:root {
  --ink: #213547;
  --muted: #6f675f;
  --paper: #fffaf2;
  --brand: #f37021;
  --brand-dark: #b84711;
  --yellow: #f6c453;
  --coral: #ef6a5b;
  --mint: #56b8a4;
  --sky: #e3f3f8;
  --blue: #63b7d4;
  --navy: #213547;
  --line: #eadfd3;
  --shadow: 0 18px 45px rgba(113, 61, 26, 0.15);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 14%, rgba(255,255,255,.9) 0 3px, transparent 4px),
    radial-gradient(circle at 84% 22%, rgba(255,255,255,.85) 0 4px, transparent 5px),
    linear-gradient(145deg, #fff0df 0%, #fff8ed 43%, #e5f5f1 73%, #e4f2f8 100%);
  overflow-x: hidden;
}

.site-home {
  display: block;
}

button { font: inherit; }
button:focus-visible { outline: 4px solid rgba(81, 71, 199, .25); outline-offset: 3px; }

.mic-notice { position: relative; z-index: 30; width: min(880px, calc(100% - 32px)); margin: 12px auto -4px; padding: 12px 16px; border: 2px solid #f4b487; border-radius: 18px; background: #fff1e7; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; box-shadow: 0 8px 22px rgba(113,61,26,.12); }
.mic-notice[hidden] { display: none; }
.mic-notice span { color: var(--muted); }
.mic-notice a { padding: 8px 12px; border-radius: 999px; color: white; background: var(--brand); font-weight: 900; text-decoration: none; }

.sky-decor {
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  opacity: .55;
  filter: blur(1px);
  pointer-events: none;
}
.sky-decor--one { top: -95px; left: -55px; background: #f37021; }
.sky-decor--two { right: -70px; bottom: -100px; background: #56b8a4; }

.app-shell {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  background: rgba(255,253,247,.94);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.topbar {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px 26px 12px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  color: var(--brand);
  background: #fff0e5;
  font-size: 26px;
  cursor: pointer;
}

.lesson-heading { display: flex; flex-direction: column; gap: 2px; }
.lesson-heading strong { font-size: clamp(16px, 2vw, 22px); }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 900; letter-spacing: .12em; }

.star-score {
  min-width: 72px;
  padding: 10px 14px;
  border-radius: 18px;
  background: #fff2bd;
  display: flex;
  justify-content: center;
  gap: 7px;
  font-size: 20px;
}
.star-score span { color: #f7ad00; }

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 28px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.progress-track { height: 9px; border-radius: 999px; background: #ece9f4; overflow: hidden; }
.progress-fill { height: 100%; width: 12.5%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--yellow)); transition: width .35s ease; }

.stage {
  min-height: 570px;
  padding: 18px 34px 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene { width: min(940px, 100%); animation: rise .35s ease; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.scene-header { text-align: center; margin-bottom: 24px; }
.scene-header.has-guide {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 108px;
  align-items: center;
  gap: 12px;
}
.scene-guide { display: flex; justify-content: center; align-self: end; }
.scene-heading-copy { min-width: 0; }
.scene-header .kicker { color: var(--brand); font-size: 13px; font-weight: 900; letter-spacing: .12em; }
.scene-header h1 { margin: 6px 0 8px; font-size: clamp(28px, 5vw, 48px); line-height: 1.05; }
.scene-header p { margin: 0 auto; max-width: 680px; color: var(--muted); font-size: 17px; line-height: 1.5; }

.story-card {
  min-height: 390px;
  padding: 32px;
  border-radius: 32px;
  background:
    linear-gradient(rgba(255,255,255,.2), rgba(255,255,255,.2)),
    radial-gradient(circle at 50% 120%, #afe2c9 0 38%, transparent 39%),
    linear-gradient(180deg, #dff3f8, #fff0df 70%);
  border: 4px solid white;
  box-shadow: 0 14px 30px rgba(65, 57, 144, .12);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  align-items: center;
  gap: 34px;
}

.mascot-row { display: flex; justify-content: center; align-items: end; gap: 8px; }
.mascot-block { text-align: center; }
.mascot-name { display: inline-block; margin-top: 7px; padding: 4px 10px; border-radius: 99px; background: white; font-size: 12px; font-weight: 900; }

.mascot {
  --character: url("assets/characters/cutouts/momo-front-v2.png");
  width: 150px;
  height: 225px;
  margin: 0 auto;
  background-image: var(--character);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center bottom;
  filter: drop-shadow(0 12px 12px rgba(39,36,72,.14));
  animation: character-bob 3.4s ease-in-out infinite;
}
.mascot.small { width: 92px; height: 138px; }
.mascot-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  user-select: none;
  pointer-events: none;
}
.mascot--momo { --character: url("assets/characters/cutouts/momo-front-v2.png"); }
.mascot--dudu { --character: url("assets/characters/cutouts/dudu-front-v2.png"); animation-delay: -.8s; }
.mascot--ollo { --character: url("assets/characters/cutouts/ollo-front-v2.png"); animation-delay: -1.6s; }
.mascot--pino { --character: url("assets/characters/cutouts/pino-front-v2.png"); animation-delay: -2.2s; }
.mascot--bibi { --character: url("assets/characters/cutouts/bibi-front-v2.png"); animation-delay: -2.8s; }
.mascot-row--final { flex-wrap: wrap; margin-bottom: 10px; }
@keyframes character-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.speech-panel { background: rgba(255,255,255,.93); border-radius: 28px; padding: 28px; box-shadow: 0 14px 34px rgba(71,64,137,.13); }
.speaker-tag { color: var(--brand); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.speech-text { min-height: 98px; margin: 10px 0 22px; font-size: clamp(22px, 3.2vw, 36px); line-height: 1.2; font-weight: 900; }
.story-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.story-counter { color: var(--muted); font-size: 13px; font-weight: 900; }

.sound-lights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 650px; margin: 24px auto; }
.sound-light, .choice-card, .friend-card, .word-door, .letter-tile {
  border: 3px solid transparent;
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.sound-light:hover, .choice-card:hover, .friend-card:hover, .word-door:hover, .letter-tile:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(65,57,144,.13); }
.sound-light {
  aspect-ratio: 1;
  border-radius: 36px;
  font-size: clamp(54px, 9vw, 92px);
  font-weight: 900;
  box-shadow: 0 8px 0 #e4e0ed;
}
.sound-light:nth-child(1) { background: #fff1ed; color: #e96e56; }
.sound-light:nth-child(2) { background: #e9f8f7; color: #268d91; }
.sound-light:nth-child(3) { background: #eeebff; color: #5d4fc1; }
.sound-light.correct { border-color: #34bd8c; box-shadow: 0 8px 0 #34bd8c; animation: pop .35s ease; }
.sound-light.wrong { border-color: #ff7668; animation: shake .3s ease; }
@keyframes pop { 50% { transform: scale(1.07); } }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.listen-button, .mini-button {
  border: 0;
  border-radius: 999px;
  background: #fff0e5;
  color: var(--brand-dark);
  font-weight: 900;
  cursor: pointer;
}
.listen-button { display: block; margin: 0 auto; padding: 13px 20px; }
.mini-button { padding: 10px 15px; }

.friend-grid, .word-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.friend-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); justify-content: center; }
.friend-card, .word-door { border-radius: 28px; padding: 24px; box-shadow: 0 8px 0 #e8e5ef; }
.friend-card { position: relative; padding: 16px 10px; }
.friend-card .mascot { width: 120px; height: 172px; }
.friend-card.selected, .word-door.opened { border-color: var(--mint); background: #effcf7; }
.friend-card.selected::after { content: "MY GUIDE"; position: absolute; top: 10px; right: 10px; padding: 4px 7px; border-radius: 999px; color: white; background: var(--mint); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.friend-card strong, .word-door strong { display: block; margin-top: 14px; font-size: 20px; }
.friend-card span, .word-door span { display: block; margin-top: 5px; color: var(--muted); }

.record-box { max-width: 600px; margin: 22px auto 0; padding: 18px; border-radius: 24px; background: #fff1e7; text-align: center; }
.mic-connect { margin: 0 auto 16px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.76); display: grid; gap: 8px; justify-items: center; color: var(--muted); font-size: 14px; font-weight: 800; line-height: 1.45; }
.mic-connect--ready { color: #236f61; background: #dff8ef; }
.mic-connect--error { color: #9b3c27; background: #ffe4dc; }
.mic-connect-button { padding: 10px 16px; border: 0; border-radius: 999px; color: white; background: var(--brand); font-weight: 900; cursor: pointer; }
.mic-connect--ready .mic-connect-button { background: #31917d; }
.mic-connect-button:disabled { opacity: .55; cursor: wait; }
.record-button {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--coral);
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 7px 0 #d65e4c;
}
.record-button.recording { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(255,128,107,.18), 0 7px 0 #d65e4c; } }
.record-status { min-height: 22px; margin: 12px 0 0; color: var(--muted); font-weight: 800; }
.playback-button { margin: 8px; padding: 9px 14px; border: 0; border-radius: 999px; color: #236f61; background: #dff8ef; font-weight: 900; cursor: pointer; }
.skip-recording-button { margin-top: 14px; padding: 11px 17px; border: 2px solid #e6b08e; border-radius: 999px; color: var(--brand-dark); background: white; font-weight: 900; cursor: pointer; }
.skip-recording-button:hover { border-color: var(--brand); background: #fff8f2; }
.skip-recording-button:disabled { opacity: .45; cursor: not-allowed; }
.skip-recording-wrap { display: flex; justify-content: center; }

.name-mission { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 760px; margin: 0 auto; }
.name-bubble, .name-answer { min-height: 230px; padding: 28px; border-radius: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.name-bubble { background: #e9f8f7; border: 3px solid #b9e8df; }
.name-answer { background: #fff0e5; border: 3px solid #ffd2b7; }
.name-bubble span, .name-answer p, .name-answer span { margin: 0 0 12px; color: var(--muted); font-weight: 800; }
.name-bubble strong, .name-answer strong { margin-bottom: 22px; font-size: clamp(24px, 4vw, 36px); }
.name-answer .record-button { margin-top: 14px; }
.name-answer label { margin-bottom: 7px; color: var(--brand-dark); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.name-input { width: min(280px, 100%); min-height: 48px; margin-bottom: 18px; border: 3px solid #ffd2b7; border-radius: 16px; padding: 8px 14px; color: var(--ink); background: white; text-align: center; font: inherit; font-size: 20px; font-weight: 900; }
.name-input:focus { border-color: var(--brand); outline: 3px solid rgba(243,112,33,.15); }

.color-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 720px; margin: 24px auto 0; }
.color-button { min-height: 112px; border: 3px solid white; border-radius: 26px; padding: 14px; background: white; color: var(--ink); cursor: pointer; box-shadow: 0 7px 0 #e4e0ed; transition: .18s ease; }
.color-button span { display: block; width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 -6px 0 rgba(0,0,0,.08); }
.color-button strong { text-transform: capitalize; }
.color-button.correct { border-color: var(--mint); transform: scale(1.04); box-shadow: 0 7px 0 var(--mint); }
.color-button.wrong { border-color: var(--coral); animation: shake .3s ease; }
.color-red { --swatch: #e9534f; } .color-blue { --swatch: #4597db; } .color-green { --swatch: #58a96b; }
.color-orange { --swatch: #f37021; } .color-purple { --swatch: #8f68c9; } .color-yellow { --swatch: #f6c453; }
.color-medal { font-size: 74px; }

.reader-card { position: relative; max-width: 760px; min-height: 400px; margin: 0 auto; padding: 28px; border: 8px solid white; border-radius: 34px; background: linear-gradient(145deg, #fff8e8, #e8f7f4); box-shadow: var(--shadow); text-align: center; }
.reader-card--sound { max-width: 900px; padding: 14px 14px 24px; border-radius: 26px 34px 34px 26px; background: #fffdf7; box-shadow: 0 20px 50px rgba(73,45,24,.22), inset 12px 0 18px rgba(117,76,42,.07); overflow: hidden; }
.reader-card--sound::after { content: ""; position: absolute; inset: 10px 8px 10px auto; width: 7px; border-radius: 99px; background: linear-gradient(180deg, #f4d8bf, #fff8ef 45%, #e8c4a3); opacity: .7; }
.reader-page-number { position: absolute; top: 16px; right: 18px; padding: 5px 10px; border-radius: 999px; background: white; color: var(--muted); font-size: 12px; font-weight: 900; }
.reader-art { min-height: 170px; display: grid; place-items: center; font-size: clamp(72px, 14vw, 130px); filter: drop-shadow(0 12px 12px rgba(39,36,72,.12)); }
.reader-scene { position: relative; min-height: 210px; margin: 4px auto 12px; display: flex; align-items: end; justify-content: center; overflow: hidden; border-radius: 26px; background: radial-gradient(circle at 50% 110%, #bfe7cf 0 34%, transparent 35%), linear-gradient(#e2f5fb, #fff2df); }
.reader-illustration { position: relative; margin: 0; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 18px 22px 12px 18px; background: #f4eadc; box-shadow: inset 0 0 0 1px rgba(78,50,27,.08); animation: page-reveal .42s ease both; }
.reader-illustration img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; user-select: none; }
.reader-card--sound .reader-text { margin: 0; padding: 18px 24px 12px; color: #35291f; background: linear-gradient(90deg, #fffaf0, #fffdf8 48%, #fff8eb); font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 3.6vw, 38px); text-align: left; }
.reader-card--sound .reader-controls { padding: 8px 18px 0; }
@keyframes page-reveal { from { opacity: .25; transform: translateX(14px) rotateY(-2deg); } to { opacity: 1; transform: none; } }
.reader-characters { position: relative; z-index: 2; display: flex; align-items: end; justify-content: center; gap: 4px; }
.reader-characters .mascot-block { margin: 0 -4px; }
.reader-characters .mascot.small { width: 94px; height: 150px; }
.reader-characters .mascot-name { margin-top: -2px; }
.reader-prop { position: absolute; z-index: 3; right: 12%; bottom: 20px; padding: 8px 12px; border-radius: 18px; background: rgba(255,255,255,.88); font-size: clamp(38px, 7vw, 70px); filter: drop-shadow(0 8px 7px rgba(39,36,72,.12)); }
.reader-characters:has(.mascot-block:nth-child(4)) .mascot.small { width: 70px; height: 112px; }
.reader-characters:has(.mascot-block:nth-child(4)) .mascot-name { display: none; }
.reader-text { margin: 10px 0 26px; font-size: clamp(25px, 4vw, 40px); line-height: 1.25; font-weight: 900; }
.reader-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.reader-controls .listen-button { margin: 0 auto; }

.listening-card, .pair-challenge { max-width: 720px; margin: 0 auto; padding: 28px; border-radius: 30px; background: white; box-shadow: 0 14px 35px rgba(65,57,144,.11); text-align: center; }
.listening-card .choice-grid { margin-top: 24px; }
.sound-radar { width: 120px; height: 120px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: radial-gradient(circle, #fff 0 15%, #ffd7bf 16% 30%, #fff0e5 31% 52%, #ffd7bf 53% 55%, #fff 56%); font-size: 56px; animation: radar-pulse 1.8s ease-in-out infinite; }
@keyframes radar-pulse { 50% { transform: scale(1.06); } }
.pair-prompt { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.pair-prompt span { font-size: 74px; }
.pair-prompt strong { font-size: 30px; text-transform: capitalize; }
.picture-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.picture-choice span { font-size: 42px; }
.picture-choice strong { text-transform: capitalize; }
.challenge-choices { max-width: 760px; margin: 0 auto; }

.pair-board { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; max-width: 680px; margin: 24px auto; }
.tile-column { display: grid; gap: 12px; }
.letter-tile { min-height: 78px; border-radius: 22px; font-size: 42px; font-weight: 900; box-shadow: 0 6px 0 #e4e0ed; }
.letter-tile.selected { border-color: var(--brand); background: #fff0e5; }
.letter-tile.matched { border-color: var(--mint); background: #ebfbf6; color: #248865; box-shadow: 0 6px 0 #69d8b4; cursor: default; }

.emoji-art { font-size: 64px; line-height: 1; filter: drop-shadow(0 8px 7px rgba(39,36,72,.12)); }
.word-door .letter-sound { color: var(--brand); font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.word-grid--expanded { gap: 12px; }
.word-grid--expanded .word-door { padding: 16px 10px; }
.word-grid--expanded .emoji-art { font-size: 48px; }

.sort-card { max-width: 760px; margin: 0 auto; padding: 26px; border-radius: 30px; background: white; box-shadow: 0 14px 35px rgba(65,57,144,.11); }
.sort-word { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.sort-word > span { font-size: 76px; }
.sort-word .word-badge {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: white;
  background: var(--brand);
  font-size: 54px;
  font-weight: 900;
  box-shadow: 0 8px 0 var(--brand-dark);
}
.sort-word > strong { font-size: 30px; text-transform: capitalize; }
.sort-word > small { color: var(--muted); font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.sound-baskets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sound-basket { min-height: 110px; border: 3px solid transparent; border-radius: 24px; background: #fff8ef; color: var(--ink); cursor: pointer; box-shadow: 0 7px 0 #e8dfd4; }
.sound-basket b { display: block; font-size: 42px; }
.sound-basket span { color: var(--muted); font-weight: 900; }
.sound-basket.correct { border-color: var(--mint); background: #ebfbf6; box-shadow: 0 7px 0 var(--mint); }
.sound-basket.wrong { border-color: var(--coral); animation: shake .3s ease; }

.trace-layout { display: grid; grid-template-columns: 130px 1fr; gap: 20px; max-width: 760px; margin: 20px auto 0; }
.trace-tabs { display: grid; gap: 9px; align-content: start; }
.trace-tab { border: 2px solid var(--line); border-radius: 16px; padding: 10px; background: white; color: var(--ink); font-size: 24px; font-weight: 900; cursor: pointer; }
.trace-tab.active { color: white; background: var(--brand); border-color: var(--brand); }
.trace-tab.done::after { content: " ✓"; color: var(--mint); }
.canvas-card { padding: 16px; border-radius: 26px; background: #fff0e5; }
#traceCanvas { width: 100%; height: 320px; display: block; border-radius: 20px; background: white; touch-action: none; cursor: crosshair; }
.canvas-actions { display: flex; justify-content: space-between; margin-top: 12px; }

.record-list { display: grid; gap: 12px; max-width: 640px; margin: 20px auto; }
.record-line { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 20px; background: white; box-shadow: 0 6px 20px rgba(65,57,144,.08); }
.record-line.done { background: #edfbf6; border: 2px solid #75d9b7; }
.record-line strong { font-size: 20px; }

.quiz-card { max-width: 760px; margin: 0 auto; padding: 28px; border-radius: 30px; background: white; box-shadow: 0 14px 35px rgba(65,57,144,.11); }
.quiz-number { color: var(--brand); font-size: 13px; font-weight: 900; letter-spacing: .1em; }
.quiz-prompt { margin: 8px 0 24px; font-size: clamp(24px, 4vw, 38px); }
.quiz-art { text-align: center; margin: -6px 0 14px; font-size: 70px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.choice-card { min-height: 94px; border-radius: 22px; padding: 12px; font-size: clamp(17px, 2.6vw, 30px); font-weight: 900; box-shadow: 0 6px 0 #e4e0ed; }
.choice-card.correct { border-color: var(--mint); background: #ecfbf6; box-shadow: 0 6px 0 var(--mint); }
.choice-card.wrong { border-color: var(--coral); background: #fff0ed; }
.quiz-feedback { min-height: 28px; margin: 20px 0 0; text-align: center; font-weight: 900; }

.result-card { max-width: 720px; margin: 0 auto; padding: 36px; border-radius: 34px; background: linear-gradient(150deg, #fff0d1, #fff2e8 55%, #e5f5f1); text-align: center; box-shadow: var(--shadow); }
.badge-orbit { width: 170px; height: 170px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: white; border: 12px solid #ffd3b8; box-shadow: 0 0 0 10px white, 0 16px 30px rgba(113,61,26,.2); }
.badge-orbit span { font-size: 52px; font-weight: 900; letter-spacing: -7px; transform: translateX(-3px); }
.result-card h1 { margin: 22px 0 7px; font-size: 40px; }
.result-card p { color: var(--muted); }
.score-line { display: flex; justify-content: center; gap: 20px; margin: 22px 0; }
.score-pill { padding: 12px 18px; border-radius: 18px; background: white; font-weight: 900; }

.bottom-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 28px 24px;
  border-top: 1px solid rgba(232,229,241,.8);
}
.primary-button, .secondary-button {
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  padding: 0 22px;
  font-weight: 900;
  cursor: pointer;
}
.primary-button { color: white; background: var(--brand); box-shadow: 0 7px 0 var(--brand-dark); }
.primary-button:disabled { background: #bbb7cc; box-shadow: 0 7px 0 #918ca5; cursor: not-allowed; }
.secondary-button { color: var(--brand-dark); background: #fff0e5; }
.secondary-button:disabled { opacity: .35; cursor: not-allowed; }
.step-dots { display: flex; justify-content: center; gap: 7px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: #d9d5e6; }
.step-dot.active { width: 24px; border-radius: 99px; background: var(--brand); }
.step-dot.done { background: var(--mint); }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 13px 20px; border-radius: 999px; color: white; background: #302b54; font-weight: 900; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: 0 10px 24px rgba(39,36,72,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.home-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 36px;
  background: rgba(255,253,247,.94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}

.home-nav-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.home-logo-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: var(--brand);
  box-shadow: 0 7px 0 var(--brand-dark);
  font-size: 26px;
  font-weight: 900;
}

.home-logo strong,
.home-logo small {
  display: block;
}

.home-logo strong {
  font-size: 20px;
}

.home-logo small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.home-nav-link,
.home-primary,
.home-secondary,
.course-card a,
.course-card button {
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.home-nav-link {
  padding: 12px 18px;
  color: var(--brand-dark);
  background: #fff0e5;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  align-items: center;
  gap: 32px;
  padding: 18px 8px 42px;
}

.home-hero-copy h1 {
  margin: 10px 0 18px;
  max-width: 720px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .98;
  letter-spacing: -.055em;
}

.home-hero-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.6;
  font-weight: 800;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.home-primary,
.home-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  padding: 0 22px;
}

.home-primary {
  color: white;
  background: var(--brand);
  box-shadow: 0 7px 0 var(--brand-dark);
}

.home-secondary {
  color: var(--brand-dark);
  background: #fff0e5;
}

.home-hero-card {
  position: relative;
  min-height: 430px;
  padding: 26px;
  border: 8px solid white;
  border-radius: 42px;
  background:
    radial-gradient(circle at 50% 112%, #aee3c9 0 36%, transparent 37%),
    linear-gradient(180deg, #e5f7fb, #fff1df 72%);
  box-shadow: 0 18px 44px rgba(71,64,137,.16);
  display: grid;
  align-content: end;
}

.home-hero-card::before {
  content: "ABC";
  position: absolute;
  top: 28px;
  right: 28px;
  padding: 10px 13px;
  border-radius: 18px;
  color: white;
  background: var(--brand);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.08em;
}

.home-mascots {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
}

.home-mascots .mascot.small {
  width: 104px;
  height: 156px;
  margin: 0 -7px;
}

.home-card-caption {
  width: min(360px, 100%);
  margin: 22px auto 0;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  text-align: center;
  box-shadow: 0 12px 28px rgba(65,57,144,.12);
}

.home-card-caption strong,
.home-card-caption span {
  display: block;
}

.home-card-caption strong {
  color: var(--brand);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.home-card-caption span {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 900;
}

.home-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.course-card {
  min-height: 250px;
  padding: 24px;
  border: 3px solid white;
  border-radius: 30px;
  background: white;
  box-shadow: 0 10px 28px rgba(65,57,144,.09);
}

.course-card--active {
  background: linear-gradient(145deg, #fff0e5, #fffaf3);
  border-color: #ffd2b7;
}

.course-level {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}

.course-card h2 {
  margin: 10px 0 10px;
  font-size: 28px;
}

.course-card p {
  min-height: 78px;
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 800;
}

.course-card a,
.course-card button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  color: white;
  background: var(--brand);
}

.course-card button:disabled {
  color: #8d857c;
  background: #eee8df;
  cursor: not-allowed;
}

.vocab-shell { overflow: visible; }

.vocab-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  margin: 10px 0 22px;
}

.vocab-hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(40px, 5vw, 66px);
  line-height: 1;
  letter-spacing: -.05em;
}

.vocab-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 800;
}

.vocab-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px;
}

.vocab-stats span {
  min-width: 96px;
  padding: 12px 14px;
  border-radius: 18px;
  background: white;
  color: var(--muted);
  box-shadow: 0 8px 22px rgba(65,57,144,.08);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.vocab-stats strong {
  display: block;
  color: var(--brand);
  font-size: 28px;
}

.vocab-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.vocab-tab {
  min-height: 42px;
  border: 2px solid #ffe0ce;
  border-radius: 999px;
  padding: 0 16px;
  color: var(--brand-dark);
  background: #fff8f2;
  font-weight: 900;
  cursor: pointer;
}

.vocab-tab.active {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.vocab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.vocab-card-view,
.vocab-list-panel {
  border-radius: 34px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 12px 34px rgba(65,57,144,.09);
}

.vocab-card-view {
  min-height: 560px;
  padding: 22px;
}

.flashcard {
  min-height: 430px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 22px;
  border: 8px solid white;
  border-radius: 34px;
  background: linear-gradient(145deg, #fff8ed, #e9f8f7);
  box-shadow: var(--shadow);
}

.flashcard-title {
  text-align: center;
}

.flashcard-title h2 {
  margin: 6px 0 0;
  font-size: clamp(48px, 7vw, 86px);
  line-height: .95;
  letter-spacing: -.05em;
}

.flashcard-art {
  min-height: 320px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 110%, rgba(86,184,164,.28) 0 36%, transparent 37%),
    linear-gradient(180deg, #e8f7fb, #fff1df 76%);
  overflow: hidden;
}

.vocab-placeholder {
  width: min(320px, 88%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 42px;
  background: rgba(255,255,255,.76);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.9), 0 18px 38px rgba(39,36,72,.12);
}

.vocab-placeholder span {
  color: var(--brand);
  font-size: clamp(72px, 10vw, 138px);
  font-weight: 900;
}

.vocab-placeholder small {
  align-self: start;
  margin-top: -28px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.vocab-swatch {
  width: min(320px, 88%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--card-color);
  box-shadow: inset 0 -22px 0 rgba(0,0,0,.08), 0 22px 42px rgba(39,36,72,.16);
}

.vocab-card-image {
  display: block;
  width: min(360px, 92%);
  aspect-ratio: 1;
  object-fit: cover;
  border: 8px solid white;
  border-radius: 34px;
  box-shadow: 0 22px 42px rgba(39,36,72,.16);
  user-select: none;
}

.flashcard-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.flashcard-sound {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
}

.flashcard-back {
  width: min(520px, 100%);
  min-height: 110px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.8);
  opacity: .25;
  filter: blur(2px);
  transition: .22s ease;
}

.flashcard.flipped .flashcard-back {
  opacity: 1;
  filter: none;
}

.flashcard-back strong,
.flashcard-back span {
  display: block;
}

.flashcard-back strong {
  font-size: 28px;
}

.flashcard-back span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.flashcard-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.flashcard-actions button {
  min-height: 46px;
}

.flashcard-actions .listen-button {
  margin: 0;
}

.flashcard-actions .listen-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.vocab-card-count {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.vocab-list-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 48px);
  padding: 16px;
  overflow: auto;
}

.vocab-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.vocab-list-heading strong {
  font-size: 18px;
}

.vocab-list-heading span {
  padding: 4px 9px;
  border-radius: 999px;
  color: white;
  background: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.vocab-list {
  display: grid;
  gap: 8px;
}

.vocab-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
  text-align: left;
  font-weight: 900;
  cursor: pointer;
}

.vocab-list-item small {
  color: var(--muted);
}

.vocab-list-item.active {
  border-color: var(--brand);
  background: #fff0e5;
}

.vocab-list-item.known::after,
.vocab-list-item.review::after {
  justify-self: end;
  grid-column: 1 / -1;
  font-size: 11px;
}

.vocab-list-item.known::after {
  content: "I KNOW";
  color: #248865;
}

.vocab-list-item.review::after {
  content: "REVIEW";
  color: var(--brand-dark);
}

.vocab-empty {
  min-height: 450px;
  display: grid;
  place-content: center;
  text-align: center;
}

@media (max-width: 760px) {
  .home-shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; padding: 18px; }
  .home-nav { margin-bottom: 20px; }
  .home-nav-actions { justify-content: flex-start; }
  .home-logo small { display: none; }
  .home-hero { grid-template-columns: 1fr; padding-bottom: 24px; }
  .home-hero-card { min-height: 330px; order: -1; }
  .home-mascots .mascot.small { width: 78px; height: 117px; margin: 0 -8px; }
  .home-dashboard { grid-template-columns: 1fr; }
  .course-card { min-height: auto; }
  .course-card p { min-height: auto; }
  .vocab-hero { grid-template-columns: 1fr; }
  .vocab-stats { grid-template-columns: repeat(3, 1fr); }
  .vocab-layout { grid-template-columns: 1fr; }
  .vocab-list-panel { position: static; max-height: none; }
  .flashcard { grid-template-columns: 1fr; }
  .flashcard-art { min-height: 260px; }
  .app-shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; }
  .topbar { padding: 14px 16px 9px; grid-template-columns: 44px 1fr auto; gap: 10px; }
  .icon-button { width: 42px; height: 42px; }
  .star-score { min-width: 58px; padding: 8px 10px; }
  .stage { min-height: 560px; padding: 16px; align-items: start; }
  .story-card { grid-template-columns: 1fr; padding: 20px; gap: 18px; }
  .mascot { width: 110px; height: 165px; }
  .mascot.small { width: 72px; height: 108px; }
  .scene-header.has-guide { grid-template-columns: 76px minmax(0, 1fr); gap: 6px; }
  .guide-spacer { display: none; }
  .friend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .friend-card .mascot { width: 105px; height: 150px; }
  .word-grid { grid-template-columns: 1fr; }
  .word-grid--expanded { grid-template-columns: repeat(3, 1fr); }
  .name-mission { grid-template-columns: 1fr; }
  .name-bubble, .name-answer { min-height: 190px; padding: 20px; }
  .color-grid { grid-template-columns: repeat(2, 1fr); }
  .reader-controls { grid-template-columns: 1fr 1fr; }
  .reader-controls .listen-button { grid-column: 1 / -1; grid-row: 1; }
  .reader-scene { min-height: 180px; }
  .reader-characters .mascot.small { width: 72px; height: 115px; }
  .reader-prop { right: 5%; bottom: 12px; }
  .word-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .word-door { padding: 14px 7px; }
  .emoji-art { font-size: 46px; }
  .pair-board { gap: 12px; }
  .trace-layout { grid-template-columns: 1fr; }
  .trace-tabs { grid-template-columns: repeat(6, 1fr); }
  .trace-tab { padding: 8px 2px; font-size: 18px; }
  #traceCanvas { height: 270px; }
  .bottom-nav { padding: 12px 16px 18px; }
  .primary-button, .secondary-button { padding: 0 15px; }
}

@media (max-width: 460px) {
  .lesson-heading strong { max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .progress-wrap { padding-inline: 18px; }
  .scene-header { margin-bottom: 16px; }
  .scene-header p { font-size: 15px; }
  .scene-header.has-guide { grid-template-columns: 64px minmax(0, 1fr); }
  .scene-guide .mascot-name { display: none; }
  .scene-guide .mascot.small { width: 62px; height: 93px; }
  .sound-lights { gap: 8px; }
  .sound-light { border-radius: 24px; }
  .choice-grid { gap: 8px; }
  .choice-card { min-height: 76px; }
  .step-dots { display: none; }
}
