:root {
  --ink: #242347;
  --purple: #5b50d6;
  --purple-dark: #4339b7;
  --yellow: #ffd646;
  --cream: #fffaf0;
  --green: #39b978;
  --red: #ef6b67;
  --muted: #777590;
  --line: #e8e4f2;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 16%, rgba(255, 214, 70, .23) 0 90px, transparent 92px),
    radial-gradient(circle at 88% 30%, rgba(91, 80, 214, .12) 0 130px, transparent 132px),
    var(--cream);
  font-family: "Nunito", sans-serif;
}

html {
  background: var(--cream);
  overscroll-behavior-y: none;
}

body.game-active {
  background-image:
    linear-gradient(rgba(255, 250, 240, .68), rgba(255, 250, 240, .78)),
    var(--level-background);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.site-header {
  position: relative;
  width: min(1120px, calc(100% - 36px));
  height: 88px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-status {
  position: absolute;
  top: 72px;
  right: 0;
  z-index: 5;
  max-width: 310px;
  margin: 0;
  padding: 8px 12px;
  color: #8a4d16;
  background: #fff2cf;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.voice-status:empty { display: none; }

.brand {
  display: grid;
  grid-template-columns: 47px auto;
  color: var(--ink);
  font: 800 27px/1 "Baloo 2", sans-serif;
  text-decoration: none;
}

.brand-mark {
  grid-row: 1 / 3;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--purple);
  border-radius: 13px 13px 13px 5px;
  transform: rotate(-5deg);
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font: 700 10px/1 "Nunito", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sound-button {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  background: white;
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

main {
  width: min(1120px, calc(100% - 36px));
  min-height: calc(100vh - 150px);
  margin: auto;
}

.screen { display: none; }
.screen.active { display: flex; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--purple);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  line-height: .98;
}

h1 { font-size: clamp(46px, 6vw, 74px); }
h1 span { color: var(--purple); }


.primary-button {
  min-height: 56px;
  padding: 0 27px;
  color: white;
  background: var(--purple);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 8px 0 var(--purple-dark);
  cursor: pointer;
  font: 800 18px "Nunito", sans-serif;
  transition: transform .15s, box-shadow .15s;
}

.primary-button:hover { transform: translateY(-2px); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--purple-dark); }
.primary-button:disabled { opacity: .4; cursor: not-allowed; transform: none; }


.game-screen {
  max-width: 780px;
  margin: 20px auto 70px;
  flex-direction: column;
}

.level-screen {
  padding: 48px 0 80px;
  flex-direction: column;
}

.level-heading { margin-bottom: 30px; text-align: center; }
.level-heading h1 { font-size: clamp(44px, 6vw, 68px); }
.level-heading > p:last-child { color: var(--muted); font-size: 18px; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.level-card {
  min-height: 190px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: white;
  background-position: center;
  background-size: cover;
  border: 3px solid var(--line);
  border-radius: 25px;
  cursor: pointer;
  text-align: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}

.level-card .level-number,
.level-card strong,
.level-card small,
.level-card .level-best { text-shadow: 0 1px 3px white; }

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--purple);
  box-shadow: 0 14px 28px rgba(55, 44, 120, .12);
  outline: none;
}

.level-number {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--purple);
  border-radius: 12px;
  font-weight: 900;
}

