:root {
  --ink: #183f3b;
  --ink-soft: #55736f;
  --paper: #fffdf4;
  --cream: #f8f1d9;
  --teal: #0e756c;
  --teal-dark: #08534e;
  --teal-light: #b9e5d3;
  --coral: #ef6b52;
  --coral-dark: #c64734;
  --sunny: #f8c94b;
  --sunny-light: #fff0a8;
  --blue: #8ed9e1;
  --shadow: rgba(24, 63, 59, 0.14);
  --radius-lg: 32px;
  --radius-md: 22px;
  --font-rounded: "Avenir Next Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color-scheme: light;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, #dff3ed 0, #f6f1d9 42rem, #f3e9c9 100%);
  font-family: var(--font-rounded);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: white;
  background: var(--teal-dark);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

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

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 16px 16px 16px 5px;
  color: var(--ink);
  background: var(--sunny);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  transform: rotate(-3deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.brand small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sound-toggle,
.text-button,
.hint-button {
  border: 0;
  cursor: pointer;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border: 2px solid rgba(24, 63, 59, 0.15);
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  backdrop-filter: blur(6px);
}

.sound-toggle__icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--teal);
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100svh - 142px);
  margin: 0 auto;
}

.welcome-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
  padding: clamp(24px, 5vh, 60px) 0 70px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--coral);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 18px;
  font-size: clamp(3.5rem, 7.4vw, 6.8rem);
  line-height: 0.87;
  letter-spacing: -0.075em;
}

h1 em {
  color: var(--coral);
  font-style: normal;
  white-space: nowrap;
}

.welcome-lead {
  max-width: 590px;
  margin-bottom: 27px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  font-weight: 600;
  line-height: 1.55;
}

.mission-card {
  max-width: 670px;
  padding: 24px;
  border: 2px solid rgba(24, 63, 59, 0.16);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 244, 0.9);
  box-shadow: 0 18px 50px var(--shadow);
  backdrop-filter: blur(12px);
}

.choice-group {
  padding: 0;
  margin: 0 0 19px;
  border: 0;
}

.choice-group legend {
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 900;
}

.mode-options,
.length-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.choice-card,
.length-options label {
  position: relative;
  cursor: pointer;
}

.choice-card input,
.length-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 11px 10px;
  border: 2px solid #d6dfd4;
  border-radius: 17px;
  background: white;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.choice-card__icon {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: var(--ink);
  background: var(--sunny-light);
  font-size: 1.35rem;
  font-weight: 900;
}

.choice-card__icon--add {
  color: #08534e;
  background: #b9e5d3;
}

.choice-card__icon--subtract {
  color: #833426;
  background: #ffd2c8;
}

.choice-card strong,
.choice-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-card strong {
  font-size: 0.86rem;
}

.choice-card small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 700;
}

.choice-card:hover {
  transform: translateY(-2px);
}

.choice-card:has(input:checked) {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 117, 108, 0.12);
}

.choice-card:has(input:focus-visible),
.length-options label:has(input:focus-visible) {
  outline: 3px solid var(--sunny);
  outline-offset: 3px;
}

.length-options label > span {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border: 2px solid #dde3da;
  border-radius: 12px;
  color: var(--ink-soft);
  background: #fafbf6;
  font-size: 0.9rem;
  font-weight: 900;
  transition: 160ms ease;
}

.length-options small {
  font-size: 0.59rem;
  font-weight: 700;
}

.length-options label:has(input:checked) > span {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: #e3f5ed;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 55px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.primary-button {
  width: 100%;
  padding: 13px 18px;
  border: 2px solid var(--ink);
  color: white;
  background: var(--coral);
  box-shadow: 4px 5px 0 var(--ink);
}

.button-arrow {
  font-size: 1.4em;
  line-height: 1;
}

.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
  transform: translateY(-2px);
}

.primary-button:active,
.secondary-button:active {
  box-shadow: 1px 2px 0 var(--ink);
  transform: translate(3px, 3px);
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 4px solid var(--sunny);
  outline-offset: 3px;
}

