:root {
  color-scheme: light;
  --ink: #24304f;
  --paper: rgba(255, 255, 255, 0.92);
  --accent: #50c878;
  --shadow: 0 20px 44px rgba(54, 55, 99, 0.19);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 209, 102, 0.95), transparent 21rem),
    radial-gradient(circle at 88% 15%, rgba(83, 168, 255, 0.78), transparent 21rem),
    radial-gradient(circle at 50% 95%, rgba(80, 200, 120, 0.7), transparent 20rem),
    linear-gradient(145deg, #fff3a8 0%, #ffd4e3 36%, #bbf4d5 70%, #c7e8ff 100%);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  display: grid;
  gap: 11px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 2px 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: #694f8f;
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #24304f;
  font-size: 2.34rem;
  line-height: 0.9;
}

.sound-toggle,
.mini-button {
  width: 50px;
  height: 50px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(36, 48, 79, 0.18);
  cursor: pointer;
}

.sound-toggle span,
.mini-button span {
  font-size: 1.36rem;
}

.passport {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: center;
}

.passport-card,
.story-panel,
.reward-panel {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  box-shadow: 0 12px 24px rgba(36, 48, 79, 0.12);
  backdrop-filter: blur(16px);
}

.passport-card {
  min-height: 64px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 10px;
}

.passport-icon,
.story-avatar,
.reward-badge {
  display: grid;
  place-items: center;
  background: #ffd166;
  box-shadow: inset 0 -5px 0 rgba(36, 48, 79, 0.09);
}

.passport-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 1.75rem;
}

.passport p,
.story-panel p,
.reward-panel p {
  margin: 0;
  font-weight: 1000;
}

.passport p {
  color: #6a5c85;
  font-size: 0.88rem;
}

.passport strong {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
}

.badge-strip {
  min-width: 112px;
  min-height: 64px;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  place-items: center;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
  color: #8a91a7;
  font-size: 1rem;
}

.world-map {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 108px;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scrollbar-width: none;
}

.world-map::-webkit-scrollbar {
  display: none;
}

.world-button {
  min-height: 74px;
  padding: 8px;
  display: grid;
  place-items: center;
  gap: 5px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.66);
  cursor: pointer;
}

.world-button span {
  min-width: 43px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #ffffff;
  background: var(--world-color);
  font-size: 1.17rem;
  font-weight: 1000;
}

.world-button strong {
  font-size: 0.95rem;
}

.world-button.active {
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(36, 48, 79, 0.16);
}

.world-button.complete {
  outline: 3px solid rgba(255, 209, 102, 0.9);
}

.story-panel {
  min-height: 62px;
  padding: 9px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
}

.story-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 1.6rem;
}

.story-panel p {
  font-size: 0.98rem;
  line-height: 1.17;
}

.game-card {
  min-height: 0;
  padding: 13px;
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr) auto;
  gap: 10px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.score-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stars {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffb703;
  font-size: 1.38rem;
}

.prompt-zone {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  text-align: center;
}

.mascot {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    conic-gradient(from 30deg, #ff6f91, #ffd166, #50c878, #53a8ff, #8b6dff, #ff6f91) border-box;
  border: 6px solid transparent;
  box-shadow: 0 14px 28px rgba(36, 48, 79, 0.14);
  font-size: 2.34rem;
}

.question {
  width: 100%;
  margin: 0;
  color: var(--ink);
  font-size: 1.46rem;
  font-weight: 1000;
  line-height: 1.1;
}

.visual-stage {
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}

.symbol {
  position: relative;
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff3bf;
  box-shadow: 0 8px 14px rgba(36, 48, 79, 0.09);
  font-size: 1.82rem;
}

.math-stage .symbol {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 1.48rem;
}

.symbol.removed {
  opacity: 0.42;
  background: #ffe0e8;
}

.symbol.removed::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: #ff6f91;
  transform: rotate(-20deg);
}

.math-sign,
.math-note {
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
  color: #ffffff;
  background: #8b6dff;
  box-shadow: 0 8px 14px rgba(36, 48, 79, 0.1);
  font-size: 1.35rem;
  font-weight: 1000;
}

.math-note {
  min-width: 70px;
  padding: 0 10px;
  background: #ff8a5b;
  font-size: 1.12rem;
}

