:root {
  --safe-x:clamp(20px,5.4vw,104px);
  --ivory:#f8f2df; --wheat:#e9cc95; --glass-edge:#d6dec365;
  background:#17231d; color-scheme:dark;
}
body { background:#17231d }
.topbar {
  position:absolute; z-index:2; inset:max(18px,env(safe-area-inset-top)) max(var(--safe-x),env(safe-area-inset-right)) auto max(var(--safe-x),env(safe-area-inset-left));
  display:flex; align-items:center; justify-content:space-between; gap:12px; pointer-events:none; color:var(--ivory);
}
.system-mark { display:flex; align-items:center; gap:15px; font:600 .81rem/1.3 var(--mono); letter-spacing:.035em }
.system-mark img { width:36px; height:36px; border-radius:2px }
.system-mark span { border-inline-start:1px solid #e0e1c863; padding-inline-start:14px }
.mast-tools { display:flex; align-items:center; gap:3px; pointer-events:auto }
.icon-tool { display:grid; place-items:center; width:42px; height:42px; background:transparent; border:1px solid transparent; color:#f2efdc; border-radius:2px }
.icon-tool .ic { width:19px; height:19px }
.icon-tool:hover { background:#26362ba8; border-color:var(--glass-edge) }
.topbar :focus-visible,.cover :focus-visible,dialog :focus-visible { outline:2px solid #ffdb99; outline-offset:2px }
.cover { position:relative; isolation:isolate; overflow:hidden; background:#1c2922; color:var(--ivory) }
.scene-picture,.cover::before,.cover::after { position:absolute; inset:0; pointer-events:none }
.scene-picture { z-index:-3 }
.cover-art { display:block; width:100%; height:100%; object-fit:cover; object-position:64% 47% }
.cover::before {
  content:""; z-index:-2;
  background:linear-gradient(90deg,#0b1712bb,#10201991 30%,#15201925 55%,transparent 72%);
}
.cover::after {
  content:""; z-index:-1;
  background:linear-gradient(to bottom,#111c17c9,transparent clamp(108px,20svh,195px)),
             linear-gradient(to top,#102018bd,transparent 26%);
}
.cover-inner {
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; align-content:center;
  min-height:100vh; min-height:100dvh; position:relative;
  padding:clamp(102px,22svh,230px) max(var(--safe-x),env(safe-area-inset-right)) clamp(70px,12svh,138px) max(var(--safe-x),env(safe-area-inset-left));
}
.cover-copy { min-width:0; width:max-content; max-width:100% }
.cover h1 {
  width:max-content; max-width:100%; color:var(--ivory); margin:0 0 clamp(20px,3svh,32px);
  font:850 clamp(4.6rem,8.65vw,10rem)/.98 var(--display); text-transform:uppercase;
  letter-spacing:-.024em; transform:skewX(-3deg); transform-origin:left bottom;
}
.cover h1:is(:lang(zh),:lang(ja)) { font:900 clamp(4.25rem,8.35vw,9.2rem)/1.08 var(--sans); letter-spacing:-.065em }
.cover h1:lang(es) { max-width:12ch; font-size:clamp(3.8rem,7.15vw,7.8rem) }
.cover-actions,.local-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px }
.launch-button {
  --edge:#dce1c28c; --surface:#17281f86; --cut:9px;
  position:relative; isolation:isolate; display:inline-flex; align-items:center; justify-content:center; gap:11px;
  min-height:48px; padding:0 clamp(16px,1.6vw,26px); border:1px solid var(--edge); border-radius:0;
  color:#fbf7e7; font-size:1rem; font-weight:680; line-height:1.2;
  background:linear-gradient(135deg,transparent calc(100% - 7px),var(--edge) calc(100% - 7px) calc(100% - 6px),transparent calc(100% - 6px)),var(--surface);
  backdrop-filter:blur(5px);
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--cut)),calc(100% - var(--cut)) 100%,0 100%);
}
.launch-button .ic { width:18px; height:18px }
.host-button { --edge:#e9ca92ce; --surface:#66553578; color:#ffe9bd; border-inline-start:3px solid #e4be7d }
.launch-button:hover { --edge:#f1d5a3; --surface:#46523cc9; color:#fff4d7 }
.host-button:hover { --surface:#72603fcc }
.launch-button:focus-visible { outline-offset:-4px }
.local-actions { gap:8px 16px; margin-top:11px }
.local-actions button,.field-name {
  display:inline-flex; align-items:center; gap:7px; min-height:38px; padding:0; background:transparent; border:0;
  font-size:.88rem; font-weight:590; color:#e3e7d6; line-height:1.35;
}
.local-actions button+button { position:relative; padding-inline-start:16px }
.local-actions button+button::before { content:""; position:absolute; inset-inline-start:0; width:1px; height:12px; background:#cfdbc35c }
.local-actions .ic { width:16px; height:16px; color:#dbd7ba }
.local-actions button:hover,.field-name:hover { color:#ffe5b2; text-decoration:underline; text-underline-offset:4px }
.field-picker {
  position:absolute; right:max(var(--safe-x),env(safe-area-inset-right)); bottom:max(clamp(22px,4svh,55px),env(safe-area-inset-bottom));
  width:clamp(268px,23vw,394px); max-width:100%;
}
.field-name { font-family:var(--mono); font-size:.8rem; min-height:35px; color:#fcf1d2; gap:8px; text-shadow:0 1px 3px #142019 }
.field-name .ic { width:15px; height:15px }.field-name .inspect-icon { width:12px; height:12px; margin-inline-start:2px }
#map-list { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px }
.map-choice {
  display:block; position:relative; min-width:0; height:clamp(36px,3vw,46px); padding:2px;
  border:1px solid #dfdfc865; background:#15241cb8; border-radius:1px;
}
.map-choice img { display:block; width:100%; height:100%; object-fit:cover; opacity:.81; filter:contrast(1.12); transition:opacity .17s ease }
.map-choice:hover { border-color:#e3dfc4 }.map-choice:hover img,.map-choice[aria-pressed=true] img { opacity:1 }
.map-choice[aria-pressed=true] { border-color:#ebc78b; box-shadow:0 2px 0 #ebc78b }
.map-state { display:none; position:absolute; right:2px; top:2px; width:13px; height:13px; background:#e5c58e; color:#243025 }
.map-state .ic { width:11px; height:11px; stroke-width:2.4 }
.map-choice[aria-pressed=true] .map-state { display:grid; place-items:center }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap }

/* The large map is only mounted when its name is opened. */
dialog[data-view="inspect"] { width:min(630px,calc(100% - 32px)) }
.map-surface { position:relative; border:1px solid var(--line); background:#354335 }
#atlas-preview { display:block; width:100%; height:auto; aspect-ratio:14/9 }
#atlas-stock { position:absolute; inset:0; list-style:none; padding:0; pointer-events:none }
#atlas-preview:not([data-paint])+#atlas-stock { visibility:hidden }
#atlas-stock li { position:absolute; display:grid; place-items:center; width:16px; height:16px; transform:translate(-50%,-50%); pointer-events:auto }
.stock-gun,.stock-med { display:inline-grid; width:11px; height:11px; flex:none }
.stock-gun { background:#d6bc87; border:2px solid #394532; outline:1px solid #eddeb1; transform:rotate(45deg) scale(.78) }
.stock-med { position:relative; background:#e3e4d2; border:1px solid #4d5847; border-radius:2px }
.stock-med::before,.stock-med::after { position:absolute; content:""; background:#935b46; align-self:center; justify-self:center }
.stock-med::before { height:2px; width:7px }.stock-med::after { width:2px; height:7px }
#map-loading { position:absolute; inset:50% auto auto 50%; transform:translate(-50%,-50%); background:#18291edc; padding:6px 10px; font-size:.88rem }
.map-key,#map-legend,#map-legend>span,#supply-layer { display:flex; align-items:center }
.map-key { flex-wrap:wrap; justify-content:space-between; gap:4px 12px; margin-top:8px }
#supply-layer { gap:6px; min-height:34px; padding:3px 8px; background:transparent; color:var(--muted); border:1px solid var(--line); font-size:.82rem }
#supply-layer[aria-pressed=true],#supply-layer:hover { color:var(--ivory); border-color:#b6b291 }
#supply-layer .ic { width:14px; height:14px }
#map-legend { gap:12px; font-size:.8rem; color:var(--muted) }#map-legend>span { gap:5px }
#map-story { margin-top:13px; font-size:.91rem; color:var(--muted); line-height:1.6 }

@media(min-aspect-ratio:6/5) and (max-aspect-ratio:7/5) {
  .cover-art { object-position:72% 47% }
}
@media(max-aspect-ratio:6/5) {
  .cover-art { object-position:54% 23% }
  .cover::before { background:linear-gradient(to top,#101d16d1,#11201894 28%,#14211844 46%,transparent 68%) }
  .cover::after {
    background:linear-gradient(to bottom,#101a16d3,#101a16a8 43px,transparent clamp(128px,18svh,195px)),
               linear-gradient(to top,#17271eb8,transparent 17%);
  }
  .cover-inner {
    grid-template-columns:minmax(0,1fr); align-content:end; justify-items:start; gap:clamp(18px,4.3svh,52px);
    padding-top:max(70px,env(safe-area-inset-top)); padding-bottom:max(clamp(19px,4svh,48px),env(safe-area-inset-bottom));
  }
  .field-picker { position:static; width:min(100%,355px) }
}
@media(min-aspect-ratio:4/5) and (max-aspect-ratio:6/5) {
  .cover-art { object-position:54% 6% }
}
@media(max-width:760px) {
  :root { --safe-x:clamp(16px,5vw,32px) }
  .topbar { top:max(9px,env(safe-area-inset-top)) }
  .system-mark { gap:9px; font-size:.71rem; letter-spacing:0 }.system-mark img { width:29px; height:29px }
  .system-mark span { padding-inline-start:8px }
  .mast-tools { gap:0 }.icon-tool { width:36px; height:40px }.icon-tool .ic { width:17px; height:17px }
  .cover h1,.cover h1:lang(de) { font-size:clamp(3.3rem,13.3vw,5.8rem) }
  .cover h1:is(:lang(zh),:lang(ja)) { font-size:clamp(3.4rem,15.5vw,6rem) }
  .cover h1:lang(es) { font-size:clamp(2.75rem,10.6vw,5rem); max-width:100% }
  .launch-button { min-height:45px; padding-inline:14px; font-size:.93rem; gap:7px }
  .local-actions { margin-top:5px; gap:5px 10px }.local-actions button { font-size:.82rem }.local-actions button+button { padding-inline-start:10px }
  .map-choice { height:42px }
}
@media(max-width:380px) {
  .mast-tools .icon-tool { width:32px }
  .cover-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px }
  .cover-copy { width:100% }.launch-button { padding-inline:4px; gap:5px; font-size:.87rem }.launch-button .ic { width:15px; height:15px }
  .system-mark { gap:6px; font-size:.67rem }.system-mark span { padding-inline-start:6px }
}
@media(max-height:725px) and (max-aspect-ratio:6/5) {
  .cover-inner { gap:14px }
  .cover-copy { position:relative; isolation:isolate }
  .cover-copy::before { content:""; position:absolute; z-index:-1; pointer-events:none; inset:-54px -100vw -32px; background:linear-gradient(to bottom,transparent,#112019b0 54px,#1120197a 62%,transparent) }
  .cover h1 { margin-bottom:14px }
}
@media(max-height:540px) and (min-aspect-ratio:6/5) {
  :root { --safe-x:clamp(12px,4vw,45px) }
  .topbar { top:max(5px,env(safe-area-inset-top)) }
  .cover-inner { align-content:end; padding-top:54px; padding-bottom:max(17px,env(safe-area-inset-bottom)) }
  .cover h1,.cover h1:lang(es),.cover h1:lang(de),.cover h1:is(:lang(zh),:lang(ja)) { font-size:clamp(2.65rem,7.5vw,4.5rem); margin-bottom:12px }
  .cover-copy { max-width:58% }.launch-button { min-height:40px; padding-inline:10px; font-size:.84rem; gap:5px }
  .local-actions { margin-top:1px; gap:4px }.local-actions button { min-height:33px; font-size:.77rem }.local-actions .ic { width:13px; height:13px }
  .field-picker { width:min(33%,253px); bottom:max(18px,env(safe-area-inset-bottom)); isolation:isolate }
  .field-picker::before {
    content:""; position:absolute; z-index:-1; pointer-events:none; inset:-14px -20px -12px;
    background:radial-gradient(ellipse at 41% 33%,#0e1c15ce 10%,#10201798 50%,transparent 80%);
  }
  .map-choice { height:31px }#map-list { gap:3px }.field-name { min-height:28px }
  dialog[data-view=inspect] { max-height:calc(100dvh - 16px) }
  dialog[data-view=inspect] #dialog-inner {
    display:grid; grid-template-columns:minmax(0,1.3fr) minmax(0,.95fr); grid-template-areas:"head head" "map story" "map key";
    align-items:start; gap:7px 15px; padding:12px 16px;
  }
  dialog[data-view=inspect] .dialog-head { grid-area:head; margin:0 }
  dialog[data-view=inspect] .map-surface { grid-area:map; width:min(100%,calc((100dvh - 84px) * 14 / 9)); align-self:center }
  dialog[data-view=inspect] #map-story { grid-area:story; margin:0; font-size:.85rem }
  dialog[data-view=inspect] .map-key { grid-area:key; margin:0; gap:6px; align-self:end }
  #map-legend { flex-wrap:wrap }
}
@media(prefers-reduced-motion:no-preference) {
  .cover-copy,.field-picker { animation:lobby-in .2s ease-out both }
  @keyframes lobby-in { from { opacity:0; transform:translateY(4px) } to { opacity:1; transform:translateY(0) } }
}
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
  .scene-picture { transform:scale(1.018) translate(var(--look-x,0%),var(--look-y,0%)); transition:transform .22s ease-out }
}