.privacy-note {
  margin: 14px 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.privacy-note span {
  color: var(--coral);
}

.mascot-scene {
  position: relative;
  min-height: 670px;
  align-self: end;
}

.mascot-scene img {
  position: absolute;
  z-index: 2;
  right: -5%;
  bottom: 42px;
  width: min(100%, 545px);
  height: auto;
  filter: drop-shadow(0 28px 22px rgba(24, 63, 59, 0.2));
  animation: mascot-breathe 4s ease-in-out infinite;
}

.mascot-halo {
  position: absolute;
  right: -8%;
  bottom: 80px;
  width: 105%;
  aspect-ratio: 1;
  border: 2px dashed rgba(14, 117, 108, 0.2);
  border-radius: 48% 52% 49% 51%;
  background: radial-gradient(circle, rgba(255, 240, 168, 0.9) 0 51%, transparent 52%);
  animation: slow-spin 32s linear infinite;
}

.speech-bubble {
  position: absolute;
  z-index: 4;
  top: 5%;
  left: -3%;
  padding: 14px 20px;
  border: 2px solid var(--ink);
  border-radius: 22px 22px 5px 22px;
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--ink);
  font-size: 0.88rem;
  transform: rotate(-3deg);
}

.speech-bubble span,
.speech-bubble strong {
  display: block;
}

.speech-bubble span {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.speech-bubble strong {
  margin-top: 2px;
}

.island-base {
  position: absolute;
  z-index: 1;
  right: -4%;
  bottom: 0;
  display: flex;
  width: 105%;
  height: 94px;
  align-items: flex-start;
  justify-content: space-around;
  padding: 19px 24px;
  border-radius: 50%;
  color: white;
  background: #0e756c;
  box-shadow: inset 0 13px 0 #52ae86, 0 16px 0 rgba(8, 83, 78, 0.16);
  font-size: 0.66rem;
  font-weight: 900;
}

.island-base span:nth-child(even) {
  transform: translateY(9px);
}

.sparkle {
  position: absolute;
  z-index: 3;
  color: var(--sunny);
  font-size: 2rem;
  animation: twinkle 2s ease-in-out infinite alternate;
}

.sparkle--one {
  top: 20%;
  right: 2%;
}

.sparkle--two {
  top: 42%;
  left: 1%;
  color: var(--coral);
  font-size: 1.2rem;
  animation-delay: -0.8s;
}

.sparkle--three {
  top: 14%;
  right: 38%;
  color: var(--teal);
  font-size: 0.8rem;
}

.sky-decoration {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sun {
  position: absolute;
  top: -170px;
  right: -160px;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  background: rgba(248, 201, 75, 0.28);
  box-shadow: 0 0 0 38px rgba(248, 201, 75, 0.08);
}

.cloud {
  position: absolute;
  width: 180px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
}

.cloud::before,
.cloud::after {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
  content: "";
}

.cloud::before {
  left: 30px;
  width: 75px;
  height: 75px;
}

.cloud::after {
  right: 24px;
  width: 55px;
  height: 55px;
}

.cloud--one {
  top: 150px;
  left: -65px;
}

.cloud--two {
  top: 340px;
  right: -100px;
  transform: scale(0.7);
}

footer {
  position: relative;
  z-index: 2;
  padding: 20px;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
}

footer p {
  margin: 0;
}

footer span {
  color: var(--coral);
}

/* Game */
.game-screen {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 20px 0 70px;
}

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 18px;
}

.text-button {
  justify-self: start;
  padding: 9px 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 900;
}

.text-button:hover {
  color: var(--teal-dark);
}

.mission-label {
  margin: 0;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.question-count {
  justify-self: end;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.75rem;
  font-weight: 900;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border: 2px solid rgba(24, 63, 59, 0.14);
  border-radius: 17px;
  background: rgba(255, 253, 244, 0.76);
  box-shadow: 0 8px 24px rgba(24, 63, 59, 0.06);
}

.stat-card__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: #e4eee8;
  font-size: 1.15rem;
  font-weight: 900;
}

.stat-card--correct .stat-card__icon {
  color: #895d00;
  background: var(--sunny-light);
}

.stat-card--wrong .stat-card__icon {
  color: #9c3b2a;
  background: #ffd8cf;
}

.stat-card small,
.stat-card strong {
  display: block;
}

.stat-card small {
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  margin-top: 1px;
  font-size: 1.25rem;
}

.journey {
  position: relative;
  display: flex;
  align-items: center;
  padding-right: 12px;
  margin-bottom: 30px;
}

.journey__track {
  position: relative;
  width: 100%;
  height: 10px;
  border: 2px solid rgba(24, 63, 59, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.journey__fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #52ae86);
  transition: width 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.journey__traveler {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0;
  font-size: 1.5rem;
  transform: translate(-35%, -54%);
  transition: left 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.journey__finish {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 1.8rem;
}

.play-area {
  display: grid;
  grid-template-columns: 220px minmax(0, 520px);
  gap: 30px;
  justify-content: center;
  align-items: end;
}

.mascot-coach {
  position: sticky;
  bottom: 20px;
  align-self: end;
}

.mascot-coach img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 15px 10px rgba(24, 63, 59, 0.16));
}

.coach-bubble {
  position: relative;
  z-index: 2;
  width: 175px;
  padding: 11px 13px;
  margin: 0 auto -12px;
  border: 2px solid var(--ink);
  border-radius: 17px 17px 5px 17px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  transform: rotate(-2deg);
}

.question-card {
  position: relative;
  width: 100%;
  min-height: 570px;
  padding: 34px clamp(24px, 5vw, 48px) 32px;
  border: 2px solid var(--ink);
  border-radius: 30px 30px 30px 8px;
  background:
    linear-gradient(rgba(14, 117, 108, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 28px;
  box-shadow: 8px 10px 0 var(--ink), 0 22px 50px var(--shadow);
  text-align: center;
}

.question-card__tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 90px;
  height: 27px;
  background: rgba(248, 201, 75, 0.78);
  transform: translateX(-50%) rotate(-2deg);
  clip-path: polygon(3% 8%, 98% 0, 94% 100%, 0 92%);
}

.question-kicker {
  margin-bottom: 12px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.equation {
  display: flex;
  min-height: 115px;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 18px);
  font-size: clamp(2.7rem, 7vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.06em;
}

.equation__operator {
  color: var(--coral);
}

.equation__equals {
  color: var(--ink-soft);
}

.answer-wrap {
  position: relative;
  display: inline-grid;
  width: 102px;
  height: 92px;
  place-items: center;
  border: 3px dashed var(--teal);
  border-radius: 22px;
  background: #e5f5ee;
  overflow: hidden;
  transition: 180ms ease;
}

.answer-wrap input {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--teal-dark);
  background: transparent;
  caret-color: transparent;
  cursor: default;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  text-align: center;
}

.answer-placeholder {
  position: absolute;
  z-index: 1;
  color: rgba(14, 117, 108, 0.35);
}

.answer-wrap:has(input:not(:placeholder-shown)) .answer-placeholder,
.answer-wrap:has(input:focus) .answer-placeholder {
  opacity: 0;
}

.answer-wrap:focus-within {
  border-style: solid;
  box-shadow: 0 0 0 5px rgba(14, 117, 108, 0.12);
}

.answer-wrap.is-correct {
  border-color: var(--teal);
  border-style: solid;
  background: #ccebdc;
  animation: answer-pop 420ms ease;
}

.answer-wrap.is-wrong {
  border-color: var(--coral);
  border-style: solid;
  background: #ffe2db;
}

.is-shaking {
  animation: shake 380ms ease;
}

.hint-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 12px;
  margin: 3px 0 14px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: rgba(14, 117, 108, 0.35);
  text-underline-offset: 3px;
}

.hint-button:hover {
  background: #e5f5ee;
}

.hint {
  padding: 10px 13px;
  margin: 0 0 12px;
  border: 2px solid #ead68c;
  border-radius: 16px;
  background: #fff7cf;
}

.hint p {
  margin: 0 0 7px;
  color: #685823;
  font-size: 0.72rem;
  font-weight: 700;
}

.counter-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 230px;
  margin: 0 auto;
}

.counter-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--teal-light);
}

