:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657084;
  --paper: #fff9e8;
  --white: #ffffff;
  --sun: #ffcd4a;
  --coral: #ff6f61;
  --mint: #2fc8a5;
  --sky: #6bc7ff;
  --leaf: #7cc84b;
  --violet: #6d5dfc;
  --rose: #ff8bb3;
  --blue: #2477ff;
  --line: rgba(23, 32, 51, 0.14);
  --shadow: 0 18px 45px rgba(35, 50, 81, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Nirmala UI", "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 205, 74, 0.2) 0 16%, transparent 16% 100%),
    linear-gradient(180deg, #fff8df 0%, #e7f8ff 52%, #fff1f7 100%);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, auto) 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem clamp(0.9rem, 2vw, 1.6rem);
  border-bottom: 3px solid rgba(23, 32, 51, 0.09);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

body.kid-app-mode {
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #f8fcff 0%, #fff8dc 46%, #eefbf1 100%);
}

body.kid-app-mode .topbar {
  display: none;
}

body.kid-app-mode main {
  padding: 0;
}

body.kid-app-mode #learnView {
  min-height: 100vh;
}

.brand {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 3.4rem;
  height: 3.4rem;
  filter: drop-shadow(0 8px 12px rgba(23, 32, 51, 0.12));
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  line-height: 1.05;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.tabs,
.learning-tabs {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  padding: 0.25rem;
  border: 2px solid rgba(23, 32, 51, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.tab,
.learn-tab,
.icon-button,
.install-button,
.whatsapp-action,
.account-chip,
.primary-action,
.download-action,
.ghost-action,
.mode-button,
.choice-card,
.lesson-button,
.pill-button,
.word-card,
.story-choice,
.trace-symbol-button {
  border: 0;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.tab,
.learn-tab {
  display: inline-flex;
  min-height: 2.6rem;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.85rem;
  border-radius: 999px;
  background: transparent;
  color: #445065;
  white-space: nowrap;
}

.tab svg,
.primary-action svg,
.download-action svg,
.ghost-action svg,
.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
  flex: 0 0 auto;
}

.tab.active,
.learn-tab.active {
  color: #101828;
  background: var(--sun);
  box-shadow: inset 0 -3px 0 rgba(23, 32, 51, 0.12);
}

.top-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.icon-button {
  position: relative;
  display: inline-flex;
  width: 2.65rem;
  height: 2.65rem;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(23, 32, 51, 0.1);
}

.icon-button::after {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  content: attr(data-tip);
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  color: #fff;
  background: #172033;
  font-size: 0.72rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.icon-button:hover::after,
.icon-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.install-button,
.whatsapp-action,
.offline-badge,
.account-chip {
  min-height: 2.35rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.install-button {
  background: var(--violet);
  color: #fff;
}

.whatsapp-action {
  background: #25d366;
  color: #0d3520;
}

.account-chip {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #edf8ff;
  border: 2px solid rgba(36, 119, 255, 0.22);
}

.offline-badge {
  border: 2px solid rgba(47, 200, 165, 0.32);
  color: #096d58;
  background: rgba(47, 200, 165, 0.14);
}

main {
  padding: clamp(0.85rem, 2.2vw, 1.5rem);
}

.view,
.learn-panel {
  display: none;
  min-width: 0;
}

.view.active,
.learn-panel.active {
  display: block;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: #c54847;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.05;
}

h1 {
  margin-bottom: 0.8rem;
  font-size: clamp(2rem, 5vw, 4.9rem);
}

h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.45rem, 3vw, 2.45rem);
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

.soft-text,
.hero-text {
  color: var(--muted);
  margin-bottom: 0;
}

.hero-text {
  max-width: 56rem;
  font-size: clamp(1.03rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.hero-section {
  min-height: calc(100vh - 6.8rem);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: clamp(1.2rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.1rem, 4vw, 3.4rem);
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(255, 205, 74, 0.42), rgba(107, 199, 255, 0.28) 48%, rgba(255, 139, 179, 0.3)),
    #fffdf5;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  min-width: 0;
}

.hero-actions,
.demo-row,
.learner-actions,
.action-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.hero-actions {
  margin-top: 1.2rem;
}

.primary-action,
.download-action,
.ghost-action,
.ghost-link {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 1rem;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(23, 32, 51, 0.14);
}

.primary-action {
  background: var(--ink);
  color: #fff;
}

.download-action {
  background: var(--blue);
  color: #fff;
}

.ghost-action,
.ghost-link {
  border: 2px solid rgba(23, 32, 51, 0.12);
  background: #fff;
}

.wide {
  width: 100%;
}

.install-help {
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: #2c3a4f;
  line-height: 1.45;
}

.trust-strip {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.trust-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.88rem;
  font-weight: 900;
}

.hero-visual {
  display: grid;
  gap: 1rem;
  place-items: center;
  min-height: 31rem;
}

.hero-copy .live-hero-text + .hero-text {
  display: none;
}

.hero-3d-studio {
  position: relative;
  width: min(30rem, 92vw);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 4px solid rgba(23, 32, 51, 0.12);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.95), transparent 24%),
    linear-gradient(145deg, #dff7ff 0%, #fff0a6 52%, #f5e9ff 100%);
  box-shadow: 0 22px 50px rgba(23, 32, 51, 0.18);
  transform: rotate(-1.5deg);
}

.hero-3d-studio canvas,
.teacher-3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.studio-caption {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.85rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border: 2px solid rgba(23, 32, 51, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  font-size: 0.84rem;
}

.studio-caption strong {
  font-size: 0.95rem;
}

.studio-caption span {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.fresh-subject-grid + .info-grid.three {
  display: none;
}

.ad-safety-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.ad-slot {
  display: grid;
  gap: 0.25rem;
  min-height: 6.5rem;
  align-content: center;
  padding: 1rem;
  border: 2px dashed rgba(23, 32, 51, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.ad-slot span {
  color: #755400;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ad-slot strong {
  font-size: 1.1rem;
}

.ad-slot small {
  color: var(--muted);
  font-weight: 800;
}

.online-ad-slot {
  background: linear-gradient(135deg, rgba(107, 199, 255, 0.25), rgba(255, 255, 255, 0.82));
}

.offline-ad-slot {
  background: linear-gradient(135deg, rgba(124, 200, 75, 0.2), rgba(255, 255, 255, 0.82));
}

.device-frame {
  width: min(23rem, 88vw);
  border: 8px solid #172033;
  border-radius: 34px;
  padding: 0.65rem;
  background: #172033;
  box-shadow: 0 28px 48px rgba(23, 32, 51, 0.22);
  transform: rotate(2deg);
}

.phone-top {
  width: 35%;
  height: 0.45rem;
  margin: 0 auto 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

.phone-screen {
  position: relative;
  min-height: 31rem;
  overflow: hidden;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.85rem;
  padding: 1.2rem;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #dff7ff 0 48%, #fff7d6 48% 100%);
}

.phone-screen img {
  width: 11rem;
  height: auto;
  animation: float 4s ease-in-out infinite;
}

.mini-level {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: var(--sun);
  font-weight: 900;
}

.mini-letter {
  min-width: 12rem;
  padding: 0.5rem;
  border: 3px dashed rgba(23, 32, 51, 0.16);
  border-radius: var(--radius);
  background: #fff;
  font-size: 3.8rem;
  font-weight: 900;
  text-align: center;
}

.mini-wave {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
}

.mini-wave span {
  display: block;
  width: 0.45rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--blue);
  animation: waveBounce 1s ease-in-out infinite alternate;
}

.mini-wave span:nth-child(2) {
  height: 2.1rem;
  background: var(--coral);
  animation-delay: -0.2s;
}

.mini-wave span:nth-child(3) {
  height: 3rem;
  background: var(--mint);
  animation-delay: -0.4s;
}

.mini-wave span:nth-child(4) {
  height: 1.8rem;
  background: var(--violet);
  animation-delay: -0.6s;
}

.mini-wave span:nth-child(5) {
  height: 2.6rem;
  background: var(--leaf);
  animation-delay: -0.8s;
}

.mini-progress {
  width: 85%;
  height: 0.85rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 32, 51, 0.13);
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
}

.section-band {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.6rem);
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(35, 50, 81, 0.1);
}

.section-head {
  max-width: 54rem;
  margin-bottom: 1rem;
}

.info-grid,
.flow-grid,
.routine-grid,
.admin-stats {
  display: grid;
  gap: 0.85rem;
}

.info-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-card,
.flow-step,
.routine-grid article,
.admin-stats article,
.preview-stat {
  min-height: 7rem;
  padding: 1rem;
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 7px 0 rgba(23, 32, 51, 0.05);
}

.info-card strong,
.routine-grid strong,
.admin-stats strong,
.preview-stat strong {
  display: block;
  margin-bottom: 0.45rem;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
}

.info-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.curriculum-band {
  background:
    linear-gradient(90deg, rgba(47, 200, 165, 0.14), rgba(255, 205, 74, 0.2)),
    rgba(255, 255, 255, 0.86);
}

.path-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
}

.path-steps span {
  display: grid;
  min-height: 5rem;
  place-items: center;
  padding: 0.8rem;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  font-weight: 900;
}

.flow-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.flow-step {
  display: grid;
  gap: 0.65rem;
}

.flow-step b {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sun);
}

.login-gate,
.payment-layout,
.parent-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(320px, 1.08fr);
  gap: 1rem;
  align-items: stretch;
}

.login-panel,
.access-preview,
.pricing-panel,
.payment-form-card,
.parent-main,
.policy-panel,
.admin-login,
.admin-dashboard,
.generate-panel,
.learner-table-panel,
.level-map,
.game-stage,
.workbench {
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  min-width: 0;
}

.login-panel,
.access-preview,
.pricing-panel,
.payment-form-card,
.parent-main,
.policy-panel {
  padding: clamp(1rem, 2.7vw, 1.6rem);
}

.access-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-content: center;
  background:
    linear-gradient(135deg, rgba(107, 199, 255, 0.24), rgba(255, 139, 179, 0.18)),
    #fff;
}

.access-preview img {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(17rem, 60vw);
  height: min(18rem, 58vw);
  object-fit: cover;
  object-position: center top;
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: #fff7da;
  animation: float 4s ease-in-out infinite;
}

.form-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: #35435a;
  font-weight: 900;
}

input,
select,
textarea {
  min-height: 3rem;
  padding: 0 0.85rem;
  border: 2px solid rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 9rem;
  padding: 0.8rem;
  resize: vertical;
}

.demo-row {
  margin-top: 0.85rem;
}

.feedback-text {
  min-height: 1.55rem;
  margin: 0.7rem 0 0;
  color: #334155;
  font-weight: 900;
}

.learner-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  min-width: 0;
}

