:root {
  color-scheme: light;
  --ink: #15304f;
  --muted: #5c6d7f;
  --paper: #fffdf6;
  --line: #c9d8df;
  --teal: #32b8ac;
  --mint: #b9f3df;
  --coral: #ff6b6b;
  --orange: #ff9f43;
  --yellow: #ffd166;
  --violet: #6c63ff;
  --green: #2bb673;
  --blue: #2677d9;
  --shadow: 0 18px 45px rgba(21, 48, 79, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 209, 102, .2) 0 18%, transparent 18% 100%),
    linear-gradient(315deg, rgba(50, 184, 172, .18) 0 22%, transparent 22% 100%),
    #f4fbff;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(38, 119, 217, .35);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.game-hero {
  min-height: clamp(360px, 58vh, 560px);
  display: grid;
  grid-template-columns: minmax(280px, .95fr) minmax(280px, 1.05fr);
  align-items: center;
  gap: clamp(20px, 4vw, 52px);
  padding: clamp(18px, 3vw, 34px) 0 clamp(12px, 2vw, 20px);
}

.hero-art {
  position: relative;
  min-height: 330px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hero-art::before,
.hero-art::after {
  content: "";
  position: absolute;
  background: repeating-linear-gradient(90deg, transparent 0 18px, rgba(21, 48, 79, .12) 18px 22px);
  border-radius: 999px;
  transform: rotate(-16deg);
}

.hero-art::before {
  width: 84%;
  height: 16px;
  top: 70px;
  left: 0;
}

.hero-art::after {
  width: 64%;
  height: 12px;
  right: 8%;
  bottom: 72px;
}

.rocket {
  width: min(75%, 300px);
  filter: drop-shadow(0 28px 22px rgba(21, 48, 79, .18));
  animation: hover 3.2s ease-in-out infinite;
  z-index: 1;
}

.word-orbit {
  position: absolute;
  z-index: 2;
  padding: 9px 13px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 5px 5px 0 rgba(21, 48, 79, .16);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
}

.orbit-a {
  top: 24px;
  right: 13%;
  transform: rotate(8deg);
}

.orbit-b {
  bottom: 38px;
  left: 12%;
  transform: rotate(-9deg);
}

.orbit-c {
  top: 44%;
  left: 3%;
  transform: rotate(5deg);
}

.hero-copy {
  padding-right: min(4vw, 42px);
}

.eyebrow {
  width: fit-content;
  margin: 0 0 12px;
  padding: 7px 10px;
  color: #073b4c;
  background: var(--mint);
  border: 2px solid #073b4c;
  border-radius: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: .78rem;
}

h1 {
  margin: 0;
  font-size: clamp(3.6rem, 11vw, 8.6rem);
  line-height: .86;
  letter-spacing: 0;
}

.tagline {
  max-width: 650px;
  margin: 22px 0 26px;
  color: #314b64;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  line-height: 1.45;
  font-weight: 650;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.primary-action,
.next-action,
.secondary-action,
.sound-action,
.tile-action,
.answer-card,
.level-tab,
.letter-tile,
.reveal-option,
.rush-action,
.submit-action {
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.primary-action,
.next-action,
.submit-action {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  color: #072c3f;
  background: var(--yellow);
  border: 3px solid #072c3f;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #072c3f;
  font-size: 1.05rem;
  font-weight: 950;
}

.rush-action {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  color: white;
  background: var(--coral);
  border: 3px solid #072c3f;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #072c3f;
  font-size: 1.05rem;
  font-weight: 950;
}

.primary-action:hover,
.next-action:hover,
.submit-action:hover,
.secondary-action:hover,
.sound-action:hover,
.level-tab:hover,
.answer-card:hover,
.letter-tile:hover,
.reveal-option:hover,
.rush-action:hover,
.tile-action:hover {
  transform: translateY(-2px);
}

.primary-action:active,
.next-action:active,
.submit-action:active,
.secondary-action:active,
.sound-action:active,
.level-tab:active,
.answer-card:active,
.letter-tile:active,
.reveal-option:active,
.rush-action:active,
.tile-action:active {
  transform: translateY(1px);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 12px;
}

.hud > div {
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .76);
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hud strong {
  display: block;
  margin-top: 1px;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  line-height: 1;
}

.level-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.level-tab {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, .86);
  border: 2px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.level-tab.active {
  background: #e8fff4;
  border-color: var(--green);
  box-shadow: inset 0 -4px 0 rgba(43, 182, 115, .24);
}

.level-number {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: var(--blue);
  border-radius: 50%;
  font-size: .92rem;
}

.play-area {
  min-height: 460px;
  padding: clamp(14px, 2vw, 24px);
  border: 3px solid #12355b;
  border-radius: 8px;
  background:
    linear-gradient(0deg, rgba(255,255,255,.9), rgba(255,255,255,.9)),
    repeating-linear-gradient(45deg, rgba(255, 159, 67, .14) 0 12px, transparent 12px 24px);
  box-shadow: var(--shadow);
}

.level-screen {
  min-height: 405px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.level-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.level-title {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.6rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.level-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sound-action,
.secondary-action,
.tile-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(21, 48, 79, .16);
  font-weight: 900;
}

.sound-action {
  min-width: 46px;
  padding: 0;
  font-size: 1.15rem;
}

.mission {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .62fr);
  gap: clamp(14px, 3vw, 26px);
  align-items: stretch;
}

.prompt-panel,
.feedback-panel {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.prompt-panel {
  padding: clamp(16px, 3vw, 28px);
}

.sentence {
  margin: 0;
  font-size: clamp(1.5rem, 4.2vw, 3.2rem);
  line-height: 1.12;
  font-weight: 950;
}

.clue {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.42;
  font-weight: 700;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.answer-card {
  min-height: 112px;
  padding: 16px;
  color: #06263a;
  background: white;
  border: 3px solid #12355b;
  border-radius: 8px;
  box-shadow: 6px 6px 0 rgba(18, 53, 91, .18);
  text-align: left;
}

.answer-card strong {
  display: block;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: .95;
  letter-spacing: 0;
}

.answer-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 800;
}

.answer-card.correct {
  background: #ddffe8;
  border-color: var(--green);
}

.answer-card.wrong {
  background: #ffe7e7;
  border-color: var(--coral);
}

.feedback-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 16px;
}

.badge {
  width: fit-content;
  padding: 6px 9px;
  color: white;
  background: var(--violet);
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
}

.feedback-title {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 1.1;
}

.feedback-text {
  margin: 0;
  color: #314b64;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 700;
}

.progress-rail {
  height: 16px;
  overflow: hidden;
  background: #d9e7ee;
  border: 2px solid #12355b;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--coral));
}

.catch-field {
  position: relative;
  min-height: 325px;
  overflow: hidden;
  border: 2px solid #12355b;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(185, 243, 223, .65), rgba(255, 253, 246, .85)),
    repeating-linear-gradient(90deg, rgba(18, 53, 91, .07) 0 2px, transparent 2px 44px);
}

.catch-chip {
  position: absolute;
  min-width: 96px;
  min-height: 54px;
  padding: 0 12px;
  color: #072c3f;
  background: white;
  border: 3px solid #12355b;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(18, 53, 91, .18);
  font-weight: 950;
  font-size: clamp(1.12rem, 4vw, 1.8rem);
}

.rush-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .42fr);
  gap: clamp(14px, 3vw, 24px);
}

.rush-stage {
  display: grid;
  gap: 12px;
}

.rush-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  color: #072c3f;
  background: #e8fff4;
  border: 2px solid #12355b;
  border-radius: 8px;
}