.counter-dot.dot--second {
  background: #ffd38b;
}

.counter-dot.is-crossed {
  opacity: 0.45;
}

.counter-dot.is-crossed::after {
  position: absolute;
  top: 50%;
  left: -3px;
  width: 17px;
  height: 2px;
  background: var(--coral-dark);
  content: "";
  transform: rotate(-45deg);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  width: min(260px, 100%);
  margin: 0 auto 11px;
}

.keypad button {
  min-height: 46px;
  border: 2px solid rgba(24, 63, 59, 0.23);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  box-shadow: 0 3px 0 rgba(24, 63, 59, 0.2);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: 100ms ease;
}

.keypad button:hover:not(:disabled) {
  border-color: var(--teal);
  background: #eff9f4;
  transform: translateY(-1px);
}

.keypad button:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(3px);
}

.keypad button:disabled {
  opacity: 0.48;
  cursor: default;
}

.feedback {
  min-height: 25px;
  margin: 0 0 8px;
  font-size: 0.84rem;
  font-weight: 900;
}

.feedback--correct {
  color: var(--teal-dark);
}

.feedback--wrong,
.feedback--prompt {
  color: var(--coral-dark);
}

.answer-button,
.next-button {
  width: min(300px, 100%);
  min-height: 50px;
  margin: 0 auto;
}

