/* 一路順風: paper, swamp green ink and international orange. Laid out for a 390 × 844 phone first; wider screens
   keep the same column. The 3D view fills the window behind every screen. */
:root {
  --paper: #f3f1e7;
  --card: #fbfaf4;
  --ink: #10302b;
  --muted: #3d5c57;
  --line: #d9d3bf;
  --orange: #ff4f00;
  --orange-dark: #c93d00;
  --green: #2e5a55;
  --good: #17804a;
  --bad: #c8321f;
  --hud: rgba(13, 38, 34, 0.84);
  --shadow: 0 6px 22px rgba(8, 28, 25, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--green);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .solid, svg .speaker, svg .dot { fill: currentColor; stroke: none; }

/* ---- the 3D view ---- */
.stage { position: fixed; inset: 0; z-index: 0; background: linear-gradient(#cfe6ee, #9cc3c4 55%, #2e5a55); }
.view { display: block; width: 100%; height: 100%; }
.scene-note {
  position: fixed; z-index: 5; left: 50%; top: calc(var(--safe-top) + 64px); transform: translateX(-50%);
  width: min(92vw, 360px); margin: 0; padding: 10px 14px; border-radius: 12px;
  background: var(--card); color: var(--ink); font-size: 14px; text-align: center; box-shadow: var(--shadow);
}

.screen { position: fixed; inset: 0; z-index: 1; }

/* ---- buttons ---- */
.primary, .secondary {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 52px; padding: 10px 18px; border-radius: 16px;
  font-size: 18px; font-weight: 800; letter-spacing: 0.04em; touch-action: manipulation;
}
.primary { border: 0; background: var(--orange); color: #fff; box-shadow: 0 4px 0 var(--orange-dark); }
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--orange-dark); }
.primary.large { min-height: 60px; font-size: 20px; }
.secondary { border: 2px solid var(--ink); background: var(--card); color: var(--ink); }
.secondary:active { background: #ebe7d6; }
.text-button {
  border: 0; background: none; padding: 8px 6px; color: var(--muted); font-size: 15px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 4px; touch-action: manipulation;
}
.text-button.danger { color: var(--bad); }
.icon-button, .round-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 0; background: rgba(251, 250, 244, 0.92); color: var(--ink); box-shadow: var(--shadow); touch-action: manipulation;
}
.round-button.small { width: 38px; height: 38px; background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
.round-button.small svg { width: 20px; height: 20px; }
.view-button { width: auto !important; min-width: 38px; padding: 0 10px !important; border-radius: 19px !important; font-size: 13px; font-weight: 700; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

[data-sound][aria-pressed="true"] .mute { display: none; }
[data-sound][aria-pressed="false"] .wave { display: none; }
[data-sound][aria-pressed="false"] { opacity: 0.8; }

/* ---- home ---- */
.home { display: flex; flex-direction: column; }
.home-top {
  position: absolute; top: calc(var(--safe-top) + 12px); right: 12px; z-index: 2; display: flex; gap: 10px;
}
.home-main { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 0; }
.home-hero { padding: calc(var(--safe-top) + 64px) 20px 12px; text-align: center; color: #fff; text-shadow: 0 2px 12px rgba(8, 28, 25, 0.55); }
.home-title { margin: 0; font-size: clamp(44px, 14vw, 76px); font-weight: 900; letter-spacing: 0.1em; line-height: 1.1; }
.home-subtitle { margin: 6px 0 0; font-size: clamp(16px, 4.6vw, 22px); font-weight: 800; letter-spacing: 0.06em; }
.home-panel {
  display: flex; flex-direction: column; gap: 10px; width: min(100%, 460px); margin: 0 auto;
  padding: 18px 20px calc(var(--safe-bottom) + 10px); border-radius: 24px 24px 0 0;
  background: rgba(243, 241, 231, 0.95); box-shadow: 0 -8px 30px rgba(8, 28, 25, 0.25);
}
.quick-sub { display: block; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.practice-link { align-self: center; font-size: 16px; }
.challenge-card {
  display: grid; gap: 10px; padding: 14px; border-radius: 16px; border: 2px dashed var(--orange); background: #fff4ec;
}
.challenge-title { margin: 0; font-weight: 800; text-align: center; }
.home-best, .home-count { margin: 0; font-size: 13px; color: var(--muted); text-align: center; white-space: pre-line; }
.home-footer {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 14px;
  margin-top: 4px; font-size: 13px; color: var(--muted);
}
.home-footer .text-button { font-size: 13px; padding: 6px 2px; position: relative; }
.home-footer a { padding: 6px 2px; font-weight: 700; text-underline-offset: 4px; }
.news-dot { position: absolute; top: 4px; right: -6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* ---- the station picker ---- */
.picker { display: flex; align-items: flex-end; }
.picker-inner {
  width: min(100%, 460px); margin: 0 auto; max-height: 100%; overflow: auto;
  padding: 16px 18px calc(var(--safe-bottom) + 16px); border-radius: 24px 24px 0 0; background: rgba(243, 241, 231, 0.96);
}
.picker-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.picker-head h2 { margin: 0; font-size: 22px; }
.picker-head .round-button { box-shadow: none; border: 2px solid var(--line); }
.station-list { display: grid; gap: 10px; }
.station {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 14px 16px; text-align: left;
  border: 2px solid var(--line); border-radius: 16px; background: var(--card);
}
.station:active { border-color: var(--orange); }
.station-no { grid-row: span 3; align-self: center; padding: 6px 8px; border-radius: 10px; background: var(--green); color: #fff; font-size: 13px; font-weight: 800; }
.station-name { font-size: 18px; }
.station-blurb { font-size: 13px; color: var(--muted); }
.station-best { font-size: 12px; font-weight: 700; color: var(--orange-dark); }
.picker-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---- the game ---- */
.game { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hud { position: absolute; top: calc(var(--safe-top) + 8px); left: 8px; right: 8px; z-index: 2; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.hud-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.hud > .hud-row:first-child { padding: 6px 6px 6px 12px; border-radius: 16px; background: var(--hud); color: #fff; pointer-events: auto; }
.hud-title { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.hud-station { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-mode { font-size: 11px; font-weight: 700; color: #ffc9ad; }
.hud-clock { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; margin-right: 2px; }
.readouts { justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
.readout {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px; border-radius: 12px; background: var(--hud); color: #fff;
}
.readout em { font-style: normal; font-size: 12px; opacity: 0.85; }
.readout b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: right; }
.readout i { font-style: normal; font-size: 12px; opacity: 0.85; }
.zone-badge, .hud-strikes, .hud-target {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 12px; font-size: 13px; font-weight: 800;
}
.zone-badge { background: #fff; color: var(--ink); border: 3px solid var(--orange); }
.zone-badge[data-over="true"] { background: var(--bad); color: #fff; border-color: #fff; animation: pulse 0.8s ease-in-out infinite alternate; }
.hud-strikes { background: var(--bad); color: #fff; }
.hud-target { background: var(--hud); color: #ffc9ad; }
.coach {
  margin: 4px 0 0; padding: 8px 16px; max-width: 92%; border-radius: 14px; background: rgba(251, 250, 244, 0.96);
  color: var(--ink); font-size: 18px; font-weight: 900; text-align: center; box-shadow: var(--shadow);
}
.quip {
  position: relative; justify-self: start; margin: 2px 0 0 6px; max-width: 80%; padding: 7px 12px 8px; border-radius: 14px 14px 14px 4px;
  background: #fff; color: var(--ink); font-size: 15px; font-weight: 700; box-shadow: var(--shadow); animation: pop 0.25s ease-out;
}
.quip-who { display: block; font-size: 11px; font-weight: 800; color: var(--orange-dark); }

.banner {
  position: absolute; z-index: 3; left: 50%; top: 34%; transform: translateX(-50%); width: max-content; max-width: 90%;
  padding: 10px 18px; border-radius: 14px; background: var(--bad); color: #fff; font-size: 17px; font-weight: 900; text-align: center;
  box-shadow: var(--shadow); animation: pop 0.25s ease-out; pointer-events: none;
}
.banner[data-kind="info"] { background: var(--hud); }
.banner[data-kind="good"] { background: var(--good); }

/* the two thumbs: the rudder on the left, the throttle on the right */
.deck {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 14px calc(var(--safe-bottom) + 16px); pointer-events: none;
}
.rudders { display: flex; gap: 10px; }
.pad {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; pointer-events: auto;
  border: 3px solid rgba(255, 255, 255, 0.85); color: #fff; background: rgba(13, 38, 34, 0.62); box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform 0.06s;
}
.pad span { font-size: 13px; font-weight: 800; line-height: 1; }
.pad small { font-size: 11px; opacity: 0.85; line-height: 1; }
.rudder { width: 78px; height: 78px; border-radius: 22px; }
.rudder svg { width: 34px; height: 34px; }
.throttle { width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 79, 0, 0.82); }
.throttle svg { width: 46px; height: 46px; stroke-width: 2.5; }
.throttle svg path { fill: currentColor; stroke: none; }
.pad[data-pressed] { transform: scale(0.94); background: rgba(13, 38, 34, 0.86); border-color: #fff; }
.throttle[data-pressed] { background: var(--orange); }
.throttle[data-pressed] svg { animation: spin 0.4s linear infinite; }
.keys-legend {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 150px); transform: translateX(-50%); z-index: 2; margin: 0;
  padding: 4px 12px; border-radius: 10px; background: var(--hud); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none;
}
body[data-input="touch"] .keys-legend { display: none; }

.countdown {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none;
  font-size: 140px; font-weight: 900; color: #fff; text-shadow: 0 6px 30px rgba(8, 28, 25, 0.6); font-variant-numeric: tabular-nums;
}

/* ---- the ready card and the result ---- */
.overlay {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: calc(var(--safe-top) + 12px) 12px calc(var(--safe-bottom) + 12px);
  background: rgba(8, 28, 25, 0.42); touch-action: auto; user-select: text;
}
.card {
  width: min(100%, 440px); max-height: 100%; overflow: auto; padding: 20px 20px 16px; border-radius: 22px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.card h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.card-kicker { margin: 0; font-size: 13px; font-weight: 800; color: var(--orange-dark); }
.ready-tasks { margin: 0; padding-left: 22px; font-size: 15px; }
.ready-tasks li + li { margin-top: 2px; }
.ready-limit { margin: 0; font-weight: 800; }
.ready-note { margin: 0; font-size: 13px; color: var(--muted); }
.ready .text-button { align-self: center; }

.result { place-items: end center; }
.result-card { position: relative; gap: 8px; }
.stamp {
  position: absolute; top: 18px; right: 18px; padding: 4px 12px; border: 4px solid currentColor; border-radius: 10px;
  font-size: 22px; font-weight: 900; letter-spacing: 0.12em; transform: rotate(-8deg); animation: stamp 0.35s cubic-bezier(.2, 1.6, .4, 1) 0.3s both;
}
.stamp[data-stamp="pass"] { color: var(--good); }
.stamp[data-stamp="fail"] { color: var(--bad); }
.result-card h2 { padding-right: 110px; }
.result-subtitle, .result-reason, .result-time, .result-best, .result-challenge, .result-next { margin: 0; }
.result-subtitle { color: var(--muted); font-size: 14px; font-weight: 700; }
.result-reason { color: var(--bad); font-weight: 800; }
.result-time { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.result-best { display: inline-block; align-self: flex-start; padding: 2px 10px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 13px; font-weight: 800; }
.result-challenge { padding: 8px 12px; border-radius: 12px; background: #fff4ec; font-weight: 800; }
.result-next { font-weight: 800; }
.result-exam, .result-items { list-style: none; margin: 0; padding: 0; }
.result-exam li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.result-exam .exam-state { font-weight: 800; }
.result-exam li[data-state="pass"] .exam-state { color: var(--good); }
.result-exam li[data-state="fail"] .exam-state { color: var(--bad); }
.result-exam li[data-state="none"] { color: var(--muted); }
.result-exam .exam-time { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.result-exam .exam-total { font-weight: 800; border-bottom: 0; }
.result-items li {
  display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "text tag state" "rule rule rule"; gap: 0 8px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.item-text { grid-area: text; font-size: 14px; font-weight: 700; }
.item-tag { grid-area: tag; padding: 1px 7px; border-radius: 8px; font-size: 11px; font-weight: 800; background: #e7eee9; color: var(--green); }
li[data-tag="game"] .item-tag { background: #efe9d8; color: #6b5a2b; }
.item-state { grid-area: state; min-width: 3.5em; text-align: right; font-size: 13px; font-weight: 800; color: var(--muted); }
.item-rule { grid-area: rule; font-size: 12px; color: var(--muted); }
.result-items li[data-state="ok"] .item-text { font-weight: 500; color: var(--muted); }
.result-items li[data-state="fail"] .item-state { color: var(--bad); }
.result-items li[data-state="count"] .item-state { color: var(--orange-dark); }
.result-legend { margin: 0; font-size: 12px; color: var(--muted); }
.result-actions { display: grid; gap: 8px; margin-top: 4px; }
.result-actions .text-button { justify-self: center; }

/* ---- 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: 6; cursor: pointer; color: #fff; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  background: linear-gradient(rgba(8, 28, 25, 0.5), transparent 24%, transparent 74%, rgba(8, 28, 25, 0.55));
}
.instant[hidden] { display: none; }
.game[data-instant="on"] .deck, .game[data-instant="on"] .hud, .game[data-instant="on"] .banner,
.game[data-instant="on"] .keys-legend { visibility: hidden; }
.instant-top { position: absolute; left: 12px; right: 12px; top: calc(var(--safe-top) + 12px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.instant-tag, .instant-cam, .instant-speed { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: 16px; font-weight: 900; line-height: 1; }
.instant-tag { background: var(--bad); letter-spacing: 0.12em; }
.instant-tag svg { width: 9px; height: 9px; fill: currentColor; stroke: none; animation: rec-blink 1s steps(1) infinite; }
@keyframes rec-blink { 50% { opacity: 0.15; } }
.instant-cam { background: rgba(13, 38, 34, 0.78); }
.instant-cam:empty { display: none; }
.instant-speed { background: #ffd2b8; color: var(--ink); font-size: 14px; }
.instant-speed[hidden] { display: none; }
.instant-title {
  position: absolute; left: 16px; right: 16px; top: calc(var(--safe-top) + 60px); margin: 0; text-align: center;
  font-size: clamp(22px, 6vw, 32px); font-weight: 900; line-height: 1.3; text-shadow: 0 2px 0 rgba(8, 28, 25, 0.6), 0 0 14px rgba(8, 28, 25, 0.55);
}
.instant-verdict {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); width: min(90%, 520px);
  display: none; justify-items: center; gap: 14px; pointer-events: none;
}
.instant[data-freeze="on"] .instant-verdict { display: grid; }
.instant-stamp {
  padding: 6px 22px; border: 6px solid var(--bad); border-radius: 14px; background: rgba(243, 241, 231, 0.94); color: var(--bad);
  font-size: 46px; font-weight: 900; letter-spacing: 0.12em; transform: rotate(-6deg); animation: stamp-in 0.2s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes stamp-in { from { opacity: 0.3; transform: rotate(-6deg) scale(1.8); } to { opacity: 1; transform: rotate(-6deg) scale(1); } }
.instant-reason { margin: 0; padding: 8px 16px; border-radius: 22px; background: rgba(13, 38, 34, 0.88); font-size: 18px; font-weight: 800; text-align: center; }
.instant-reason:empty { display: none; }
.instant-bottom {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 18px); display: flex; align-items: center; gap: 10px;
}
.instant-clock { min-width: 108px; white-space: nowrap; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.instant-progress { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.instant-progress i { display: block; height: 100%; background: var(--orange); transform-origin: left center; transform: scaleX(0); }
.instant-skip.secondary { flex-direction: row; gap: 6px; width: auto; min-height: 40px; padding: 6px 14px; font-size: 15px; border-color: transparent; background: rgba(251, 250, 244, 0.92); }
.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 0.24s ease-out; }
@keyframes cut-flash { from { opacity: 0.7; } to { opacity: 0; } }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 24px); transform: translateX(-50%); z-index: 8;
  padding: 10px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: var(--shadow);
  animation: pop 0.2s ease-out; white-space: nowrap;
}

/* ---- sheets ---- */
dialog.sheet {
  width: min(calc(100% - 24px), 480px); max-height: calc(100% - 24px); overflow: auto; padding: 16px 18px 18px;
  border: 0; border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(8, 28, 25, 0.5); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet-close {
  display: grid; place-items: center; width: 40px; height: 40px; margin: -4px -6px 0 0; padding: 0; border: 0; border-radius: 50%;
  background: #ebe7d6; color: var(--ink);
}
.sheet-actions { display: grid; gap: 8px; margin-top: 14px; }
.sheet-actions .text-button { justify-self: center; }
.sheet-intro { margin: 0 0 8px; font-size: 14px; color: var(--muted); }

/* the share sheet (reel.js): the 9:16 preview (the photo, then the looping video), its progress, the text options, the
   actions, Threads and LINE */
dialog.sheet.reel { width: min(calc(100% - 24px), 440px); overscroll-behavior: contain; }
.reel-stage {
  position: relative; height: min(50svh, 500px); aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 14px; overflow: hidden;
  background: var(--ink); box-shadow: 0 8px 24px rgba(8, 28, 25, 0.22);
}
.reel-photo, .reel-video, .reel-live { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--ink); }
.reel-photo[hidden], .reel-video[hidden], .reel-sound[hidden], .reel-wait[hidden], .reel-copy[hidden], .reel-captions[hidden], .reel-more .text-button[hidden] { display: none; }
.reel-video { cursor: pointer; }
.reel-sound {
  position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(13, 38, 34, 0.72); color: #fff;
}
.reel-sound[aria-pressed="true"] { background: var(--orange); }
.reel-wait { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 14px 14px; background: linear-gradient(transparent, rgba(8, 28, 25, 0.82)); }
.reel-progress {
  display: block; width: 100%; height: 8px; border: 0; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, 0.22);
  -webkit-appearance: none; appearance: none; accent-color: var(--orange);
}
.reel-progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.22); }
.reel-progress::-webkit-progress-value { background: var(--orange); }
.reel-progress::-moz-progress-bar { background: var(--orange); }
.reel-status { min-height: 20px; margin: 10px 0 0; font-size: 13px; font-weight: 700; text-align: center; color: var(--muted); }
.reel-status:empty { display: none; }
.reel-captions { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.reel-captions legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 800; }
.reel-caption {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-size: 14px; line-height: 1.4; cursor: pointer;
}
.reel-caption:has(input:checked) { border-color: var(--orange-dark); background: #fff4ec; }
.reel-caption input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange-dark); }
.reel-actions, .reel-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.reel-links { margin-top: 8px; }
.reel-link.secondary { min-height: 44px; font-size: 16px; text-decoration: none; }
.reel-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 4px; }
.reel-more .text-button { min-height: 44px; }
.reel-copy {
  display: block; width: 100%; box-sizing: border-box; margin-top: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-size: 16px; line-height: 1.4; resize: none;
}
.reel-offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

.howto-art { margin: 0 0 10px; }
.howto-art svg { display: block; width: 100%; height: auto; max-height: 150px; stroke-width: 2.5; }
.howto-art figcaption { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 14px; font-weight: 800; }
body[data-input="touch"] .howto-keys { display: none; }
body[data-input="keys"] .howto-touch { display: none; }
.art-screen { fill: var(--green); stroke: none; }
.art-water { stroke: #8fc1b5; }
.art-boat { fill: #c9cdd2; stroke: none; }
.art-cage { fill: none; stroke: #fff; }
.art-key { fill: #fff; stroke: var(--ink); }
.art-dim { opacity: 0.3; }
.art-mark { fill: var(--ink); stroke: none; }
.art-throttle { fill: var(--orange); stroke: #fff; }
.howto-lines { margin: 0; padding-left: 20px; font-size: 15px; }
.howto-lines li + li { margin-top: 4px; }

.license-body { display: grid; gap: 8px; }
.license-canvas { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 2px 10px rgba(8, 28, 25, 0.18); }
.license-empty, .license-note { margin: 0; font-size: 14px; color: var(--muted); }

.changelog-list { list-style: none; margin: 0; padding: 0; }
.changelog-list > li + li { margin-top: 12px; }
.changelog-list h3 { display: flex; justify-content: space-between; margin: 0 0 4px; font-size: 16px; }
.changelog-list h3 span { font-size: 13px; font-weight: 500; color: var(--muted); }
.changelog-list ul { margin: 0; padding-left: 20px; font-size: 14px; }

.noscript { position: fixed; inset: auto 12px 12px; z-index: 9; padding: 12px; border-radius: 12px; background: var(--card); text-align: center; }

/* ---- motion ---- */
@keyframes pop { from { opacity: 0; transform: translateX(var(--x, 0)) scale(0.9); } to { opacity: 1; } }
.banner, .toast { --x: -50%; }
@keyframes stamp { from { opacity: 0; transform: rotate(-8deg) scale(2.2); } to { opacity: 1; transform: rotate(-8deg) scale(1); } }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.7; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- short or wide screens ---- */
@media (max-height: 680px) {
  .home-hero { padding-top: calc(var(--safe-top) + 40px); }
  .rudder { width: 66px; height: 66px; }
  .throttle { width: 104px; height: 104px; }
  .keys-legend { bottom: calc(var(--safe-bottom) + 128px); }
}
@media (min-width: 720px) {
  .hud { left: 50%; right: auto; width: 520px; transform: translateX(-50%); }
  .deck { padding-left: max(14px, calc(50vw - 300px)); padding-right: max(14px, calc(50vw - 300px)); }
}