.level-icon { margin: 10px 0 4px; font-size: 36px; }
.level-card strong { font: 800 19px "Baloo 2", sans-serif; }
.level-card small { color: var(--muted); font-weight: 800; }
.level-best { min-height: 20px; margin-top: 8px; color: #9b7100; font-size: 13px; font-weight: 900; }
.level-label { margin: 0 0 2px; color: var(--purple); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 25px;
  align-items: center;
  margin-bottom: 20px;
}

.question-count { margin: 0 0 7px; font-weight: 900; }
.progress-track { height: 12px; overflow: hidden; background: #e5e1ef; border-radius: 99px; }
#progress-fill { width: 5%; height: 100%; background: linear-gradient(90deg, var(--purple), #8d80f1); border-radius: inherit; transition: width .4s; }
.score-pill { padding: 11px 17px; background: white; border: 2px solid var(--line); border-radius: 17px; font-size: 20px; }

.question-card {
  padding: clamp(24px, 5vw, 46px);
  text-align: center;
  background: rgba(255, 255, 255, .96);
  border: 2px solid white;
  border-radius: 32px;
  box-shadow: 0 22px 50px rgba(46, 38, 99, .11);
}

.picture {
  width: 150px;
  height: 150px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  background: #f0eeff;
  border-radius: 44px;
  font-size: 86px;
  animation: pop .35s both;
}

.prompt-label { margin: 0 0 4px; color: var(--muted); font-weight: 800; }
.filipino-prompt {
  margin: 2px auto 0;
  padding: 4px 14px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font: 800 38px/1.15 "Baloo 2", sans-serif;
}

.filipino-prompt:hover,
.filipino-prompt:focus-visible { background: #f0eeff; outline: none; }
.listen-icon { font-size: 22px; }
.answers { display: grid; gap: 12px; margin: 26px 0 19px; }

.answer-button {
  min-height: 61px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  background: white;
  border: 3px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  font-size: 19px;
  font-weight: 900;
  text-align: left;
  transition: transform .12s, border-color .12s, background .12s;
}

.answer-button:hover { transform: translateX(3px); border-color: #bbb3ef; }
.answer-button.selected { border-color: var(--purple); background: #f0eeff; }
.answer-button.correct { color: #16774a; border-color: var(--green); background: #e5f8ee; }
.answer-button.wrong { color: #a84440; border-color: var(--red); background: #fff0ef; }
.answer-letter {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: #f2eff8;
  border-radius: 10px;
  font-size: 14px;
}

.feedback { min-height: 35px; font-size: 18px; font-weight: 900; }
.feedback.good { color: #168354; }
.feedback.try { color: #b44c47; }
.submit-button { width: 100%; }
.hidden { display: none !important; }

.result-screen {
  position: relative;
  min-height: 670px;
  padding: 35px 20px 70px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.result-screen h1 { font-size: clamp(48px, 7vw, 76px); color: var(--purple); }
.result-mascot { width: 190px; margin-bottom: -10px; filter: drop-shadow(0 15px 12px rgba(62, 46, 127, .16)); }
.result-message { margin: 14px 0 20px; color: var(--muted); font-size: 19px; }
.final-score { min-width: 260px; margin-bottom: 27px; padding: 20px 40px; background: white; border-radius: 27px; box-shadow: 0 16px 35px rgba(47, 40, 95, .12); }
.final-score strong, .final-score small { display: block; }
.final-score strong { margin: 6px 0; font: 800 48px "Baloo 2"; }
.final-score small { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.score-stars { letter-spacing: 5px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.secondary-button {
  min-height: 56px;
  padding: 0 24px;
  color: var(--purple);
  background: white;
  border: 2px solid #cfc9ef;
  border-radius: 17px;
  cursor: pointer;
  font-weight: 900;
}

#fireworks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
footer { padding: 10px 20px 24px; color: #9895a8; text-align: center; font-size: 12px; font-weight: 800; }

@keyframes bob { 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.65) rotate(-6deg); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 780px) {
  .sound-label { display: none; }
  .sound-button { padding: 10px 12px; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 460px) {
  .site-header { height: 74px; }
  .brand { grid-template-columns: 39px auto; font-size: 23px; }
  .brand-mark { width: 33px; height: 33px; }
  main { width: min(100% - 22px, 1120px); }
  h1 { font-size: 43px; }
  .picture { width: 125px; height: 125px; font-size: 70px; border-radius: 36px; }
  .filipino-prompt { font-size: 31px; }
  .question-card { padding: 23px 16px; border-radius: 25px; }
  .level-grid { grid-template-columns: 1fr; }
  .level-card { min-height: 145px; }
  .primary-button,
  .secondary-button,
  .answer-button { min-height: 58px; }
}

@media (display-mode: standalone) {
  .site-header { height: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

.flagged-practice-button{margin:0 auto 24px;padding:12px 18px;display:flex;align-items:center;gap:10px;color:var(--ink);background:#fff5cf;border:2px solid #e3c56a;border-radius:16px;cursor:pointer;font-weight:800}.flagged-practice-button>span{color:#a87800;font-size:23px}.flagged-practice-button small{color:var(--muted)}.flagged-practice-button:disabled{opacity:.5;cursor:not-allowed}.game-actions{display:flex;align-items:center;gap:10px}.game-levels-button{padding:10px 14px;color:var(--ink);background:white;border:2px solid var(--line);border-radius:15px;cursor:pointer;font-weight:900}.flag-question-button{margin:4px auto 14px;padding:8px 13px;color:var(--muted);background:white;border:2px solid var(--line);border-radius:999px;cursor:pointer;font-weight:900}.flag-question-button.flagged{color:#8b6500;background:#fff1b8;border-color:#d8b54c}@keyframes starGlow{0%,100%{box-shadow:0 24px 65px rgba(47,40,95,.13)}35%{box-shadow:0 0 20px rgba(255,214,70,.9),0 0 48px rgba(255,214,70,.55),0 24px 65px rgba(47,40,95,.13)}}.question-card.star-glow{animation:starGlow .7s ease-out}@media(max-width:540px){.game-actions{gap:6px}.game-levels-button{padding:9px 10px;font-size:12px}.score-pill{padding:9px 12px}}

.voice-gender-selector{display:flex;padding:3px;background:#fff3bd;border:1px solid #d8b54c;border-radius:999px}.voice-gender-selector button{padding:7px 10px;color:#795900;background:transparent;border:0;border-radius:999px;cursor:pointer;font-size:12px;font-weight:900}.voice-gender-selector button.active{color:#17233d;background:#ffd646;box-shadow:0 2px 7px rgba(121,89,0,.28)}@media(max-width:620px){.voice-gender-selector button{padding:7px 8px;font-size:0}.voice-gender-selector button::first-letter{font-size:15px}}
.speech-bubble {
position: absolute;
top: 3% !important;
right: -4% !important;
z-index: 10;
max-width: 260px;
}

/* Tablet */
@media (max-width: 780px) {
.speech-bubble {
top: 1% !important;
right: -2% !important;
max-width: 240px;
}
}

/* Mobile */
@media (max-width: 460px) {
.speech-bubble {
top: -3% !important;
right: -2% !important;
max-width: 210px;
font-size: 16px;
}

.speech-bubble small {
font-size: 10px;
}
}

/* Module 1 level selection: premium StarPath visual system */
:root {
  --starpath-navy: #031735;
  --starpath-navy-deep: #02122b;
  --starpath-navy-card: #07224b;
  --starpath-gold: #d8a84d;
  --starpath-gold-bright: #ffd071;
  --starpath-purple: #5b50d6;
  --starpath-purple-dark: #4339b7;
  --starpath-text: #ffffff;
  --starpath-muted: #c2cede;
}

html {
  background: var(--starpath-navy);
}

body {
  position: relative;
  overflow-x: hidden;
  color: var(--starpath-text);
  background:
    radial-gradient(circle at 12% 10%, rgba(216, 168, 77, .1), transparent 24%),
    radial-gradient(circle at 86% 24%, rgba(91, 80, 214, .15), transparent 25%),
    linear-gradient(180deg, var(--starpath-navy-deep), var(--starpath-navy) 48%, #051632);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: .48;
  background-image:
    radial-gradient(circle at 8% 14%, rgba(255, 208, 113, .8) 0 1px, transparent 1.6px),
    radial-gradient(circle at 18% 37%, rgba(255, 255, 255, .65) 0 1px, transparent 1.5px),
    radial-gradient(circle at 31% 9%, rgba(255, 208, 113, .65) 0 1px, transparent 1.7px),
    radial-gradient(circle at 47% 28%, rgba(255, 255, 255, .5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 63% 12%, rgba(255, 208, 113, .72) 0 1px, transparent 1.7px),
    radial-gradient(circle at 78% 39%, rgba(255, 255, 255, .55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 91% 17%, rgba(255, 208, 113, .7) 0 1px, transparent 1.7px);
  background-size: 310px 270px, 380px 330px, 430px 310px, 360px 390px, 410px 300px, 340px 370px, 390px 320px;
}

body::after {
  position: fixed;
  z-index: -1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 24vh;
  content: "";
  pointer-events: none;
  background: linear-gradient(to top, rgba(31, 55, 84, .22), transparent);
}

body:not(.game-active) main {
  min-height: calc(100vh - 126px);
}

.site-header {
  width: min(1280px, calc(100% - 40px));
  min-height: 82px;
  height: auto;
  padding-block: 10px;
  color: var(--starpath-text);
  background: transparent;
}

.site-header .module-home-button,
.site-header .back-filipino-button,
.site-header .voice-gender-selector,
.site-header .sound-button {
  border: 1px solid rgba(216, 168, 77, .28);
  background: rgba(5, 22, 50, .78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22), inset 0 1px rgba(255, 255, 255, .04);
  backdrop-filter: blur(12px);
}

.site-header .module-home-button {
  border-color: var(--starpath-gold);
}

.site-header .module-home-nav {
  width: 62px;
  flex-basis: 62px;
  margin-right: 28px;
}

.site-header .module-home-button {
  width: 62px;
  height: 62px;
  flex-basis: 62px;
}

.site-header .module-header-controls {
  gap: 22px;
  margin-left: auto;
}

.site-header .back-filipino-button {
  color: #fff;
  background: linear-gradient(180deg, #685ee2, var(--starpath-purple));
  border-color: rgba(255, 255, 255, .12);
  box-shadow: 0 5px 0 var(--starpath-purple-dark), 0 9px 22px rgba(0, 0, 0, .22);
}

.site-header .sound-button {
  color: #fff;
}

.site-header .voice-gender-selector {
  padding: 3px;
}

.site-header .voice-gender-selector button {
  color: #f4d77e;
}

.site-header .voice-gender-selector button.active {
  color: #17233d;
  background: #ffd646;
}

.voice-status {
  color: var(--starpath-gold-bright);
  background: rgba(5, 22, 50, .94);
  border: 1px solid rgba(216, 168, 77, .28);
}

main {
  width: min(1280px, calc(100% - 40px));
}

.eyebrow {
  color: var(--starpath-gold-bright);
}

h1,
h2 {
  color: #fff;
}

h1 span {
  color: var(--starpath-gold-bright);
}

body.game-start-page #start-screen .intro {
  color: var(--starpath-muted);
}

body.game-start-page #start-screen .feature-row span,
body.game-start-page #start-screen .install-card {
  color: #fff;
  background: rgba(7, 34, 75, .78);
  border-color: rgba(216, 168, 77, .24);
}

body.game-start-page #start-screen .hero-art {
  background:
    radial-gradient(circle at 50% 42%, rgba(91, 80, 214, .25), transparent 58%),
    rgba(5, 22, 50, .42);
  border: 1px solid rgba(216, 168, 77, .18);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .24);
}

body.game-start-page #start-screen .speech-bubble {
  color: #0F2B5B;
  background: url("../../../assets/Speech-bubble.svg") center / contain no-repeat;
  border: 0;
  box-shadow: none;
  letter-spacing: .01em;
}

body.game-start-page #start-screen .speech-bubble small {
  color: rgba(15, 43, 91, .76);
}

.level-screen {
  padding: 18px 0 64px;
}

.level-hero {
  display: grid;
  grid-template-columns: minmax(250px, 1.15fr) minmax(370px, 1.85fr) minmax(220px, 1fr);
  align-items: center;
  gap: clamp(18px, 2.6vw, 38px);
  margin-bottom: 38px;
  min-height: 360px;
}

.level-hero-scene {
  position: relative;
  isolation: isolate;
  align-self: center;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.level-hero-scene::before {
  position: absolute;
  z-index: 0;
  inset: 9% 4% 7%;
  content: "";
  background: rgba(31, 171, 196, .15);
  border-radius: 50%;
  filter: blur(34px);
}

.level-hero-scene::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(to right, var(--starpath-navy) 0%, transparent 18%, transparent 58%, var(--starpath-navy) 100%),
    linear-gradient(to bottom, transparent 58%, rgba(3, 23, 53, .48) 76%, var(--starpath-navy) 100%);
}

.level-hero-scene img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(.92) contrast(1.02);
}

.level-hero-copy {
  position: relative;
  z-index: 2;
  text-align: center;
}

.level-heading {
  margin-bottom: 24px;
}

.module-identifier {
  margin: 0 0 18px;
  color: var(--starpath-gold-bright);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .15em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
}

.module-identifier span,
.module-identifier strong {
  display: block;
}

.module-identifier strong {
  margin-top: 3px;
  color: #fff;
  font-size: 12px;
}

.journey-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  margin-bottom: 20px;
  margin-inline: auto;
  color: var(--starpath-gold-bright);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.journey-kicker > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.journey-kicker strong {
  color: #fff;
  font-size: 11px;
  letter-spacing: .13em;
}

.journey-kicker img {
  width: 30px;
  height: 20px;
  object-fit: cover;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}

.level-heading h1 {
  color: #fff;
  font-size: clamp(58px, 6.4vw, 84px);
  line-height: .92;
  text-shadow: 0 5px 24px rgba(0, 0, 0, .35);
}

.level-heading .level-total {
  margin: 18px auto 0;
  color: var(--starpath-gold-bright);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.level-heading > p:last-child {
  max-width: 430px;
  margin: 10px auto 0;
  color: var(--starpath-muted);
  font-size: 17px;
  line-height: 1.55;
}

.level-hero-mascot {
  position: relative;
  width: min(100%, 300px);
  min-height: 300px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(216, 168, 77, .2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 80, 214, .25), rgba(5, 22, 50, .22) 58%, transparent 59%);
  box-shadow: inset 0 0 40px rgba(216, 168, 77, .04);
}

.level-hero-mascot > img {
  width: min(82%, 245px);
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, .3));
  animation: bob 3.2s ease-in-out infinite;
}

.level-speech-bubble {
  position: absolute;
  z-index: 3;
  top: -8%;
  right: -12%;
  width: clamp(130px, 14vw, 190px);
  min-width: 0;
  max-width: min(220px, 52vw);
  aspect-ratio: 520 / 190;
  padding: 0 18%;
  color: #0F2B5B;
  background: url("../../../assets/Speech-bubble.svg") center / contain no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font: 800 clamp(19px, 2vw, 26px)/1 "Baloo 2", sans-serif;
  letter-spacing: .01em;
  text-align: center;
  white-space: nowrap;
  transform: rotate(3deg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.level-speech-bubble::after {
  content: none;
}

.level-speech-bubble .bubble-local {
  display: block;
  font-weight: 900;
  line-height: 1.12;
}

.level-speech-bubble small,
.level-speech-bubble .bubble-translation {
  display: block;
  margin-top: 3px;
  color: #5F6B7A;
  font: 700 10px/1.1 "Nunito", sans-serif;
}

.mascot-star {
  position: absolute;
  color: var(--starpath-gold-bright);
  text-shadow: 0 0 12px rgba(255, 208, 113, .55);
}

.mascot-star-one {
  right: 3%;
  bottom: 18%;
  font-size: 22px;
}

.mascot-star-two {
  top: 28%;
  left: 3%;
  font-size: 34px;
}

.flagged-practice-button {
  width: min(100%, 430px);
  min-height: 54px;
  margin: 0 auto;
  padding: 8px 14px;
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, rgba(7, 34, 75, .92), rgba(4, 27, 63, .94));
  border: 1px solid rgba(216, 168, 77, .55);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22), inset 0 1px rgba(255, 255, 255, .04);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.flagged-practice-button > span {
  width: 21px;
  height: 24px;
  display: block;
  font-size: 0;
  color: var(--starpath-gold-bright);
}

.flagged-practice-button > span::before {
  width: 18px;
  height: 22px;
  display: block;
  content: "";
  background: var(--starpath-gold-bright);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath fill='black' d='M4 2h16a2 2 0 0 1 2 2v22l-10-6-10 6V4a2 2 0 0 1 2-2Zm2 4v13l6-3.6 6 3.6V6H6Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath fill='black' d='M4 2h16a2 2 0 0 1 2 2v22l-10-6-10 6V4a2 2 0 0 1 2-2Zm2 4v13l6-3.6 6 3.6V6H6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.flagged-practice-button small {
  margin-left: 2px;
  color: var(--starpath-muted);
  white-space: nowrap;
}

.flagged-practice-button:hover:not(:disabled),
.flagged-practice-button:focus-visible:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--starpath-gold-bright);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .28), 0 0 18px rgba(216, 168, 77, .08);
}

.level-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.level-card {
  position: relative;
  isolation: isolate;
  min-height: 156px;
  overflow: hidden;
  padding: 13px 14px 11px;
  color: #fff;
  background-color: var(--starpath-navy-card);
  background-image: linear-gradient(155deg, rgba(9, 43, 91, .98), rgba(4, 24, 56, .98)) !important;
  border: 1px solid rgba(216, 168, 77, .34);
  border-radius: 22px;
  box-shadow: 0 13px 30px rgba(0, 0, 0, .23), inset 0 1px rgba(255, 255, 255, .035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.level-card::before {
  position: absolute;
  z-index: -1;
  right: -5%;
  bottom: -7%;
  width: 48%;
  height: 56%;
  content: "";
  opacity: .04;
  background: var(--starpath-gold-bright);
  -webkit-mask-position: right bottom;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: right bottom;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.level-card:nth-child(-n+10)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'%3E%3Cg fill='none' stroke='black' stroke-width='5' stroke-linecap='round'%3E%3Cpath d='M4 63C24 20 42 22 59 58s34 35 57-4M5 39c19-27 37-26 54 2s35 29 56 1'/%3E%3Cpath d='M92 8v18M83 17h18M26 15v12M20 21h12M13 82h94'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'%3E%3Cg fill='none' stroke='black' stroke-width='5' stroke-linecap='round'%3E%3Cpath d='M4 63C24 20 42 22 59 58s34 35 57-4M5 39c19-27 37-26 54 2s35 29 56 1'/%3E%3Cpath d='M92 8v18M83 17h18M26 15v12M20 21h12M13 82h94'/%3E%3C/g%3E%3C/svg%3E");
}

.level-card:nth-child(n+11):nth-child(-n+20)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'%3E%3Cpath fill='black' d='M18 92h20V63h13L35 40h11L29 13 12 40h11L7 63h11v29Zm40 0h21V58h14L76 34h11L68 5 49 34h12L44 58h14v34Zm37 0h17V70h8l-16-27-16 27h7v22Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'%3E%3Cpath fill='black' d='M18 92h20V63h13L35 40h11L29 13 12 40h11L7 63h11v29Zm40 0h21V58h14L76 34h11L68 5 49 34h12L44 58h14v34Zm37 0h17V70h8l-16-27-16 27h7v22Z'/%3E%3C/svg%3E");
}

.level-card:nth-child(n+21)::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 100'%3E%3Cg fill='black'%3E%3Cpath d='M10 85h49V43L35 25 10 43v42Zm12-31h10v13H22V54Zm19 0h9v13h-9V54Z'/%3E%3Cpath d='M65 85h47V54L89 37 65 54v31Zm11-21h9v12h-9V64Zm18 0h9v12h-9V64Z'/%3E%3C/g%3E%3Cpath d='M2 89c20-7 39-7 58 0s39 7 67-2' fill='none' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 100'%3E%3Cg fill='black'%3E%3Cpath d='M10 85h49V43L35 25 10 43v42Zm12-31h10v13H22V54Zm19 0h9v13h-9V54Z'/%3E%3Cpath d='M65 85h47V54L89 37 65 54v31Zm11-21h9v12h-9V64Zm18 0h9v12h-9V64Z'/%3E%3C/g%3E%3Cpath d='M2 89c20-7 39-7 58 0s39 7 67-2' fill='none' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.level-card::after {
  position: absolute;
  top: 13px;
  right: 14px;
  content: "☆";
  color: rgba(255, 208, 113, .75);
  font-size: 18px;
  line-height: 1;
}

.level-card .level-number,
.level-card strong,
.level-card small,
.level-card .level-best {
  text-shadow: none;
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255, 208, 113, .82);
  box-shadow: 0 19px 38px rgba(0, 0, 0, .3), 0 0 20px rgba(216, 168, 77, .07);
}

.level-card,
.level-card .level-icon {
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .level-card:hover .level-icon {
    transform: scale(1.05);
  }
}

.level-number {
  width: 38px;
  height: 38px;
  color: var(--starpath-gold-bright);
  background: rgba(2, 18, 43, .72);
  border: 1px solid rgba(216, 168, 77, .58);
  border-radius: 50%;
}

.level-icon {
  margin: 7px 0 2px;
  font-size: 33px;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .18));
}

.level-card strong {
  margin: 0;
  color: #fff;
  line-height: 1.08;
}

.level-card small {
  margin-top: 2px;
  color: var(--starpath-muted);
  line-height: 1.2;
}

.level-best {
  min-height: 17px;
  margin-top: 4px;
  color: var(--starpath-gold-bright);
  line-height: 1.2;
}

.level-best::after {
  content: " →";
}

.level-card.completed,
.level-card.is-complete {
  border-color: rgba(255, 208, 113, .68);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .26), 0 0 20px rgba(216, 168, 77, .1);
}

.level-card.completed .level-number,
.level-card.is-complete .level-number {
  border: 2px solid var(--starpath-gold-bright);
  box-shadow: 0 0 0 3px rgba(216, 168, 77, .12);
}

.level-card.completed::after,
.level-card.is-complete::after {
  content: "★";
  color: var(--starpath-gold-bright);
  text-shadow: 0 0 10px rgba(255, 208, 113, .32);
}

.learning-progress-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 42px;
  padding: 24px 28px;
  background: linear-gradient(145deg, rgba(7, 34, 75, .9), rgba(4, 27, 63, .94));
  border: 1px solid rgba(216, 168, 77, .46);
  border-radius: 24px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .24);
}

.progress-card-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--starpath-gold-bright);
  background: rgba(2, 18, 43, .65);
  border: 1px solid rgba(255, 208, 113, .72);
  border-radius: 50%;
  font-size: 22px;
}

.learning-progress-card h2 {
  margin: 0 0 6px;
  color: var(--starpath-gold-bright);
  font-size: 28px;
}

.learning-progress-card p {
  margin: 0;
  color: var(--starpath-muted);
  font-size: 16px;
  line-height: 1.55;
}

.progress-dashboard-content {
  min-width: 0;
}

.progress-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.progress-stat {
  min-width: 0;
}

.progress-stat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: #fff;
  font-size: 12px;
}

.progress-stat-heading strong {
  font-weight: 900;
}

.progress-stat-heading span {
  flex: 0 0 auto;
  color: var(--starpath-gold-bright);
  font-weight: 900;
}

.dashboard-progress-track {
  height: 11px;
  overflow: hidden;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(216, 168, 77, .34);
  border-radius: 999px;
}

.dashboard-progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #d8a84d, #ffd071);
  border-radius: inherit;
  box-shadow: 0 0 10px rgba(255, 208, 113, .2);
  transition: width 450ms ease;
}

.foundations-complete-message {
  margin-top: 13px !important;
  color: var(--starpath-muted) !important;
  font-size: 13px !important;
}

.foundations-complete-message strong {
  display: block;
  margin-bottom: 2px;
  color: var(--starpath-gold-bright);
}

footer {
  color: var(--starpath-gold-bright);
}

@media (max-width: 1080px) {
  .level-hero {
    grid-template-columns: minmax(220px, 1.1fr) minmax(320px, 1.8fr) minmax(200px, 1fr);
    gap: 22px;
  }

  .level-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .level-speech-bubble {
    right: -2%;
    width: clamp(112px, 22vw, 170px);
  }
}

@media (max-width: 840px) {
  .site-header {
    width: calc(100% - 24px);
  }

  .level-hero {
    grid-template-columns: minmax(180px, .8fr) minmax(300px, 1.2fr);
  }

  .level-hero-copy {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .level-hero-scene {
    grid-column: 1;
    grid-row: 2;
    min-height: 240px;
  }

  .level-hero-mascot {
    grid-column: 2;
    grid-row: 2;
    width: min(100%, 270px);
    min-height: 270px;
  }

  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: nowrap;
  }

  .site-header .module-header-controls {
    gap: 8px;
    margin-left: auto;
  }

  .site-header .module-home-nav {
    width: 48px;
    flex-basis: 48px;
    margin-right: 12px;
  }

  .site-header .module-home-button {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  main {
    width: calc(100% - 24px);
  }

  .level-screen {
    padding-top: 8px;
  }

  .level-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    min-height: 0;
    margin-bottom: 28px;
  }

  .level-hero-scene,
  .level-hero-copy,
  .level-hero-mascot {
    grid-column: 1;
    grid-row: auto;
  }

  .level-hero-scene {
    min-height: 205px;
  }

  .level-hero-scene::after {
    background:
      linear-gradient(to bottom, var(--starpath-navy) 0%, transparent 13%, transparent 72%, var(--starpath-navy) 100%),
      linear-gradient(to right, var(--starpath-navy) 0%, transparent 13%, transparent 87%, var(--starpath-navy) 100%);
  }

  .level-heading h1 {
    font-size: clamp(42px, 13vw, 56px);
  }

  .module-identifier {
    margin-bottom: 14px;
  }

  .journey-kicker {
    margin-bottom: 16px;
  }

  .level-heading > p:last-child {
    font-size: 16px;
  }

  .level-hero-mascot {
    width: min(78vw, 270px);
    min-height: 250px;
  }

  .level-hero-mascot > img {
    width: min(78%, 215px);
  }

  .level-speech-bubble {
    top: -2%;
    right: -3%;
    width: clamp(106px, 34vw, 160px);
    max-width: min(160px, 48vw);
    padding: 0 18%;
    font-size: 16px;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .level-card {
    min-height: 151px;
    padding: 12px 10px 10px;
  }

  .learning-progress-card {
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 20px;
  }

  .learning-progress-card h2 {
    font-size: 24px;
  }

  .progress-summary {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 13px;
  }

}

@media (max-width: 390px) {
  .level-grid {
    grid-template-columns: 1fr;
  }

  .level-card {
    min-height: 145px;
  }

  .level-hero-scene {
    min-height: 185px;
  }

  .level-hero-mascot {
    width: min(76vw, 250px);
    min-height: 230px;
  }
}

/* Filipino modules: icon-only sound slider */
.site-header .sound-button {
  position: relative;
  isolation: isolate;
  width: 76px;
  min-width: 76px;
  height: 38px;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  overflow: hidden;
  border-radius: 999px;
}

.site-header .sound-button::before {
  position: absolute;
  z-index: -1;
  top: 3px;
  left: 3px;
  width: 34px;
  height: 30px;
  content: "";
  background: var(--starpath-purple);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
  transform: translateX(34px);
  transition: transform 180ms ease;
}

.site-header .sound-button.sound-on::before {
  transform: translateX(0);
}

.sound-option {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  opacity: .52;
  filter: grayscale(.55);
  font-size: 15px;
  line-height: 1;
  transition: opacity 180ms ease, filter 180ms ease;
}

.sound-button.sound-on .sound-on-icon,
.sound-button:not(.sound-on) .sound-off-icon {
  opacity: 1;
  filter: none;
}

@media (max-width: 620px) {
  .site-header .sound-button {
    width: 68px;
    min-width: 68px;
    height: 36px;
    padding: 3px;
  }

  .site-header .sound-button::before {
    width: 30px;
    height: 28px;
    transform: translateX(30px);
  }

  .site-header .sound-button.sound-on::before {
    transform: translateX(0);
  }

  .sound-option {
    width: 30px;
    height: 28px;
    font-size: 14px;
  }
}