.next-button {
  background: var(--teal);
}

.burst-star {
  position: absolute;
  z-index: 8;
  top: 29%;
  left: 50%;
  color: var(--sunny);
  font-size: 1.4rem;
  pointer-events: none;
  animation: star-burst 800ms ease-out forwards;
}

/* Results */
.result-screen {
  display: grid;
  grid-template-columns: minmax(0, 590px) minmax(260px, 360px);
  gap: 28px;
  align-items: end;
  justify-content: center;
  padding: 38px 0 80px;
}

.result-card {
  position: relative;
  z-index: 2;
  overflow: hidden;
  padding: clamp(28px, 5vw, 48px);
  border: 2px solid var(--ink);
  border-radius: 36px 36px 36px 10px;
  background: var(--paper);
  box-shadow: 9px 11px 0 var(--ink), 0 30px 60px var(--shadow);
  text-align: center;
}

.result-card .eyebrow {
  justify-content: center;
}

.result-stars {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-bottom: 13px;
}

.result-stars span {
  color: #dfe3d9;
  font-size: clamp(2rem, 6vw, 3.2rem);
  -webkit-text-stroke: 2px var(--ink);
  filter: drop-shadow(2px 3px 0 var(--ink));
  transform: rotate(-8deg) scale(0.9);
}

.result-stars span:nth-child(2) {
  transform: translateY(-8px) scale(1.12);
}

.result-stars span:nth-child(3) {
  transform: rotate(8deg) scale(0.9);
}

.result-stars .is-earned {
  color: var(--sunny);
  animation: result-star 620ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.result-stars .is-earned:nth-child(2) {
  animation-delay: 120ms;
}

.result-stars .is-earned:nth-child(3) {
  animation-delay: 240ms;
}

.result-card h2 {
  margin-bottom: 10px;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.result-message {
  max-width: 430px;
  margin: 0 auto 21px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.5;
}

.score-orbit {
  display: grid;
  margin-bottom: 22px;
  place-items: center;
}

.score-orbit__ring {
  --score: 0deg;
  display: grid;
  width: 120px;
  height: 120px;
  place-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--paper) 0 60%, transparent 61%),
    conic-gradient(var(--coral) 0 var(--score), #e6e8de var(--score) 360deg);
}

.score-orbit__ring strong,
.score-orbit__ring span {
  display: block;
}

.score-orbit__ring strong {
  font-size: 1.8rem;
}

.score-orbit__ring span {
  color: var(--ink-soft);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: #f1f3e9;
}

.result-stats > div {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 0 6px;
  align-items: center;
}

.result-stats > div + div {
  border-left: 1px solid #d2d9ce;
}

.result-stats span {
  color: var(--coral);
}

.result-stats strong {
  font-size: 1.15rem;
}

.result-stats small {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.best-result {
  display: inline-block;
  padding: 7px 12px;
  margin: 14px 0 0;
  border-radius: 999px;
  color: #735008;
  background: var(--sunny-light);
  font-size: 0.7rem;
  font-weight: 900;
}

.result-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
  margin-top: 21px;
}

.result-actions .primary-button {
  min-height: 52px;
  font-size: 0.78rem;
}

.secondary-button {
  min-height: 52px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: white;
  box-shadow: 3px 4px 0 var(--ink);
  font-size: 0.72rem;
}

.result-mascot {
  position: relative;
}

.result-mascot img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 25px 18px rgba(24, 63, 59, 0.2));
}

.speech-bubble--result {
  top: -18%;
  left: -8%;
  font-size: 0.82rem;
  white-space: nowrap;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti__piece {
  position: absolute;
  top: -18px;
  left: var(--x);
  width: 8px;
  height: 16px;
  border-radius: 3px;
  background: var(--coral);
  animation: confetti-fall 2.2s var(--delay) ease-out both;
  transform: rotate(var(--spin));
}

.confetti__piece--1 {
  border-radius: 50%;
  background: var(--sunny);
}

.confetti__piece--2 {
  background: var(--teal);
}

.confetti__piece--3 {
  background: var(--blue);
}

@keyframes mascot-breathe {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-7px) rotate(0.5deg); }
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

