:root {
  color-scheme: light;
  --ink: #17334b;
  --deep: #07536b;
  --sky: #8bd8e8;
  --sun: #ffd25b;
  --coral: #f46f5d;
  --cream: #fff8dc;
  --paper: #f7f1d7;
  --line: #214d61;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #d7eff0; }
body {
  margin: 0;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, rgba(18, 77, 94, .035) 0 1px, transparent 1px 5px),
    #d7eff0;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  overflow-x: hidden;
}
button, a { font: inherit; }
button { min-height: 44px; cursor: pointer; }
[hidden] { display: none !important; }

.sky-page { width: min(100%, 1040px); margin: 0 auto; min-height: 100vh; padding: 0 14px 38px; }
.sky-header {
  min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 2px solid rgba(23,51,75,.28); font-size: .9rem; font-weight: 800;
}
.sky-header a { color: var(--deep); text-decoration: none; }
.sky-header button { border: 2px solid var(--line); background: var(--cream); color: var(--ink); padding: 7px 12px; box-shadow: 3px 3px 0 var(--line); }

.screen { min-height: calc(100vh - 80px); }
.start-screen { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 34px; padding: 34px 18px; }
.sunprint { position: relative; height: min(68vw, 650px); min-height: 490px; overflow: hidden; background: #60bfd0; border: 3px solid var(--line); border-radius: 49% 49% 8% 8%; box-shadow: 12px 14px 0 #17334b; }
.sunprint::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(160deg, transparent 0 32px, rgba(255,255,255,.2) 33px 35px, transparent 36px 64px); }
.sun-disc { position: absolute; width: 210px; height: 210px; border-radius: 50%; background: var(--sun); left: 50%; top: 54px; transform: translateX(-50%); box-shadow: 0 0 0 18px rgba(255,210,91,.25); }
.wind-ribbon { position: absolute; z-index: 2; padding: 7px 22px; color: #153b52; background: var(--cream); border: 2px solid var(--line); box-shadow: 5px 5px 0 rgba(23,51,75,.75); font: 900 1.05rem/1.2 Georgia, serif; transform: rotate(-5deg); }
.ribbon-a { left: 9%; top: 23%; }
.ribbon-b { right: 7%; top: 39%; transform: rotate(4deg); }
.ribbon-c { left: 16%; top: 56%; transform: rotate(-2deg); }
.cover-glider { position: absolute; z-index: 3; width: 140px; height: 48px; left: 39%; bottom: 55px; background: var(--coral); clip-path: polygon(0 50%, 72% 0, 58% 42%, 100% 52%, 57% 62%, 72% 100%); filter: drop-shadow(5px 6px 0 rgba(23,51,75,.7)); }
.cover-glider i { position: absolute; width: 20px; height: 20px; background: var(--sun); border-radius: 50%; left: 61px; top: 14px; }
.friend-kite { position: absolute; right: 13%; top: 12%; width: 90px; height: 90px; display: grid; place-items: center; background: #fff8dc; border: 3px solid var(--line); transform: rotate(45deg); font: 900 .75rem/1 Georgia, serif; color: var(--deep); }
.friend-kite::first-line { transform: rotate(-45deg); }
.noise-cloud { position: absolute; width: 120px; height: 42px; border: 3px dashed #315466; background: #b4c3c7; border-radius: 50%; opacity: .82; }
.noise-cloud::before,.noise-cloud::after { content:""; position:absolute; border:3px dashed #315466; background:#b4c3c7; border-radius:50%; }
.noise-cloud::before { width: 52px; height: 52px; left: 16px; top: -25px; }
.noise-cloud::after { width: 66px; height: 60px; right: 8px; top: -32px; }
.cloud-one { left: -25px; top: 70%; transform: rotate(7deg); }
.cloud-two { right: -35px; top: 61%; transform: rotate(-7deg) scale(.75); }

.flight-note { align-self: center; }
.eyebrow { display: inline-block; margin: 0 0 9px; padding: 5px 10px; border: 2px solid var(--ink); font: 900 .78rem/1 Georgia, serif; letter-spacing: .14em; background: var(--sun); }
h1 { margin: 0; font-size: clamp(2.3rem, 6vw, 5.5rem); line-height: .95; letter-spacing: -.06em; }
h1 em { color: var(--coral); font-family: Georgia, serif; text-shadow: 3px 3px 0 var(--ink); -webkit-text-stroke: 1px var(--ink); }
.flight-note > p:not(.eyebrow) { font-weight: 700; line-height: 1.9; max-width: 34em; }
.main-button { border: 3px solid var(--line); color: #fff; background: var(--coral); padding: 13px 24px; font-weight: 900; box-shadow: 6px 6px 0 var(--line); }
.main-button:active { transform: translate(3px,3px); box-shadow: 3px 3px 0 var(--line); }
.flight-note > small { display: block; margin-top: 16px; line-height: 1.6; }
.record-line { margin-top: 24px; border-top: 2px dashed var(--line); border-bottom: 2px dashed var(--line); display: flex; flex-wrap: wrap; gap: 12px 22px; padding: 12px 0; font-weight: 800; }

.play-screen { padding-top: 12px; }
.flight-hud { display: grid; grid-template-columns: repeat(3, minmax(70px, .7fr)) minmax(190px, 1.5fr); background: var(--ink); color: #fff; border: 3px solid var(--ink); }
.flight-hud > div { padding: 8px 13px; border-right: 1px dashed rgba(255,255,255,.35); }
.flight-hud small { display: block; font-size: .72rem; opacity: .76; }
.flight-hud strong { font: 900 1.25rem/1.2 Georgia, serif; }
.confidence-cell i { display: block; height: 8px; margin-top: 5px; background: #071d2d; overflow: hidden; }
.confidence-cell i b { display: block; height: 100%; width: 100%; background: var(--sun); transition: width .25s; }

.phrase-deck { display: flex; align-items: stretch; gap: 15px; padding: 10px 12px; background: var(--paper); border: 3px solid var(--line); border-top: 0; }
.phrase-deck > span { writing-mode: vertical-rl; text-orientation: mixed; font: 900 .67rem/1 Georgia,serif; letter-spacing: .12em; padding: 5px; border-right: 2px solid var(--line); }
.phrase-deck > div { flex: 1; min-width: 0; }
.phrase-deck small,.phrase-deck em { display: block; }
.phrase-deck strong { display: block; color: var(--deep); font: 900 clamp(1.05rem,3vw,1.65rem)/1.1 Georgia,serif; overflow-wrap: anywhere; }
.phrase-deck em { font-size: .8rem; font-style: normal; }
.phrase-deck ol { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.phrase-deck li { padding: 6px; border: 2px solid var(--line); font: 900 .64rem/1 Georgia,serif; background: #fff; }
.phrase-deck li.done { background: var(--sun); }
.phrase-deck li.current { outline: 3px solid var(--coral); outline-offset: 2px; }

.voice-arena { position: relative; width: 100%; aspect-ratio: 900 / 620; max-height: 65vh; min-height: 390px; overflow: hidden; background: #70c7d7; border: 3px solid var(--line); border-top: 0; touch-action: pan-y; }
#gameCanvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.warning-text { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 7px 13px; background: rgba(255,248,220,.92); border: 2px solid var(--line); text-align: center; font-weight: 900; pointer-events: none; }
.release-banner { position: absolute; inset: 33% 12% auto; padding: 18px; color: var(--ink); background: var(--sun); border: 4px solid var(--line); box-shadow: 8px 8px 0 var(--line); text-align: center; pointer-events: none; }
.release-banner strong,.release-banner span { display: block; }
.release-banner strong { font: 900 clamp(1.35rem,5vw,2.7rem)/1 Georgia,serif; }
.setback-panel { position: absolute; z-index: 5; inset: 18% 12%; display: grid; place-content: center; padding: 20px; color: #fff; background: rgba(23,51,75,.96); border: 4px solid var(--sun); text-align: center; }
.setback-panel h2 { margin: 4px; font-size: clamp(1.45rem,5vw,2.5rem); }
.setback-panel button { border: 2px solid var(--ink); background: var(--sun); color: var(--ink); font-weight: 900; padding: 10px 16px; }

.control-wing { display: grid; grid-template-columns: 1fr .9fr 1.25fr; gap: 10px; align-items: stretch; margin-top: 10px; }
.move-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.move-controls button { border: 3px solid var(--line); background: var(--cream); color: var(--ink); font-size: 1.4rem; font-weight: 900; touch-action: manipulation; }
.move-controls span { display: block; font-size: .68rem; }
.aim-readout { display: grid; place-content: center; padding: 7px; border: 2px dashed var(--line); text-align: center; }
.aim-readout small,.aim-readout span { display:block; font-size:.65rem; }
.aim-readout strong { font-size: .82rem; }
.fire-button { border: 3px solid var(--line); color: #fff; background: var(--coral); padding: 7px 12px; touch-action: manipulation; }
.fire-button small,.fire-button b { display: block; }
.fire-button b { font: 900 1.1rem/1.1 Georgia,serif; letter-spacing: .06em; }
.fire-button i { display:block; height:7px; margin-top:6px; background:#7a2731; }
.fire-button i span { display:block; width:0; height:100%; background:var(--sun); }
.play-help { margin: 9px 2px 0; font-size: .82rem; line-height: 1.55; }

.quiz-screen,.result-screen { display: grid; place-items: center; padding: 26px 0; }
.quiet-cloud { position: relative; width: min(100%,760px); padding: clamp(20px,5vw,48px); background: var(--cream); border: 3px solid var(--line); box-shadow: 11px 12px 0 var(--sky), 14px 15px 0 var(--line); }
.quiet-cloud > p:first-child { font-weight: 900; color: var(--deep); }
.quiet-cloud h2 { font-size: clamp(1.3rem,4vw,2.15rem); line-height: 1.45; }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-choices button { min-width: 0; padding: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); text-align: left; font-weight: 800; overflow-wrap: anywhere; }
.quiz-choices button:disabled { opacity: .62; }
.quiz-choices button.correct { opacity: 1; background: #d5f2c8; outline: 3px solid #27763b; }
.quiz-choices button.wrong { opacity: 1; background: #ffe0d4; text-decoration: line-through; }
.quiz-feedback { margin-top: 13px; padding: 13px; border-left: 6px solid var(--coral); background: #fff; }
.quiz-feedback strong { font-size: 1.25rem; }
.quiz-feedback button { border: 2px solid var(--line); background: var(--sun); color: var(--ink); padding: 8px 20px; font-weight: 900; }

.landing-poster { position: relative; overflow: hidden; width: min(100%,760px); padding: clamp(24px,6vw,58px); background: #fff5c7; border: 4px solid var(--line); box-shadow: 12px 13px 0 var(--line); text-align: center; }
.poster-sun { position:absolute; width:390px; height:390px; border-radius:50%; background:var(--sun); top:-220px; left:50%; transform:translateX(-50%); opacity:.72; }
.landing-poster > *:not(.poster-sun) { position:relative; }
.landing-poster > p:first-of-type { font:900 .78rem/1 Georgia,serif; letter-spacing:.16em; }
.landing-poster h2 { font-size:clamp(1.7rem,5vw,3rem); margin:16px 0; }
.final-score { display:inline-grid; padding:10px 40px; color:#fff; background:var(--ink); transform:rotate(-1deg); }
.final-score strong { font:900 clamp(2.2rem,8vw,4.8rem)/1 Georgia,serif; color:var(--sun); }
.result-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:20px 0; }
.result-grid div { padding:10px 4px; border-top:2px solid var(--line); border-bottom:2px solid var(--line); }
.result-grid small,.result-grid b { display:block; }
.result-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:12px; }
.result-actions > button:not(.main-button) { border:3px solid var(--line); background:#fff; color:var(--ink); padding:10px 18px; font-weight:900; }
.ranking-panel { width:100%; margin-top:18px; padding:10px; color:#172f43; background:#fff; border:3px solid var(--line); text-align:left; overflow-wrap:anywhere; }
.ranking-panel button { color:#17334b; background:#fff8dc; border-color:#17334b; }
.ranking-panel [aria-selected="true"],.ranking-panel .is-active { color:#fff !important; background:#07536b !important; }

@media (max-width: 720px) {
  .sky-page { padding-inline: 8px; }
  .sky-header span { display:none; }
  .start-screen { grid-template-columns: 1fr; padding: 18px 4px 34px; }
  .sunprint { height: 58vh; min-height: 390px; box-shadow: 7px 8px 0 var(--ink); }
  .flight-note { order:-1; }
  h1 { font-size: clamp(2.55rem,15vw,4.4rem); }
  .flight-note > p:not(.eyebrow) { line-height:1.65; }
  .flight-hud { grid-template-columns: repeat(3,1fr); }
  .confidence-cell { grid-column:1/-1; border-top:1px dashed rgba(255,255,255,.4); }
  .phrase-deck { gap:7px; padding:8px 7px; }
  .phrase-deck > span { display:none; }
  .phrase-deck ol { flex-direction:column; justify-content:center; }
  .phrase-deck li { padding:4px; font-size:.56rem; }
  .voice-arena { min-height: 410px; max-height: 62vh; aspect-ratio: 3 / 4; }
  .control-wing { grid-template-columns: 1fr 1fr; }
  .aim-readout { display:none; }
  .fire-button { grid-column:2; grid-row:1; }
  .quiz-choices { grid-template-columns:1fr; }
  .quiet-cloud { box-shadow:7px 8px 0 var(--line); }
  .result-grid { grid-template-columns:1fr; }
  .setback-panel { inset:11% 5%; }
}

@media (max-width: 400px) {
  .sky-header { font-size:.8rem; }
  .sky-header button { padding:5px 8px; }
  .flight-hud > div { padding:7px 8px; }
  .flight-hud strong { font-size:1rem; }
  .control-wing { gap:6px; }
  .play-help { font-size:.76rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; animation:none !important; transition:none !important; }
}