body.kid-app-mode .learner-workspace {
  min-height: 100vh;
  gap: 0;
}

body.kid-app-mode .login-gate {
  min-height: 100vh;
  padding: 1rem;
}

body.kid-app-mode .learner-workspace.subject-picker-open {
  grid-template-rows: auto minmax(0, 1fr);
}

body.kid-app-mode .learner-workspace.subject-picker-open .teacher-board,
body.kid-app-mode .learner-workspace.subject-picker-open .learning-tabs,
body.kid-app-mode .learner-workspace.subject-picker-open .learn-panel {
  display: none;
}

body.kid-app-mode .learner-workspace.class-started {
  grid-template-rows: auto minmax(15rem, 39vh) minmax(0, 1fr);
}

body.kid-app-mode .learner-workspace.class-started .classroom-strip,
body.kid-app-mode .learner-workspace.class-started .learning-tabs,
body.kid-app-mode .learner-workspace.class-started #questPanel,
body.kid-app-mode .learner-workspace.class-started #soundPanel,
body.kid-app-mode .learner-workspace.class-started #wordsPanel,
body.kid-app-mode .learner-workspace.class-started #storyPanel {
  display: none;
}

body.kid-app-mode .learner-workspace.class-started #tracePanel {
  display: block;
  min-height: 0;
}