@keyframes twinkle {
  from { opacity: 0.45; transform: scale(0.75) rotate(-8deg); }
  to { opacity: 1; transform: scale(1.12) rotate(8deg); }
}

@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes answer-pop {
  50% { transform: scale(1.12) rotate(-2deg); }
}

@keyframes star-burst {
  from { opacity: 1; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(0.4); }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-115px) scale(1.2); }
}

@keyframes result-star {
  from { opacity: 0; transform: translateY(30px) scale(0.2) rotate(-25deg); }
}

@keyframes confetti-fall {
  0% { opacity: 1; transform: translateY(0) rotate(var(--spin)); }
  100% { opacity: 0; transform: translateY(510px) rotate(calc(var(--spin) + 540deg)); }
}

@media (min-width: 721px) and (max-width: 900px) {
  .site-header {
    padding: 14px 0;
  }

  .game-screen {
    padding-top: 8px;
    padding-bottom: 30px;
  }

  footer {
    padding: 12px;
  }
}

@media (min-width: 721px) and (max-width: 1200px) and (max-height: 900px) and (orientation: landscape) {
  .site-header {
    padding: 9px 0;
  }

  .brand__mark {
    width: 40px;
    height: 40px;
    border-radius: 13px 13px 13px 5px;
  }

  .brand strong {
    font-size: 1rem;
  }

  .sound-toggle {
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .app-shell {
    min-height: 0;
  }

  .welcome-screen {
    gap: 24px;
    padding: 2px 0 12px;
  }

  .welcome-screen h1 {
    margin-bottom: 10px;
    font-size: clamp(3.25rem, 7vw, 5rem);
  }

  .welcome-lead {
    margin-bottom: 12px;
    font-size: 0.96rem;
    line-height: 1.35;
  }

  .mission-card {
    padding: 15px;
    border-radius: 24px;
  }

  .choice-group {
    margin-bottom: 10px;
  }

  .choice-group legend {
    margin-bottom: 6px;
  }

  .choice-card {
    padding: 7px 8px;
  }

  .choice-card__icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 1.1rem;
  }

  .length-options label > span {
    padding: 5px;
  }

  .mission-card .primary-button {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .privacy-note {
    margin-top: 8px;
  }

  .mascot-scene {
    min-height: 500px;
  }

  .mascot-scene img {
    right: 1%;
    bottom: 30px;
    width: min(88%, 430px);
  }

  .mascot-halo {
    right: 0;
    bottom: 62px;
    width: 92%;
  }

  .island-base {
    right: 0;
    bottom: 2px;
    width: 100%;
  }

  body[data-screen="game"] footer,
  body[data-screen="result"] footer {
    display: none;
  }

  .game-screen {
    padding: 0 0 8px;
  }

  .game-topbar {
    margin-bottom: 6px;
  }

  .text-button {
    padding: 5px 0;
  }

  .hud {
    gap: 8px;
    margin-bottom: 7px;
  }

  .stat-card {
    gap: 8px;
    padding: 6px 11px;
    border-radius: 14px;
  }

  .stat-card__icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 0.95rem;
  }

  .stat-card strong {
    font-size: 1.05rem;
  }

  .journey {
    margin-bottom: 9px;
  }

  .journey__finish {
    font-size: 1.4rem;
  }

  .play-area {
    grid-template-columns: 155px minmax(0, 450px);
    gap: 18px;
    align-items: center;
  }

  .mascot-coach {
    position: static;
  }

  .mascot-coach img {
    width: 145px;
    margin: 0 auto;
  }

  .coach-bubble {
    width: 140px;
    padding: 8px 9px;
    margin-bottom: -8px;
    font-size: 0.65rem;
  }

  .question-card {
    min-height: 0;
    padding: 17px 30px 15px;
    border-radius: 24px 24px 24px 7px;
    box-shadow: 6px 7px 0 var(--ink), 0 16px 34px var(--shadow);
  }

  .question-card__tape {
    top: -9px;
    height: 21px;
  }

  .question-kicker {
    margin-bottom: 3px;
  }

  .equation {
    min-height: 70px;
    font-size: clamp(3rem, 6vw, 3.7rem);
  }

  .answer-wrap {
    width: 80px;
    height: 68px;
    border-radius: 17px;
  }

  .hint-button {
    min-height: 28px;
    padding: 4px 10px;
    margin: 0 0 6px;
  }

  .hint {
    padding: 6px 10px;
    margin-bottom: 6px;
  }

  .hint p {
    margin-bottom: 4px;
  }

  .counter-dots {
    gap: 3px;
  }

  .counter-dot {
    width: 11px;
    height: 11px;
  }

  .keypad {
    gap: 5px;
    width: min(230px, 100%);
    margin-bottom: 6px;
  }

  .keypad button {
    min-height: 35px;
    border-radius: 10px;
  }

  .feedback {
    min-height: 20px;
    margin-bottom: 4px;
    font-size: 0.78rem;
  }

  .answer-button,
  .next-button {
    min-height: 42px;
  }

  .result-screen {
    gap: 20px;
    padding: 4px 0 12px;
  }

  .result-card {
    padding: 22px 32px;
  }

  .result-mascot img {
    width: 240px;
  }

  footer {
    padding: 8px;
  }
}