.rush-target strong {
  display: block;
  font-size: clamp(1.25rem, 4vw, 2rem);
  line-height: 1.05;
}

.rush-target span {
  color: var(--muted);
  font-weight: 800;
}

.rush-combo {
  min-width: 82px;
  padding: 9px;
  color: white;
  background: var(--violet);
  border-radius: 8px;
  text-align: center;
  font-weight: 950;
}

.rush-arena {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  border: 3px solid #12355b;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(38, 119, 217, .16), rgba(185, 243, 223, .4)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(18, 53, 91, .08) 35px 38px);
}

.rush-arena::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 58px;
  background: linear-gradient(180deg, transparent, rgba(255, 209, 102, .45));
  pointer-events: none;
}

.rush-chip {
  position: absolute;
  min-width: 92px;
  min-height: 50px;
  padding: 0 12px;
  color: #072c3f;
  background: white;
  border: 3px solid #12355b;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(18, 53, 91, .2);
  font-weight: 950;
  font-size: clamp(1.05rem, 4vw, 1.6rem);
  will-change: transform;
}

.rush-chip.target {
  background: var(--yellow);
}

.rush-chip.power {
  min-width: 74px;
  background: var(--mint);
  border-color: var(--green);
}

.rush-chip.bad-hit {
  background: #ffe7e7;
  border-color: var(--coral);
}

.rush-side {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 8px;
}

.rush-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.rush-stat {
  min-height: 72px;
  padding: 10px;
  background: white;
  border: 2px solid var(--line);
  border-radius: 8px;
}

.rush-stat span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rush-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1.55rem;
  line-height: 1;
}

.rush-log {
  min-height: 86px;
  margin: 0;
  color: #314b64;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 750;
}

.rush-start-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr);
  gap: clamp(14px, 3vw, 28px);
  align-items: center;
}

.rush-rules {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rush-rules li {
  padding: 10px 12px;
  background: white;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-weight: 850;
}

.reveal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .48fr);
  gap: clamp(14px, 3vw, 26px);
  align-items: stretch;
}

.reveal-panel {
  display: grid;
  gap: 14px;
}

.reveal-picture {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border: 3px solid #12355b;
  border-radius: 8px;
  background: white;
}

.scene-art,
.scene-art svg {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
}