.letter-card {
  min-width: 100px;
  height: 88px;
  padding: 0 22px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  color: #ffffff;
  background: linear-gradient(135deg, #ff6f91, #8b6dff);
  box-shadow: 0 16px 28px rgba(139, 109, 255, 0.25);
  font-size: 3.2rem;
  font-weight: 1000;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.answer-button {
  min-height: 94px;
  padding: 9px;
  display: grid;
  place-items: center;
  gap: 4px;
  border-radius: 22px;
  background: #ffffff;
  box-shadow:
    inset 0 -5px 0 rgba(36, 48, 79, 0.08),
    0 10px 18px rgba(36, 48, 79, 0.1);
  cursor: pointer;
  touch-action: manipulation;
}

.answer-button:active {
  transform: scale(0.97);
}

.answer-button.correct {
  background: #ceffd8 !important;
}

.answer-button.wrong {
  background: #ffe0e8 !important;
  animation: nope 260ms ease;
}

.answer-visual {
  height: 50px;
  display: grid;
  place-items: center;
  font-size: 2.45rem;
  line-height: 1;
}

.answer-label {
  max-width: 100%;
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 1000;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}

.reward-panel {
  min-height: 70px;
  padding: 10px;
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 11px;
}

.reward-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 1.82rem;
}

.reward-panel p {
  margin: 0 0 7px;
  color: #394360;
  font-size: 1rem;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(36, 48, 79, 0.1);
}

.progress-track span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffd166, #ff6f91);
  transition: width 260ms ease;
}

.float-pop {
  animation: float-pop 520ms ease;
}

@keyframes float-pop {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.08);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes nope {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-6px);
  }
  70% {
    transform: translateX(6px);
  }
}

@media (max-width: 360px), (max-height: 760px) {
  .app-shell {
    padding-inline: 10px;
    gap: 8px;
  }

  h1 {
    font-size: 2.05rem;
  }

  .sound-toggle,
  .mini-button {
    width: 44px;
    height: 44px;
  }

  .passport-card,
  .badge-strip {
    min-height: 56px;
  }

  .badge-strip {
    min-width: 96px;
    padding: 6px;
    font-size: 0.9rem;
  }

  .passport-card {
    grid-template-columns: 42px 1fr;
  }

  .passport-icon,
  .story-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 1.45rem;
  }

  .world-map {
    grid-auto-columns: 94px;
  }

  .world-button {
    min-height: 62px;
    border-radius: 16px;
  }

  .world-button span {
    height: 27px;
    min-width: 38px;
  }

  .world-button strong {
    font-size: 0.84rem;
  }

  .story-panel {
    min-height: 54px;
  }

  .story-panel p {
    font-size: 0.88rem;
  }

  .game-card {
    padding: 10px;
    grid-template-rows: auto minmax(130px, 1fr) auto;
    gap: 7px;
  }

  .score-row {
    min-height: 40px;
  }

  .stars {
    min-height: 34px;
    font-size: 1.18rem;
  }

  .prompt-zone {
    min-height: 130px;
    gap: 6px;
  }

  .mascot {
    width: 58px;
    height: 58px;
    border-width: 5px;
    font-size: 1.88rem;
  }

  .question {
    font-size: 1.16rem;
  }

  .visual-stage {
    min-height: 54px;
    gap: 5px;
  }

  .symbol,
  .math-stage .symbol {
    width: 35px;
    height: 35px;
    border-radius: 12px;
    font-size: 1.24rem;
  }

  .math-sign,
  .math-note {
    min-width: 34px;
    height: 34px;
    border-radius: 13px;
    font-size: 1.05rem;
  }

  .letter-card {
    min-width: 72px;
    height: 62px;
    border-radius: 18px;
    font-size: 2.22rem;
  }

  .answer-button {
    min-height: 78px;
    padding: 7px;
    border-radius: 18px;
  }

  .answer-visual {
    height: 34px;
    font-size: 1.8rem;
  }

  .answer-label {
    font-size: 0.98rem;
  }

  .reward-panel {
    min-height: 58px;
    grid-template-columns: 44px 1fr;
    padding: 8px;
  }

  .reward-badge {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.42rem;
  }
}
