:root {
  --ink: #282365;
  --muted: #66668b;
  --purple: #6555d9;
  --purple-dark: #4437a4;
  --coral: #ff7e6b;
  --yellow: #ffd45e;
  --mint: #59d4bd;
  --cream: #fffaf0;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(42, 35, 101, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at 50% 15%, #fffdf7 0, #fff8e9 44%, #f4edff 100%);
  font-family: "Nunito", sans-serif;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }

.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.star { position: absolute; color: var(--yellow); font-size: clamp(1.5rem, 3vw, 2.8rem); filter: drop-shadow(0 4px 8px rgba(255, 190, 50, .25)); animation: twinkle 3s ease-in-out infinite; }
.star-one { top: 16%; left: 8%; }
.star-two { right: 8%; top: 30%; animation-delay: 1.2s; }
.planet { position: absolute; border-radius: 50%; opacity: .8; }
.planet-one { width: 170px; height: 170px; left: -75px; bottom: 8%; background: repeating-linear-gradient(-20deg, #9ee5d7 0 18px, #80dac8 18px 34px); }
.planet-two { width: 120px; height: 120px; right: -50px; top: 8%; background: #c6bcff; box-shadow: inset 20px -15px 0 #b4a7fa; }

.shell { position: relative; z-index: 1; width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 52px; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand, .sound-button, .report-button { border: 0; background: transparent; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 11px; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 1.12rem; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--purple); border-radius: 12px 12px 16px 12px; font-size: 1.7rem; line-height: 1; box-shadow: 0 7px 0 #d7d0ff; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.report-button { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; color: var(--purple-dark); background: rgba(255,255,255,.72); border-radius: 99px; box-shadow: 0 8px 25px rgba(42,35,101,.1); font-weight: 800; }
.report-button > span:first-child { font-size: 1.15rem; }
.sound-button { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.7); box-shadow: 0 8px 25px rgba(42,35,101,.1); }
.sound-button svg { width: 23px; fill: var(--ink); }
.sound-off { display: none; }
.sound-button[aria-pressed="false"] .sound-on { display: none; }
.sound-button[aria-pressed="false"] .sound-off { display: block; }

.screen { display: none; animation: screenIn .45s ease both; }
.screen.is-active { display: block; }
.welcome-screen { padding-top: clamp(48px, 8vh, 92px); }
.hero-copy { max-width: 650px; margin: 0 auto 30px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--purple); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .76rem; }
.centered { display: flex; justify-content: center; }
h1, h2 { font-family: "Baloo 2", sans-serif; margin: 0; line-height: 1; }
h1 { margin-top: 12px; font-size: clamp(3rem, 8vw, 5.4rem); letter-spacing: -.045em; }
.hero-copy p { margin: 18px auto 0; color: var(--muted); font-size: clamp(1.03rem, 2.2vw, 1.24rem); max-width: 580px; line-height: 1.55; }

.choice-card, .quiz-card, .result-card { background: rgba(255,255,255,.9); border: 2px solid rgba(255,255,255,.8); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.choice-card { width: min(710px, 100%); margin: 0 auto; border-radius: 34px; padding: clamp(24px, 5vw, 42px); }
.choice-card h2 { font-size: 1.5rem; margin-bottom: 20px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-button { display: flex; align-items: center; gap: 14px; padding: 17px; text-align: left; background: var(--cream); border: 2px solid transparent; border-radius: 20px; cursor: pointer; transition: transform .18s, border-color .18s, background .18s; }
.mode-button:hover { transform: translateY(-2px); }
.mode-button.is-selected { border-color: var(--purple); background: #f2efff; }
.mode-icon { display: grid; place-items: center; flex: 0 0 46px; height: 46px; border-radius: 14px; color: white; background: var(--coral); font-size: 1.35rem; }
.mode-button:last-child .mode-icon { background: var(--mint); }
.mode-button strong, .mode-button small { display: block; }
.mode-button strong { font-size: 1rem; }
.mode-button small { margin-top: 3px; color: var(--muted); }
.table-picker { margin-top: 24px; }
.table-picker p { margin: 0 0 10px; font-weight: 800; }
.number-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.table-number { aspect-ratio: 1; border: 0; border-radius: 13px; background: #f1eff7; font-family: "Baloo 2"; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.table-number:hover, .table-number.is-selected { color: white; background: var(--purple); }
.primary-button, .check-button, .next-button { border: 0; cursor: pointer; font-weight: 800; transition: transform .16s, box-shadow .16s; }
.primary-button { display: flex; justify-content: center; align-items: center; gap: 14px; width: 100%; margin-top: 28px; padding: 17px 24px; color: white; background: var(--purple); border-radius: 16px; box-shadow: 0 7px 0 var(--purple-dark); font-size: 1.08rem; }
.primary-button:hover, .check-button:hover, .next-button:hover { transform: translateY(-2px); }
.primary-button:active, .check-button:active, .next-button:active { transform: translateY(3px); box-shadow: none; }
.gentle-note { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: .9rem; }
.local-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; color: #7b7894; font-size: .78rem; }

.quiz-screen { padding-top: clamp(34px, 6vh, 65px); }
.progress-row { width: min(680px, 100%); margin: 0 auto 18px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 20px; }
.progress-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .82rem; font-weight: 800; }
.progress-track { height: 10px; overflow: hidden; background: #e8e3f4; border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--mint), var(--purple)); border-radius: inherit; transition: width .45s ease; }
.streak-pill { padding: 8px 13px; border-radius: 99px; background: #fff2df; font-size: .86rem; }
.quiz-card { position: relative; width: min(680px, 100%); min-height: 475px; margin: 0 auto; padding: 52px clamp(22px, 7vw, 72px) 40px; border-radius: 38px; text-align: center; }
.mascot-wrap { position: absolute; top: -35px; left: 50%; transform: translateX(-50%); }
.mascot { position: relative; width: 72px; height: 68px; background: var(--yellow); border: 4px solid var(--ink); border-radius: 45% 45% 40% 40%; transition: transform .25s; }
.mascot.correct { animation: mascotHop .55s ease; }
.antenna { position: absolute; width: 4px; height: 17px; top: -17px; left: 31px; background: var(--ink); }
.antenna::after { content: ""; position: absolute; width: 10px; height: 10px; left: -3px; top: -6px; border-radius: 50%; background: var(--coral); border: 2px solid var(--ink); }
.eye { position: absolute; top: 25px; width: 7px; height: 9px; border-radius: 50%; background: var(--ink); }
.eye-left { left: 19px; } .eye-right { right: 19px; }
.smile { position: absolute; width: 20px; height: 10px; left: 22px; top: 40px; border-bottom: 3px solid var(--ink); border-radius: 50%; }
.prompt { margin: 22px 0 3px; color: var(--muted); font-weight: 800; }
.question { display: flex; align-items: center; justify-content: center; gap: clamp(18px, 4vw, 34px); font-family: "Baloo 2"; font-size: clamp(4.7rem, 14vw, 7.5rem); font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.times { color: var(--coral); font-size: .72em; }
#answerForm label { display: block; margin: 10px 0 7px; color: var(--muted); font-size: .86rem; font-weight: 800; }
.answer-row { display: grid; grid-template-columns: 1fr auto; gap: 11px; max-width: 370px; margin: 0 auto; }
#answerInput { min-width: 0; width: 100%; padding: 12px 16px; color: var(--ink); background: #fbfaf6; border: 3px solid #ded9ef; border-radius: 15px; outline: none; text-align: center; font-family: "Baloo 2"; font-size: 1.8rem; font-weight: 800; }
#answerInput:focus { border-color: var(--purple); box-shadow: 0 0 0 5px #eeeaff; }
#answerInput.is-correct { border-color: var(--mint); background: #edfff9; }
#answerInput.is-wrong { border-color: var(--coral); background: #fff1ee; }
.check-button, .next-button { padding: 12px 20px; color: white; background: var(--coral); border-radius: 15px; box-shadow: 0 5px 0 #d85e4d; }
.next-button { display: inline-flex; margin-top: 14px; gap: 8px; background: var(--purple); box-shadow: 0 5px 0 var(--purple-dark); }
.next-button[hidden] { display: none; }
.feedback { min-height: 27px; margin-top: 15px; color: var(--muted); font-weight: 800; }
.feedback.good { color: #238b79; }
.feedback.try { color: #c95848; }
.quiet-button { display: block; margin: 22px auto 0; padding: 8px 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; text-decoration: underline; text-decoration-color: #cfc9df; text-underline-offset: 4px; }

.result-screen { padding-top: clamp(42px, 7vh, 78px); }
.result-card { width: min(650px, 100%); margin: 0 auto; padding: clamp(30px, 6vw, 55px); border-radius: 38px; text-align: center; }
.result-badge { display: grid; place-items: center; width: 92px; height: 92px; margin: -9px auto 20px; color: var(--ink); background: var(--yellow); border: 5px solid var(--ink); border-radius: 50%; font-size: 2.7rem; box-shadow: 0 10px 0 #f0bb31; animation: badgeIn .6s cubic-bezier(.2,.9,.3,1.3); }
.result-card h1 { margin-top: 8px; font-size: clamp(2.6rem, 7vw, 4.4rem); }
.result-card > p:not(.eyebrow) { max-width: 470px; margin: 14px auto 0; color: var(--muted); line-height: 1.55; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 27px 0; }
.result-stats div { padding: 19px 10px; background: #f6f3ff; border-radius: 18px; }
.result-stats strong, .result-stats span { display: block; }
.result-stats strong { font-family: "Baloo 2"; font-size: 2.1rem; line-height: 1; }
.result-stats span { color: var(--muted); font-size: .82rem; font-weight: 800; }
.review-box { display: flex; gap: 13px; align-items: center; padding: 16px; text-align: left; background: #edfff9; border-radius: 18px; }
.review-box > span { font-size: 1.8rem; }
.review-box p, .review-box strong, .review-box span { margin: 0; display: block; }
.review-box p span { margin-top: 2px; color: var(--muted); }

.report-screen { padding-top: clamp(42px, 7vh, 72px); }
.report-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.report-heading h1 { margin-top: 8px; font-size: clamp(2.55rem, 6.8vw, 4.6rem); }
.report-heading > div > p:last-child { margin: 10px 0 0; color: var(--muted); }
.close-report { flex: 0 0 auto; padding: 10px 16px; color: var(--ink); background: white; border: 2px solid #ded9ef; border-radius: 13px; cursor: pointer; font-weight: 800; }
.report-empty { width: min(620px, 100%); margin: 50px auto 0; padding: clamp(30px, 6vw, 54px); background: rgba(255,255,255,.9); border-radius: 34px; box-shadow: var(--shadow); text-align: center; }
.report-empty > span { font-size: 3rem; }
.report-empty h2 { margin-top: 12px; font-size: 2rem; }
.report-empty p { max-width: 460px; margin: 12px auto 0; color: var(--muted); line-height: 1.55; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-grid article { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 13px; padding: 19px; background: rgba(255,255,255,.9); border-radius: 21px; box-shadow: 0 12px 35px rgba(42,35,101,.09); }
.summary-icon { display: grid; grid-row: 1 / 3; place-items: center; width: 47px; height: 47px; color: white; border-radius: 15px; font-size: 1.25rem; font-weight: 900; }
.summary-icon.purple { background: var(--purple); }
.summary-icon.mint { background: var(--mint); }
.summary-icon.coral { background: var(--coral); }
.summary-grid strong { font-family: "Baloo 2"; font-size: 2rem; line-height: .9; }
.summary-grid small { color: var(--muted); font-weight: 800; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.report-card { padding: clamp(22px, 4vw, 34px); background: rgba(255,255,255,.92); border-radius: 27px; box-shadow: 0 15px 45px rgba(42,35,101,.1); }
.report-card h2 { margin-top: 8px; font-size: 1.8rem; }
.card-intro { margin: 9px 0 0; color: var(--muted); line-height: 1.45; }
.focus-list { display: grid; gap: 9px; margin: 20px 0 0; padding: 0; list-style: none; }
.focus-list li { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; min-height: 49px; padding: 9px 12px; background: #fff6e6; border-radius: 14px; }
.focus-list li > span:last-child { color: var(--muted); text-align: right; font-size: .8rem; font-weight: 700; }
.focus-rank { display: grid; place-items: center; width: 27px; height: 27px; color: #9b551d; background: #ffe1a4; border-radius: 9px; font-weight: 900; }
.focus-list .focus-empty { display: block; padding: 17px; color: #287f70; background: #edfff9; line-height: 1.45; }
.table-bars { display: grid; gap: 8px; margin-top: 18px; }
.table-bar-row { display: grid; grid-template-columns: 35px 1fr 38px; align-items: center; gap: 8px; }
.table-bar-row strong, .table-bar-row small { font-size: .78rem; }
.table-bar-row small { color: var(--muted); text-align: right; font-weight: 800; }
.bar-track { height: 8px; overflow: hidden; background: #eae6f4; border-radius: 99px; }
.bar-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--purple)); border-radius: inherit; }
.heatmap-card { margin-top: 18px; }
.heatmap-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: var(--muted); font-size: .75rem; font-weight: 800; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; }
.heatmap-scroll { margin-top: 20px; overflow-x: auto; padding-bottom: 8px; }
.heatmap { display: grid; grid-template-columns: 28px repeat(12, minmax(44px, 1fr)); gap: 6px; min-width: 675px; }
.heatmap-label, .heatmap-cell { display: grid; place-items: center; min-height: 34px; border-radius: 8px; font-size: .69rem; font-weight: 900; }
.heatmap-label { color: var(--muted); }
.heatmap-label.corner { color: var(--purple); font-size: 1.1rem; }
.heatmap-cell { color: var(--ink); }
.level-new { background: #f0edf5; }
.level-growing { background: #ffdca0; }
.level-strong { background: #91e2d2; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 20px 0 0; color: var(--muted); text-align: center; font-size: .8rem; }

.celebration { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 1.4s ease-in forwards; }

@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes twinkle { 50% { transform: scale(.72) rotate(15deg); opacity: .45; } }
@keyframes mascotHop { 40% { transform: translateY(-13px) rotate(-4deg); } 70% { transform: rotate(4deg); } }
@keyframes badgeIn { from { opacity: 0; transform: scale(.3) rotate(-20deg); } }
@keyframes fall { to { transform: translate3d(var(--drift), 105vh, 0) rotate(720deg); opacity: .4; } }

@media (max-width: 620px) {
  .shell { width: min(100% - 22px, 1040px); padding-top: 13px; }
  .brand { font-size: .97rem; }
  .brand-mark { width: 34px; height: 34px; }
  .report-button { width: 42px; padding: 0; justify-content: center; }
  .report-button > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mode-grid { grid-template-columns: 1fr; }
  .number-grid { grid-template-columns: repeat(5, 1fr); }
  .welcome-screen { padding-top: 40px; }
  .choice-card { border-radius: 26px; }
  .progress-row { grid-template-columns: 1fr; gap: 10px; }
  .streak-pill { justify-self: end; grid-row: 1; }
  .quiz-card { min-height: 445px; padding-top: 45px; border-radius: 28px; }
  .answer-row { grid-template-columns: 1fr; }
  .check-button { min-height: 48px; }
  .result-card { border-radius: 28px; }
  .report-heading { align-items: flex-start; }
  .report-heading h1 { font-size: 2.7rem; }
  .summary-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .focus-list li { grid-template-columns: auto auto; }
  .focus-list li > span:last-child { grid-column: 2; text-align: left; }
  .heatmap-title { align-items: flex-start; flex-direction: column; }
  .legend { justify-content: flex-start; }
}

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