.reveal-cover {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  background: transparent;
  pointer-events: none;
}

.reveal-cover-tile {
  display: block;
  border: 1px solid #12355b;
  border-radius: 0;
  opacity: 1;
  transform: scale(1);
  transition: opacity .25s ease, transform .25s ease;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 10px,
      rgba(255, 255, 255, .18) 10px 16px
    ),
    linear-gradient(135deg, #ffd166 0%, #32b8ac 100%);
}

.reveal-cover-tile.revealed {
  opacity: 0;
  transform: scale(.86);
}

.reveal-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.reveal-option {
  min-height: 70px;
  padding: 10px;
  color: #072c3f;
  background: white;
  border: 3px solid #12355b;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(18, 53, 91, .18);
}

.reveal-option strong {
  display: block;
  font-size: clamp(1.15rem, 3vw, 1.8rem);
  line-height: 1;
}

.reveal-option.correct {
  background: #ddffe8;
  border-color: var(--green);
}

.reveal-option.wrong {
  background: #ffe7e7;
  border-color: var(--coral);
}

.timer {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 950;
}

.timer-bar {
  width: min(240px, 38vw);
  height: 14px;
  overflow: hidden;
  border: 2px solid #12355b;
  border-radius: 999px;
  background: #e6eef3;
}

.timer-fill {
  width: 100%;
  height: 100%;
  background: var(--orange);
}

.builder {
  display: grid;
  gap: 16px;
}

.build-slots,
.letter-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.slot {
  width: clamp(48px, 11vw, 76px);
  height: clamp(56px, 13vw, 84px);
  display: grid;
  place-items: center;
  color: var(--ink);
  background: white;
  border: 3px dashed #7191a8;
  border-radius: 8px;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 950;
}

.slot.filled {
  border-style: solid;
  border-color: var(--green);
  background: #e8fff4;
}

.letter-tile {
  width: clamp(48px, 11vw, 76px);
  height: clamp(56px, 13vw, 84px);
  color: #072c3f;
  background: var(--yellow);
  border: 3px solid #12355b;
  border-radius: 8px;
  box-shadow: 5px 5px 0 rgba(18, 53, 91, .18);
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 950;
  text-transform: uppercase;
}

.letter-tile.used {
  opacity: .32;
  pointer-events: none;
}

.builder-actions,
.boss-actions,
.final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.boss-panel {
  display: grid;
  gap: 18px;
}

.boss-input {
  width: min(100%, 520px);
  height: 64px;
  padding: 0 14px;
  border: 3px solid #12355b;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: clamp(1.4rem, 4vw, 2.15rem);
  font-weight: 900;
}

.word-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 6px 4px 0;
  padding: 7px 9px;
  background: #eef7ff;
  border: 2px solid #9cb9cb;
  border-radius: 8px;
  font-weight: 900;
}

.result-screen {
  min-height: 400px;
  display: grid;
  align-content: center;
  gap: 18px;
  text-align: center;
}

.result-screen h2 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 5rem);
  line-height: .96;
  letter-spacing: 0;
}

.star-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: clamp(2rem, 8vw, 4rem);
}

.final-word-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
}

.mini-word {
  padding: 8px 10px;
  background: white;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

@keyframes hover {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

@media (max-width: 820px) {
  .game-hero,
  .mission,
  .reveal-layout,
  .rush-layout,
  .rush-start-panel {
    grid-template-columns: 1fr;
  }

  .game-hero {
    min-height: auto;
    padding-top: 14px;
  }

  .hero-art {
    min-height: 265px;
    order: 2;
  }

  .hero-copy {
    padding-right: 0;
  }

  .hud,
  .level-map {
    grid-template-columns: repeat(2, 1fr);
  }

  .level-top {
    align-items: stretch;
  }

  .timer-bar {
    width: 34vw;
  }
}

@media (max-width: 540px) {
  .shell {
    width: min(100% - 18px, 1120px);
    padding-top: 9px;
  }

  .hero-art {
    min-height: 230px;
  }

  .orbit-c {
    left: 0;
  }

  .hud {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .hud > div {
    padding: 9px 6px;
  }

  .hud-label {
    font-size: .64rem;
  }

  .level-map {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .level-tab {
    min-height: 52px;
    font-size: .88rem;
  }

  .play-area {
    padding: 10px;
  }

  .level-screen {
    gap: 12px;
  }

  .level-top {
    flex-direction: column;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .answer-card {
    min-height: 86px;
  }

  .reveal-picture,
  .scene-art,
  .scene-art svg {
    min-height: 260px;
  }

  .reveal-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rush-target {
    grid-template-columns: 1fr;
  }

  .rush-combo {
    width: fit-content;
  }

  .rush-arena {
    min-height: 320px;
  }

  .rush-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .catch-field {
    min-height: 285px;
  }

  .catch-chip {
    min-width: 82px;
  }

  .timer {
    justify-content: space-between;
  }

  .timer-bar {
    width: 58vw;
  }
}
