/* style.css: game is always dark (space). Tokens on :root. */
:root {
  --bg: #07080b; --ink: #eef3f6; --dim: #9fb0bd; --line: rgba(150, 215, 235, 0.18); --line-hi: rgba(127, 227, 255, 0.55);
  --accent: #7fe3ff; --accent-ink: #031217; --accent-soft: rgba(127, 227, 255, 0.12);
  --warn: #ffb347; --danger: #ff6159; --ok: #8fe08a; --gold: #d9b24a; --paper: #efe7d6; --paper-ink: #2a2620;
  --rec: #6fa8ff; --sim: #d9b24a; --game: #c48cff;
  /* HUD surfaces: dark visor glass, thin cyan edge */
  --panel: rgba(6, 11, 17, 0.78); --panel-solid: rgba(7, 12, 19, 0.95); --r: 6px; --gap: 12px;
  --mm-w: 240px; --mm-h: 156px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;   /* same stack as the team UI kit */
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #07080b; } }
:root[data-theme="dark"] { --bg: #07080b; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); }
body { word-break: keep-all; overflow-wrap: break-word; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--r); padding: 12px 22px; font-weight: 800; font-size: 17px; min-height: 48px; }
.primary:disabled { opacity: 0.5; }
.ghost { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; min-height: 44px; font-size: 14px; }
body.touch .kc { display: none !important; }   /* keycaps only with a keyboard */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ghost .ico svg { width: 18px; height: 18px; display: block; }
svg { stroke-linecap: round; stroke-linejoin: round; }

/* ---- keycap: every key the game names ---- */
.kc { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 6px;
  background: linear-gradient(#2c323d, #1b2029); border: 1px solid #56606f; border-bottom-width: 3px; color: var(--ink);
  font: 700 13px/1 system-ui, 'Noto Sans KR', sans-serif; white-space: nowrap; vertical-align: middle; flex: none; }
.kc.wide { padding: 0 9px; }
.kc + .kc { margin-left: 4px; }
.kc.mouse svg { width: 14px; height: 14px; margin-right: 4px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary .kc { background: rgba(3, 18, 23, 0.12); border-color: rgba(3, 18, 23, 0.4); color: #031217; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }

/* ---- title: full-bleed photo key art, Earth ring, text on the dark side ---- */
#title { position: fixed; inset: 0; overflow: hidden; background: #000; }
.tart { position: absolute; inset: 0; transform-origin: 70% 25%; animation: kenburns 40s ease-in-out infinite alternate; }
.tbg { position: absolute; left: 0; top: 0; width: max(66vw, 100vh); height: 100%; object-fit: cover; object-position: 50% 30%; display: block;
  -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.07) translate(-1%, 1%); } }
.earthMark { position: absolute; width: 0; height: 0; }
.earthMark i { position: absolute; left: calc(var(--d) / -2); top: calc(var(--d) / -2); width: var(--d); height: var(--d); border: 2px solid var(--accent); border-radius: 50%; box-shadow: 0 0 10px rgba(127, 227, 255, 0.5); animation: ering 2.4s ease-out infinite; }
.earthMark span { position: absolute; right: calc(var(--d) / 2 + 10px); top: -9px; white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); text-shadow: 0 1px 3px #000; }
@keyframes ering { 0% { transform: scale(0.9); opacity: 1; } 70% { transform: scale(1.35); opacity: 0.25; } 100% { transform: scale(0.9); opacity: 1; } }
.tshade { position: absolute; inset: 0; background: linear-gradient(270deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.35) 38%, rgba(0, 0, 0, 0) 55%), linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 28%); }
.ttop { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); display: flex; gap: 6px; z-index: 2; }
.ttext { position: absolute; right: max(5vw, 24px); top: 50%; transform: translateY(-42%); width: min(540px, 40vw); display: flex; flex-direction: column; align-items: flex-start; }
.nosig { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 4px 10px; border: 1px solid rgba(255, 97, 89, 0.55); border-radius: 4px; background: rgba(40, 6, 6, 0.55); color: var(--danger); font-size: 12px; font-weight: 800; letter-spacing: 0.14em; }
.nosig i { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.ttext h1 { font-size: clamp(32px, 3.8vw, 54px); line-height: 1.1; margin: 0 0 14px; font-weight: 800; text-shadow: 0 2px 12px #000; }
.hook { font-size: clamp(17px, 1.6vw, 21px); line-height: 1.5; font-weight: 600; margin: 0 0 10px; color: #ffe2a6; text-shadow: 0 1px 4px #000; }
.pitch { font-size: 15px; line-height: 1.55; margin: 0 0 22px; color: var(--dim); }
#bStart { font-size: 20px; min-height: 56px; padding: 14px 30px; box-shadow: 0 0 24px rgba(127, 227, 255, 0.35); }
.soundHint { display: flex; align-items: center; gap: 7px; margin: 12px 0 0; font-size: 13px; color: var(--dim); }
.soundHint svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.soundHint .unmute { display: none; }
body.muted .soundHint .unmute { display: inline-flex; }
.ctlline { margin-top: 10px; }
.ctlline ul.ctl { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--dim); }
.ctlline ul.ctl li { display: inline-flex; gap: 6px; }
.ctlline .kc { min-width: 22px; height: 22px; font-size: 11px; padding: 0 5px; border-bottom-width: 2px; }
.ctlline .ti { display: none; }
.tfoot { position: absolute; left: 16px; right: 16px; bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; font-size: 11.5px; color: rgba(159, 176, 189, 0.75); text-align: right; text-shadow: 0 1px 2px #000; }
#bootErr { position: fixed; bottom: 40px; left: 16px; color: var(--warn); }
#bootErr.lost { z-index: 100; right: 16px; top: 40%; bottom: auto; margin: 0; text-align: center; font-size: 18px; padding: 16px; background: rgba(0, 0, 0, 0.85); }
@media (max-width: 720px) {
  .tbg { width: 100%; object-position: 80% 0%; -webkit-mask-image: none; mask-image: none; }
  .tshade { background: linear-gradient(0deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.78) 45%, rgba(0, 0, 0, 0) 70%); }
  .ttext { left: 16px; right: 16px; top: auto; bottom: calc(64px + env(safe-area-inset-bottom)); width: auto; transform: none; }
  .ttext h1 { font-size: clamp(28px, 8.5vw, 36px); margin-bottom: 8px; }
  .hook { font-size: 16px; margin-bottom: 14px; }
  .pitch { display: none; }
  #bStart { align-self: stretch; }
  .nosig { margin-bottom: 10px; }
  .tfoot { text-align: left; font-size: 10.5px; }
}
body.touch .ctlline { display: none; }   /* touch: the in-game hint teaches the controls */
@media (max-height: 600px) and (max-width: 720px) { .ctlline { display: none; } .soundHint { margin-top: 8px; } }

/* ---- story crawl: lines rise and recede over stars ---- */
#crawl { position: fixed; inset: 0; z-index: 25; overflow: hidden; background-color: #000;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 67% 9%, #cfe, transparent), radial-gradient(1.5px 1.5px at 38% 62%, #fff, transparent), radial-gradient(1px 1px at 84% 44%, #fff, transparent), radial-gradient(1px 1px at 22% 82%, #def, transparent), radial-gradient(1.5px 1.5px at 91% 77%, #fff, transparent), radial-gradient(1px 1px at 52% 31%, #fff, transparent);
  background-size: 260px 260px, 310px 310px, 370px 370px, 230px 230px, 290px 290px, 410px 410px, 200px 200px; }
#crawl .view { position: absolute; inset: 0; perspective: 800px; perspective-origin: 50% 15%; -webkit-mask-image: linear-gradient(transparent 8%, #000 42%); mask-image: linear-gradient(transparent 8%, #000 42%); }
#crawl .text { position: absolute; left: 50%; top: 100%; width: min(660px, 86vw); transform-origin: 50% 0; animation: crawl 15s linear forwards;
  font-family: 'Noto Sans KR', system-ui, sans-serif; font-weight: 600; font-size: clamp(22px, 3.4vw, 34px); line-height: 1.55; text-align: center; color: #ffd98a; text-shadow: 0 0 14px rgba(255, 190, 90, 0.35); }
#crawl .text p { margin: 0 0 0.9em; }
@keyframes crawl { from { transform: translateX(-50%) rotateX(28deg) translateY(0); } to { transform: translateX(-50%) rotateX(28deg) translateY(calc(-1 * var(--dist, 160vh))); } }
#crawl .soundHint.top { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 0; right: 0; justify-content: center; margin: 0; z-index: 1; display: none; }
body.muted #crawl .soundHint.top { display: flex; animation: hintout 2.2s forwards; }
@keyframes hintout { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes linein { to { opacity: 1; } }
#crawl .skip { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 1; color: var(--ink); }

/* ---- book ---- */
#book { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: #120f0c; }
.spread { display: grid; grid-template-columns: 1fr 1fr; width: min(1100px, 100%); aspect-ratio: 1.55; background: var(--paper); color: var(--paper-ink); border-radius: 6px; box-shadow: 0 30px 80px #000, inset 0 0 0 1px #c9bfa8; transform: perspective(1400px) rotateX(18deg) scale(0.92); opacity: 0; transition: transform 0.9s ease, opacity 0.6s; }
#book.open .spread { transform: none; opacity: 1; }
.page { padding: clamp(18px, 4vw, 48px); display: flex; flex-direction: column; justify-content: center; }
.page.left { border-right: 1px solid #d3c8b0; background: linear-gradient(90deg, var(--paper) 85%, #e2d8c2); }
.page.left h2 { font-size: clamp(22px, 2.6vw, 32px); margin: 0 0 14px; }
.page.left p { font-size: 17px; line-height: 1.7; margin: 0 0 20px; }
.page.right { align-items: center; background: linear-gradient(270deg, var(--paper) 85%, #e2d8c2); }
#bookPhoto { position: relative; margin: 0; width: 100%; max-width: 460px; }
#bookPhoto img { width: 100%; height: auto; display: block; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
/* labels on the orbital photo: a ring on the object, the word beside it (.l = word on the left) */
#bookPhoto .tag { position: absolute; transform: translate(9px, -50%); font-size: 11px; font-weight: 700; line-height: 1; color: #fff; white-space: nowrap; padding: 2px 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.55); pointer-events: none; }
#bookPhoto .tag::before { content: ""; position: absolute; left: -15px; top: 50%; width: 10px; height: 10px; margin-top: -6px; border: 1.5px solid #ffd66b; border-radius: 50%; }
#bookPhoto .tag.l { transform: translate(calc(-100% - 9px), -50%); }
#bookPhoto .tag.l::before { left: auto; right: -15px; }
#bookPhoto .tag.bare { transform: translate(-50%, -50%); }
#bookPhoto .tag.edge { transform: translate(4px, -50%); }
#bookPhoto .tag.bare::before { content: none; }
#bookPhoto .tag.edge::before { content: "\2190\00a0"; position: static; border: 0; width: auto; height: auto; margin: 0; }   /* ALSEP lies west, out of frame */
.page.right .orbitCap { margin: 12px 0 6px; font-size: 15px; line-height: 1.55; max-width: 460px; }
.page.right .orbitNote { margin: 0 0 10px; font-size: 13.5px; line-height: 1.55; max-width: 460px; color: #4a4336; }
.page.right .credit { color: #6b6253; margin: 2px 0 0; font-size: 11px; line-height: 1.45; max-width: 460px; }
#book .endText, #book.end .startText { display: none; }
#book.end .endText { display: block; }
/* end page: field-notes paper (kit tokens), ink text, thin rules, square controls; credits and the step list fold away */
#book.end .spread { border-radius: var(--a17-radius-paper, 4px); color: var(--a17-ink); font-family: var(--a17-font); box-shadow: 0 24px 65px #0008, 0 3px 0 #b7ad98, 0 6px 0 #6f695b; }
#book.end .page { min-height: 0; background-color: var(--a17-paper); background-image: linear-gradient(#f4efe433, #efe6d311), url('../assets/paper.webp'); background-size: auto, 650px 650px; overflow-y: auto; }
#book.end .page.left { border-right: 1px solid var(--a17-rule-paper); }
#book.end .endText { max-width: 400px; }
#book.end .endKicker { margin: 0 0 14px; font: 11px/1 var(--a17-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--a17-muted-paper); }
#book.end .page.left h2 { font-size: 32px; line-height: 1.15; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--a17-rule-paper); }
#book.end .page.left .endLead { font-size: 16px; line-height: 1.6; margin: 0 0 22px; color: var(--a17-ink); }
#book.end .endSteps { margin: 0 0 26px; border-top: 1px solid var(--a17-rule-paper); border-bottom: 1px solid var(--a17-rule-paper); }
#book.end .endSteps summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; font-size: 14px; color: var(--a17-muted-paper); }
#book.end .endSteps summary::-webkit-details-marker { display: none; }
#book.end .endSteps summary::after { content: '+'; margin-left: auto; font: 16px/1 var(--a17-mono); color: var(--a17-muted-paper); }
#book.end .endSteps[open] summary::after { content: '\2212'; }
#book.end .endCount { font: 600 15px/1 var(--a17-mono); color: var(--a17-success-paper); }
#book.end .checks { columns: 2; column-gap: 20px; font-size: 12.5px; padding: 2px 0 12px; }
#book.end .checks li, #book.end .checks li.ok, #book.end .checks li.final.ok { break-inside: avoid; align-items: flex-start; gap: 7px; padding: 3px 0; font-size: 12.5px; font-weight: 400; line-height: 1.35; color: var(--a17-muted-paper); }
#book.end .checks .box { width: 11px; height: 11px; margin-top: 2px; border: 1px solid #847a68; border-radius: 0; color: var(--a17-ink); }
#book.end .checks li.ok .box::after { left: 3px; top: 0; width: 3px; height: 6px; border-width: 0 1.5px 1.5px 0; }
#book.end .endAgain { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 18px; background: transparent; color: var(--a17-ink); border: 1px solid var(--a17-ink); border-radius: 0; font: 500 15px/1 var(--a17-font); cursor: pointer; transition: background var(--a17-duration), color var(--a17-duration); }
#book.end .endAgain:hover { background: var(--a17-ink); color: var(--a17-paper); }
#book.end .endAgain:focus-visible { outline: 2px solid var(--a17-focus-paper); outline-offset: 3px; }
#book.end .page.right { justify-content: center; }
#book.end #bookPhoto img { box-shadow: none; outline: 1px solid #2a262033; }
#book.end #bookPhoto .tag { font: 500 10.5px/1 var(--a17-font); letter-spacing: 0.02em; padding: 3px 5px; border-radius: 0; background: rgba(24, 22, 18, 0.62); }
#book.end #bookPhoto .tag::before { border: 1px solid #f3cd8b; }
#book.end .page.right .orbitCap { margin: 14px 0 8px; font-size: 14px; line-height: 1.55; color: var(--a17-ink); }
#book.end .page.right .orbitNote { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--a17-muted-paper); }
#book.end .endCredits { width: 100%; max-width: 460px; border-top: 1px solid var(--a17-rule-paper); }
#book.end .endCredits summary { min-height: 36px; display: flex; align-items: center; cursor: pointer; font: 11px/1 var(--a17-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--a17-muted-paper); }
#book.end .endCredits .credit { margin: 0 0 6px; font-size: 11px; line-height: 1.5; color: var(--a17-muted-paper); max-width: none; }
#zoom { position: fixed; overflow: hidden; z-index: 20; pointer-events: none; }
#zoom img { width: 100%; height: 100%; object-fit: cover; display: block; transform-origin: 50% 60%; }
/* intro overlay: one caption line + skip; the HUD boots under it (#hud.boot) */
#intro { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; }
#intro.done { pointer-events: none; }
#intro .line { margin: 0 0 18vh; max-width: 640px; text-align: center; font-size: 18px; font-weight: 500; letter-spacing: 0.01em; line-height: 1.5; color: #e8ece8; text-shadow: 0 1px 6px #000c; word-break: keep-all; padding: 8px 0; border-radius: 0; background: none; }   /* kit style: no box, thin rules, quiet type */
#intro .line:empty { display: none; }
#intro .line.lost { color: #ffc861; font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; padding: 10px 22px; border: 0; border-top: 1px solid #ffc861b0; border-bottom: 1px solid #ffc861b0; background: rgba(8, 10, 12, 0.62); text-shadow: 0 2px 10px #000; }   /* must read clearly over the bright lander */
#intro .line.goal { color: #e8ece8; font-size: 20px; font-weight: 500; padding: 10px 0 0; border: 0; border-top: 1px solid #a9bcbb55; background: none; }
#intro .skip { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
#intro.done .skip { display: none; }
#hud.boot > :not(#topleft), #hud.boot #obj, #hud.boot #sky { visibility: hidden; }
#hud.boot .meter { transition: opacity 0.3s, transform 0.3s; }
#hud.boot .meter:not(.on) { opacity: 0; transform: translateX(-8px); }
@media (max-width: 720px) {
  .spread { grid-template-columns: 1fr; aspect-ratio: auto; max-height: 100%; overflow: auto; }
  .page.left { border-right: 0; border-bottom: 1px solid #d3c8b0; order: 2; }
  .page.right { order: 1; padding-bottom: 8px; }
  #book { padding: 8px; }
  #bookPhoto { max-width: 100%; }
  .page { padding: 16px 18px; }
  .page.left h2 { font-size: 22px; margin-bottom: 8px; }
  .page.left p { font-size: 15px; line-height: 1.6; margin-bottom: 12px; }
  #book.end .page { overflow: visible; }
  #book.end .page.left h2 { font-size: 26px; }
  #book.end .endText { max-width: none; }
  #book.end .checks { columns: 1; }
}


/* ==== HUD ===========================================================================
   top-left: objective tracker, vitals panel, need alert | top-right: icon buttons
   top-centre: toast | centre: crosshair + [E] prompt (touch: big button bottom-right)
   bottom-centre: #stack (first-run hint, drink, part tray, aim panel)
   bottom-left: key legend (touch: joystick) | bottom-right: minimap -> wrist note
   One surface style: dark visor glass, thin cyan edge, amber = warn, red = danger. */
#hud { position: fixed; inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud > #topleft, #hud > #stack, #hud > #toast, #hud > #xhair, #hud > #vign { pointer-events: none; }
#stack > *, #topleft > button { pointer-events: auto; }
#hud .kc { background: linear-gradient(#26303b, #161c24); border-color: #4f6070; }

/* objective tracker */
#topleft { position: absolute; top: var(--gap); left: var(--gap); width: min(380px, calc(100% - 260px)); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
#obj { align-self: stretch; display: grid; gap: 4px; padding: 9px 14px 10px 14px; border-left: 2px solid var(--accent); border-radius: 0 var(--r) var(--r) 0;
  background: linear-gradient(90deg, rgba(6, 11, 17, 0.86), rgba(6, 11, 17, 0.62)); text-shadow: 0 1px 2px #000; }
#obj .lbl { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 800; font-size: 12px; letter-spacing: 0.06em; }
#obj .obd { width: 8px; height: 8px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 8px var(--accent); flex: none; margin-right: 2px; }
#obj .stepn { color: var(--dim); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0; }
#obj .dist { margin-left: auto; color: var(--ink); font-weight: 700; font-size: 13px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
#obj .dist:empty { display: none; }
#obj .row { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
#obj .txt { font-size: 17px; font-weight: 700; line-height: 1.4; }
#obj .keys { display: inline-flex; }

/* vitals: one panel, a row per meter (icon, name, bar, value, warning word) */
#vitals { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px 7px; }
#meters { display: grid; gap: 5px; }
.meter { display: grid; grid-template-columns: 15px 112px 92px 50px auto; column-gap: 8px; align-items: center; min-height: 18px; font-size: 12px; border-radius: 3px; }
.meter svg { grid-column: 1; grid-row: 1; width: 15px; height: 15px; fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0.85; }
.meter .name { grid-column: 2; grid-row: 1; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter em { grid-column: 3; grid-row: 1; position: relative; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 1px; overflow: hidden; }
.meter em::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(6, 11, 17, 0.9) calc(10% - 1px) 10%); }
.meter i { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.meter b { grid-column: 4; grid-row: 1; text-align: right; white-space: nowrap; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.meter s { grid-column: 5; grid-row: 1; text-decoration: none; font-weight: 800; font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 3px; background: var(--warn); color: #1d1100; }
.meter s:empty { display: none; }
#mTemp.sun svg { stroke: #ffd75e; opacity: 1; }
.meter.warn svg { stroke: var(--warn); opacity: 1; } .meter.warn b, .meter.warn .name { color: var(--warn); } .meter.warn i { background: var(--warn); }
.meter.crit svg { stroke: var(--danger); } .meter.crit b, .meter.crit .name { color: var(--danger); } .meter.crit i { background: var(--danger); } .meter.crit s { background: var(--danger); color: #fff; }
.meter.crit { animation: crit 0.9s ease-in-out infinite; }
@keyframes crit { 50% { background: rgba(255, 97, 89, 0.22); } }
#sky { display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim); }
#sky > span { display: inline-flex; align-items: center; gap: 5px; }
#sky svg { width: 13px; height: 13px; fill: none; stroke: #ffd75e; stroke-width: 2; flex: none; }
#compass { color: var(--ink); font-weight: 700; } #compass svg { stroke: none; fill: var(--accent); transition: transform 0.15s linear; }

/* need alert: most urgent survival problem + suggested action; opens the "why" card */
#need { display: inline-flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-height: 44px; max-width: 100%; text-align: left; padding: 6px 12px 6px 10px; font-size: 15px; line-height: 1.35;
  border: 1px solid rgba(255, 179, 71, 0.45); border-left: 3px solid var(--warn); border-radius: 0 var(--r) var(--r) 0; background: rgba(34, 20, 4, 0.88); color: #ffe9cc; }
#need .ico { display: grid; place-items: center; width: 20px; height: 20px; background: var(--warn); color: #1d1100; font-weight: 800; font-size: 13px; flex: none; clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 4px; }
#need .h { font-weight: 800; } #need .keys { display: inline-flex; }
#need .q { margin-left: auto; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-weight: 800; font-size: 12px; opacity: 0.75; }
#need.info { border-color: var(--line-hi); border-left-color: var(--accent); background: rgba(5, 20, 27, 0.88); color: var(--ink); }
#need.info .ico { background: var(--accent); color: var(--accent-ink); clip-path: none; border-radius: 50%; padding-top: 0; }
#need.warn .ico { animation: keypulse 1.4s ease-in-out infinite; }

/* ground-station window: top centre on wide screens, under the vitals on narrow ones; opens the DSN card */
#comm { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 4px 12px; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
  border: 1px solid var(--line-hi); border-radius: var(--r); background: var(--panel); color: var(--ink); }
#comm svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2; flex: none; }
#comm.wait { border-color: rgba(255, 179, 71, 0.6); color: #ffe9cc; background: rgba(34, 20, 4, 0.88); } #comm.wait svg { stroke: var(--warn); }
#comm.soon { color: var(--warn); }
@media (min-width: 1101px) {
  #comm { position: fixed; top: calc(var(--gap) + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
  #hud > #toast { top: calc(var(--gap) + 50px); }
}
/* body feedback: red edge + visor fog when O2 / CO2 / heat is critical; clears slowly after relief */
#vign { position: absolute; inset: calc(-1 * env(safe-area-inset-top)) calc(-1 * env(safe-area-inset-right)) calc(-1 * env(safe-area-inset-bottom)) calc(-1 * env(safe-area-inset-left)); opacity: 0; transition: opacity 2s ease-out; }
#vign::before, #vign::after { content: ''; position: absolute; inset: 0; }
#vign::before { box-shadow: inset 0 0 18vmin 4vmin rgba(200, 20, 20, 0.6); animation: vpulse 1.1s ease-in-out infinite; }
#vign::after { background: radial-gradient(ellipse at 50% 45%, transparent 38%, rgba(225, 232, 238, 0.16) 80%, rgba(225, 232, 238, 0.26) 100%); }
body.lowair #vign { opacity: 1; transition-duration: 0.6s; }
@keyframes vpulse { 50% { opacity: 0.45; } }

/* top-right icon buttons; desktop shows the shortcut letter in the corner */
#topbtns { position: absolute; top: var(--gap); right: var(--gap); display: flex; gap: 6px; }
.ibtn { position: relative; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.ibtn svg { width: 22px; height: 22px; display: block; fill: none; stroke: var(--ink); stroke-width: 1.8; }
.ibtn svg .fill { fill: var(--ink); stroke: none; }
.ibtn .ico svg { width: 22px; height: 22px; }
.ibtn.lang .code { font-weight: 800; font-size: 14px; }
.ibtn[data-key]::before { content: attr(data-key); position: absolute; right: 3px; bottom: 1px; font: 800 9px/1 system-ui, sans-serif; color: var(--dim); }
body.touch .ibtn[data-key]::before { display: none; }
.ibtn:hover { border-color: var(--accent); background: rgba(10, 30, 38, 0.85); }
.ibtn[data-tip]:hover::after, .ibtn[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); right: 0; white-space: nowrap; background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); padding: 4px 8px; border-radius: 4px; font-size: 13px; pointer-events: none; z-index: 3; }
body.touch .ibtn[data-tip]::after { display: none; }

/* world markers: destination ring + edge chevron (aim mode reuses the ring for Earth); amber = survival spot */
#marker, #edge, #reticle, #marker2, #edge2 { position: absolute; left: 0; top: 0; pointer-events: none; }
#marker .dot { position: absolute; width: 18px; height: 18px; margin: -9px; border: 2px solid var(--accent); transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 12px var(--accent); }
#marker .dot::after { content: ''; position: absolute; inset: -8px; border: 1px solid var(--accent); animation: ping 1.6s ease-out infinite; }
@keyframes ping { from { opacity: 0.8; transform: scale(0.7); } to { opacity: 0; transform: scale(1.4); } }
body.aiming #marker .dot { width: 46px; height: 46px; margin: -23px; border-radius: 50%; transform: none; }
body.aiming #marker .dot::after { border-radius: 50%; }
#marker .lab, #edge .lab { position: absolute; transform: translate(-50%, -46px); background: var(--panel-solid); border: 1px solid var(--line-hi); color: var(--ink); padding: 3px 10px; border-radius: 4px; font-size: 13.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.aiming #marker .lab { transform: translate(-50%, 32px); }
#edge .arr { position: absolute; width: 36px; height: 36px; margin: -18px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 16px rgba(127, 227, 255, 0.6); }
#edge .arr svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-ink); stroke-width: 3; }
#edge .lab { transform: translate(-50%, 26px); } #edge .lab.above { transform: translate(-50%, -58px); }
#marker2 .dot { position: absolute; width: 16px; height: 16px; margin: -8px; border: 2px solid var(--warn); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 10px var(--warn); }
#marker2 .lab, #edge2 .lab { position: absolute; transform: translate(-50%, 18px); background: rgba(30, 17, 3, 0.92); border: 1px solid var(--warn); color: #ffe9cc; padding: 2px 9px; border-radius: 4px; font-size: 13px; font-weight: 700; white-space: nowrap; }
#edge2 .arr { position: absolute; width: 30px; height: 30px; margin: -15px; border-radius: 50%; background: var(--warn); display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5); }
#edge2 .arr svg { width: 18px; height: 18px; fill: none; stroke: #2a1600; stroke-width: 3; }
#edge2 .lab { transform: translate(-50%, 20px); } #edge2 .lab.above { transform: translate(-50%, -46px); }
#reticle .x { position: absolute; width: 40px; height: 40px; margin: -20px; border: 2px solid #ffd75e; border-radius: 50%; box-shadow: 0 0 0 1px #000; }
#reticle .x::before, #reticle .x::after { content: ''; position: absolute; background: #ffd75e; box-shadow: 0 0 0 1px #000; }
#reticle .x::before { left: -10px; right: -10px; top: 18px; height: 2px; }
#reticle .x::after { top: -10px; bottom: -10px; left: 18px; width: 2px; }
#reticle .lab { position: absolute; transform: translate(-50%, 30px); font-size: 13px; font-weight: 700; color: #ffd75e; text-shadow: 0 1px 3px #000, 0 0 2px #000; white-space: nowrap; }

/* centre: crosshair dot + interaction prompt */
#xhair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: rgba(238, 243, 246, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 0 7px rgba(238, 243, 246, 0.0); }
#xhair::after { content: ''; position: absolute; inset: -8px; border: 1px solid rgba(238, 243, 246, 0.35); border-radius: 50%; }
body.aiming #xhair, body.wrist #xhair { display: none; }
#bAct { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 10px; max-width: calc(100% - 24px);
  background: rgba(6, 11, 17, 0.8); color: var(--ink); border: 1px solid var(--line-hi); border-radius: var(--r); padding: 6px 16px 6px 6px; min-height: 46px; font-size: 16px; font-weight: 700;
  box-shadow: 0 0 18px rgba(127, 227, 255, 0.18); animation: promptin 0.15s ease-out; }
#bAct .kc { min-width: 32px; height: 32px; font-size: 15px; background: var(--accent); color: var(--accent-ink); border-color: #2aa9c9; }
#bAct:hover { border-color: var(--accent); }
@keyframes promptin { from { opacity: 0; transform: translate(-50%, 6px); } }

/* toast: top centre */
#toast { position: absolute; top: var(--gap); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(440px, calc(100% - 24px)); background: var(--panel-solid); border: 1px solid var(--line); border-top: 2px solid var(--accent);
  padding: 9px 16px; border-radius: 0 0 var(--r) var(--r); font-size: 15px; line-height: 1.45; text-align: center; z-index: 4; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
#toast:not(.on) { display: none; }
#toast.on { animation: dropin 0.2s ease-out; }
#toast.warn { border-top-color: var(--warn); background: rgba(30, 18, 4, 0.95); color: #ffe9cc; }
#toast.ok { border-top-color: var(--ok); background: rgba(8, 26, 12, 0.95); color: #dff7dc; }
/* learn line: one calm caption at the top of the bottom stack (ui.learnLine); only its More button takes clicks */
#stack > #learnline { pointer-events: none; }
#learnline { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; align-items: center; padding: 8px 4px 10px 14px; text-align: left;
  background: rgba(6, 11, 17, 0.7); border: 0; border-top: 1px solid var(--a17-active-dark, #b1d1da); border-radius: 0; color: var(--a17-text-dark, #e8ece8); }
#learnline:not(.on) { display: none; }
#learnline.on { animation: fadein 0.3s ease-out; }
#learnline .ll-k { grid-column: 1; margin: 0; font-size: 12px; letter-spacing: 0.04em; color: var(--a17-muted-dark, #a6b3b2); }
#learnline .ll-t { grid-column: 1; margin: 0; font-size: 16px; line-height: 1.45; }
#learnline .ll-more { grid-column: 2; grid-row: 1 / span 2; pointer-events: auto; min-height: 40px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; border-radius: 0; }
#learnline .ll-more[hidden] { display: none; }
/* NEW mark on a learned card (wrist list, field notes page 4) until the page is viewed */
.newmark { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--warn); }
.fn-ui .newmark { color: var(--a17-active-paper, #23637a); }
@keyframes dropin { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* bottom-centre stack: grows upward, its parts never overlap each other */
#stack { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
body.aiming #stack { bottom: 16px; }
#coach { display: flex; align-items: center; justify-content: center; gap: 8px 10px; flex-wrap: wrap; background: rgba(5, 20, 27, 0.9); border: 1px solid var(--line-hi); border-radius: var(--r); padding: 6px 8px 6px 14px;
  box-shadow: 0 0 24px rgba(127, 227, 255, 0.18); font-size: 16px; font-weight: 600; animation: fadein 0.25s ease-out; }
#coach .dots { display: flex; gap: 4px; }
#coach .dots i { width: 8px; height: 8px; transform: rotate(45deg) scale(0.8); background: rgba(255, 255, 255, 0.25); }
#coach .dots i.cur { background: var(--accent); } #coach .dots i.done { background: var(--ok); }
#coach .keys { display: inline-flex; }
#coach .keys .kc { animation: keypulse 1.6s ease-in-out infinite; }
@keyframes keypulse { 50% { border-color: var(--accent); box-shadow: 0 0 10px rgba(127, 227, 255, 0.6); } }
#coach .skip { background: none; border: 0; color: var(--dim); text-decoration: underline; min-height: 44px; min-width: 44px; padding: 0 8px; font-size: 14px; }
#tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; max-width: 100%; }
#tray p { width: 100%; margin: 0; text-align: center; font-size: 13px; color: var(--dim); }
.chip { background: rgba(43, 36, 18, 0.92); border: 1px solid var(--gold); border-radius: var(--r); padding: 8px 16px; min-height: 44px; font-size: 15px; touch-action: none; }
.chip.drag { position: relative; z-index: 5; box-shadow: 0 0 16px var(--gold); }
#bUse { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 16px 6px 6px; border-radius: var(--r); background: rgba(6, 24, 32, 0.88); border: 1px solid #5fc4e6; color: var(--ink); font-weight: 800; font-size: 15px; }
#bUse svg { width: 18px; height: 18px; fill: #5fc4e6; stroke: none; }

/* aim panel */
#aim { width: 100%; background: var(--panel-solid); border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: 0 0 var(--r) var(--r); padding: 12px 14px; }
#aim .row { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; }
#meter { flex: 1; position: relative; height: 10px; background: rgba(255, 255, 255, 0.1); border-radius: 1px; overflow: hidden; }
#meter::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 1px), rgba(7, 12, 19, 0.9) calc(5% - 1px) 5%); }
#meterFill { height: 100%; width: 0; background: linear-gradient(90deg, #3f9fb8, var(--accent)); }
#meterVal { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
#aimTip { margin: 8px 0 10px; font-size: 15px; text-align: center; }
#aimTip.hint { color: var(--warn); font-weight: 700; }
#aim .stat { font-size: 12.5px; color: var(--dim); font-weight: 600; white-space: nowrap; }
#aimDish { margin: 8px 0 0; display: grid; gap: 2px; text-align: center; font-size: 13px; color: var(--dim); }
#aimDish .v { font-size: 16px; color: var(--ink, #e6e6e6); font-variant-numeric: tabular-nums; }
#aimDish .gl { font-size: 12px; opacity: 0.85; }
@media (max-width: 520px) { #aimDish .gl { display: none; } }
#aim.ready #aimTip { color: var(--accent); font-weight: 700; }
#aim .ctrls { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.pad { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: 30px 30px auto; gap: 3px; justify-items: center; }
.pad .kc { width: 30px; height: 30px; min-width: 0; padding: 0; margin: 0; font-size: 15px; }
.pad .kc[data-arrow="ArrowUp"] { grid-area: 1 / 2; } .pad .kc[data-arrow="ArrowLeft"] { grid-area: 2 / 1; }
.pad .kc[data-arrow="ArrowDown"] { grid-area: 2 / 2; } .pad .kc[data-arrow="ArrowRight"] { grid-area: 2 / 3; }
#hud .pad .kc.go { background: var(--accent); color: var(--accent-ink); border-color: #2aa9c9; }
.pad .cap { grid-column: 1 / -1; font-size: 13px; color: var(--dim); }
#bTx { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 14px 6px 8px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); opacity: 0.6; touch-action: none; text-align: left; user-select: none; -webkit-user-select: none; }
#aim.ready #bTx { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.ring { width: 44px; height: 44px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 4; }
.ring .fillr { stroke: var(--accent); stroke-dasharray: 100; stroke-dashoffset: 100; }
#bTx .tl { display: grid; gap: 3px; } #bTx .name { font-weight: 800; font-size: 17px; }
#bTx .sub { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
#bLeave { white-space: nowrap; }
body.touch #aim .ctrls { grid-template-columns: 1fr auto; }
body.touch .pad { display: none; }

/* key legend (keyboard only): open on first run, folds to its title chip after the first-run hint */
#legend { position: absolute; left: var(--gap); bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; width: 262px; }
#legend.closed { width: auto; }
#bLegend { width: 100%; justify-content: space-between; gap: 12px; background: none; border: 0; font-weight: 700; font-size: 13px; color: var(--dim); }
#bLegend .chev::before { content: '▾'; } #legend.closed .chev::before { content: '▴'; }
#legend.closed .body { display: none; }
#legend .body { padding: 0 12px 10px; }
#legend ul.ctl { font-size: 13.5px; gap: 6px; }
#legend ul.ctl li { grid-template-columns: 118px 1fr; }
body.touch #legend { display: none; }
body.aiming #legend { display: none; }

/* minimap: north up, centred on the player; click or N opens the wrist note in the same corner */
#minimap { position: absolute; right: var(--gap); bottom: 16px; width: var(--mm-w); height: var(--mm-h); padding: 0; overflow: hidden; display: block; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  background-color: #101318; background-image: repeating-linear-gradient(0deg, transparent 0 15px, rgba(150, 215, 235, 0.07) 15px 16px), repeating-linear-gradient(90deg, transparent 0 15px, rgba(150, 215, 235, 0.07) 15px 16px); }
#minimap:hover { border-color: var(--accent); }
#minimap::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7); }
#mini { width: 100%; height: 100%; display: block; }
#minimap .mmk { position: absolute; left: 6px; bottom: 6px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; border-radius: 4px; background: rgba(4, 8, 12, 0.78); font-size: 12px; font-weight: 700; color: var(--ink); }
body.touch #minimap .mmk { padding: 2px 7px; }
#minimap .mmk .kc { min-width: 22px; height: 22px; font-size: 12px; }
body.wrist #minimap, body.aiming #minimap { display: none; }

#joy { position: absolute; left: 24px; bottom: 28px; width: 120px; height: 120px; border-radius: 50%; background: rgba(6, 11, 17, 0.35); border: 1px solid var(--line-hi); display: none; touch-action: none; }
#joy .knob { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: rgba(127, 227, 255, 0.35); border: 1px solid var(--accent); }
#joy .cap { position: absolute; left: 0; right: 0; top: -24px; text-align: center; font-size: 13px; color: var(--dim); pointer-events: none; text-shadow: 0 1px 2px #000; }
body.touch #joy { display: block; }
body.aiming #joy { display: none !important; }

/* touch: the action is a big thumb button above the minimap; the stack sits above both */
body.touch { --mm-w: 132px; --mm-h: 96px; }
body.touch #xhair { display: none; }
body.touch #bAct { left: auto; top: auto; right: var(--gap); bottom: calc(16px + var(--mm-h) + 10px); transform: none; max-width: calc(100% - 170px); min-height: 60px; padding: 10px 18px;
  background: var(--accent); color: var(--accent-ink); border: 0; font-size: 18px; font-weight: 800; box-shadow: 0 0 0 4px rgba(127, 227, 255, 0.18), 0 8px 24px rgba(0, 0, 0, 0.5); animation: none; }
body.touch #stack { bottom: calc(16px + var(--mm-h) + 84px); }
body.touch.aiming #stack { bottom: 16px; }

/* ---- wrist note: same corner as the minimap ---- */
#wrist { position: fixed; right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); max-height: calc(100% - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); width: min(460px, calc(100% - 24px));
  background: var(--panel-solid); border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: 0 0 var(--r) var(--r); padding: 10px 14px 12px; overflow: auto; z-index: 8; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); animation: fadein 0.18s ease-out; }
#wrist header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#wrist header b { font-size: 15px; letter-spacing: 0.04em; color: var(--accent); }
.panel .cancel { width: 100%; margin-top: 10px; }
#map { width: 100%; aspect-ratio: 74 / 34; background: #12151a; border-radius: 4px; border: 1px solid var(--line); }
#map .route, #mini .route { fill: none; stroke: var(--accent); stroke-width: 0.5; stroke-dasharray: 1.6 1.2; opacity: 0.8; }
#map .pin circle, #mini .pin circle { fill: #fff; } #map .pin.small circle, #mini .pin.small circle { fill: #c8c8c8; }
#map .pin text, #mini .pin text { font-size: 2.6px; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: #000; stroke-width: 0.6px; font-weight: 600; }
#map .pin.small text { font-size: 2px; fill: #ddd; }
#mini .pin text { font-size: 2.3px; }
#map .pin.next circle:not(.ring), #mini .pin.next circle:not(.ring) { fill: var(--accent); }
#mini .pin.next text { fill: var(--accent); font-weight: 800; }
#map .ring, #mini .ring { fill: none !important; stroke: var(--accent); stroke-width: 0.5; animation: ring 1.4s infinite; }
#mini .pin.next .ring { r: 2.8px; }
@keyframes ring { from { opacity: 1; } to { opacity: 0.2; } }
#map .me path, #mini .me path { fill: #ffd75e; stroke: #000; stroke-width: 0.3; }
#mini .edge path { fill: var(--accent); stroke: #000; stroke-width: 0.25; }
#map .scalebar line { stroke: #fff; stroke-width: 0.5; } #map .scalebar text { font-size: 2px; fill: #fff; text-anchor: middle; }
#map .pin.sv circle, #mini .pin.sv circle { fill: var(--warn); } #map .pin.sv text { font-size: 1.9px; fill: #ffe0b0; text-anchor: middle; paint-order: stroke; stroke: #000; stroke-width: 0.5px; }
#map .pin.sv .ring, #mini .pin.sv .ring { stroke: var(--warn); }
.mapinfo { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; margin: 6px 0 4px; }
#mapNext { color: var(--accent); font-weight: 700; } #mapScale { color: var(--dim); }
#wrist .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#wrist h3 { font-size: 12px; margin: 10px 0 4px; color: var(--dim); letter-spacing: 0.06em; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.checks { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--dim); }
.checks li.cur { color: var(--ink); font-weight: 700; }
.checks li.ok { color: var(--ok); }
.checks li.final.ok { font-weight: 800; font-size: 16px; }
.checks .box { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 3px; flex: none; position: relative; }
.checks li.ok .box::after { content: ''; position: absolute; left: 3px; top: -1px; width: 4px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checks li.cur .box { border-color: var(--accent); box-shadow: 0 0 6px rgba(127, 227, 255, 0.5); }
.checks small { color: var(--dim); font-weight: 400; }
#book .checks li.ok { color: #2f7a2c; }
.tabs { display: flex; gap: 6px; margin: 0 0 8px; }
.tabs button { flex: 1; min-height: 44px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); font-weight: 700; font-size: 14px; color: var(--dim); }
.tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.checks .lk { display: flex; gap: 8px; align-items: center; width: 100%; min-height: 44px; padding: 4px 0; background: none; border: 0; color: inherit; text-align: left; font: inherit; }
.checks li:has(.lk) { padding: 0; }
.checks li.opt { font-style: normal; opacity: 0.85; }
.inv { list-style: none; margin: 0; padding: 0; font-size: 14px; display: grid; gap: 4px; }
.inv li { padding: 4px 8px; border-radius: 4px; background: rgba(255, 179, 71, 0.1); border: 1px solid rgba(255, 179, 71, 0.35); }
.inv li.none { background: none; border: 0; color: var(--dim); padding: 3px 0; }
.lhint { margin: 0 0 8px; font-size: 13px; color: var(--dim); }
.learned { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.learned li.none { color: var(--dim); font-size: 14px; }
.lcard { display: grid; grid-template-columns: 132px 1fr; gap: 10px; align-items: center; width: 100%; min-height: 64px; padding: 6px; text-align: left; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: var(--r); }
.lcard:hover, .lcard:focus-visible { border-color: var(--accent); }
.lcard .thumb svg { width: 132px; height: auto; display: block; border-radius: 4px; background: #0b0e13; }
.lcard .thumb * { animation: none !important; }
.lcard .lt { display: grid; gap: 2px; min-width: 0; } .lcard b { font-size: 14px; } .lcard small { font-size: 12px; color: var(--dim); line-height: 1.4; }

/* ---- modals: visor panel (cut corners, cyan top edge) ---- */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2, 6, 10, 0.58); z-index: 10; padding: 16px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
body.touch .modal { backdrop-filter: none; -webkit-backdrop-filter: none; }   /* blur over the live 3D view is costly on phones */
.panel { position: relative; background: var(--panel-solid); border: 1px solid var(--line); border-top: 2px solid var(--accent); padding: 18px 20px 20px; width: min(560px, 100%); max-height: 100%; overflow: auto;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); animation: panelin 0.18s ease-out; }
@keyframes panelin { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.panel h2 { margin: 0 0 14px; padding: 0 0 10px 12px; font-size: 21px; line-height: 1.35; border-bottom: 1px solid var(--line); position: relative; }
.panel h2::before { content: ''; position: absolute; left: 0; top: 5px; width: 3px; height: 18px; background: var(--accent); }
.panel ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.panel li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; line-height: 1.55; font-size: 16px; }
.tag { font-size: 13px; font-weight: 800; padding: 2px 7px; border-radius: 4px; white-space: nowrap; margin-top: 3px; color: #0b0d12; }
.tag.rec { background: var(--rec); } .tag.sim { background: var(--sim); } .tag.game { background: var(--game); }
.panel .primary { width: 100%; }
.opts { display: grid; gap: 8px; }
.opts button { display: grid; gap: 2px; text-align: left; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 0 var(--r) var(--r) 0; padding: 12px 14px; min-height: 52px; font-size: 16px; }
.opts button:hover, .opts button:focus { border-color: var(--accent); background: var(--accent-soft); }
.opts button small { font-size: 13px; color: var(--dim); }
.opts button:disabled { opacity: 0.45; cursor: default; }
#fail .panel { border-top-color: var(--danger); text-align: center; } #fail h2 { color: #ffd2cf; } #fail h2::before { background: var(--danger); } #fail p { font-size: 17px; margin: 0 0 16px; }
@keyframes dash { to { stroke-dashoffset: -9; } }

/* info card: picture + three parts + "더 알아보기" */
.picbox { margin: 0 0 10px; background: #0b0e13; border: 1px solid var(--line); border-radius: 4px; padding: 4px; }
.pic { width: 100%; height: auto; display: block; }
.pic text { fill: #e6e6e6; font-size: 10px; text-anchor: middle; font-family: inherit; }
.pic text.l { text-anchor: start; } .pic text.b { font-weight: 800; font-size: 11px; } .pic text.d { fill: #111; font-weight: 700; }
.pic text.w { font-size: 9px; font-weight: 700; } .pic text.s2 { font-size: 8px; } .pic text.big { font-size: 40px; font-weight: 800; fill: #111; }
.pic text.sos { font-size: 40px; font-weight: 800; fill: #e8c45a; letter-spacing: 6px; }
.cap { margin: -4px 0 10px; font-size: 13px; color: var(--dim); line-height: 1.5; }
.cp { margin: 0 0 10px; padding: 8px 12px; border-radius: 0 var(--r) var(--r) 0; background: rgba(255, 255, 255, 0.035); border-left: 3px solid var(--line); }
.cp h3 { margin: 0 0 4px; font-size: 12.5px; color: var(--accent); letter-spacing: 0.04em; }
.cp.why { border-left-color: var(--warn); } .cp.why h3 { color: var(--warn); }
.cp.how { border-left-color: var(--ok); } .cp.how h3 { color: var(--ok); }
.cp.what { border-left-color: var(--accent); }
.cp p { margin: 0 0 4px; font-size: 16px; line-height: 1.55; } .cp p:last-child { margin-bottom: 0; }
.cp .tag { font-size: 11px; padding: 1px 6px; vertical-align: 2px; margin-left: 2px; }
details.more { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 12px; }
details.more summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; color: var(--dim); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: '▸'; } details.more[open] summary::before { content: '▾'; }
details.more ul { margin: 0 0 12px; }
details.more li { font-size: 14px; }

@media (max-width: 360px) { body.coaching #need { visibility: hidden; } }   /* 320 px: the need chip sits under the first-run hint */
#fail p.why { font-size: 14.5px; color: var(--dim); line-height: 1.55; margin: -6px 0 16px; }

.learned.small { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 14px; }
.learned.small .lcard { grid-template-columns: 96px 1fr; } .learned.small .lcard .thumb svg { width: 96px; }

/* controls list: title card, key legend, help card (after .panel rules so it wins) */
ul.ctl { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
ul.ctl li { display: grid; grid-template-columns: 132px 1fr; gap: 10px; align-items: center; line-height: 1.35; }
ul.ctl .ks { display: inline-flex; }
.panel .extra ul.ctl { margin-bottom: 14px; }
body.touch ul.ctl li { grid-template-columns: 30px 1fr; }
.ti { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--dim); }
.ti.joy { background: radial-gradient(circle, var(--dim) 30%, transparent 32%); }
.ti.drag { border-style: dashed; }
.ti.tap { background: var(--accent); border-color: var(--accent); border-radius: 8px; }
.ti.map { border-radius: 6px; }

/* card picture animations (light; off with reduced motion) */
.an-dash { stroke-dasharray: 6 5; animation: dash 0.9s linear infinite; }
.an-pulse { animation: pulse 1.8s ease-in-out infinite; }
.an-up { transform-box: fill-box; animation: rise 1.6s ease-out infinite; }
.an-fill { transform-box: fill-box; transform-origin: 50% 100%; animation: fillup 4s ease-in-out infinite; }
.an-fillx { transform-box: fill-box; transform-origin: 0 50%; animation: fillx 3s ease-in-out infinite; }
.an-needle { transform-box: view-box; transform-origin: 0 0; animation: needle 4s ease-in-out infinite; }
.an-ring { transform-box: fill-box; transform-origin: center; animation: ringout 2.4s ease-out infinite; }
.an-wave { animation: pulse 2.4s ease-in-out infinite; }
.an-shadow { animation: pulse 3s ease-in-out infinite; }
.an-spin { transform-box: view-box; transform-origin: 96px 62px; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(-10px); opacity: 0; } }
@keyframes fillup { 0% { transform: scaleY(0.15); } 70%, 100% { transform: scaleY(1); } }
@keyframes fillx { 0% { transform: scaleX(0.1); } 60%, 100% { transform: scaleX(1); } }
@keyframes needle { 0% { transform: rotate(-60deg); } 70%, 100% { transform: rotate(60deg); } }
@keyframes ringout { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }

/* ---- mid widths: the toast leaves the top row once it would touch the objective tracker ---- */
@media (max-width: 1100px) {
  #toast { top: 34%; border-radius: var(--r); }
}
/* ---- phone ---- */
@media (max-width: 720px) {
  :root { --gap: 10px; }
  #topleft { width: auto; right: 62px; gap: 6px; }
  #topbtns { flex-direction: column; }
  #obj { padding: 7px 10px 8px 12px; }
  #obj .txt { font-size: 15px; }
  #vitals { padding: 6px 8px 5px; }
  #meters { gap: 4px; }
  .meter { grid-template-columns: 14px 56px minmax(40px, auto) auto; column-gap: 6px; min-height: 16px; }
  .meter .name { display: none; }   /* icon + bar + value (+ warning word) on narrow screens */
  .meter em { grid-column: 2; } .meter b { grid-column: 3; font-size: 12px; } .meter s { grid-column: 4; }
  .meter svg { width: 14px; height: 14px; }
  #sky { max-width: 200px; font-size: 11px; margin-top: 5px; padding-top: 4px; }
  #need { font-size: 14px; padding: 5px 10px 5px 8px; }
  #map .pin text { font-size: 3.6px; } #map .pin.small text { font-size: 3px; } #map .scalebar text { font-size: 3px; }
  #wrist { left: calc(12px + env(safe-area-inset-left)); width: auto; max-height: 72%; }
  #wrist .cols { grid-template-columns: 1fr; }
  #coach { font-size: 15px; }
  #aim { padding: 10px 12px; }
  #aim .ctrls { grid-template-columns: auto 1fr; }
  #bLeave { grid-column: 1 / -1; }
  body.touch #aim .ctrls { grid-template-columns: 1fr auto; }
  body.touch #bLeave { grid-column: auto; }
  .cp p { font-size: 15px; }
  .lcard { grid-template-columns: 80px 1fr; } .lcard .thumb svg { width: 80px; }
  .panel { padding: 16px 16px 18px; }
  .panel h2 { font-size: 19px; }
}
@media (max-width: 360px) {
  #obj .txt { font-size: 14px; }
  .meter { grid-template-columns: 14px 44px minmax(38px, auto) auto; }
}
@media (max-width: 360px), (max-height: 620px) and (max-width: 720px) {   /* small phones: the chip becomes one plain line under the vitals */
  #comm { min-height: 0; padding: 0 2px; margin-top: -2px; border: 0; background: none; font-size: 12px; text-shadow: 0 1px 2px #000; }
  #topleft > #comm { pointer-events: none; }
}
@media (max-height: 620px) and (max-width: 720px) { .tphoto { max-height: 26vh; } .pitch { margin-bottom: 12px; } }
@media (prefers-reduced-motion: reduce) {
  .spread { transition: none; }
  .tart, .earthMark i, .nosig i { animation: none; }
  #crawl .view { -webkit-mask-image: none; mask-image: none; display: grid; place-items: center; padding: 16px; }
  #crawl .text { position: static; transform: none; animation: none; width: min(660px, 100%); }
  #crawl .text p { opacity: 0; animation: linein 0.6s forwards; }
  #crawl .text p:nth-child(1) { animation-delay: 0.0s; }
  #crawl .text p:nth-child(2) { animation-delay: 1.2s; }
  #crawl .text p:nth-child(3) { animation-delay: 2.4s; }
  #crawl .text p:nth-child(4) { animation-delay: 3.6s; }
  #crawl .text p:nth-child(5) { animation-delay: 4.8s; }
  #crawl .text p:nth-child(6) { animation-delay: 6.0s; }
  #hud.boot .meter { transition: none; transform: none; }
  #vign::before { animation: none; opacity: 0.8; }
  #map .ring, #mini .ring, #toast.on, #learnline.on, #coach, #coach .keys .kc, #marker .dot::after, .meter.crit, #bAct, .panel, #wrist { animation: none; }
  .an-dash, .an-pulse, .an-up, .an-fill, .an-fillx, .an-needle, .an-ring, .an-wave, .an-shadow, .an-spin, #need.warn .ico { animation: none; }
  .an-up { opacity: 1; }
}

/* ---- ending ---- (js/ending.js: the team cinematic in the 3D view, then the team's book iframe (ending/book-review)) */
#ending { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
#ending .sub { position: absolute; left: 16px; right: 16px; bottom: clamp(40px, 11vh, 110px); margin: 0; text-align: center;
  font: 600 clamp(17px, 2.3vw, 27px)/1.4 'Noto Sans KR', sans-serif; letter-spacing: 0.02em; color: #f4f1ea;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 18px rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.8s ease; }
#ending .sub::before { content: '\201C'; }
#ending .sub::after { content: '\201D'; }
#ending .sub:empty::before, #ending .sub:empty::after { content: none; }
#ending .sub.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #ending .sub { transition: none; } }
