:root {
  --blue: #43b9ff;
  --deep-blue: #2868d8;
  --yellow: #ffd84d;
  --coral: #ff6f74;
  --green: #4ed69a;
  --purple: #a76cff;
  --ink: #263557;
  --paper: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 8px;
  overflow-x: hidden;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255,216,77,.5), transparent 25%),
    radial-gradient(circle at 90% 85%, rgba(167,108,255,.35), transparent 28%),
    linear-gradient(160deg, #dff6ff, #fff7d9 55%, #ffe4ec);
}

button { font: inherit; -webkit-tap-highlight-color: transparent; }
.app { width: min(100%, 650px); margin: 0 auto; }
.screen { display: none; min-height: calc(100vh - 16px); padding: 16px; border-radius: 25px; background: rgba(255,255,255,.94); box-shadow: 0 16px 45px rgba(38,53,87,.14); }
.screen.active { display: block; animation: screen-in .35s ease both; }

@keyframes screen-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.home-screen { position: relative; overflow: hidden; isolation: isolate; background: #66c8ff; }
.home-backdrop { position: absolute; inset: 0; z-index: -2; }
.home-backdrop img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.home-screen::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg,rgba(26,104,182,.1) 0%,rgba(255,255,255,0) 37%,rgba(42,103,170,.08) 100%); }
.home-content { min-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.home-heading { text-align: center; text-shadow: 0 2px 7px rgba(255,255,255,.8); }
.stage-label { width: max-content; margin: 2px auto 5px; padding: 5px 11px; border: 2px solid rgba(255,255,255,.75); border-radius: 999px; color: #765200; background: rgba(255,240,168,.9); box-shadow: 0 6px 16px rgba(38,53,87,.12); font-size: 11px; font-weight: 900; }
h1 { min-height: 38px; margin: 0; text-align: center; color: #fff; white-space: nowrap; letter-spacing: -.45px; font-size: clamp(17px,5.4vw,32px); line-height: 1.18; text-shadow: 0 3px 0 rgba(40,104,216,.62),0 7px 18px rgba(38,53,87,.32); }
.home-heading h1.typing::after { content: "|"; margin-left: 2px; color: var(--yellow); animation: cursor-blink .7s steps(1) infinite; }
@keyframes cursor-blink { 50% { opacity: 0; } }
.intro { width: max-content; max-width: 100%; margin: 5px auto 0; padding: 4px 10px; border-radius: 999px; text-align: center; color: #34476b; background: rgba(255,255,255,.76); box-shadow: 0 5px 14px rgba(38,53,87,.08); font-size: 13px; font-weight: 800; }
.home-learning-area { margin-top: auto; }
.stage-tabs { width: min(100%,260px); display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; margin: 0 auto 6px; padding: 3px; border: 2px solid rgba(255,255,255,.78); border-radius: 15px; background: rgba(255,255,255,.62); box-shadow: 0 8px 20px rgba(38,53,87,.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.stage-tab { min-height: 32px; border: 0; border-radius: 10px; color: var(--deep-blue); background: transparent; cursor: pointer; font-size: 13px; font-weight: 900; transition: transform .15s,background .15s,color .15s; }
.stage-tab:active { transform: scale(.96); }
.stage-tab.active { color: #fff; background: linear-gradient(135deg,var(--deep-blue),var(--purple)); box-shadow: 0 6px 13px rgba(40,104,216,.25); }
.stage-panel { display: none; gap: 7px; }
.stage-panel.active { display: grid; animation: panel-in .28s ease both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.module-card { position: relative; overflow: hidden; display: grid; grid-template-columns: 82px 1fr; grid-template-areas: "symbol title" "symbol actions" "progress progress"; gap: 4px 8px; align-items: center; padding: 7px 9px 6px; border: 2px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 10px 23px rgba(38,53,87,.17); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.module-card::after { content: ""; position: absolute; width: 120px; height: 120px; left: -42px; bottom: -58px; border-radius: 50%; background: rgba(255,255,255,.33); }
.letters-card { background: linear-gradient(135deg,rgba(224,242,255,.88),rgba(241,230,255,.88)); }
.numbers-card { background: linear-gradient(135deg,rgba(255,241,189,.9),rgba(220,249,233,.9)); }
.module-symbol { grid-area: symbol; width: 100%; margin: 0; padding: 9px 5px; border-radius: 13px; color: #fff; background: linear-gradient(135deg,var(--coral),var(--purple)); box-shadow: 0 7px 15px rgba(167,108,255,.24); text-align: center; white-space: nowrap; font-size: 19px; font-weight: 900; direction: ltr; }
.numbers-card .module-symbol { background: linear-gradient(135deg,var(--green),var(--deep-blue)); }
.lowercase-symbol { text-transform: lowercase; }
.tens-symbol { font-size: 22px; }
.module-card h2 { grid-area: title; margin: 0; text-align: left; font-size: 15px; line-height: 1.12; }
.module-card p { display: none; }
.module-actions { grid-area: actions; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.action-button, .big-button, .secondary-button, .icon-button { border: 0; cursor: pointer; font-weight: 900; }
.action-button { min-height: 35px; border-radius: 10px; color: var(--ink); box-shadow: 0 5px 11px rgba(38,53,87,.1); font-size: 13px; transition: transform .15s; }
.action-button:active { transform: scale(.96); }
.learn-button { background: #fff; }
.quiz-button { color: #fff; background: linear-gradient(135deg,var(--deep-blue),var(--purple)); }
.action-icon { margin-right: 3px; font-size: 15px; }
.module-progress { grid-area: progress; margin-top: 1px; color: #7b668c; text-align: center; font-size: 10px; font-weight: 800; }
.designer-credit { width: max-content; max-width: 100%; margin: 5px auto 0; padding: 3px 10px; border: 1px solid rgba(255,255,255,.82); border-radius: 999px; color: #34476b; background: rgba(255,255,255,.8); box-shadow: 0 5px 14px rgba(38,53,87,.12); text-align: center; font-size: 10px; font-weight: 900; }

.word-category-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }
.word-module { min-width: 0; display: grid; grid-template-columns: 42px 1fr; grid-template-areas: "icon title" "actions actions" "progress progress"; gap: 4px 6px; align-items: center; padding: 7px; border: 2px solid rgba(255,255,255,.9); border-radius: 15px; background: rgba(255,255,255,.84); box-shadow: 0 8px 18px rgba(38,53,87,.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.word-module-icon { grid-area: icon; width: 42px; height: 42px; overflow: hidden; border: 2px solid rgba(255,255,255,.92); border-radius: 12px; background: #fff; box-shadow: 0 4px 10px rgba(38,53,87,.13); }
.word-module-icon img { width: 100%; height: 100%; display: block; object-fit: cover; }
.word-module h2 { grid-area: title; margin: 0; font-size: 13px; line-height: 1.05; }
.word-module-actions { grid-area: actions; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.word-module .action-button { min-height: 30px; font-size: 11px; }
.word-module .module-progress { grid-area: progress; font-size: 8.5px; }
.animals-card { background: linear-gradient(135deg,rgba(255,232,193,.92),rgba(255,248,224,.88)); }
.vegetables-card { background: linear-gradient(135deg,rgba(214,250,223,.92),rgba(239,255,231,.88)); }
.fruits-card { background: linear-gradient(135deg,rgba(255,232,190,.94),rgba(255,219,225,.9)); }
.social-card { background: linear-gradient(135deg,rgba(222,244,255,.92),rgba(229,236,255,.88)); }
.mixed-card { background: linear-gradient(135deg,rgba(255,242,191,.92),rgba(226,250,246,.88)); }

.top-bar, .quiz-header { display: grid; grid-template-columns: 50px 1fr 50px; gap: 8px; align-items: center; }
.top-bar h2 { margin: 0; text-align: center; font-size: 21px; }
.icon-button { width: 50px; height: 50px; border-radius: 16px; background: #eef6ff; font-size: 23px; box-shadow: 0 6px 13px rgba(38,53,87,.1); }
.instruction-video-panel { position: relative; width: min(190px,52vw); aspect-ratio: 1; margin: 12px auto 10px; overflow: hidden; border: 6px solid #fff; border-radius: 24px; background: #eef8ff; box-shadow: 0 12px 26px rgba(38,53,87,.2); }
.instruction-video-panel[hidden] { display: none; }
.instruction-video-panel video { width: 100%; height: 100%; display: block; object-fit: cover; cursor: pointer; }
.video-tap-label { position: absolute; left: 50%; bottom: 10px; display: none; padding: 7px 13px; border-radius: 999px; color: #fff; background: rgba(38,53,87,.82); transform: translateX(-50%); pointer-events: auto; cursor: pointer; border: 0; white-space: nowrap; font-size: 13px; font-weight: 900; }
.instruction-video-panel.needs-tap .video-tap-label { display: block; animation: start-pulse 1s ease-in-out infinite alternate; }
.mascot-tip { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 20px auto 14px; font-size: 30px; }
.mascot-tip[hidden] { display: none; }
.mini-mascot { animation: pencil-bob 1.7s ease-in-out infinite; }
.tap-hand { animation: tap 1.2s ease-in-out infinite; }
.sound-waves { color: var(--deep-blue); direction: ltr; font-size: 17px; font-weight: 900; }
@keyframes pencil-bob { 50% { transform: translateY(-7px) rotate(5deg); } }
@keyframes tap { 50% { transform: translateY(6px) scale(.92); } }
.learn-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 9px; }
.learn-tile { aspect-ratio: 1; display: grid; place-items: center; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; color: #fff; cursor: pointer; font: 900 clamp(25px,8vw,37px)/1 Arial,sans-serif; box-shadow: 0 8px 15px rgba(38,53,87,.12); transition: transform .15s, filter .15s; }
.learn-tile:nth-child(5n+1) { background: var(--coral); }
.learn-tile:nth-child(5n+2) { background: var(--deep-blue); }
.learn-tile:nth-child(5n+3) { background: var(--green); }
.learn-tile:nth-child(5n+4) { background: var(--purple); }
.learn-tile:nth-child(5n) { background: #f1aa28; }
.learn-tile.playing { transform: scale(1.13) rotate(-3deg); filter: brightness(1.08); outline: 5px solid rgba(255,216,77,.55); }
.learn-grid.words-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px 6px; }
.word-learn-tile { position: relative; min-width: 0; aspect-ratio: auto; display: grid; grid-template-rows: auto 1fr; place-items: center; align-items: start; padding: 0; overflow: visible; border: 0; border-radius: 0; color: var(--ink); background: transparent; box-shadow: none; font: inherit; }
.word-learn-tile:nth-child(5n+1), .word-learn-tile:nth-child(5n+2), .word-learn-tile:nth-child(5n+3), .word-learn-tile:nth-child(5n+4), .word-learn-tile:nth-child(5n) { background: transparent; }
.word-picture { width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; place-items: center; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.word-picture img { width: 100%; height: 100%; min-height: 0; display: block; object-fit: contain; border-radius: 0; }
.word-learn-tile .word-picture { width: min(100%,92px); height: auto; aspect-ratio: 1; }
.word-label { width: 100%; padding: 6px 2px 0; color: var(--deep-blue); text-align: center; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; font-size: clamp(12px,3.2vw,15px); }
.word-learn-tile.playing { transform: none; filter: brightness(1.05); outline: none; }
.word-learn-tile.playing .word-label { color: #8b5d00; }
.word-learn-tile:focus-visible { outline: 3px solid var(--deep-blue); outline-offset: 3px; }
.color-swatch { width: clamp(62px,20vw,92px); height: clamp(62px,20vw,92px); display: block; border: 7px solid rgba(255,255,255,.92); border-radius: 50%; box-shadow: 0 9px 19px rgba(38,53,87,.18), inset 0 0 0 2px rgba(0,0,0,.06); }
.light-swatch { box-shadow: 0 9px 19px rgba(38,53,87,.18), inset 0 0 0 3px #d7dce7; }
.big-button, .secondary-button { width: 100%; min-height: 55px; margin-top: 18px; border-radius: 17px; }
.big-button { color: #fff; background: linear-gradient(135deg,var(--coral),#ec4ba4); box-shadow: 0 10px 20px rgba(236,75,164,.24); font-size: 18px; }
.secondary-button { color: var(--deep-blue); background: #edf6ff; }

.quiz-screen { position: relative; overflow: hidden; background: linear-gradient(160deg,#eefaff,#fff7d5 60%,#f3e9ff); }
.quiz-screen::before, .quiz-screen::after { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; opacity: .35; animation: bubble-drift 6s ease-in-out infinite alternate; }
.quiz-screen::before { top: 100px; right: -120px; background: var(--blue); }
.quiz-screen::after { bottom: 70px; left: -125px; background: var(--coral); animation-delay: -3s; }
@keyframes bubble-drift { to { transform: translate(25px,35px) scale(1.15); } }
.quiz-screen > * { position: relative; z-index: 1; }
.quiz-header { grid-template-columns: 50px 1fr 1fr; }
.quiz-stat { min-height: 50px; display: flex; justify-content: center; align-items: center; gap: 8px; border-radius: 16px; background: rgba(255,255,255,.86); box-shadow: 0 6px 13px rgba(38,53,87,.08); }
.quiz-stat b { color: var(--deep-blue); font-size: 19px; }
.progress-track { height: 10px; margin: 15px 0; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.78); direction: ltr; }
.progress-bar { height: 100%; width: 10%; border-radius: inherit; background: linear-gradient(90deg,var(--yellow),var(--green),var(--blue)); transition: width .3s; }
.question-zone { min-height: 230px; display: grid; place-items: center; align-content: center; position: relative; }
.quiz-video-panel { width: min(205px,56vw); margin: 0; }
.replay-button { position: relative; width: 132px; height: 132px; display: grid; place-items: center; border: 7px solid #fff; border-radius: 50%; background: linear-gradient(145deg,var(--blue),var(--deep-blue)); cursor: pointer; box-shadow: 0 17px 32px rgba(40,104,216,.28); }
.replay-button[hidden], .replay-dots[hidden] { display: none; }
.speaker { position: relative; z-index: 3; font-size: 55px; }
.pulse { position: absolute; inset: -5px; border: 4px solid rgba(67,185,255,.45); border-radius: 50%; animation: pulse 1.8s ease-out infinite; }
.pulse-two { animation-delay: -.9s; }
@keyframes pulse { to { transform: scale(1.5); opacity: 0; } }
.replay-button.playing { animation: speaker-pop .55s ease-in-out infinite alternate; }
@keyframes speaker-pop { to { transform: scale(1.06); } }
.replay-dots { margin-top: 13px; color: var(--purple); letter-spacing: 6px; animation: dots 1.2s ease-in-out infinite; }
@keyframes dots { 50% { opacity: .3; } }
.quiz-answers { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; direction: ltr; }
.answer-button { min-height: 105px; border: 4px solid #fff; border-radius: 23px; color: #fff; cursor: pointer; font: 900 clamp(36px,12vw,58px)/1 Arial,sans-serif; box-shadow: 0 12px 22px rgba(38,53,87,.15); transition: transform .15s; }
.answer-button:nth-child(1) { background: var(--coral); }
.answer-button:nth-child(2) { background: var(--deep-blue); }
.answer-button:nth-child(3) { color: #6f5100; background: var(--yellow); }
.answer-button:active:not(:disabled) { transform: scale(.95); }
.answer-button.correct { color: #fff; background: #20b978; outline: 7px solid rgba(78,214,154,.3); animation: correct-bounce .45s ease; }
.answer-button.wrong { background: #e74759; animation: wrong-shake .35s ease; }
.word-quiz-answers { gap: 9px; }
.answer-button.word-answer { min-height: 128px; display: grid; place-items: center; padding: 7px; background: rgba(255,255,255,.9); }
.answer-button.word-answer:nth-child(1), .answer-button.word-answer:nth-child(2), .answer-button.word-answer:nth-child(3) { color: inherit; background: rgba(255,255,255,.9); }
.answer-button.word-answer .quiz-picture { min-height: 92px; }
.answer-button.word-answer .quiz-picture img { min-height: 92px; object-fit: contain; }
.answer-button.word-answer.correct { background: #c8f5dc; }
.answer-button.word-answer.wrong { background: #ffd9dc; }
@keyframes correct-bounce { 50% { transform: scale(1.12); } }
@keyframes wrong-shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.feedback { min-height: 55px; display: grid; place-items: center; text-align: center; color: var(--deep-blue); font-size: clamp(22px,7vw,35px); font-weight: 900; }

.result-screen { text-align: center; background: linear-gradient(155deg,#e6f8ff,#fff8d6,#f4e8ff); }
.celebration { margin-top: 40px; font-size: 84px; animation: trophy 1.1s ease-in-out infinite alternate; }
@keyframes trophy { to { transform: translateY(-9px) rotate(5deg); } }
.result-screen h2 { margin: 8px 0; color: var(--deep-blue); font-size: 35px; }
.result-stars { margin: 8px 0 20px; font-size: 36px; letter-spacing: 7px; }
.score-bubble { width: 145px; height: 145px; display: grid; place-content: center; margin: 0 auto; border: 9px solid #fff; border-radius: 50%; background: var(--yellow); box-shadow: 0 13px 26px rgba(38,53,87,.14); }
.score-bubble b { display: block; color: #8b5d00; font-size: 48px; line-height: 1; }
.score-bubble span { margin-top: 8px; color: #765c22; font-weight: 800; }
.result-screen p { color: #687693; font-weight: 800; }

@media (max-width: 420px) {
  body { padding: 0; }
  .screen { min-height: 100vh; border-radius: 0; padding: 12px; }
  .home-content { min-height: calc(100vh - 24px); }
  .learn-grid { grid-template-columns: repeat(4,1fr); gap: 7px; }
  .learn-tile { border-radius: 15px; }
  .answer-button { min-height: 92px; border-radius: 19px; }
  .question-zone { min-height: 210px; }
  .word-category-grid { gap: 6px; }
  .word-module { grid-template-columns: 36px 1fr; padding: 6px; gap: 3px 5px; }
  .word-module-icon { width: 36px; height: 36px; font-size: 22px; }
  .word-module h2 { font-size: 12px; }
  .word-module .action-button { min-height: 29px; font-size: 10.5px; }
  .answer-button.word-answer { min-height: 105px; }
}

@media (max-height: 740px) {
  .home-heading h1 { min-height: 30px; font-size: clamp(16px,5.2vw,28px); }
  .stage-label { margin-bottom: 4px; padding: 5px 12px; font-size: 13px; }
  .intro { margin-top: 4px; padding: 4px 10px; font-size: 13px; }
  .stage-tabs { margin-bottom: 5px; padding: 2px; }
  .stage-tab { min-height: 29px; font-size: 12px; }
  .stage-panel { gap: 5px; }
  .module-card { padding: 5px 8px 4px; border-radius: 15px; }
  .module-symbol { padding: 7px 4px; font-size: 17px; }
  .module-card h2 { margin: 0; font-size: 14px; }
  .module-card p { display: none; }
  .action-button { min-height: 32px; font-size: 12px; }
  .module-progress { margin-top: 0; font-size: 9px; }
  .designer-credit { margin-top: 4px; padding: 2px 9px; font-size: 9px; }
  .word-module { padding: 5px 6px; }
  .word-module-icon { width: 34px; height: 34px; font-size: 20px; }
  .word-module .action-button { min-height: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Expanded vocabulary: compact, three-column learning cards on every phone. */
.stage-word-count { margin: 0 0 7px; text-align: center; font-size: 11px; font-weight: 900; color: #34476b; }
.word-module h2 small { display: block; margin-top: 3px; font-size: 9px; color: #536581; }
.basic-card { background: linear-gradient(135deg,rgba(227,239,255,.95),rgba(240,226,255,.92)); }
.word-picture { position: relative; }
.word-photo-atlas { display: block; width: 100%; height: 100%; overflow: hidden; }
.word-learn-tile .word-label { min-height: 24px; padding-top: 5px; }
@media (max-width: 420px) {
  .learn-grid.words-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px 6px; }
  .word-learn-tile { border-radius: 0; }
  .word-module h2 small { font-size: 8px; }
}

.answer-button.word-answer .quiz-picture { width: min(100%,180px); height: auto; min-height: 0; aspect-ratio: 1; }
.answer-button.word-answer .quiz-picture img { min-height: 0; }

/* Transparent complete pictures: no answer-card frame, white block or shadow. */
.word-module-icon svg { display: block; width: 100%; height: 100%; }
.answer-button.word-answer,
.answer-button.word-answer:nth-child(1),
.answer-button.word-answer:nth-child(2),
.answer-button.word-answer:nth-child(3) {
  position: relative; border: 0; border-radius: 0; background: transparent;
  padding: 2px; box-shadow: none; outline: none;
}
.answer-button.word-answer.correct,
.answer-button.word-answer.wrong { background: transparent; outline: none; box-shadow: none; }
.answer-button.word-answer.correct::after,
.answer-button.word-answer.wrong::after { position: absolute; right: 1px; bottom: 0; font: 900 28px/1 Arial,sans-serif; }
.answer-button.word-answer.correct::after { content: '✓'; color: #20b978; }
.answer-button.word-answer.wrong::after { content: '×'; color: #e74759; }
.answer-button.word-answer:focus-visible { outline: 2px solid var(--deep-blue); outline-offset: 2px; }
.quiz-video-panel { border: 0; border-radius: 0; box-shadow: none; }

/* Two letter quizzes share one row in the menu and learning screen. */
.letters-actions .learn-button { grid-column: 1 / -1; }
.letters-card { grid-template-areas: "symbol title" "symbol actions" ". progress"; }
.letter-progress-row { grid-area: progress; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.letter-progress-row .module-progress { grid-area: auto; min-width: 0; }
.quiz-action-row { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; margin-top: 18px; }
.quiz-action-row.has-letter-match { grid-template-columns: repeat(2,minmax(0,1fr)); }
.quiz-action-row .big-button { min-width: 0; margin-top: 0; font-size: clamp(14px,4vw,18px); }
.lowercase-quiz-button { color: #fff; background: linear-gradient(135deg,#2684df,#6752d3); }
.letter-match-quiz .question-zone { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.letter-match-prompt { min-width: 0; text-align: center; color: var(--deep-blue); }
.letter-match-prompt p { margin: 0 0 6px; font-size: clamp(13px,3.5vw,18px); font-weight: 800; }
.letter-match-prompt strong { display: block; font: 900 clamp(76px,24vw,120px)/1.1 Arial,sans-serif; }
.letter-match-quiz .quiz-video-panel { width: min(140px,100%); }
.letter-match-quiz .answer-button { font-family: 'Trebuchet MS',Arial,sans-serif; }

/* The shared logo is part of the game frame, below its scrolling content. */
body.aq-games-enabled .app {
  --aq-site-logo-height: calc(min(calc(100vw - 16px),650px) * 0.098382749326);
  height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 25px;
  box-shadow: 0 16px 45px rgba(38,53,87,.14);
}
.game-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; }
body.aq-games-enabled .screen { min-height: 100%; border-radius: 0; box-shadow: none; }
body.aq-games-enabled .home-content { min-height: calc(100vh - 16px - var(--aq-site-logo-height) - 32px); }
@supports (height: 100svh) {
  body.aq-games-enabled .app { height: calc(100svh - 16px); }
  body.aq-games-enabled .home-content { min-height: calc(100svh - 16px - var(--aq-site-logo-height) - 32px); }
}
@media (max-width: 420px) {
  body.aq-games-enabled .app { --aq-site-logo-height: calc(100vw * 0.098382749326); height: calc(100vh - env(safe-area-inset-bottom,0px)); border-radius: 0; }
  body.aq-games-enabled .home-content { min-height: calc(100vh - env(safe-area-inset-bottom,0px) - var(--aq-site-logo-height) - 24px); }
  @supports (height: 100svh) {
    body.aq-games-enabled .app { height: calc(100svh - env(safe-area-inset-bottom,0px)); }
    body.aq-games-enabled .home-content { min-height: calc(100svh - env(safe-area-inset-bottom,0px) - var(--aq-site-logo-height) - 24px); }
  }
}

/* Picture identification and writing quizzes. */
.word-progress-row { grid-area: progress; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; }
.word-progress-row .module-progress { grid-area: auto; font-size: 8.5px; line-height: 1.3; overflow-wrap: anywhere; }
.picture-quiz-button { color: #fff; background: linear-gradient(135deg,#16886f,#28ac83); }
.write-quiz-button { color: #fff; background: linear-gradient(135deg,#df791a,#eea02b); }
.quiz-action-row.has-word-quizzes { grid-template-columns: repeat(3,minmax(0,1fr)); }
.quiz-action-row.has-word-quizzes .big-button { font-size: clamp(12px,3.5vw,16px); padding: 8px 4px; }
.picture-question-panel { display: grid; justify-items: center; gap: 8px; width: 100%; }
.picture-question-panel[hidden], .spelling-form[hidden], .quiz-answers[hidden] { display: none; }
.picture-quiz-prompt { margin: 0; color: var(--deep-blue); font-size: clamp(18px,5vw,25px); font-weight: 900; text-align: center; }
.question-picture { width: min(270px,70vw); aspect-ratio: 1; }
.picture-word-quiz .question-zone { min-height: 0; margin: 12px 0 18px; }
.picture-word-quiz .quiz-video-panel { position: absolute; top: 8px; right: 0; width: 65px; z-index: 2; }
.answer-button.text-word-answer { min-height: 65px; min-width: 0; padding: 8px 5px; border-width: 3px; border-radius: 14px; font: 900 clamp(13px,3.8vw,21px)/1.2 'Trebuchet MS',Arial,sans-serif; overflow-wrap: anywhere; }
.spelling-form { display: grid; grid-template-columns: minmax(0,1fr) 94px; gap: 8px; align-items: center; }
.spelling-input { width: 100%; min-width: 0; height: 56px; padding: 8px; border: 3px solid #b1d8ff; border-radius: 14px; color: var(--ink); background: #fff; font: 900 clamp(18px,5vw,24px)/1.2 'Trebuchet MS',Arial,sans-serif; text-align: center; }
.spelling-input:focus-visible { outline: 3px solid rgba(58,151,238,.3); outline-offset: 2px; }
.spelling-input.correct { border-color: #20b978; background: #e4fff0; }
.spelling-input.wrong { border-color: #e74759; animation: wrong-shake .35s ease; }
.spelling-form .big-button { min-height: 56px; margin: 0; font-size: 18px; }
.picture-word-quiz .feedback { min-height: 50px; font-size: clamp(17px,5vw,24px); }
@media (max-height: 600px) {
  .question-picture { width: min(165px,44vw); }
  .picture-word-quiz .question-zone { margin: 6px 0 10px; }
}

/* Named exams and audio-only questions. */
.student-form { display: grid; grid-template-columns: minmax(0,1fr) 100px; gap: 6px; width: min(100%,380px); margin: 10px auto; padding: 9px; text-align: left; border-radius: 14px; background: rgba(255,255,255,.9); }
.student-form label { grid-column: 1 / -1; font-size: 15px; font-weight: 900; }
.student-form input { min-width: 0; width: 100%; padding: 9px; border: 2px solid #8ec8ff; border-radius: 14px; color: var(--ink); font: 700 18px Arial,sans-serif; text-align: center; }
.student-form .big-button { min-height: 43px; margin: 0; font-size: 14px; }
.student-form .form-message { grid-column: 1 / -1; }
.student-form .form-message:empty { display: none; }
.form-message { color: #9c303d; font-size: 14px; margin: 0; }
.student-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 10px 0; padding: 6px; border-radius: 12px; background: rgba(255,255,255,.86); }
.student-toolbar strong { max-width: 100%; overflow-wrap: anywhere; color: var(--ink); font-size: 16px; }
.student-toolbar .secondary-button { width: auto; min-height: 34px; margin: 0; padding: 7px 9px; font-size: 12px; }
.stage-word-count span { display: inline-block; margin-top: 4px; font-size: 10px; }
.section-results-button { grid-column: 1 / -1; border: 0; border-radius: 8px; background: rgba(255,255,255,.75); color: var(--deep-blue); font: 700 12px Arial,sans-serif; padding: 5px; cursor: pointer; }
#quizScreen:not(.teacher-video-quiz) #quizVideoPanel { display: none !important; }
.quiz-details { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 8px 0; }
.quiz-details > div { min-width: 0; display: grid; gap: 3px; }
.quiz-details strong { font-size: 17px; }
.quiz-details span { font-size: 14px; overflow-wrap: anywhere; }
.quiz-details .secondary-button { flex: 0 0 44px; width: 44px; min-height: 40px; margin: 0; padding: 8px; }
.quiz-screen:not(.picture-word-quiz):not(.letter-match-quiz):not(.teacher-video-quiz) .question-zone { display: none; }
.letter-match-quiz .question-zone { grid-template-columns: minmax(0,1fr); }
.spelling-hints { margin: 0 0 12px; text-align: center; }
.hint-letters { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; }
.hint-letter { display: grid; place-items: center; width: 27px; min-height: 32px; border-bottom: 2px solid #70a3d4; color: var(--deep-blue); background: #edf7ff; border-radius: 5px 5px 0 0; font: 900 21px 'Trebuchet MS',Arial,sans-serif; }
.hint-letter.revealed { color: #146c49; background: #e2ffec; }
.hint-space { width: 10px; align-self: center; }
.spelling-hints .secondary-button { width: auto; min-height: 34px; margin: 0; padding: 8px 14px; font-size: 14px; }
.spelling-hints p { margin: 6px 0 0; line-height: 1.4; font-size: 12px; }
button:disabled { cursor: default; }
#hintButton:disabled { opacity: .5; }
#resultStudentName { font-weight: 900; font-size: 21px; overflow-wrap: anywhere; }
#resultMessage { line-height: 1.5; }
#resultStorageStatus { margin: 10px 0; }
.scores-screen h3 { margin: 12px 0; text-align: center; }
.scores-filter { display: flex; align-items: center; gap: 10px; margin-top: 20px; font-weight: 800; }
.scores-filter select { min-width: 0; flex: 1; padding: 10px; border: 2px solid #b1d8ff; border-radius: 12px; color: var(--ink); background: #fff; font: 700 16px Arial,sans-serif; }
.scores-note { line-height: 1.6; font-size: 13px; color: #52607a; }
.scores-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid #d6e6f4; border-radius: 12px; }
.scores-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.scores-table th, .scores-table td { padding: 10px; text-align: center; border-bottom: 1px solid #e0eaf4; }
.scores-table th { background: #e6f3ff; white-space: nowrap; }
.scores-table td:first-child { min-width: 100px; overflow-wrap: anywhere; max-width: 180px; }
.scores-table td:last-child { min-width: 135px; font-size: 12px; }
.scores-table tr:nth-child(even) { background: #f5faff; }
@media (max-width: 420px) {
  .quiz-details strong { font-size: 15px; }
  .picture-quiz-prompt { font-size: 19px; }
  .hint-letter { width: 23px; font-size: 19px; }
  .scores-table { font-size: 12px; }
}
