:root {
  --ink: #16384c;
  --ink-soft: #466271;
  --cream: #fff9ed;
  --paper: #fffdf7;
  --sky: #bfe7e8;
  --sea: #3b9da4;
  --sea-dark: #246e78;
  --yellow: #f5c85b;
  --orange: #ee9562;
  --coral: #d9665b;
  --green: #79ad85;
  --line: rgba(22, 56, 76, 0.16);
  --shadow: 0 18px 50px rgba(20, 54, 70, 0.14);
  --radius: 28px;
  font-family: ui-rounded, "SF Pro Rounded", "PingFang HK", "PingFang TC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sky);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overscroll-behavior: none; }

body {
  min-height: 100svh;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,.9) 0 7%, transparent 28%),
    linear-gradient(180deg, #dff5ef 0%, #bfe8e8 50%, #7bc3c9 100%);
}

button { font: inherit; }

.app-shell {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  font-size: clamp(18px, 2vw, 25px);
  letter-spacing: .02em;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--paper);
  box-shadow: 0 6px 18px rgba(22,56,76,.12);
}

.progress-pill {
  min-width: 230px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 760;
  margin-bottom: 5px;
}

.progress-track {
  height: 9px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(22,56,76,.12);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
  transition: width .55s cubic-bezier(.2,.8,.2,1);
}

.top-actions { justify-self: end; display: flex; gap: 9px; }

.icon-button, .language-button {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255,255,255,.78);
  box-shadow: 0 6px 18px rgba(22,56,76,.1);
  cursor: pointer;
}

.language-button { padding: 0 15px; font-weight: 850; }

.screen {
  width: min(1180px, 100%);
  margin: 0 auto;
  min-height: calc(100svh - 98px);
}

.hero-card, .mission-card, .parent-card {
  background: rgba(255,253,247,.94);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(340px, .88fr) minmax(540px, 1.42fr);
  gap: 22px;
  min-height: calc(100svh - 112px);
}

.hero-card { padding: clamp(24px, 4vw, 48px); display: flex; flex-direction: column; justify-content: space-between; }

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e6f4ed;
  color: #39704d;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .08em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(37px, 5.5vw, 68px); line-height: 1.02; margin: 18px 0 14px; letter-spacing: -.04em; }
h2 { font-size: clamp(29px, 4vw, 48px); line-height: 1.08; letter-spacing: -.025em; }
h3 { font-size: clamp(19px, 2.2vw, 27px); }
.lead { font-size: clamp(17px, 1.8vw, 22px); line-height: 1.55; color: var(--ink-soft); max-width: 28em; }

.captain {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border-radius: 22px;
  background: #eef7f4;
  margin-top: 22px;
}

.captain-face {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--yellow);
  display: grid;
  place-items: center;
  font-size: 47px;
  border: 5px solid var(--paper);
}

.captain p { margin: 4px 0 0; line-height: 1.45; color: var(--ink-soft); }