@media (max-width: 900px) {
  .welcome-screen {
    grid-template-columns: 1fr minmax(280px, 0.7fr);
    gap: 20px;
  }

  .mascot-scene {
    min-height: 570px;
  }

  .choice-card {
    display: grid;
    justify-items: center;
    text-align: center;
  }

  .result-screen {
    grid-template-columns: minmax(0, 590px) 250px;
  }
}

@media (max-width: 720px) {
  .site-header,
  .app-shell {
    width: min(100% - 28px, 600px);
  }

  .site-header {
    padding: 14px 0;
  }

  .welcome-screen {
    grid-template-columns: 1fr;
    padding-top: 28px;
  }

  h1 {
    font-size: clamp(3.5rem, 17vw, 5.3rem);
  }

  .welcome-lead {
    max-width: 520px;
  }

  .mission-card {
    padding: 18px;
  }

  .mascot-scene {
    min-height: 540px;
    margin-top: -20px;
  }

  .mascot-scene img {
    right: 2%;
    width: min(88%, 430px);
  }

  .mascot-halo {
    right: 2%;
    width: 90%;
  }

  .island-base {
    right: 0;
    width: 100%;
  }

  .speech-bubble {
    left: 4%;
  }

  .game-topbar {
    margin-top: 8px;
  }

  .mission-label {
    display: none;
  }

  .game-topbar {
    grid-template-columns: 1fr 1fr;
  }

  .hud {
    gap: 7px;
  }

  .stat-card {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 8px 4px;
    text-align: center;
  }

  .stat-card__icon {
    width: 29px;
    height: 29px;
    border-radius: 9px;
    font-size: 0.9rem;
  }

  .stat-card small {
    font-size: 0.5rem;
  }

  .stat-card strong {
    font-size: 1rem;
  }

  .journey {
    margin-bottom: 22px;
  }

  .play-area {
    grid-template-columns: 1fr;
  }

  .mascot-coach {
    display: none;
  }

  .question-card {
    min-height: 0;
    padding: 29px 20px 26px;
    border-radius: 25px 25px 25px 7px;
    box-shadow: 5px 7px 0 var(--ink), 0 18px 36px var(--shadow);
  }

  .equation {
    min-height: 102px;
    font-size: clamp(2.5rem, 14vw, 4rem);
  }

  .answer-wrap {
    width: 82px;
    height: 78px;
    border-radius: 18px;
  }

  .result-screen {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }

  .result-mascot {
    display: none;
  }
}

@media (max-width: 430px) {
  .brand small,
  .sound-toggle__label {
    display: none;
  }

  .sound-toggle {
    padding: 6px;
  }

  .mode-options {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 15vw;
  }

  h1 em {
    white-space: nowrap;
  }

  .welcome-copy .eyebrow {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
  }

  .welcome-copy .eyebrow span {
    margin-right: 5px;
  }

  .choice-card {
    display: flex;
    justify-items: initial;
    text-align: left;
  }

  .length-options label > span {
    display: grid;
    gap: 0;
    justify-items: center;
  }

  .mascot-scene {
    min-height: 450px;
  }

  .speech-bubble {
    top: 3%;
    padding: 10px 13px;
  }

  .equation {
    gap: 6px;
    font-size: 2.55rem;
  }

  .answer-wrap {
    width: 72px;
    height: 68px;
  }

  .result-card {
    padding: 28px 18px;
    box-shadow: 5px 7px 0 var(--ink), 0 20px 40px var(--shadow);
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
