:root {
  color-scheme: light;
  --ink: #17374a;
  --ink-soft: #54707a;
  --paper: #f7f1e4;
  --cream: #fffaf0;
  --white: #fffefb;
  --orange: #ff8c5b;
  --orange-dark: #da5d36;
  --sun: #ffcf63;
  --mint: #bcebd8;
  --teal: #167e7f;
  --line: #d6ddda;
  --shadow: 0 14px 0 #d6ddd7;
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 4%, rgba(255, 207, 99, .24), transparent 25rem),
    radial-gradient(circle at 94% 61%, rgba(188, 235, 216, .5), transparent 28rem),
    var(--paper);
}

button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 4px solid var(--orange-dark);
  outline-offset: 4px;
}
a { color: var(--teal); font-weight: 800; }
img, svg { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sun-glow {
  position: fixed;
  z-index: -1;
  top: 45%;
  left: -140px;
  width: 260px;
  height: 260px;
  border: 25px solid rgba(255, 207, 99, .19);
  border-radius: 50%;
  pointer-events: none;
}
.page-wrap { width: min(1190px, calc(100% - 44px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 118px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.brand-mark { position: relative; display: block; width: 51px; height: 53px; flex: none; }
.brand-mark i {
  position: absolute;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 47px;
  border: 2px solid var(--ink);
  border-radius: 12px 12px 5px 5px;
  background: var(--sun);
  box-shadow: 2px 3px 0 var(--ink);
  font: 800 21px Georgia, serif;
}
.brand-mark i:last-child { right: 0; background: var(--orange); }
.brand strong { display: block; font-size: 23px; line-height: 1; letter-spacing: -.055em; font-weight: 1000; }
.brand small { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-actions nav { display: flex; gap: 4px; }
.nav-button { padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 900; }
.nav-button:hover { background: #eadfc8; }
.order-picker { display: grid; gap: 4px; color: var(--ink-soft); font-size: 10px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.order-picker select { min-width: 175px; padding: 9px 27px 9px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 800; letter-spacing: 0; text-transform: none; }

.eyebrow { margin: 0 0 15px; color: var(--teal); font-size: 12px; font-weight: 1000; letter-spacing: .16em; text-transform: uppercase; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, .88fr);
  gap: 20px;
  min-height: 468px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: var(--shadow);
}
.hero-copy { align-self: center; padding: 54px 20px 54px 57px; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 2px solid #e9c986; border-radius: 999px; background: #fff0c5; color: #815b24; font-size: 11px; }
.hero h1, .page-title { margin: 0; font-size: clamp(42px, 5.4vw, 75px); font-weight: 1000; line-height: .99; letter-spacing: -.075em; }
.hero h1 em { color: var(--orange-dark); font-style: normal; }
.hero p:not(.eyebrow) { max-width: 510px; margin: 22px 0 26px; color: #46606c; font-size: 18px; font-weight: 700; line-height: 1.55; }
.hero-actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 51px;
  padding: 11px 21px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  box-shadow: 4px 5px 0 var(--ink);
  background: var(--orange);
  color: var(--ink);
  font-size: 15px;
  font-weight: 1000;
  text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: 4px 7px 0 var(--ink); }
.button:active { transform: translateY(3px); box-shadow: 2px 2px 0 var(--ink); }
.button.secondary { background: var(--white); }
.button.mint { background: var(--mint); }
.button.small { min-height: 42px; padding: 8px 14px; font-size: 13px; }
.hero-art-wrap { position: relative; display: grid; align-items: end; overflow: hidden; background: linear-gradient(#dff4e9 0%, #f3f7db 70%, #fdf8e9 100%); }
.hero-art { display: block; width: 100%; height: 100%; min-height: 450px; }
.hero-art .sparkle { transform-origin: center; animation: twinkle 2.8s ease-in-out infinite alternate; }
.hero-art .sparkle:nth-of-type(2) { animation-delay: .8s; }
@keyframes twinkle { to { opacity: .42; transform: scale(.72); } }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 54px 0 20px; }
.section-head h2 { margin: 0; font-size: clamp(28px, 3vw, 39px); line-height: 1; letter-spacing: -.055em; }
.section-head p { max-width: 400px; margin: 0; color: var(--ink-soft); font-size: 14px; font-weight: 700; line-height: 1.5; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.mode-card {
  display: flex;
  flex-direction: column;
  min-height: 235px;
  padding: 22px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 4px 5px 0 var(--ink);
  background: var(--white);
  color: var(--ink);
  text-align: left;
  transition: transform .16s ease, box-shadow .16s ease;
}
.mode-card:hover { transform: translateY(-4px); box-shadow: 4px 9px 0 var(--ink); }
.mode-card:nth-child(2) { background: #e9f5ee; }
.mode-card:nth-child(3) { background: #fff2d5; }
.mode-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 18px; border: 2px solid var(--ink); border-radius: 15px; background: var(--sun); font-size: 27px; }
.mode-card:nth-child(2) .mode-icon { background: var(--mint); }
.mode-card:nth-child(3) .mode-icon { background: #fff9e9; }
.mode-card strong { font-size: 23px; font-weight: 1000; letter-spacing: -.04em; }
.mode-card small { margin: 7px 0 15px; color: var(--ink-soft); font-size: 14px; font-weight: 700; line-height: 1.45; }
.mode-card .mode-arrow { margin-top: auto; color: var(--teal); font-size: 21px; font-weight: 1000; }
.gentle-note { margin: 31px 0 0; padding: 17px 21px; border-left: 5px solid var(--teal); border-radius: 0 13px 13px 0; background: #fdfaf2; color: var(--ink-soft); font-size: 13px; font-weight: 700; line-height: 1.5; }

.game-shell, .study-shell { max-width: 1040px; margin: 18px auto 40px; }
.game-head, .study-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin: 25px 0 22px; }
.game-head h1, .study-head h1 { margin: 0; font-size: clamp(38px, 5vw, 57px); line-height: 1; letter-spacing: -.065em; }
.game-head p:not(.eyebrow), .study-head p:not(.eyebrow) { max-width: 650px; margin: 13px 0 0; color: var(--ink-soft); font-size: 16px; font-weight: 700; line-height: 1.5; }
.score-badge { min-width: 125px; padding: 13px 18px; border: 2px solid var(--ink); border-radius: 15px; background: var(--sun); text-align: center; box-shadow: 4px 5px 0 var(--ink); }
.score-badge small { display: block; font-size: 11px; font-weight: 1000; letter-spacing: .1em; text-transform: uppercase; }
.score-badge strong { font-size: 29px; line-height: 1.15; }
.trail-strip { display: grid; grid-template-columns: repeat(10, 1fr); align-items: center; gap: 5px; margin: 24px 0; }
.trail-dot { display: grid; place-items: center; height: 33px; border: 2px solid #a7bab6; border-radius: 999px; background: #fffdf7; color: var(--ink-soft); font-size: 12px; font-weight: 1000; }
.trail-dot.done { border-color: var(--teal); background: var(--mint); color: var(--ink); }
.trail-dot.current { border-color: var(--ink); background: var(--sun); box-shadow: 0 0 0 3px #fff7d4; color: var(--ink); transform: scale(1.16); }
.game-card, .study-intro, .finish-card {
  border: 3px solid var(--ink);
  border-radius: 25px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.game-card { padding: clamp(24px, 4vw, 45px); }
.game-card-top { display: flex; align-items: center; gap: 15px; }
.number-stone { display: grid; place-items: center; width: 71px; height: 71px; flex: none; border: 2px solid var(--ink); border-radius: 20px 20px 12px 12px; background: var(--sun); box-shadow: 3px 4px 0 var(--ink); font-size: 34px; font-weight: 1000; }
.game-card-top small { display: block; color: var(--teal); font-size: 11px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.game-card-top h2 { margin: 3px 0 0; font-size: clamp(25px, 3vw, 35px); letter-spacing: -.05em; line-height: 1.1; }
.question-help { margin: 23px 0 17px; color: var(--ink-soft); font-size: 15px; font-weight: 700; }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.answer {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  padding: 13px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fffaf1;
  color: var(--ink);
  text-align: left;
  font-size: 16px;
  font-weight: 900;
  transition: background .15s ease, transform .15s ease;
}
.answer:hover:not(:disabled) { transform: translateY(-2px); background: #fff0c5; }
.answer .answer-icon { display: grid; place-items: center; width: 37px; height: 37px; flex: none; border: 1.5px solid #d5d8cb; border-radius: 11px; background: white; color: var(--teal); font-size: 21px; }
.answer.wrong { border-color: #d77962; background: #ffe5dd; color: #7b3c30; }
.answer.correct { border-color: var(--teal); background: var(--mint); }
.answer:disabled { cursor: default; opacity: 1; }
.game-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; min-height: 54px; margin-top: 22px; }
.text-button { padding: 7px 2px; border: 0; background: transparent; color: var(--teal); font-size: 14px; font-weight: 1000; text-decoration: underline; text-underline-offset: 4px; }
.feedback { flex: 1 1 280px; margin: 0; color: var(--ink-soft); font-size: 14px; font-weight: 800; line-height: 1.5; }
.feedback.good { color: #116f67; }
.feedback.try { color: #ad4b35; }
.hint { margin: 15px 0 0; padding: 12px 15px; border: 2px dashed #e4b755; border-radius: 12px; background: #fff2cb; font-size: 14px; font-weight: 800; }
.lesson-reveal { margin-top: 20px; padding: 18px 20px; border-radius: 15px; background: #e9f6ee; font-size: 15px; line-height: 1.55; }
.lesson-reveal strong { display: block; margin-bottom: 4px; font-size: 18px; }
.lesson-reveal p { margin: 0; }
.builder-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 26px; margin-top: 23px; }
.builder-label { margin: 0 0 11px; color: var(--ink-soft); font-size: 12px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }
.slot-list { display: grid; gap: 7px; }
.slot { display: flex; align-items: center; gap: 9px; min-height: 41px; padding: 6px 10px; border: 1.5px dashed #a9beb9; border-radius: 9px; background: #faf8f0; color: #829195; font-size: 13px; font-weight: 800; }
.slot b { display: grid; place-items: center; width: 25px; height: 25px; flex: none; border-radius: 7px; background: #e8ede9; color: var(--ink); }
.slot.filled { border-style: solid; border-color: var(--teal); background: #e7f5eb; color: var(--ink); }
.slot.next { border: 2px solid var(--orange-dark); background: #fff1d0; color: var(--ink); }
.tile-bank { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; align-content: start; }
.tile-bank .answer { min-height: 57px; padding: 9px 11px; font-size: 13px; }
.tile-bank .answer-icon { width: 29px; height: 29px; font-size: 17px; }
.builder-feedback { min-height: 26px; margin: 17px 0 0; }
.study-intro { padding: 22px 25px; background: #e9f6ee; box-shadow: 5px 6px 0 var(--ink); }
.study-intro p { margin: 0; color: #386569; font-size: 14px; font-weight: 750; line-height: 1.5; }
.study-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin: 22px 0; }
.study-card { display: flex; gap: 16px; min-height: 162px; padding: 19px; border: 2px solid var(--ink); border-radius: 18px; background: var(--white); box-shadow: 3px 4px 0 var(--ink); }
.study-card:nth-child(4n+2), .study-card:nth-child(4n+3) { background: #fff5da; }
.study-card-number { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border: 2px solid var(--ink); border-radius: 13px; background: var(--mint); font-size: 23px; font-weight: 1000; }
.study-card h2 { margin: 0 0 5px; font-size: 21px; letter-spacing: -.04em; }
.study-card p { margin: 0 0 8px; color: var(--ink-soft); font-size: 14px; font-weight: 700; line-height: 1.45; }
.study-card small { color: var(--teal); font-size: 12px; font-weight: 900; }
.study-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 30px 0 0; }
.finish-card { position: relative; max-width: 740px; margin: 65px auto 65px; padding: 50px 36px; overflow: hidden; text-align: center; background: #fffaf0; }
.finish-card::before, .finish-card::after { content: '✦'; position: absolute; color: var(--orange); font-size: 45px; }
.finish-card::before { top: 35px; left: 45px; transform: rotate(-20deg); }
.finish-card::after { top: 88px; right: 45px; color: var(--teal); transform: rotate(20deg); }
.finish-icon { display: grid; place-items: center; width: 110px; height: 110px; margin: 0 auto 23px; border: 3px solid var(--ink); border-radius: 50%; background: var(--sun); box-shadow: 5px 6px 0 var(--ink); font-size: 50px; }
.finish-card h1 { margin: 0; font-size: clamp(39px, 6vw, 66px); line-height: 1; letter-spacing: -.07em; }
.finish-card p { max-width: 490px; margin: 17px auto 25px; color: var(--ink-soft); font-size: 17px; font-weight: 750; line-height: 1.5; }
.finish-stars { margin: 14px 0; color: #e98e2c; font-size: 38px; letter-spacing: 7px; }
.finish-card .button-row { justify-content: center; }
.loading-card { padding: 70px 20px; text-align: center; }
.site-footer { display: flex; justify-content: space-between; gap: 15px; padding: 48px 0 35px; color: var(--ink-soft); font-size: 12px; font-weight: 700; line-height: 1.45; }

@media (max-width: 900px) {
  .site-header { align-items: flex-start; padding: 25px 0; }
  .header-actions { align-items: flex-end; flex-direction: column-reverse; gap: 8px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 42px 35px 12px; }
  .hero-art-wrap { max-height: 310px; }
  .hero-art { min-height: 310px; }
  .mode-grid { gap: 11px; }
  .mode-card { padding: 17px; }
}
@media (max-width: 650px) {
  .page-wrap { width: min(100% - 24px, 520px); }
  .site-header { align-items: flex-start; flex-direction: column; min-height: 0; gap: 13px; }
  .header-actions { width: 100%; align-items: center; flex-direction: row; justify-content: space-between; }
  .order-picker select { min-width: 155px; max-width: 165px; }
  .hero { border-radius: 20px; }
  .hero-copy { padding: 30px 23px 7px; }
  .hero h1 { font-size: clamp(42px, 11vw, 60px); }
  .hero p:not(.eyebrow) { font-size: 16px; }
  .hero-art-wrap { max-height: 250px; }
  .hero-art { min-height: 250px; }
  .section-head { align-items: start; flex-direction: column; margin-top: 45px; }
  .mode-grid, .study-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 165px; }
  .mode-icon { width: 44px; height: 44px; margin-bottom: 10px; font-size: 21px; }
  .mode-card small { margin: 4px 0 7px; }
  .game-head, .study-head { gap: 10px; }
  .game-head h1, .study-head h1 { font-size: 38px; }
  .score-badge { min-width: 85px; padding: 10px 7px; }
  .score-badge strong { font-size: 22px; }
  .trail-strip { gap: 3px; }
  .trail-dot { height: 29px; font-size: 10px; }
  .game-card { padding: 21px 16px; }
  .number-stone { width: 60px; height: 60px; font-size: 28px; }
  .answer-grid, .builder-layout { grid-template-columns: 1fr; }
  .answer { min-height: 61px; font-size: 15px; }
  .builder-layout { gap: 20px; }
  .tile-bank { gap: 7px; }
  .study-card { min-height: 130px; }
  .site-footer { flex-direction: column; padding-top: 42px; }
}
@media (max-width: 390px) {
  .brand strong { font-size: 21px; }
  .nav-button { padding: 8px 6px; font-size: 12px; }
  .order-picker select { min-width: 146px; max-width: 146px; font-size: 12px; }
  .tile-bank { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