.map-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 650px;
  background:
    radial-gradient(circle at 78% 18%, #fff6c8 0 7%, transparent 7.3%),
    linear-gradient(180deg, #addfdb 0 42%, #4baab2 42% 100%);
  border: 1px solid rgba(255,255,255,.72);
}

.map-card::before {
  content: "";
  position: absolute;
  inset: 41% -10% auto;
  height: 120px;
  background: var(--paper);
  border-radius: 50%;
  opacity: .4;
  box-shadow: 0 48px 0 rgba(255,255,255,.23), 0 98px 0 rgba(255,255,255,.16);
}

.island {
  position: absolute;
  inset: 9% 7% 8%;
  border-radius: 45% 55% 50% 40% / 35% 46% 54% 65%;
  background: #80b98a;
  border: 8px solid rgba(255,255,255,.66);
  transform: rotate(-2deg);
  box-shadow: inset -20px -18px 0 rgba(48,110,78,.12);
}

.route {
  position: absolute;
  inset: 16% 13%;
  pointer-events: none;
}

.route svg { width: 100%; height: 100%; overflow: visible; }
.route path { fill: none; stroke: rgba(255,255,255,.86); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 2 19; }

.stations { position: absolute; inset: 0; }
.station {
  position: absolute;
  width: 116px;
  transform: translate(-50%, -50%);
  border: 0;
  background: none;
  cursor: pointer;
  text-align: center;
  color: var(--ink);
}

.station-dot {
  width: 68px;
  height: 68px;
  margin: auto;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: var(--paper);
  border: 4px solid rgba(255,255,255,.86);
  box-shadow: 0 8px 20px rgba(23,65,75,.22);
  transition: transform .2s ease;
}

.station:active .station-dot { transform: scale(.94); }
.station-label { display: block; margin-top: 7px; padding: 5px 8px; border-radius: 12px; background: rgba(255,255,255,.82); font-size: 13px; font-weight: 850; }
.station.locked { filter: grayscale(.8); opacity: .5; cursor: default; }
.station.current .station-dot { outline: 6px solid rgba(245,200,91,.7); animation: breathe 2.2s ease-in-out infinite; }
.station.done .station-dot { background: #fff0b6; }

@keyframes breathe { 50% { transform: translateY(-4px) scale(1.04); } }

.shipyard {
  margin-top: 18px;
  min-height: 130px;
  border-radius: 24px;
  background: linear-gradient(180deg, #dff4f0 0 48%, #4b9ba3 49% 100%);
  position: relative;
  overflow: hidden;
}

.ship { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 220px; height: 96px; }
.ship-part { opacity: .12; transition: opacity .6s, transform .6s; }
.ship-part.built { opacity: 1; }
.hull { position: absolute; bottom: 0; left: 15px; width: 190px; height: 48px; background: var(--coral); clip-path: polygon(0 0,100% 0,82% 100%,18% 100%); }
.mast { position: absolute; bottom: 43px; left: 106px; width: 8px; height: 48px; background: #8d674c; }
.sail { position: absolute; bottom: 48px; left: 114px; width: 68px; height: 42px; background: var(--yellow); clip-path: polygon(0 0,100% 100%,0 100%); }
.wheel { position: absolute; bottom: 15px; left: 92px; width: 40px; height: 40px; border: 8px dotted var(--ink); border-radius: 50%; }
.flag { position: absolute; bottom: 82px; left: 113px; width: 35px; height: 22px; background: var(--green); clip-path: polygon(0 0,100% 20%,74% 50%,100% 80%,0 100%); }
.scope { position: absolute; bottom: 41px; left: 48px; width: 35px; height: 13px; border-radius: 10px; background: var(--ink); transform: rotate(-18deg); }
.propeller { position: absolute; bottom: 7px; right: 3px; font-size: 34px; }
.star-light { position: absolute; bottom: 47px; left: 79px; font-size: 28px; }

.mission-card {
  min-height: calc(100svh - 112px);
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(520px, 1.35fr);
  overflow: hidden;
}

.scene-panel {
  padding: clamp(24px, 4vw, 48px);
  color: var(--paper);
  background: linear-gradient(155deg, var(--ink), var(--sea-dark));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 620px;
}

.scene-number { font-size: 14px; font-weight: 850; letter-spacing: .12em; opacity: .7; }
.scene-illustration { font-size: clamp(95px, 14vw, 180px); text-align: center; filter: drop-shadow(0 15px 15px rgba(0,0,0,.18)); }
.story-text { font-size: clamp(18px, 2vw, 24px); line-height: 1.55; }

.task-panel { padding: clamp(26px, 4vw, 54px); display: flex; flex-direction: column; min-width: 0; }
.task-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.task-heading h2 { margin-bottom: 10px; }
.task-copy { color: var(--ink-soft); font-size: clamp(17px, 1.7vw, 21px); line-height: 1.55; }
.listen-button {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 22px;
  border: 0;
  background: var(--yellow);
  color: var(--ink);
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(173,121,25,.2);
}

.activity { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 15px; padding: 18px 0; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.choice {
  min-height: 88px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 15px 18px;
  color: var(--ink);
  font-size: clamp(17px, 1.6vw, 20px);
  font-weight: 760;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}
.choice:hover, .choice:focus-visible { border-color: var(--sea); background: #f1fbf8; }
.choice.selected { border-color: var(--sea); background: #e1f4ef; }
.choice.correct { border-color: var(--green); background: #e8f5e9; }
.choice.wrong { border-color: var(--coral); background: #fff0ec; }
.choice-emoji { font-size: 31px; }

.sequence-list { display: grid; gap: 11px; }
.sequence-card {
  min-height: 62px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 17px;
  font-size: 18px;
  font-weight: 760;
  cursor: pointer;
}
.sequence-card.picked { opacity: .42; }
.sequence-index { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--yellow); font-weight: 900; }

.sentence-answer {
  min-height: 88px;
  border: 2px dashed rgba(36,110,120,.34);
  border-radius: 22px;
  background: #f2faf7;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--ink-soft);
}

.answer-word, .word-card {
  min-height: 48px;
  border-radius: 14px;
  padding: 9px 15px;
  font-size: 18px;
  font-weight: 820;
}

.answer-word { display: inline-grid; place-items: center; background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.word-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.word-card { border: 2px solid var(--line); background: white; color: var(--ink); cursor: pointer; }
.word-card:disabled { opacity: .25; }

.memory-stage { display: grid; place-items: center; gap: 24px; }
.memory-items { width: 100%; min-height: 150px; border-radius: 24px; background: #eef8f4; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: clamp(20px,4vw,45px); }
.memory-items span { font-size: clamp(48px,6vw,76px); filter: drop-shadow(0 8px 9px rgba(22,56,76,.12)); }

.record-box {
  border: 2px dashed rgba(36,110,120,.32);
  border-radius: 25px;
  padding: 24px;
  background: #f2faf7;
  text-align: center;
}
.record-button {
  width: 90px;
  height: 90px;
  border: 0;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  font-size: 35px;
  box-shadow: 0 9px 0 #b24e48;
  cursor: pointer;
}
.record-button.recording { animation: pulse 1.2s infinite; background: #b94b55; }
@keyframes pulse { 50% { box-shadow: 0 0 0 15px rgba(217,102,91,.16), 0 9px 0 #9c4047; } }
.record-status { margin-top: 16px; color: var(--ink-soft); font-weight: 760; }
audio { width: min(100%, 420px); margin-top: 15px; }

.task-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 64px; }
.feedback { font-size: 17px; font-weight: 780; color: var(--ink-soft); }
.primary-button, .secondary-button {
  min-height: 56px;
  padding: 0 27px;
  border-radius: 18px;
  border: 0;
  font-weight: 850;
  font-size: 17px;
  cursor: pointer;
}
.primary-button { color: white; background: var(--ink); box-shadow: 0 8px 0 #0b2636; }
.primary-button:disabled { opacity: .32; box-shadow: none; cursor: default; }
.secondary-button { color: var(--ink); background: #e8f2f0; }

.completion {
  min-height: calc(100svh - 112px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
}
.completion-inner { width: min(760px, 100%); }
.part-reveal { font-size: 130px; animation: reveal .8s cubic-bezier(.17,.85,.34,1.3); }
@keyframes reveal { from { transform: translateY(40px) scale(.6); opacity: 0; } }
.completion p { font-size: 20px; color: var(--ink-soft); line-height: 1.55; }

.parent-card { padding: clamp(24px, 4vw, 48px); min-height: calc(100svh - 112px); }
.parent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.metric, .recording-row { background: #f4f8f7; border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.metric strong { display: block; font-size: 30px; margin-bottom: 5px; }
.recordings { display: grid; gap: 12px; }
.recording-row { display: grid; grid-template-columns: 1fr minmax(220px, 380px) auto; gap: 15px; align-items: center; }
.recording-row audio { margin: 0; }
.status-select { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 0 10px; font: inherit; color: var(--ink); }
.danger-button { border: 0; color: #9b3d3a; background: #fdecea; min-height: 44px; border-radius: 12px; padding: 0 14px; font-weight: 760; }

.modal-backdrop { position: fixed; inset: 0; z-index: 10; background: rgba(8,30,42,.46); display: grid; place-items: center; padding: 24px; backdrop-filter: blur(8px); }
.modal { width: min(460px, 100%); background: var(--paper); border-radius: 26px; padding: 28px; box-shadow: var(--shadow); text-align: center; }
.gate-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.gate-options button { min-height: 60px; border: 2px solid var(--line); border-radius: 16px; background: white; font-size: 20px; font-weight: 850; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 900px), (orientation: portrait) {
  .map-layout, .mission-card { grid-template-columns: 1fr; }
  .map-card { min-height: 620px; }
  .scene-panel { min-height: 310px; }
  .scene-illustration { font-size: 100px; }
  .parent-grid { grid-template-columns: 1fr; }
  .recording-row { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { grid-template-columns: 1fr auto; }
  .progress-pill { grid-column: 1 / -1; grid-row: 2; }
  .choice-grid { grid-template-columns: 1fr; }
  .brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
