/* 一飛沖天: the sister games' visual system (paper, ink, Noto Sans TC + Barlow Condensed, sheet dialogs, safe areas)
   with lime as the accent (dark words on it) and sky blue as the second colour. The control deck is two square sticks
   in the series' tile style (Mode 2, 美國手) under a row of one-tap actions.
   Sections: tokens · base · buttons · the 3D stage · home · picker · game HUD · control deck · overlays · instant
   replay · dialogs · responsive. The result card's inside, the 紀念駕照 and the share sheet are styled in pass.css. */

/* ── tokens ── */
:root{
  --ink:#1d2a2a;
  --accent:#c6e03a;          /* lime: dark words on it */
  --accent-dark:#4d5c00;
  --accent-soft:#eef6c8;
  --accent-shadow:#8fa521;
  --teal:#2f6f9f;            /* sky blue, the second colour */
  --paper:#f5f6ef;
  --panel:rgba(245,246,239,.94);
  --red:#d4402b;
  --red-dark:#a5332a;
  --green:#2f8f4e;
  --muted:#556464;
  --line:rgba(29,42,42,.14);
  --ease-out:cubic-bezier(0.23,1,0.32,1);
  --sans:'Noto Sans TC','Microsoft JhengHei',system-ui,sans-serif;
  --mono:'Barlow Condensed','Noto Sans TC','Microsoft JhengHei',system-ui,sans-serif;
  --safe-top:env(safe-area-inset-top,0px);
  --safe-right:env(safe-area-inset-right,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  --safe-left:env(safe-area-inset-left,0px);
  --app-height:100svh;
  --bad:#d4402b;
  --good:#2f8f4e;
  color-scheme:light;
}
@supports(height:100dvh){:root{--app-height:100dvh}}

/* ── base ── */
*{box-sizing:border-box}
html{min-height:100%;background:#ebe9de}
body{margin:0;min-height:var(--app-height);color:var(--ink);font-family:var(--sans);font-size:14px;overflow-x:hidden;
  -webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:100%;
  background:radial-gradient(circle at 85% 0%,#eef5d4,transparent 60%),#ebe9de}
body[data-screen="game"]{overflow:hidden;overscroll-behavior:none}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none;padding:0}
button:focus-visible,a:focus-visible,summary:focus-visible{outline:3px solid var(--accent-dark);outline-offset:3px}
button:disabled{cursor:not-allowed;opacity:.5}
button,dialog,a{touch-action:manipulation}
[hidden]{display:none!important}
kbd{font:600 11px/1 var(--mono);letter-spacing:.02em;padding:2px 4px;border-radius:4px;background:rgba(29,42,42,.08);color:var(--ink)}
a{color:var(--accent-dark)}
/* line icons (README rule 12): inline SVG in the buttons, filled where a part says so */
button svg{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
svg .solid,svg .speaker,svg .dot,svg .blades{fill:currentColor;stroke:none}
[data-sound][aria-pressed="true"] .mute{display:none}
[data-sound][aria-pressed="false"] .wave{display:none}

/* ── buttons ── */
.primary{background:var(--accent);color:var(--ink);font-weight:800;min-height:50px;padding:12px 22px;border-radius:10px;
  display:inline-flex;align-items:center;justify-content:center;gap:10px;box-shadow:0 3px 0 var(--accent-shadow);
  transition:transform 160ms var(--ease-out),box-shadow 160ms var(--ease-out),background-color 180ms}
.primary:hover{background:#d2ea4f}
.primary:active{transform:translateY(3px);box-shadow:0 0 0 var(--accent-shadow)}
.primary.large{font-size:18px;min-height:60px;border-radius:12px}
.secondary{background:rgba(255,255,255,.5);border:1px solid #bdb59c;border-radius:10px;min-height:48px;padding:11px 16px;font-size:14px;
  font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:8px}
.secondary:hover{background:#f1ead3}
.secondary.small{min-height:38px;padding:7px 12px;font-size:13px}
.text-button{min-height:44px;padding:9px 0;font-size:13px;font-weight:700;display:inline-flex;align-items:center;gap:6px;color:var(--ink);text-decoration:none}
.text-button:hover{color:var(--accent-dark)}
.text-button.danger{color:var(--red-dark)}
.round-button,.icon-button{width:44px;height:44px;border-radius:50%;background:var(--panel);display:grid;place-items:center;font-size:18px;
  box-shadow:0 3px 12px rgba(29,42,42,.1);flex:none;font-weight:800}
.round-button.small{width:40px;height:40px;font-size:13px}
.round-button.small svg{width:20px;height:20px}
.secondary:active,.text-button:active,.round-button:active,.icon-button:active,.station-card:active{transform:scale(.97)}

/* ── the 3D stage behind the screens ── */
.stage{position:fixed;inset:0;z-index:0;background:#dde7e4}
.view{width:100%;height:100%;display:block;touch-action:none}
.screen{position:relative;z-index:1}
.scene-note{position:fixed;z-index:5;left:50%;top:calc(max(8px,var(--safe-top)) + 64px);transform:translateX(-50%);width:min(calc(100% - 24px),360px);
  margin:0;padding:10px 14px;border-radius:12px;background:var(--panel);color:var(--ink);font-size:13px;font-weight:700;line-height:1.6;text-align:center;
  box-shadow:0 6px 20px rgba(29,42,42,.15)}

/* ── home ── */
/* The paper fades out where the drone hovers (scene.js cameraPlan orbit: about 48–81 % of a phone's height) and back
   in under it, so the title above and the links below read over the field. */
.home{min-height:var(--app-height);display:flex;flex-direction:column;
  background:linear-gradient(180deg,rgba(245,246,239,.96) 0%,rgba(245,246,239,.86) 44%,rgba(245,246,239,.2) 58%,rgba(245,246,239,0) 63%,
    rgba(245,246,239,0) 74%,rgba(245,246,239,.78) 86%,rgba(245,246,239,.9) 100%)}
.home-top{display:flex;align-items:center;justify-content:space-between;padding:max(14px,var(--safe-top)) max(20px,var(--safe-right)) 6px max(20px,var(--safe-left))}
.brand{display:flex;align-items:center;gap:10px;margin:0}
.brand-mark{display:grid;place-items:center;width:40px;height:40px;border-radius:11px;background:var(--accent);box-shadow:0 3px 0 var(--accent-shadow);overflow:hidden}
.brand-mark svg{display:block;width:40px;height:40px}
.brand-name{font-size:18px;font-weight:900;letter-spacing:.12em}
.top-actions{display:flex;gap:8px}
.home-main{flex:1;display:flex;flex-direction:column;padding:8px max(22px,var(--safe-right)) max(16px,var(--safe-bottom)) max(22px,var(--safe-left))}
.hero-copy h1{font-size:clamp(34px,10vw,58px);line-height:1.08;margin:14px 0 18px;font-weight:900;letter-spacing:.02em}
.outlined{color:var(--accent-dark)}
/* The friend's challenge, then the two ways in at the same width, then 單站練習. */
.hero-cta{display:flex;flex-direction:column;gap:10px;width:min(100%,360px)}
.hero-cta .primary,.hero-cta .quick-start{width:100%}
.challenge-card{display:grid;gap:10px;padding:12px 14px 14px;border-radius:12px;background:#fff;border:1px solid var(--line);
  border-left:4px solid var(--accent);box-shadow:0 2px 8px rgba(29,42,42,.08)}
.challenge-title{margin:0;font-size:14px;font-weight:800;line-height:1.5}
.home-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
/* 定位 / 姿態 (the flight mode for the next run): the chip beside 單站練習, in the picker and on the exam's first page;
   the tag on the main button says which */
body[data-flight="gps"] [data-flight-when="atti"],body[data-flight="atti"] [data-flight-when="gps"]{display:none}
.flight-chip{display:inline-grid;grid-template-columns:1fr 1fr;gap:3px;padding:3px;border-radius:10px;background:#e2e4cc}
.flight-chip button{min-height:38px;padding:4px 14px;border-radius:8px;font-weight:800;font-size:13px;color:var(--muted)}
.flight-chip button[aria-pressed="true"]{background:var(--paper);color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.flight-chip.small button{min-height:34px;padding:3px 10px}
.flight-chip button:active{transform:scale(.97)}
.flight-tag{font:700 12px/1 var(--sans);background:rgba(29,42,42,.12);padding:5px 8px;border-radius:6px}
.practice-link{font-size:15px}
.practice-link .chev{width:8px;height:14px;fill:none;stroke:var(--accent-dark);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
/* 60 秒四面停懸: the way in that flies at once */
.quick-start{display:flex;flex-direction:column;align-items:center;gap:2px;min-height:60px;padding:8px 18px;border-radius:12px;
  font-size:16px;font-weight:800;text-align:center}
.quick-sub{font-size:12px;font-weight:600;color:var(--muted)}
/* the lines under the buttons can sit over the drone on short phones: a pale halo */
.exam-promise{font-size:13px;font-weight:700;color:var(--muted);margin:8px 0 0}
.home-best{margin:8px 0 0;font-weight:700;white-space:pre-line}
.exam-promise,.home-best{text-shadow:0 0 6px rgba(245,246,239,.95),0 0 2px rgba(245,246,239,.95)}
/* The counter card: stats.js writes two lines, the first led by its own ●. */
.home-count{width:fit-content;max-width:100%;margin:6px 0 0 -8px;padding:3px 10px 3px 8px;border-radius:8px;background:rgba(245,246,239,.82);
  color:#4f5a50;font-size:12px;font-weight:600;line-height:1.75;font-variant-numeric:tabular-nums;white-space:pre-line}
.home-count::first-letter{color:#1f9d63}
.home-count:empty{display:none}
/* 操作說明 and 紀念駕照 sit low, over the field, above 關於. */
.home-links{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:0 22px;margin-top:auto;padding-top:12px}
.home-links .text-button{font-size:14px;text-shadow:0 0 6px rgba(245,246,239,.95),0 0 2px rgba(245,246,239,.95)}
/* 關於 and the footer: plain over the backdrop, 關於 gets its own card when open. */
.simulator-intro{position:relative;z-index:1;max-width:720px;color:#4f5a50;font-size:12px}
.simulator-intro[open]{margin:0 -12px;padding:0 12px 4px;border-radius:12px;background:var(--paper);box-shadow:0 4px 18px rgba(29,42,42,.06)}
.simulator-intro summary{width:fit-content;cursor:pointer;min-height:44px;padding:12px 0;line-height:20px;font-weight:700;color:var(--ink)}
.simulator-intro p{margin:4px 0 6px;font-size:13px;line-height:1.8}
.simulator-intro a{display:inline-flex;align-items:center;min-height:44px;font-size:13px;font-weight:700;color:var(--accent-dark)}
.home-footer{position:relative;z-index:1;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:0 14px;padding:6px 3px 0;
  border-top:1px solid var(--line);font-size:11px;letter-spacing:.08em;color:var(--muted)}
.home-footer a,.home-footer .text-button{min-height:44px;font-size:11px;font-weight:600;letter-spacing:.08em;color:var(--muted)}
.home-footer a{display:inline-flex;align-items:center;text-decoration:none}
.home-footer a:hover,.home-footer .text-button:hover{color:var(--accent-dark)}
.changelog-open{position:relative}
.news-dot{position:absolute;top:calc(50% - 10px);right:-8px;width:7px;height:7px;border-radius:50%;background:#e2483d;box-shadow:0 0 0 2px var(--paper)}

/* ── picker ── */
.picker{min-height:var(--app-height);background:rgba(245,246,239,.94)}
.picker-inner{max-width:640px;margin:0 auto;padding:max(14px,var(--safe-top)) max(18px,var(--safe-right)) max(18px,var(--safe-bottom)) max(18px,var(--safe-left))}
.picker-head{display:flex;align-items:center;gap:12px}
.picker-head h2{flex:1;margin:0;font-size:22px}
.station-list{display:grid;gap:12px;margin-top:18px}
.station-card{display:grid;grid-template-columns:52px minmax(0,1fr);align-items:center;gap:14px;width:100%;text-align:left;background:#fff;
  border:1px solid var(--line);border-radius:14px;padding:14px;box-shadow:0 2px 8px rgba(29,42,42,.06)}
.station-card:hover{border-color:var(--accent)}
.station-no{display:grid;place-items:center;width:52px;height:52px;border-radius:12px;background:var(--accent-soft);font:800 26px/1 var(--mono);color:var(--accent-dark)}
.station-text{display:grid;gap:3px;min-width:0}
.station-card h3{margin:0;font-size:16px}
.station-blurb{margin:0;color:var(--muted);font-size:12.5px;line-height:1.55}
.station-best{margin:0;font-size:12.5px;font-weight:800;color:var(--muted)}
.station-best[data-best="true"]{color:var(--green)}
.picker-note{color:var(--muted);font-size:12.5px;margin-top:16px}

/* ── game HUD ── */
.game{position:fixed;inset:0;pointer-events:none;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.game>*{pointer-events:auto}
.hud{position:absolute;left:0;right:0;top:0;z-index:2;padding:max(8px,var(--safe-top)) max(10px,var(--safe-right)) 0 max(10px,var(--safe-left));pointer-events:none}
.hud>*{pointer-events:auto}
.hud-row{display:flex;align-items:center;gap:8px}
.hud-title{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--panel);border-radius:10px;padding:5px 10px;box-shadow:0 2px 10px rgba(0,0,0,.08)}
.hud-station{font-weight:900;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hud-mode{font-size:11px;color:var(--muted);font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* Phones under 375 px: a little tighter, so the station's name keeps most of its words. */
@media (max-width:374px){.hud-row{gap:6px}.hud-title{padding:5px 8px}.hud-station{font-size:13px}.hud-mode{font-size:10px}}
.hud-clock{font:700 22px/1 var(--mono);background:var(--ink);color:#fff;border-radius:10px;padding:9px 10px;min-width:64px;text-align:center;
  font-variant-numeric:tabular-nums;box-shadow:0 2px 10px rgba(0,0,0,.12)}
.readouts{margin-top:6px;gap:5px;flex-wrap:wrap}
.readout{display:inline-flex;align-items:center;gap:3px;min-height:27px;background:var(--panel);border-radius:8px;padding:4px 8px;font-size:11px;color:var(--muted);
  box-shadow:0 1px 6px rgba(0,0,0,.06)}
.readout.speed{align-items:baseline}
.readout b{font:700 19px/1 var(--mono);color:var(--ink);min-width:1.1em;text-align:right;font-variant-numeric:tabular-nums}
.readout em{font-style:normal;font-weight:700}
.readout i{font-style:normal}
/* 機頭差 with the way to turn; 懸停 3／5, dark while it counts, why it waits when it does not; the friend's landing */
.readout.heading i{font-weight:800;color:var(--accent-dark)}
.readout.heading i:empty{display:none}
.readout.count i{font-weight:800;color:var(--red-dark)}
.readout.count i:empty{display:none}
.readout.count[data-counting="true"]{background:var(--ink);color:#fff}
.readout.count[data-counting="true"] b{color:var(--accent)}
.hud-target{font-size:12px;font-weight:800;background:var(--ink);color:#fff}
/* the examiner's words for the step (engine.js st.say), and the next point as the pilot sees it */
.say{display:flex;align-items:baseline;gap:6px;width:fit-content;max-width:100%;margin:6px 0 0;padding:5px 11px;border-radius:10px;
  background:var(--panel);font-size:13px;font-weight:800;line-height:1.45;box-shadow:0 1px 6px rgba(0,0,0,.06);pointer-events:none}
.say-who{flex:none;font-size:11px;font-weight:900;color:var(--teal)}
.next-point{width:fit-content;max-width:100%;margin:4px 0 0;padding:3px 10px;border-radius:8px;background:rgba(29,42,42,.72);color:#fff;
  font-size:12px;font-weight:700;line-height:1.5;pointer-events:none}
.coach{margin:6px 0 0;background:rgba(29,42,42,.82);color:#fff;border-radius:9px;padding:7px 10px;font-weight:700;font-size:13px;line-height:1.5;max-width:560px;
  pointer-events:none}
/* the examiner's line: a small dark pill under the coach */
.hud .quip{display:flex;align-items:baseline;gap:6px;width:fit-content;max-width:100%;margin:6px 0 0;padding:5px 11px;border-radius:12px;
  background:rgba(29,42,42,.82);color:#fff;font-size:12.5px;font-weight:700;line-height:1.45;pointer-events:none;animation:rise .25s var(--ease-out)}
.quip-who{flex:none;font-size:11px;font-weight:800;color:var(--accent)}
/* the practice card (advice.js faultCard) when an item fails: what went wrong, what to do, the first time the rule */
.practice-card{margin:6px 0 0;display:flex;flex-direction:column;gap:2px;max-width:min(100%,340px);padding:8px 12px;border-radius:10px;
  background:var(--panel);border-left:4px solid var(--accent-dark);font-size:12px;line-height:1.5;box-shadow:0 3px 12px rgba(29,42,42,.12);pointer-events:none}
.practice-card strong{font-weight:800;color:var(--red-dark)}
.practice-card span{font-weight:700;color:var(--ink)}
.practice-card em{font-style:normal;font-weight:800;color:var(--teal)}
/* the belly camera's picture (scene.js renderDownCam draws it under this box) and its crosshair */
.downcam{position:absolute;z-index:2;right:max(10px,var(--safe-right));bottom:calc(max(10px,var(--safe-bottom)) + var(--stick) + 74px);
  width:min(28vw,124px);aspect-ratio:1;border:3px solid var(--ink);border-radius:12px;box-shadow:0 4px 14px rgba(0,0,0,.2);pointer-events:none}
.downcam::before,.downcam::after{content:'';position:absolute;left:50%;top:50%;background:var(--accent);box-shadow:0 0 0 1px rgba(29,42,42,.5)}
.downcam::before{width:44%;height:2px;margin:-1px 0 0 -22%}
.downcam::after{width:2px;height:44%;margin:-22% 0 0 -1px}
.downcam-label{position:absolute;left:5px;top:4px;padding:1px 6px;border-radius:6px;background:rgba(29,42,42,.78);color:#fff;font-size:11px;font-weight:800}
/* 熟悉試飛: what it is, and 結束試飛 */
.trial-bar{position:absolute;z-index:3;left:max(10px,var(--safe-left));bottom:calc(max(10px,var(--safe-bottom)) + var(--stick) + 74px);display:flex;
  align-items:center;gap:10px;background:var(--ink);color:#fff;border-radius:12px;padding:6px 6px 6px 14px;font-size:13px;font-weight:800}
.trial-bar .secondary{background:var(--paper);color:var(--ink)}
.banner{position:absolute;z-index:3;left:50%;top:calc(max(8px,var(--safe-top)) + 196px);transform:translateX(-50%);background:var(--red);color:#fff;font-weight:900;
  border-radius:12px;padding:10px 16px;font-size:16px;box-shadow:0 6px 20px rgba(0,0,0,.2);width:max-content;max-width:calc(100% - 24px);text-align:center;
  pointer-events:none;animation:pop .28s var(--ease-out)}
.banner[data-kind="info"]{background:var(--ink)}
.banner[data-kind="good"]{background:var(--green)}

/* ── control deck: the one-tap actions over two sticks (Mode 2, 美國手): left 升降 and 機頭, right 前後左右 ── */
.game{--stick:min(40vw,168px)}
.deck{position:absolute;left:0;right:0;bottom:0;z-index:2;
  padding:6px max(12px,var(--safe-right)) max(10px,var(--safe-bottom)) max(12px,var(--safe-left));
  background:linear-gradient(180deg,rgba(245,246,239,0),rgba(245,246,239,.72) 26%,rgba(245,246,239,.92));
  user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:none}
.autos{display:flex;justify-content:center;gap:6px;max-width:520px;margin:0 auto 8px}
.auto{flex:1 1 0;min-width:0;min-height:44px;padding:5px 8px;border-radius:12px;background:var(--panel);border:2px solid #c4c7a4;
  box-shadow:0 3px 0 rgba(0,0,0,.16);color:var(--ink);font-size:12.5px;font-weight:800;line-height:1.25;touch-action:none;
  transition:transform 80ms,box-shadow 80ms,background-color 120ms}
.auto:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(0,0,0,.16)}
.auto[data-state="running"]{background:var(--ink);color:var(--accent);border-color:var(--ink)}
.auto[data-state="done"]{border-color:var(--accent-dark);background:var(--accent-soft)}
.sticks{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;max-width:560px;margin:0 auto}
/* a stick: the square base (the series' tile), its cross, the words at its four ways, the knob that follows the thumb */
.stick{position:relative;display:block;flex:none;width:var(--stick);height:var(--stick);border-radius:20px;background:var(--panel);
  border:2px solid #c4c7a4;box-shadow:0 4px 0 rgba(0,0,0,.18);touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.stick::before,.stick::after{content:'';position:absolute;left:50%;top:50%;border-radius:1px;background:rgba(29,42,42,.16)}
.stick::before{width:2px;height:64%;margin:-32% 0 0 -1px}
.stick::after{width:64%;height:2px;margin:-1px 0 0 -32%}
.stick[data-pressed]{border-color:var(--ink)}
.stick-cap{position:absolute;font-size:11px;font-weight:900;line-height:1;color:var(--muted);pointer-events:none}
.cap-up{top:7px;left:50%;transform:translateX(-50%)}
.cap-down{bottom:7px;left:50%;transform:translateX(-50%)}
.cap-left{left:7px;top:50%;transform:translateY(-50%)}
.cap-right{right:7px;top:50%;transform:translateY(-50%)}
/* moved by --kx and --ky (controls.js: −1 … 1 of the travel, STICK_TRAVEL 0.32 of the base; up +) */
.stick-knob{position:absolute;z-index:1;left:50%;top:50%;width:40%;height:40%;margin:-20% 0 0 -20%;border-radius:50%;background:var(--ink);
  border:4px solid var(--accent);box-shadow:0 3px 8px rgba(0,0,0,.25);pointer-events:none;
  transform:translate(calc(var(--kx,0) * var(--stick) * .32),calc(var(--ky,0) * var(--stick) * -.32))}
/* the right stick's small aircraft turns with the nose (--heading, controls.js showHeading) */
.stick-plane{position:absolute;left:50%;top:50%;width:46%;height:46%;margin:-23% 0 0 -23%;fill:none;stroke:var(--accent-dark);stroke-width:2.4;
  stroke-linecap:round;opacity:.55;transform:rotate(var(--heading,0deg));pointer-events:none}
.stick-plane .solid{fill:var(--accent-dark)}
/* the keys, only for a keyboard */
.keys-legend{display:none;margin:6px 0 0;font-size:11.5px;color:var(--muted);text-align:center}
body[data-input="keys"] .keys-legend{display:block}

/* ── overlays ── */
.overlay{position:absolute;inset:0;z-index:5;display:grid;place-items:center;padding:16px;background:rgba(29,42,42,.35);touch-action:auto;user-select:text;
  -webkit-user-select:text}
.card{background:var(--paper);border-radius:18px;padding:20px 18px 14px;width:min(100%,460px);max-height:calc(var(--app-height) - 32px);overflow:auto;
  box-shadow:0 18px 50px rgba(0,0,0,.3)}
.card h2{margin:2px 0 8px;font-size:22px}
.card-kicker{margin:0;font-weight:800;color:var(--accent-dark);font-size:12.5px;letter-spacing:.06em}
/* the ready card: a sheet from the bottom, the scene above it */
.ready{place-items:end center;padding:0;background:linear-gradient(180deg,rgba(29,42,42,0) 45%,rgba(29,42,42,.22))}
.ready .card{display:flex;flex-direction:column;width:min(100%,560px);border-radius:22px 22px 0 0;padding:20px max(20px,var(--safe-right)) max(14px,var(--safe-bottom)) max(20px,var(--safe-left));
  max-height:calc(var(--app-height) - 72px);box-shadow:0 -8px 30px rgba(29,42,42,.18)}
.ready-tasks{margin:0 0 8px;padding-left:20px;font-size:15px;line-height:1.6}
.ready-limit{margin:0 0 4px;font-size:15px;font-weight:800}
.ready-note{margin:0 0 14px;font-size:13px;color:var(--muted)}
/* the route from above (app.js drawRoute): metres, the pilot at the bottom */
.ready-route{display:block;width:100%;height:auto;max-height:min(24vh,180px);margin:2px 0 10px;border-radius:12px;background:#dfe9d6}
.ready-route .route-line{fill:none;stroke:#fff}
.ready-route .route-ring{fill:none;stroke:var(--red)}
.ready-route .route-pad{fill:var(--accent-soft);stroke:var(--ink)}
.ready-route .route-pad-mark{fill:var(--ink);font-family:var(--sans);font-weight:900;text-anchor:middle}
.ready-route .route-path{fill:none;stroke:var(--teal);stroke-linecap:round;stroke-linejoin:round}
.ready-route .route-head{fill:var(--teal)}
.ready-route .route-cone{fill:#ff7a1a}
.ready-route .route-cone-no{fill:var(--ink);font-family:var(--mono);font-weight:800;text-anchor:middle}
.ready-route .route-pilot{fill:var(--ink)}
.ready-route .route-pilot-name{fill:var(--ink);font-family:var(--sans);font-weight:800;text-anchor:middle}
.ready-go{display:flex;gap:8px}
.ready-go>*{flex:1 1 0}
.ready-go .primary{flex-grow:1.5}
/* 飛行前檢查 and 飛行後檢查 (inspect.js): the list ticks itself off while the camera walks round the drone */
.game[data-check="on"] .hud,.game[data-check="on"] .deck{visibility:hidden}
.inspect{place-items:end center;padding:0;background:none}
.inspect .card{width:min(100%,560px);border-radius:22px 22px 0 0;padding:16px max(18px,var(--safe-right)) max(14px,var(--safe-bottom)) max(18px,var(--safe-left));
  box-shadow:0 -8px 30px rgba(29,42,42,.18)}
.inspect-note{margin:4px 0 10px;font-size:13px;line-height:1.6;color:var(--muted)}
.inspect-items{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.inspect-items li{display:flex;align-items:center;gap:5px;padding:6px 7px;border-radius:9px;background:#fff;border:1px solid var(--line);
  font-size:12.5px;font-weight:700;color:var(--muted);white-space:nowrap}
.inspect-items li::before{content:'';flex:none;width:13px;height:13px;border-radius:4px;border:2px solid #b9b9a0}
.inspect-items li[data-done="true"]{color:var(--ink);border-color:var(--accent-dark)}
.inspect-items li[data-done="true"]::before{background:var(--accent);border-color:var(--accent-dark)}
.inspect-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px}
.inspect-label{font:700 15px/1 var(--mono);color:var(--accent-dark)}
@media (max-width:379px){.inspect-items{grid-template-columns:repeat(2,minmax(0,1fr))}}
.ready .text-button{align-self:center;margin-top:6px}
/* 3、2、1、開始 */
.countdown{position:absolute;left:50%;top:40%;z-index:5;transform:translate(-50%,-50%);pointer-events:none;
  font:900 clamp(72px,24vw,140px)/1 var(--sans);color:var(--accent);-webkit-text-stroke:4px var(--ink);paint-order:stroke fill;
  text-shadow:0 6px 0 rgba(29,42,42,.35)}
.result{place-items:center}
.toast{position:fixed;left:50%;bottom:calc(max(12px,var(--safe-bottom)) + 12px);transform:translateX(-50%);z-index:8;width:max-content;max-width:calc(100% - 24px);
  padding:10px 16px;border-radius:12px;background:var(--ink);color:#fff;font-weight:800;font-size:14px;text-align:center;box-shadow:0 6px 20px rgba(0,0,0,.2);
  animation:pop .28s var(--ease-out)}

/* ── the instant replay before a failed run's result (app.js instantReplay): 重播, the angle, slow motion, the freeze ── */
.instant{position:absolute;inset:0;z-index:7;cursor:pointer;color:#fff;-webkit-tap-highlight-color:transparent;touch-action:manipulation;
  background:linear-gradient(rgba(0,0,0,.42),transparent 24%,transparent 76%,rgba(0,0,0,.48))}
.game[data-instant="on"] .deck,.game[data-instant="on"] .hud,.game[data-instant="on"] .banner,.game[data-instant="on"] .downcam,
.game[data-instant="on"] .trial-bar{visibility:hidden}
.instant-top{position:absolute;left:max(12px,var(--safe-left));right:max(12px,var(--safe-right));top:calc(max(10px,var(--safe-top)) + 4px);
  display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.instant-tag{display:inline-flex;align-items:center;gap:6px;background:var(--red);padding:6px 10px;border-radius:6px;font:800 16px/1 var(--sans);letter-spacing:.14em}
.instant-tag svg{width:9px;height:9px;fill:currentColor;stroke:none;animation:rec-blink 1s steps(1) infinite}
.instant-cam{background:rgba(29,31,26,.72);padding:6px 10px;border-radius:6px;font:800 16px/1 var(--sans);letter-spacing:.06em}
.instant-cam:empty{display:none}
.instant-speed{background:var(--accent);color:var(--ink);padding:6px 9px;border-radius:6px;font-weight:800;font-size:13px;line-height:1}
.instant-title{position:absolute;left:16px;right:16px;top:calc(max(10px,var(--safe-top)) + 50px);margin:0;text-align:center;
  font:900 clamp(19px,5.2vw,30px)/1.35 var(--sans);text-shadow:0 2px 0 rgba(0,0,0,.55),0 0 14px rgba(0,0,0,.5)}
.instant-verdict{position:absolute;left:50%;top:32%;transform:translate(-50%,-50%);width:min(90%,520px);display:none;justify-items:center;gap:12px;pointer-events:none}
.instant[data-freeze="on"] .instant-verdict{display:grid}
/* the round red stamp, as the sister games' */
.instant-stamp{display:grid;place-items:center;width:128px;height:128px;border-radius:50%;border:6px solid var(--red);background:rgba(245,246,239,.92);
  color:var(--red);font-weight:900;font-size:34px;transform:rotate(-12deg);animation:stamp-in .4s var(--ease-out)}
.instant-reason{margin:0;background:rgba(29,31,26,.84);padding:8px 14px;border-radius:10px;font-weight:800;font-size:16px;line-height:1.45;text-align:center}
.instant-reason:empty{display:none}
.instant-bottom{position:absolute;left:max(12px,var(--safe-left));right:max(12px,var(--safe-right));bottom:calc(max(10px,var(--safe-bottom)) + 10px);
  display:flex;align-items:center;gap:10px}
.instant-clock{min-width:118px;white-space:nowrap;font:800 19px/1 var(--mono);text-shadow:0 1px 3px rgba(0,0,0,.7)}
.instant-progress{flex:1;height:5px;border-radius:3px;background:rgba(255,255,255,.35);overflow:hidden}
.instant-progress i{display:block;height:100%;background:var(--accent);transform-origin:left center;transform:scaleX(0)}
.instant-skip{display:inline-flex;align-items:center;gap:6px;background:rgba(245,246,239,.9);color:var(--ink)}
.instant-skip svg{width:13px;height:13px;fill:currentColor;stroke:none}
.instant-flash{position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none;animation:cut-flash .24s ease-out}

/* ── dialogs ── */
dialog.sheet{border:0;border-radius:18px;padding:18px;width:min(100% - 24px,520px);max-height:calc(var(--app-height) - 24px);background:var(--paper);color:var(--ink);
  box-shadow:0 20px 60px rgba(0,0,0,.35);overscroll-behavior:contain}
dialog.sheet::backdrop{background:rgba(29,42,42,.45)}
dialog.sheet h2{margin:0 0 12px}
/* every sheet's title row, with its close button top right; it stays in view while a long sheet scrolls */
.sheet-head{position:sticky;top:-18px;z-index:3;display:flex;align-items:center;gap:10px;margin:-18px -18px 8px;padding:12px 10px 8px 18px;
  background:var(--paper);border-radius:18px 18px 0 0}
dialog.sheet .sheet-head h2{flex:1;margin:0}
.sheet-close{flex:none;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:rgba(29,42,42,.07);
  color:var(--ink);cursor:pointer}
.sheet-close svg{width:20px;height:20px;stroke-width:2.4}
.sheet-close:hover{background:rgba(29,42,42,.13)}
.sheet-close:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.sheet-actions{display:grid;gap:8px;margin-top:12px}
.sheet-actions .text-button{justify-self:center}
.sheet-intro{margin:0;font-size:13px;color:var(--muted)}
.changelog-list{list-style:none;margin:18px 0 0;padding:0;display:grid;gap:16px}
.changelog-list>li{padding-top:14px;border-top:1px solid var(--line)}
.changelog-list>li:first-child{padding-top:0;border-top:0}
.changelog-list h3{margin:0 0 6px;display:flex;align-items:baseline;gap:10px;font:800 16px/1.3 var(--mono);letter-spacing:.02em}
.changelog-list h3 span{font:600 12px/1 var(--sans);color:var(--muted)}
.changelog-list ul{margin:0;padding-left:1.2em;font-size:13px;line-height:1.75;word-break:keep-all;overflow-wrap:anywhere}

/* 操作說明 (#howto): the two sticks as they are on a phone, each with a short tag for what it does (touch screens), or
   the keys (a keyboard); the game controller; then the things to know, as the sister game's 操作說明 */
dialog.sheet.howto{width:min(100% - 24px,560px)}
.help-body{font-size:13.5px;line-height:1.6}
.help-sec{margin:0 0 14px}
.help-sec h3{margin:4px 0 8px;font-size:14px;font-weight:900}
body[data-input="touch"] .howto-keys{display:none}
body[data-input="keys"] .howto-touch{display:none}
.hd{--stick:104px;display:flex;justify-content:space-around;gap:10px;padding:12px 8px 10px;border-radius:14px;
  background:linear-gradient(180deg,#dfe8e4,#eceee8 45%,#f1eee4);border:1px solid var(--line)}
.hd-side{display:flex;flex-direction:column;align-items:center;gap:6px}
/* what a control does: a small tag under it */
.hd-tag{display:inline-block;padding:1px 6px;border-radius:6px;background:var(--accent-soft);color:var(--accent-dark);
  font-size:10.5px;font-weight:800;line-height:1.4;white-space:nowrap}
.hk-more{margin:10px 0 0;font-size:12.5px;line-height:1.8;color:var(--muted)}
table.keys{border-collapse:collapse;width:100%;font-size:12.5px}
table.keys th{font:700 13px/1.2 var(--mono);text-align:left;white-space:nowrap;padding:4px 6px 4px 0;color:var(--accent-dark)}
table.keys td{padding:4px 10px 4px 0}
@media (max-width:480px){table.keys,table.keys tbody{display:block}table.keys tr{display:grid;grid-template-columns:6.2em 1fr;column-gap:8px}}
.help-body .pad-note{margin:6px 0 0;color:var(--muted);font-size:12.5px}
.help-tips{margin:8px 0 0;padding:0;list-style:none;display:grid;gap:4px;font-size:13px}
.help-tips li{padding-left:14px;position:relative}
.help-tips li::before{content:'';position:absolute;left:3px;top:.62em;width:5px;height:5px;border-radius:50%;background:var(--accent-dark)}
.help-more{margin:10px 0 0;font-size:12.5px}
.help-more a{display:inline-flex;align-items:center;min-height:44px;font-weight:700}
/* the mock exam's first page: the four stations, what fails, 試飛, the flight mode */
.exam-steps{list-style:none;margin:12px 0;padding:0;display:grid;gap:10px}
.exam-steps li{display:grid;gap:2px;padding:8px 12px;border-radius:10px;background:#fff;border:1px solid var(--line)}
.exam-steps strong{font-size:15px}
.exam-steps span{font-size:13px;color:var(--muted);line-height:1.6}
.exam-intro-note{margin:0 0 12px;font-size:13px;line-height:1.7}
.exam-intro .flight-chip{margin:0 0 6px}

.noscript{position:fixed;inset:auto 0 0 0;background:var(--red);color:#fff;padding:12px;text-align:center;margin:0;z-index:9}

/* ── motion ── */
@keyframes pop{from{transform:translateX(-50%) scale(.85);opacity:0}to{transform:translateX(-50%) scale(1);opacity:1}}
@keyframes rise{from{transform:translateY(4px);opacity:0}to{transform:none;opacity:1}}
@keyframes stamp-in{from{transform:rotate(-12deg) scale(1.6);opacity:0}to{transform:rotate(-12deg) scale(1);opacity:1}}
@keyframes pulse{from{opacity:1}to{opacity:.7}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes rec-blink{50%{opacity:.15}}
@keyframes cut-flash{from{opacity:.7}to{opacity:0}}
@media(prefers-reduced-motion:reduce){
  .banner,.toast,.hud .quip,.instant-stamp,.instant-tag svg,.instant-flash{animation:none}
  .primary,.auto{transition:none}
}

/* ── responsive ── */
/* short phones (360 × 640): smaller sticks, so the drone keeps its room */
@media(max-height:700px) and (orientation:portrait){
  .game{--stick:min(34vw,132px)}
  .auto{min-height:40px;font-size:12px}
  .banner{top:calc(max(8px,var(--safe-top)) + 150px)}
}
@media(min-width:700px){
  .game{--stick:168px}
  .deck{padding-left:max(24px,var(--safe-left));padding-right:max(24px,var(--safe-right))}
  .sticks{max-width:760px}
}
@media(min-width:720px){
  .hud{left:50%;right:auto;width:560px;transform:translateX(-50%);padding-left:0;padding-right:0}
}
@media(min-width:900px){
  /* desktop: a wider margin, bigger type, and a pale wash on the left so the copy reads over the field */
  .home{background:linear-gradient(90deg,rgba(245,246,239,.95) 0,rgba(245,246,239,.86) 30%,rgba(245,246,239,0) 54%),
    linear-gradient(180deg,rgba(245,246,239,0) 78%,rgba(245,246,239,.8) 100%)}
  .home-top{padding-left:max(56px,var(--safe-left));padding-right:max(48px,var(--safe-right));padding-top:24px}
  .home-main{max-width:none;padding-left:max(56px,var(--safe-left));padding-right:max(48px,var(--safe-right))}
  .hero-copy{max-width:520px}
  .hero-copy h1{font-size:68px;margin:28px 0 26px}
  .hero-cta{width:340px}
  .primary.large{font-size:19px;min-height:64px}
}
@media(orientation:landscape) and (max-height:520px){
  .hud .readouts{margin-top:4px}
  .game{--stick:min(36vh,136px)}
  .deck{background:none;padding-top:0}
  .sticks{max-width:none}
  .autos{position:absolute;left:50%;bottom:max(10px,var(--safe-bottom));transform:translateX(-50%);width:min(46vw,420px);margin:0}
  .banner{top:calc(max(8px,var(--safe-top)) + 70px)}
}