.classroom-strip {
  display: grid;
  grid-template-columns: minmax(170px, 0.25fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 205, 74, 0.26), rgba(107, 199, 255, 0.2)),
    #fff;
  box-shadow: 0 10px 28px rgba(35, 50, 81, 0.1);
  min-width: 0;
}

body.kid-app-mode .classroom-strip {
  min-height: calc(100vh - 5.2rem);
  align-content: center;
  padding: clamp(1rem, 5vw, 2rem);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background:
    linear-gradient(135deg, rgba(255, 205, 74, 0.28), rgba(107, 199, 255, 0.22)),
    #fffdf2;
}

body.kid-app-mode .classroom-strip h2 {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1;
}

body.kid-app-mode .subject-card {
  min-height: 7rem;
  padding: 1rem;
  border-width: 4px;
  box-shadow: 0 8px 0 rgba(23, 32, 51, 0.08);
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  min-width: 0;
}

.subject-card {
  min-height: 5.1rem;
  display: grid;
  gap: 0.25rem;
  align-content: center;
  padding: 0.75rem;
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 7px 0 rgba(23, 32, 51, 0.05);
}

.subject-card strong {
  font-size: 1.05rem;
}

.subject-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.subject-card.active {
  border-color: var(--ink);
  background: #fff3bf;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.15);
  opacity: 0.58;
}

.teacher-board {
  display: grid;
  grid-template-columns: minmax(13rem, 0.46fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.95rem;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 244, 191, 0.78), rgba(232, 248, 255, 0.88)),
    #fff;
  box-shadow: 0 12px 0 rgba(23, 32, 51, 0.06);
}

.teacher-3d-stage {
  position: relative;
  width: 100%;
  min-height: 12rem;
  aspect-ratio: 1.28 / 1;
  overflow: hidden;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: 16px;
  background:
    radial-gradient(circle at 24% 16%, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(145deg, #def7ff, #fff1a7 58%, #ffe4ef);
  box-shadow: inset 0 -10px 24px rgba(23, 32, 51, 0.06);
}

.teacher-3d-label {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  color: #172033;
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.68rem;
  font-weight: 900;
}

body.kid-app-mode .teacher-board {
  min-height: 100%;
  margin: 0;
  padding: clamp(0.85rem, 3vw, 1.4rem);
  border: 0;
  border-radius: 0;
  grid-template-columns: minmax(12rem, 0.42fr) minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(255, 251, 231, 0.78), rgba(238, 248, 255, 0.92)),
    #fff;
  box-shadow: none;
}

.teacher-avatar {
  display: none;
  position: relative;
  width: 8.7rem;
  height: 8.7rem;
  align-self: end;
  overflow: hidden;
  border: 3px solid #172033;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 28%, #fff7d8 0 18%, transparent 19%),
    linear-gradient(180deg, #e8f7ff 0 58%, #fff3bf 58% 100%);
  box-shadow: 0 8px 0 rgba(23, 32, 51, 0.12);
  transform-origin: 50% 88%;
}

.avatar-hair {
  position: absolute;
  left: 1.9rem;
  top: 0.7rem;
  width: 4.8rem;
  height: 4.2rem;
  border-radius: 48% 48% 42% 42%;
  background: #292233;
  z-index: 2;
}

.avatar-head {
  position: absolute;
  left: 2.25rem;
  top: 1.2rem;
  width: 4.1rem;
  height: 4rem;
  border-radius: 48%;
  background: #f2b889;
  box-shadow: inset 0 -0.35rem 0 rgba(23, 32, 51, 0.08);
  z-index: 3;
}

.avatar-eye,
.avatar-mouth {
  position: absolute;
  background: #172033;
}

.avatar-eye {
  top: 1.72rem;
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 50%;
}

.avatar-eye.left {
  left: 1.1rem;
}

.avatar-eye.right {
  right: 1.1rem;
}

.avatar-mouth {
  left: 50%;
  bottom: 0.92rem;
  width: 1.2rem;
  height: 0.38rem;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.avatar-body {
  position: absolute;
  left: 2rem;
  bottom: 0;
  width: 4.8rem;
  height: 3.6rem;
  border-radius: 1.8rem 1.8rem 0 0;
  background:
    linear-gradient(90deg, transparent 0 42%, rgba(255,255,255,0.7) 42% 58%, transparent 58%),
    #ffcd4a;
  border: 2px solid rgba(23, 32, 51, 0.18);
  z-index: 1;
}

.avatar-arm {
  position: absolute;
  right: 1.05rem;
  bottom: 1.9rem;
  width: 3rem;
  height: 0.65rem;
  border-radius: 999px;
  background: #f2b889;
  transform-origin: 0.25rem 50%;
  transform: rotate(-18deg);
  box-shadow: 0 3px 0 rgba(23, 32, 51, 0.1);
  z-index: 4;
}

.avatar-pencil {
  position: absolute;
  right: 0.45rem;
  bottom: 2.25rem;
  width: 2.2rem;
  height: 0.42rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffcd4a 0 72%, #f8d9b2 72% 90%, #172033 90%);
  transform: rotate(-20deg);
  transform-origin: 0 50%;
  z-index: 5;
}

body.kid-app-mode .teacher-avatar {
  width: min(13.5rem, 28vw);
  height: min(13.5rem, 28vw);
}

.teacher-board h3 {
  margin: 0.1rem 0 0.35rem;
  font-size: clamp(1.15rem, 1.8vw, 1.65rem);
  line-height: 1.2;
}

.teacher-board-copy {
  min-width: 0;
}

.board-stage {
  display: none;
  position: relative;
  overflow: hidden;
  border: 5px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #224736, #143325);
  box-shadow: inset 0 0 0 2px rgba(23, 32, 51, 0.24), 0 10px 0 rgba(23, 32, 51, 0.12);
}

.board-focus-text {
  position: relative;
  min-height: clamp(6rem, 16vw, 10rem);
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0.5rem;
  color: #fff8d5;
  font-size: clamp(4.8rem, 16vw, 9rem);
  font-weight: 900;
  line-height: 0.9;
  text-align: center;
  overflow-wrap: anywhere;
  opacity: 1;
}

.board-focus-text.is-revealing {
  animation: chalkReveal 1.45s steps(16, end) both;
}

.example-card {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
}

.example-picture {
  display: grid;
  width: 4.1rem;
  height: 4.1rem;
  place-items: center;
  border: 2px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background: var(--example-color, #ffcd4a);
  box-shadow: 0 5px 0 rgba(23, 32, 51, 0.08);
}

.example-picture svg {
  width: 3.3rem;
  height: 3.3rem;
  display: block;
}

.example-picture svg * {
  vector-effect: non-scaling-stroke;
}

.example-card strong,
.example-card small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.example-card strong {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
}

.example-card small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.writing-pencil {
  position: absolute;
  left: 13%;
  top: 21%;
  width: 5rem;
  height: 5rem;
  pointer-events: none;
  opacity: 0;
  transform: rotate(-18deg);
}

.writing-pencil::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 1.1rem;
  width: 4.6rem;
  height: 0.72rem;
  border: 2px solid rgba(23, 32, 51, 0.35);
  border-radius: 999px;
  background:
    linear-gradient(90deg, #ffcd4a 0 70%, #f59e0b 70% 84%, #f8d9b2 84% 94%, #172033 94%);
  box-shadow: 0 4px 0 rgba(23, 32, 51, 0.12);
}

.writing-pencil span {
  position: absolute;
  right: 0.1rem;
  top: 0.1rem;
  width: 2.1rem;
  height: 2.7rem;
  border: 2px solid rgba(23, 32, 51, 0.28);
  border-radius: 46% 46% 40% 40%;
  background: #f2b889;
  transform: rotate(18deg);
}

.chalk-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(20, 51, 37, 0.96), rgba(20, 51, 37, 0.36), transparent);
  transform: translateX(0);
  opacity: 0;
  pointer-events: none;
}

.teacher-board.is-writing .writing-pencil {
  opacity: 1;
  animation: pencilWrite 1.45s cubic-bezier(0.34, 0.02, 0.28, 0.99) both;
}

.teacher-board.is-writing .chalk-sweep {
  opacity: 1;
  animation: sweepWrite 1.45s linear both;
}

.teacher-board.is-writing .teacher-avatar {
  animation: teacherWrite 0.46s ease-in-out infinite alternate;
}

.teacher-board.is-writing .avatar-arm,
.teacher-board.is-writing .avatar-pencil {
  animation: avatarHandWrite 0.46s ease-in-out infinite alternate;
}

.teacher-board.turning .teacher-avatar {
  animation: teacherTurn 0.42s ease both;
}

.teacher-board[data-status="listen"] {
  border-color: rgba(47, 200, 165, 0.65);
}

.teacher-board[data-status="listening"] {
  border-color: rgba(107, 199, 255, 0.8);
  background:
    linear-gradient(135deg, rgba(232, 248, 255, 0.96), rgba(255, 255, 255, 0.86)),
    #fff;
}

.teacher-board[data-status="attention"] {
  border-color: rgba(255, 111, 97, 0.74);
  background:
    linear-gradient(135deg, rgba(255, 224, 224, 0.9), rgba(255, 248, 221, 0.92)),
    #fff;
}

.teacher-board[data-status="success"] {
  border-color: rgba(124, 200, 75, 0.76);
}

.teacher-board[data-status="listening"] .avatar-eye {
  height: 0.22rem;
  border-radius: 999px;
}

.teacher-board[data-status="attention"] .avatar-eye.left {
  transform: rotate(12deg);
}

.teacher-board[data-status="attention"] .avatar-eye.right {
  transform: rotate(-12deg);
}

.teacher-board[data-status="attention"] .avatar-mouth {
  width: 1rem;
  height: 0.7rem;
  border-radius: 50%;
}

.teacher-board[data-status="success"] .avatar-mouth {
  height: 0.5rem;
  border-radius: 0 0 999px 999px;
  background: transparent;
  border-bottom: 0.22rem solid #172033;
}

.teacher-board.speaking .teacher-avatar {
  animation: teacherTalk 0.38s ease-in-out infinite;
}

.teacher-board.speaking .avatar-mouth {
  animation: avatarTalk 220ms ease-in-out infinite alternate;
}

.kids-app-bar,
.learner-head,
.admin-head,
.table-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.kids-app-bar {
  position: relative;
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr) 3.3rem;
  padding: 0.55rem clamp(0.65rem, 2vw, 1rem);
  border-bottom: 2px solid rgba(23, 32, 51, 0.08);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  min-width: 0;
}

.kids-app-logo {
  width: 3.15rem;
  height: 3.15rem;
  flex: 0 0 auto;
  filter: drop-shadow(0 7px 10px rgba(23, 32, 51, 0.12));
}

.kids-app-bar h1 {
  margin: 0;
  justify-self: center;
  align-self: center;
  max-width: 100%;
  overflow: hidden;
  color: #172033;
  font-size: clamp(1.15rem, 4vw, 1.55rem);
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-button {
  justify-self: end;
}

.profile-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  justify-items: end;
  background: rgba(23, 32, 51, 0);
  pointer-events: none;
  transition: background 180ms ease;
}

.profile-sheet.open {
  background: rgba(23, 32, 51, 0.32);
  pointer-events: auto;
}

.profile-panel {
  width: min(21rem, 86vw);
  min-height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1rem;
  background: #fff;
  box-shadow: -22px 0 46px rgba(23, 32, 51, 0.2);
  transform: translateX(105%);
  transition: transform 190ms ease;
}

.profile-sheet.open .profile-panel {
  transform: translateX(0);
}

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid rgba(23, 32, 51, 0.08);
}

.profile-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.profile-details {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.profile-details div {
  padding: 0.75rem;
  border: 2px solid rgba(23, 32, 51, 0.08);
  border-radius: var(--radius);
  background: #fff9e8;
}

.profile-details dt {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-details dd {
  margin: 0.15rem 0 0;
  color: var(--ink);
  font-weight: 900;
}

.voice-style-field {
  display: grid;
  gap: 0.45rem;
  margin: 1rem 0;
  padding: 0.8rem;
  border: 2px solid rgba(36, 119, 255, 0.14);
  border-radius: var(--radius);
  background: #eef7ff;
  color: var(--ink);
  font-weight: 900;
}

.voice-style-field.priority-setting {
  border-color: rgba(255, 111, 97, 0.3);
  background: linear-gradient(135deg, #fff4e5, #eef7ff);
}

.voice-style-field span {
  color: var(--blue);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.voice-style-field select {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.55rem 0.7rem;
  border: 2px solid rgba(23, 32, 51, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

.voice-style-field small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.profile-actions {
  display: grid;
  gap: 0.65rem;
}

.learner-head {
  padding: 1rem;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 28px rgba(35, 50, 81, 0.1);
  min-width: 0;
}

.learning-tabs {
  justify-content: flex-start;
  overflow-x: auto;
}

.quest-layout {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: stretch;
}

.level-map {
  padding: 1.05rem;
}

.map-top {
  padding: 0 0.4rem 0.7rem;
}

.lesson-list {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}

.lesson-button {
  width: 100%;
  min-height: 4.3rem;
  display: grid;
  grid-template-columns: 2.3rem 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.65rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 0 rgba(23, 32, 51, 0.04);
}

.lesson-button.active {
  border-color: var(--ink);
  background: #fff3bf;
}

.lesson-button.locked {
  opacity: 0.66;
}

.lesson-number {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 999px;
  background: var(--sky);
  color: #10243d;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(23, 32, 51, 0.1);
}

.lesson-copy strong,
.lesson-copy small {
  display: block;
}

.lesson-copy strong {
  font-size: 0.96rem;
}

.lesson-copy small {
  color: var(--muted);
  font-size: 0.75rem;
}

.lesson-stars {
  color: #c17b00;
  font-size: 0.84rem;
  font-weight: 900;
}

.game-stage {
  position: relative;
  min-height: 40rem;
  overflow: hidden;
  padding: clamp(1rem, 2vw, 1.5rem);
  background:
    linear-gradient(180deg, rgba(107, 199, 255, 0.35), rgba(255, 255, 255, 0.8) 38%),
    #fffdf5;
}

.stage-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  width: 8.5rem;
  height: 3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  filter: drop-shadow(0 8px 16px rgba(23, 32, 51, 0.08));
  animation: drift 16s linear infinite;
}

.cloud::before,
.cloud::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 3.8rem;
  height: 3.8rem;
  left: 1.1rem;
  bottom: 0.5rem;
}

.cloud::after {
  width: 4.9rem;
  height: 4.9rem;
  right: 0.8rem;
  bottom: 0.1rem;
}

.cloud-one {
  top: 5rem;
  left: 8%;
}

.cloud-two {
  top: 2rem;
  right: 8%;
  animation-duration: 20s;
  animation-delay: -7s;
}

.kite {
  position: absolute;
  width: 2rem;
  height: 2rem;
  transform: rotate(45deg);
  border: 2px solid rgba(23, 32, 51, 0.12);
  animation: bob 3s ease-in-out infinite;
}

.kite-one {
  right: 19%;
  top: 8rem;
  background: var(--rose);
}

.kite-two {
  left: 22%;
  top: 13rem;
  background: var(--leaf);
  animation-delay: -1s;
}

.stage-header,
.mission-panel {
  position: relative;
  z-index: 1;
}

.stage-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.score-stack {
  display: grid;
  min-width: 5.7rem;
  min-height: 5.7rem;
  place-items: center;
  padding: 0.5rem;
  border: 3px solid rgba(23, 32, 51, 0.14);
  border-radius: 50%;
  background: var(--sun);
  box-shadow: inset 0 -7px 0 rgba(23, 32, 51, 0.12);
}

.score-stack strong {
  font-size: 2rem;
  line-height: 1;
}

.score-stack span {
  margin-top: -0.55rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.mission-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(310px, 1.1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  min-height: 29rem;
  padding: 0.5rem 0 0;
}

.character-scene {
  position: relative;
  min-height: 18rem;
  display: grid;
  place-items: center;
  min-width: 0;
}

.character-scene img {
  width: min(82%, 18rem);
  height: auto;
  animation: float 4s ease-in-out infinite;
}

.spark {
  position: absolute;
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: inset 0 -3px 0 rgba(23, 32, 51, 0.1);
  animation: pop 2.2s ease-in-out infinite;
}

.spark-a {
  left: 16%;
  top: 18%;
  background: var(--coral);
}

.spark-b {
  right: 18%;
  top: 12%;
  background: var(--mint);
  animation-delay: -0.8s;
}

.spark-c {
  right: 30%;
  bottom: 18%;
  background: var(--violet);
  animation-delay: -1.4s;
}

.challenge-box {
  padding: clamp(0.9rem, 2.4vw, 1.3rem);
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  min-width: 0;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  padding: 0.25rem;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: 999px;
  background: #f2f6ff;
}

.mode-button {
  min-height: 2.25rem;
  border-radius: 999px;
  background: transparent;
  color: #516070;
  font-weight: 800;
}

.mode-button.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 6px 12px rgba(23, 32, 51, 0.08);
}

.challenge-label {
  margin: 0.9rem 0 0.5rem;
  color: #3b495f;
  font-weight: 900;
}

.prompt-card {
  display: grid;
  min-height: 10rem;
  place-items: center;
  padding: 0.8rem;
  border: 3px dashed rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 205, 74, 0.45), rgba(255, 139, 179, 0.26)),
    #fff;
}

.prompt-card span {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(4.2rem, 13vw, 8.5rem);
  font-weight: 900;
  line-height: 0.9;
}

.prompt-card small {
  color: #425066;
  font-size: clamp(1rem, 2.3vw, 1.35rem);
  font-weight: 900;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.choice-card {
  min-height: 5.5rem;
  display: grid;
  gap: 0.3rem;
  place-items: center;
  padding: 0.7rem;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 7px 0 rgba(23, 32, 51, 0.06);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.choice-card:hover,
.choice-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 0 rgba(23, 32, 51, 0.06);
}

.choice-card.correct {
  border-color: #13a66f;
  background: #dffbef;
}

.choice-card.wrong {
  border-color: #e84d4d;
  background: #ffe8e8;
}

.choice-main {
  max-width: 100%;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.choice-sub {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.workbench {
  min-height: 38rem;
  padding: clamp(1rem, 2.4vw, 1.4rem);
  background: rgba(255, 255, 255, 0.82);
}

.workbench-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sound-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.1fr) minmax(220px, 1fr);
  gap: 1rem;
}

.sound-pad,
.mouth-panel,
.sentence-panel,
.trace-side {
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: #fff;
  padding: 1rem;
}

.pill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.pill-grid.compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.pill-button {
  min-height: 3rem;
  border-radius: 999px;
  background: #edf8ff;
  border: 2px solid rgba(23, 32, 51, 0.1);
  font-size: 1.1rem;
  font-weight: 900;
}

.pill-button.active {
  background: var(--sun);
  border-color: var(--ink);
}

.blend-display {
  min-height: 5.2rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(47, 200, 165, 0.2), rgba(109, 93, 252, 0.16)),
    #fff;
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  font-weight: 900;
  text-align: center;
}

.mouth-panel {
  display: grid;
  gap: 1rem;
  place-items: center;
  background: linear-gradient(180deg, #fff8e0, #fff);
}

.mouth-face {
  position: relative;
  width: min(16rem, 70vw);
  aspect-ratio: 1;
  border: 4px solid rgba(23, 32, 51, 0.12);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 38%, #fff 0 7%, transparent 8%),
    radial-gradient(circle at 62% 38%, #fff 0 7%, transparent 8%),
    #ffcd4a;
  box-shadow: inset 0 -14px 0 rgba(23, 32, 51, 0.1), 0 16px 30px rgba(23, 32, 51, 0.12);
}

.eye {
  position: absolute;
  top: 38%;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #172033;
}

.eye.left {
  left: 36%;
}

.eye.right {
  right: 36%;
}

.mouth {
  position: absolute;
  left: 50%;
  bottom: 27%;
  width: 4.5rem;
  height: 1.3rem;
  transform: translateX(-50%);
  border-radius: 0 0 999px 999px;
  background: #172033;
  transition: height 160ms ease, border-radius 160ms ease;
}

.mouth-face.speaking .mouth {
  height: 3rem;
  border-radius: 50%;
  animation: mouthSpeak 240ms ease-in-out infinite alternate;
}

#waveCanvas {
  width: 100%;
  max-width: 35rem;
  height: 10rem;
  border: 2px dashed rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  background: #f8fbff;
}

.trace-layout {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) minmax(190px, 250px);
  gap: 1rem;
  align-items: stretch;
}

body.kid-app-mode .trace-workbench,
body.kid-app-mode .workbench {
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

body.kid-app-mode .trace-workbench .workbench-head,
body.kid-app-mode .trace-symbols,
body.kid-app-mode .trace-side {
  display: none;
}

body.kid-app-mode .trace-layout {
  height: 100%;
  min-height: calc(55vh - 4.8rem);
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.trace-symbols {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  max-height: calc(100vh - 12rem);
  overflow: auto;
  padding-right: 0.25rem;
}

.trace-symbol-button {
  min-height: 3.5rem;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1.6rem;
  font-weight: 900;
}

.trace-symbol-button.active {
  background: #dcf8ff;
  border-color: var(--blue);
}

.canvas-wrap {
  position: relative;
  min-height: 30rem;
  overflow: hidden;
  border: 4px solid rgba(23, 32, 51, 0.13);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(23, 32, 51, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.06) 1px, transparent 1px),
    #fff;
  background-size: 32px 32px;
}

body.kid-app-mode .canvas-wrap {
  min-height: 100%;
  border-width: 0;
  border-top: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: 0;
  background:
    linear-gradient(rgba(36, 119, 255, 0.1) 2px, transparent 2px),
    linear-gradient(90deg, rgba(36, 119, 255, 0.08) 2px, transparent 2px),
    #ffffff;
  background-size: 42px 42px;
}

.trace-ghost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(23, 32, 51, 0.09);
  font-size: clamp(9rem, 24vw, 19rem);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

body.kid-app-mode .trace-ghost {
  color: rgba(23, 32, 51, 0.08);
  font-size: clamp(10rem, 39vw, 22rem);
}

#traceCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.auto-trace-status {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.8rem;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0.8rem;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.auto-trace-status span {
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auto-trace-status strong {
  min-width: 3.2rem;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
  text-align: center;
}

.auto-trace-status .feedback-text {
  min-height: 0;
  margin: 0;
  font-size: 0.95rem;
}

.trace-side {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.trace-target {
  display: grid;
  min-height: 9rem;
  place-items: center;
  border-radius: var(--radius);
  background: #fff3bf;
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 900;
}

.category-select {
  min-height: 2.8rem;
  min-width: min(15rem, 55vw);
  padding: 0 0.8rem;
  border: 2px solid rgba(23, 32, 51, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.word-card {
  position: relative;
  min-height: 10.5rem;
  display: grid;
  place-items: center;
  gap: 0.35rem;
  padding: 0.8rem;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 0 rgba(23, 32, 51, 0.06);
}

.word-picture {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border-radius: 50%;
  background: var(--card-color, #ffcd4a);
}

.word-picture svg {
  width: 2.7rem;
  height: 2.7rem;
  fill: rgba(23, 32, 51, 0.82);
}

.word-card strong {
  font-size: 1.3rem;
}

.word-card span {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 900;
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 1rem;
  align-items: stretch;
}

.story-scene {
  position: relative;
  min-height: 31rem;
  overflow: hidden;
  border: 3px solid rgba(23, 32, 51, 0.11);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #bdeaff 0 55%, #dff7bd 55% 100%);
}

.story-scene img {
  position: absolute;
  left: 50%;
  bottom: 2.2rem;
  width: min(55%, 15rem);
  transform: translateX(-50%);
  animation: float 4s ease-in-out infinite;
}

.sun {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 1rem rgba(255, 205, 74, 0.25);
}

.hill {
  position: absolute;
  bottom: 0;
  width: 75%;
  height: 34%;
  border-radius: 50% 50% 0 0;
}

.hill-a {
  left: -12%;
  background: #79c855;
}

.hill-b {
  right: -18%;
  background: #41b977;
}

.path {
  position: absolute;
  left: 42%;
  bottom: 0;
  width: 7rem;
  height: 42%;
  background: #ffd38d;
  clip-path: polygon(36% 0, 64% 0, 100% 100%, 0 100%);
}

.sentence-panel {
  align-content: start;
}

.story-sentence {
  min-height: 8rem;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-radius: var(--radius);
  background: #f8fbff;
  font-size: clamp(2rem, 5vw, 4.2rem);
  font-weight: 900;
  text-align: center;
}

.story-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.story-choice {
  min-height: 4rem;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background: #fff;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 900;
}

.story-choice.correct {
  background: #ddfbe8;
  border-color: #1ea86d;
}

.story-choice.wrong {
  background: #ffe4e4;
  border-color: #e54848;
}

.hindi-line {
  margin: 1rem 0 0;
  color: #4e5b72;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  font-weight: 900;
  text-align: center;
}

.price-card,
.upi-box,
.device-card {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 3px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: #fff;
}

.price-card strong {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.upi-box {
  background: #e8fff6;
}

.upi-box small,
.price-card p {
  color: var(--muted);
}

.parent-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.routine-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.routine-grid article span {
  color: var(--muted);
  font-weight: 800;
}

.clean-list {
  display: grid;
  gap: 0.65rem;
  padding-left: 1.1rem;
  color: #334155;
  line-height: 1.45;
}

.device-card strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.admin-login {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem;
}

.admin-dashboard {
  padding: clamp(1rem, 2.4vw, 1.4rem);
}

.admin-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1rem 0;
}

.legacy-admin-section[hidden] {
  display: none !important;
}

.voice-setup-panel {
  padding: 1rem;
  margin: 0 0 1rem;
  border: 3px solid rgba(36, 119, 255, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(238, 247, 255, 0.92), rgba(255, 244, 229, 0.92)),
    #fff;
}

.voice-setup-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.8rem;
}

.voice-setup-grid .wide-field,
.voice-setup-grid .wide {
  grid-column: 1 / -1;
}

.voice-recorder-panel {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 0.9rem;
  border: 2px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.voice-recorder-panel h3 {
  margin: 0 0 0.25rem;
}

.voice-recorder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.voice-recorder-grid .wide-field {
  grid-column: 1 / -1;
}

.voice-recorder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.voice-clip-list {
  display: grid;
  gap: 0.5rem;
}

.voice-clip-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem;
  border: 2px solid rgba(23, 32, 51, 0.08);
  border-radius: 8px;
  background: #fff;
}

.voice-clip-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.voice-clip-item small {
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: 1rem;
}

.generate-panel,
.learner-table-panel {
  padding: 1rem;
}

.generated-message {
  width: 100%;
  margin-top: 0.85rem;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 0.75rem;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(23, 32, 51, 0.11);
  text-align: left;
  vertical-align: top;
}

th {
  color: #445065;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: #243047;
  font-weight: 800;
}

.table-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 2.1rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(23, 32, 51, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  min-height: 1.8rem;
  align-items: center;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: #e8fff6;
  color: #096d58;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.inactive {
  background: #ffe4e4;
  color: #9d2222;
}

.celebrate {
  animation: celebrate 420ms ease-in-out;
}

@keyframes waveBounce {
  from {
    transform: scaleY(0.72);
  }
  to {
    transform: scaleY(1.12);
  }
}

@keyframes drift {
  0% {
    transform: translateX(-1rem);
  }
  50% {
    transform: translateX(1.5rem);
  }
  100% {
    transform: translateX(-1rem);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
  }
  50% {
    transform: translateY(-0.75rem) rotate(45deg);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.8rem);
  }
}

@keyframes pop {
  0%,
  100% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.15);
  }
}

@keyframes mouthSpeak {
  from {
    height: 1.3rem;
  }
  to {
    height: 3rem;
  }
}

@keyframes teacherTalk {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-0.16rem) rotate(-1.2deg) scale(1.025);
  }
}

@keyframes teacherWrite {
  from {
    transform: rotate(-1deg) translateY(0);
  }
  to {
    transform: rotate(1.5deg) translateY(-0.12rem);
  }
}

@keyframes avatarHandWrite {
  from {
    transform: rotate(-24deg) translateY(0);
  }
  to {
    transform: rotate(-2deg) translateY(-0.18rem);
  }
}

@keyframes avatarTalk {
  from {
    height: 0.32rem;
    border-radius: 0 0 999px 999px;
  }
  to {
    height: 0.82rem;
    border-radius: 50%;
  }
}

@keyframes teacherTurn {
  0% {
    transform: rotate(-2deg) scale(1);
  }
  55% {
    transform: rotate(3deg) scale(1.035);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

@keyframes pencilWrite {
  0% {
    transform: translate(0, 0) rotate(-20deg);
  }
  28% {
    transform: translate(50%, 34%) rotate(-8deg);
  }
  58% {
    transform: translate(118%, 4%) rotate(-18deg);
  }
  100% {
    transform: translate(205%, 38%) rotate(-10deg);
  }
}

@keyframes sweepWrite {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(110%);
  }
}

@keyframes chalkReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes celebrate {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.035) rotate(-0.3deg);
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .main-tabs {
    grid-column: 1 / -1;
    order: 3;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .hero-section,
  .login-gate,
  .payment-layout,
  .parent-layout,
  .quest-layout,
  .sound-grid,
  .story-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .voice-setup-grid {
    grid-template-columns: 1fr;
  }

  .voice-recorder-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
  }

  .hero-visual {
    min-height: auto;
  }

  .hero-3d-studio {
    width: min(100%, 30rem);
    transform: none;
  }

  .lesson-list {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.3rem;
  }

  .classroom-strip {
    grid-template-columns: 1fr;
  }

  .subject-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ad-safety-strip {
    grid-template-columns: 1fr;
  }

  .mission-panel {
    grid-template-columns: 1fr;
  }

  .character-scene {
    min-height: 11rem;
  }

  .character-scene img {
    width: min(12rem, 48vw);
  }

  .trace-layout {
    grid-template-columns: 1fr;
  }

  .trace-symbols {
    grid-template-columns: repeat(6, minmax(3.2rem, 1fr));
    max-height: none;
  }

  .trace-side {
    grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1fr);
    align-items: center;
  }

  .trace-side .challenge-label,
  .trace-side .feedback-text {
    grid-column: 1 / -1;
  }

  .word-grid,
  .info-grid.three,
  .path-steps,
  .flow-grid,
  .routine-grid,
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0.65rem;
  }

  .brand img {
    width: 2.8rem;
    height: 2.8rem;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand small {
    display: none;
  }

  .brand span {
    display: none;
  }

  .top-actions {
    gap: 0.35rem;
  }

  .top-actions .install-button {
    min-width: 0;
    padding: 0 0.85rem;
    font-size: 0.82rem;
  }

  .account-chip {
    max-width: 10.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .offline-badge,
  .whatsapp-action {
    display: none;
  }

  .tab,
  .learn-tab {
    min-width: 4.7rem;
    padding: 0 0.55rem;
    font-size: 0.85rem;
  }

  main {
    padding: 0.65rem;
  }

  .hero-section {
    padding: 1rem;
  }

  .hero-3d-studio {
    width: min(100%, 24rem);
  }

  .studio-caption {
    align-items: flex-start;
    flex-direction: column;
  }

  .studio-caption span {
    text-align: left;
  }

  .device-frame {
    width: min(19rem, 94vw);
    transform: none;
  }

  .phone-screen {
    min-height: 25rem;
  }

  .mini-letter {
    min-width: 9rem;
    font-size: 3rem;
  }

  .lesson-list {
    grid-template-columns: repeat(7, minmax(205px, 1fr));
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-board {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }

  .teacher-3d-stage {
    min-height: 13.5rem;
  }

  .teacher-avatar {
    width: 5.6rem;
    height: 5.6rem;
  }

  .teacher-board h3 {
    font-size: 1rem;
  }

  body.kid-app-mode .teacher-board {
    grid-template-columns: 1fr;
    padding: 0.55rem 0.75rem 0.7rem;
  }

  body.kid-app-mode .teacher-avatar {
    width: min(7.8rem, 28vw);
    height: min(7.8rem, 28vw);
  }

  body.kid-app-mode .teacher-board h3 {
    font-size: 0.95rem;
    line-height: 1.15;
  }

  body.kid-app-mode .board-focus-text {
    min-height: 5.6rem;
    font-size: clamp(3.25rem, 16vw, 6rem);
  }

  body.kid-app-mode .example-card {
    grid-template-columns: 3.4rem minmax(0, 1fr);
    margin-top: 0.45rem;
    padding: 0.45rem 0.55rem;
  }

  body.kid-app-mode .example-picture {
    width: 3.2rem;
    height: 3.2rem;
  }

  body.kid-app-mode .example-picture svg {
    width: 2.55rem;
    height: 2.55rem;
  }

  body.kid-app-mode .example-card strong {
    font-size: 0.95rem;
  }

  body.kid-app-mode .example-card small {
    font-size: 0.78rem;
  }

  .stage-header,
  .workbench-head,
  .learner-head,
  .admin-head,
  .table-head {
    align-items: stretch;
    flex-direction: column;
  }

  .score-stack {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    min-width: 4.7rem;
    min-height: 4.7rem;
  }

  .stage-header {
    padding-right: 5.2rem;
  }

  .choice-grid,
  .story-options,
  .word-grid,
  .info-grid.three,
  .path-steps,
  .flow-grid,
  .routine-grid,
  .admin-stats,
  .access-preview {
    grid-template-columns: 1fr;
  }

  .prompt-card {
    min-height: 8.2rem;
  }

  .sound-pad,
  .mouth-panel,
  .sentence-panel,
  .trace-side {
    padding: 0.8rem;
  }

  .pill-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pill-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .canvas-wrap {
    min-height: 23rem;
  }
}

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