:root {
  --bg-app: #f4f5f6;
  --bg-surface: #ffffff;
  --bg-soft: #eaedf0;
  --text-primary: #20252b;
  --text-secondary: #5a626b;
  --border: #d7dce1;
  --accent-primary: #657487;
  --accent-primary-hover: #556477;
  --accent-secondary: #879685;
  --success: #5e7d68;
  --warning: #8a7652;
  --error: #8a5f63;
  --focus: #315eaf;
  --shadow-soft: 0 12px 36px rgba(31, 38, 45, 0.09);
  --radius-sm: 14px;
  --radius-md: 24px;
  --radius-lg: 36px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

:root[data-theme="natural-color"] {
  --bg-app: #fff9f1;
  --bg-surface: #ffffff;
  --bg-soft: #f4f0e8;
  --text-primary: #253044;
  --text-secondary: #5e6878;
  --border: #e3ded4;
  --accent-primary: #4e72c2;
  --accent-primary-hover: #3f60a7;
  --accent-secondary: #d88d49;
  --success: #4b8f6b;
  --warning: #a87832;
  --error: #b85d5d;
  --focus: #315eaf;
  --shadow-soft: 0 12px 36px rgba(49, 55, 70, 0.11);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg-app); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--accent-secondary) 13%, transparent), transparent 34rem),
    var(--bg-app);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }

button { cursor: pointer; }

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

:focus-visible {
  outline: 4px solid color-mix(in srgb, var(--focus) 75%, white);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: .75rem 1rem;
  color: white;
  background: var(--text-primary);
  border-radius: .75rem;
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

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

.screen {
  display: none;
  min-height: 100vh;
  padding: clamp(1.25rem, 4vw, 4rem);
}

.screen.is-active { display: block; }

.welcome-grid {
  width: min(1120px, 100%);
  min-height: calc(100vh - 8rem);
  margin: auto;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: clamp(2rem, 7vw, 7rem);
  align-items: center;
}

.adult-mark {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  color: var(--text-secondary);
  font-size: .86rem;
}

.eyebrow {
  margin: 0 0 .75rem;
  color: var(--accent-primary);
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1, h2, p { text-wrap: pretty; }

h1 {
  max-width: 20ch;
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: .98;
  letter-spacing: -.045em;
}

h2 {
  margin: 0 0 .6rem;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: -.025em;
}

.lead {
  max-width: 58ch;
  margin: 1.4rem 0 0;
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 2rem;
}

.local-login {
  max-width: 650px;
  margin-top: 1.5rem;
  padding: 1.1rem;
  background: color-mix(in srgb, var(--bg-surface) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.admin-entry-button {
  background: var(--text-primary);
}

.welcome-theme-preview {
  max-width: 650px;
  margin-top: .8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
}

.mini-theme-card {
  min-height: 64px;
  padding: .65rem .8rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-weight: 750;
}

.mini-theme-card.is-selected { border: 2px solid var(--accent-primary); }

.mini-palette { display: flex; gap: 3px; }
.mini-palette i { display: block; width: 16px; height: 32px; border-radius: 5px; }
.calm-palette i:nth-child(1) { background: #657487; }
.calm-palette i:nth-child(2) { background: #879685; }
.calm-palette i:nth-child(3) { background: #d7dce1; }
.natural-palette i:nth-child(1) { background: #4e72c2; }
.natural-palette i:nth-child(2) { background: #d88d49; }
.natural-palette i:nth-child(3) { background: #4b8f6b; }

.local-login h2 {
  font-size: 1.05rem;
  letter-spacing: 0;
}

.login-fields {
  margin: .9rem 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
}

.login-fields label, .voice-panel label {
  display: grid;
  gap: .35rem;
  color: var(--text-secondary);
  font-size: .88rem;
  font-weight: 700;
}

.login-fields input, .voice-row select {
  width: 100%;
  min-height: 48px;
  padding: .65rem .75rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.button, .icon-button, .path-card, .letter-option, .theme-choice button, .lab-card, .letter-tile {
  border: 0;
  transition: transform 140ms var(--ease-out), background-color 180ms ease, border-color 180ms ease;
}

.button:active, .icon-button:active, .path-card:active, .letter-option:active, .theme-choice button:active, .lab-card:active, .letter-tile:active {
  transform: scale(.97);
}

.button {
  min-height: 52px;
  padding: .85rem 1.25rem;
  border-radius: 16px;
  color: #fff;
  background: var(--accent-primary);
  font-weight: 750;
}

.button:hover { background: var(--accent-primary-hover); }

.button-secondary {
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.button-secondary:hover { background: var(--bg-soft); }

.button-google {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: #202124;
  background: #fff;
  box-shadow: inset 0 0 0 1px #c8cbd0;
}

.button-google:hover { background: #f8f9fa; }

.google-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #356fd1;
  font-weight: 800;
}

.button-small { min-height: 44px; padding: .65rem .9rem; }

.fine-print, .hint {
  color: var(--text-secondary);
  font-size: .9rem;
}

.calm-card, .panel, .gate-card {
  background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.calm-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.leaf-shape {
  width: 116px;
  height: 76px;
  margin: 0 0 2rem auto;
  background: color-mix(in srgb, var(--accent-secondary) 45%, var(--bg-soft));
  border-radius: 80% 16% 78% 22%;
  transform: rotate(-9deg);
}

.plain-list {
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  padding: .6rem 0;
  border-top: 1px solid var(--border);
}

.child-screen {
  background: linear-gradient(145deg, color-mix(in srgb, var(--bg-soft) 50%, transparent), transparent 55%);
}

.child-header, .adult-header {
  width: min(1160px, 100%);
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 750;
}

.profile-chip small {
  display: block;
  color: var(--text-secondary);
  font-size: .75rem;
  font-weight: 600;
}

.profile-select-grid {
  width: min(900px, 100%);
  margin: clamp(2rem, 8vh, 5rem) auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.profile-card {
  min-height: 280px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.profile-card:hover, .profile-card:focus-visible { border-color: var(--accent-primary); }
.profile-avatar-four { background: var(--accent-secondary); }
.profile-avatar-six { background: var(--accent-primary); }
.profile-card-name { margin-top: 1rem; font-size: 1.4rem; font-weight: 800; }
.profile-card-note { max-width: 28ch; margin-top: .4rem; color: var(--text-secondary); text-align: center; }
.profile-explanation { max-width: 720px; margin: 1.5rem auto; color: var(--text-secondary); text-align: center; }

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 50%;
}

.icon-button {
  min-width: 48px;
  min-height: 48px;
  padding: .7rem 1rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  font-weight: 700;
}

.child-content, .activity-wrap, .complete-wrap {
  width: min(920px, 100%);
  margin: clamp(3rem, 9vh, 7rem) auto 0;
  text-align: center;
}

.level-map-wrap {
  width: min(1040px, 100%);
  margin: clamp(2.5rem, 7vh, 5rem) auto 0;
  text-align: center;
}

.level-map-wrap h1 {
  max-width: 18ch;
  margin-inline: auto;
}

.level-map-intro { margin-inline: auto; }

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

.level-card {
  min-height: 168px;
  padding: 1.35rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  color: var(--text-primary);
  text-align: left;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.level-card:hover, .level-card:focus-visible { border-color: var(--accent-primary); }

.level-number {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 18px;
  font-size: 1.3rem;
  font-weight: 850;
}

.level-card.is-recommended .level-number { background: var(--accent-secondary); }
.level-card:disabled {
  cursor: not-allowed;
  opacity: .62;
  box-shadow: none;
}
.level-card:disabled:hover { border-color: var(--border); }
.world-kicker,
.world-inventory {
  display: block;
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 750;
}
.world-kicker {
  margin-bottom: .2rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.world-inventory { margin-top: .55rem; }
.world-progress {
  display: block;
  width: min(280px, 100%);
  height: 8px;
  margin-top: .7rem;
  overflow: hidden;
  background: var(--border);
  border-radius: 99px;
}
.world-progress > span {
  display: block;
  height: 100%;
  background: var(--success);
  border-radius: inherit;
}
.world-card.is-locked .level-number {
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 2px solid var(--border);
}
.level-title { display: block; margin-bottom: .35rem; font-size: 1.3rem; font-weight: 800; }
.level-goal { display: block; color: var(--text-secondary); }
.level-status { display: block; margin-top: .6rem; color: var(--success); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }

.child-content h1, .activity-wrap h1, .complete-wrap h1 {
  max-width: 18ch;
  margin-inline: auto;
  font-size: clamp(2.5rem, 7vw, 5.8rem);
}

.path-grid {
  margin-top: clamp(2rem, 6vh, 4rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 2rem);
}

.path-card {
  min-height: 230px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.path-card:hover, .path-card:focus-visible {
  border-color: var(--accent-primary);
}

.path-card-alt .path-symbol { background: var(--accent-secondary); }

.path-symbol {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  margin-bottom: 1rem;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 24px;
  font-size: 2.5rem;
  font-weight: 800;
}

.path-name { font-size: 1.5rem; font-weight: 800; }
.path-note, .progress-note { color: var(--text-secondary); }
.progress-note { margin-top: 1.5rem; }

.meaning-support {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .75rem;
}

.target-audio-button,
.translation-button {
  min-height: 52px;
  margin-bottom: 1rem;
}

.translation-hint {
  width: fit-content;
  margin: 0 auto 1rem;
  padding: .7rem 1rem;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 2px solid var(--accent-secondary);
  border-radius: 14px;
  font-weight: 800;
}

.guide-invitation {
  max-width: 920px;
  margin: 1.5rem auto 0;
  padding: 1.1rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  text-align: left;
  background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.guide-invitation h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
.guide-invitation p:not(.eyebrow) { margin: 0; color: var(--text-secondary); }

.guide-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-secondary) 18%, var(--bg-surface));
  border-radius: 20px;
}

.guide-mark svg { width: 42px; height: 42px; }
.guide-mark path { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.guide-mark-small { width: 48px; height: 48px; border-radius: 15px; }
.guide-mark-small svg { width: 32px; height: 32px; }
.guide-start-button { min-width: 180px; }

.today-lab {
  max-width: 920px;
  margin: 1rem auto 0;
  padding: clamp(1.1rem, 3vw, 1.5rem);
  text-align: left;
  background: var(--bg-surface);
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-md);
}

.today-lab-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.today-lab-heading h2 { font-size: clamp(1.35rem, 2.5vw, 1.9rem); }
.today-lab-heading p:not(.eyebrow) { margin: 0; color: var(--text-secondary); }

.practice-language-choice {
  display: flex;
  padding: 4px;
  flex: 0 0 auto;
  background: var(--bg-soft);
  border-radius: 14px;
}

.practice-language-choice button {
  min-height: 44px;
  padding: .55rem .8rem;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-weight: 800;
}

.practice-language-choice button[aria-pressed="true"] {
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
}

.today-lab-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.lab-card {
  min-height: 104px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  color: var(--text-primary);
  text-align: left;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 18px;
}

.lab-card-primary { border-color: var(--accent-primary); }
.lab-card strong, .lab-card small { display: block; }
.lab-card small { margin-top: .2rem; color: var(--text-secondary); }

.lab-number {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 16px;
  font-size: 1.25rem;
  font-weight: 850;
}

.activity-guide {
  max-width: 700px;
  margin: 0 auto 1.25rem;
  padding: .8rem 1rem;
  display: flex;
  gap: .8rem;
  align-items: center;
  color: var(--text-primary);
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.activity-guide span { color: var(--accent-primary); font-size: .78rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.activity-guide p { margin: .15rem 0 0; color: var(--text-secondary); }
.guide-adult-button {
  margin-left: auto;
  white-space: nowrap;
}

.step-dots span {
  display: block;
  flex: 1 1 28px;
  min-width: 6px;
  max-width: 28px;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
}
.step-dots {
  display: flex;
  flex: 1 1 340px;
  justify-content: center;
  gap: 5px;
  max-width: 391px;
}
.step-dots .is-filled { background: var(--accent-primary); }

.option-grid {
  max-width: 760px;
  margin: clamp(2rem, 7vh, 4rem) auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(.8rem, 2vw, 1.5rem);
}

.letter-option {
  aspect-ratio: 1;
  min-height: 128px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
}

.letter-option.is-current {
  border-color: var(--focus);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--focus) 17%, transparent);
}

.letter-option.is-word {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
}

.letter-option.is-phrase {
  padding: .75rem;
  font-size: clamp(1.15rem, 3vw, 2.1rem);
  line-height: 1.15;
}

.letter-option.is-correct { border-color: var(--success); }
.letter-option.is-retry { border-color: var(--warning); }

.letter-option.is-visual {
  min-height: 210px;
  aspect-ratio: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: 1.2rem;
}

.activity-illustration {
  width: min(112px, 80%);
  height: auto;
  color: var(--accent-primary);
}

.activity-pictogram {
  display: block;
  width: min(148px, 86%);
  aspect-ratio: 1;
  background-image: url("./assets/learner-pictograms-v1.png");
  background-repeat: no-repeat;
  background-size: 300% 300%;
  border-radius: 18px;
}

.pictogram-cat { background-position: 0 0; }
.pictogram-dog { background-position: 50% 0; }
.pictogram-sun { background-position: 100% 0; }
.pictogram-book { background-position: 0 50%; }
.pictogram-fish { background-position: 50% 50%; }
.pictogram-map { background-position: 100% 50%; }
.pictogram-bed { background-position: 0 100%; }
.pictogram-hen { background-position: 50% 100%; }

.write-stage, .build-stage, .story-stage, .cloze-stage, .match-stage, .sequence-stage {
  max-width: 760px;
  margin: clamp(1.5rem, 5vh, 3rem) auto 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.write-stage[hidden], .build-stage[hidden], .story-stage[hidden], .cloze-stage[hidden], .match-stage[hidden], .sequence-stage[hidden], .option-grid[hidden] { display: none; }

.story-stage {
  text-align: left;
}

.story-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.story-heading h2 { margin: .15rem 0 0; }
.story-text {
  max-width: 62ch;
  margin: 1.25rem 0;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  line-height: 1.7;
}
.story-question {
  padding-top: 1rem;
  border-top: 2px solid var(--border);
  font-size: 1.15rem;
  font-weight: 800;
}

.cloze-text {
  font-size: clamp(1.35rem, 3.5vw, 2rem);
  font-weight: 800;
  line-height: 2;
}
.cloze-blank {
  display: inline-flex;
  min-width: 5.2ch;
  min-height: 48px;
  margin-inline: .2rem;
  padding: .15rem .55rem;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  background: var(--bg-soft);
  border: 2px dashed var(--accent-primary);
  border-radius: 12px;
}
.cloze-blank.is-filled { border-style: solid; }
.word-bank {
  margin: 1.25rem 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .7rem;
}
.word-tile {
  min-height: 52px;
  padding: .65rem 1rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid var(--accent-primary);
  border-radius: 14px;
  font-weight: 850;
}
.word-tile.is-used { opacity: .45; }

.match-help { margin-top: 0; color: var(--text-secondary); }
.match-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.match-sources, .match-targets {
  display: grid;
  gap: .75rem;
}
.match-source, .match-target {
  min-height: 112px;
  padding: .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  font-weight: 800;
}
.match-source .activity-pictogram,
.match-target .activity-pictogram {
  width: 82px;
  flex: 0 0 82px;
}
.match-source.is-selected {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 16%, transparent);
}
.match-source.is-assigned { opacity: .62; }
.match-source.is-dragging { opacity: .35; }
.match-target.is-filled {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 7%, var(--bg-surface));
}

.sequence-slots {
  min-height: 104px;
  margin-bottom: 1rem;
  padding: .8rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
  background: var(--bg-soft);
  border: 2px dashed var(--border);
  border-radius: 18px;
}

.sequence-slot, .sequence-scene {
  min-height: 88px;
  padding: .65rem;
  display: grid;
  place-items: center;
  gap: .35rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  text-align: center;
  font: inherit;
  font-weight: 750;
}

.sequence-slot.is-empty {
  color: var(--text-secondary);
  background: transparent;
  border-style: dashed;
}

.sequence-bank {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

.sequence-scene { cursor: pointer; }
.sequence-scene:disabled { cursor: default; opacity: .42; }

.write-stage label {
  display: block;
  margin: 1rem 0 .4rem;
  color: var(--text-secondary);
  font-weight: 750;
}

.write-stage input {
  width: min(440px, 100%);
  min-height: 58px;
  padding: .7rem 1rem;
  color: var(--text-primary);
  text-align: center;
  text-transform: uppercase;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.write-stage .button { display: block; margin: 1rem auto 0; }

.letter-boxes, .build-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
}

.letter-box, .build-slot {
  display: grid;
  width: clamp(48px, 10vw, 68px);
  height: clamp(58px, 12vw, 78px);
  place-items: center;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 850;
}

.letter-box.is-editable, .build-slot { border-color: var(--accent-primary); }
.letter-box-space { width: 18px; }
.box-prefix { align-self: center; margin-right: .35rem; font-size: 1.5rem; font-weight: 850; }

.letter-tiles {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .65rem;
}

.letter-tile {
  min-width: 58px;
  min-height: 58px;
  padding: .65rem .85rem;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1.35rem;
  font-weight: 850;
}

.letter-tile.is-used { opacity: .35; }
.build-actions { justify-content: center; }
.write-stage.is-correct, .build-stage.is-correct { border-color: var(--success); }
.write-stage.is-retry, .build-stage.is-retry { border-color: var(--warning); }

.feedback {
  min-height: 3rem;
  margin-top: 1.25rem;
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 750;
}

.feedback.is-success { color: var(--success); }

.complete-wrap { max-width: 700px; }
.complete-wrap .button { margin-top: 1.5rem; }

.quiet-reward {
  max-width: 520px;
  margin: 1.5rem auto 0;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  text-align: left;
  background: var(--bg-surface);
  border: 2px solid var(--success);
  border-radius: 18px;
}

.quiet-reward[hidden] { display: none; }
.quiet-reward small { display: block; color: var(--text-secondary); }
.reward-leaf {
  width: 40px;
  height: 54px;
  flex: 0 0 auto;
  background: var(--success);
  border-radius: 75% 18% 72% 22%;
  transform: rotate(22deg);
}

.gentle-orbit {
  width: 96px;
  height: 96px;
  margin: 0 auto 1.5rem;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent-primary) 14%, var(--bg-surface));
  border-radius: 50%;
}

.gentle-orbit span {
  width: 38px;
  height: 52px;
  background: var(--accent-secondary);
  border-radius: 70% 20% 70% 25%;
  transform: rotate(25deg);
}

.gate-screen {
  display: none;
  place-items: center;
}
.gate-screen.is-active { display: grid; }

.gate-card {
  width: min(620px, 100%);
  padding: clamp(1.5rem, 5vw, 3rem);
}

.gate-card h1 { max-width: 14ch; font-size: clamp(2.3rem, 5vw, 4rem); }

.gate-card label {
  display: block;
  margin: 1.6rem 0 .5rem;
  font-weight: 750;
}

.gate-card input {
  width: 100%;
  min-height: 58px;
  padding: .8rem 1rem;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1.4rem;
  letter-spacing: .2em;
}

.button-row {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
}

.gate-feedback { min-height: 1.5rem; margin-top: 1rem; color: var(--error); }

.adult-screen { padding-top: 2rem; }
.adult-header h1 { font-size: clamp(2rem, 4vw, 3.8rem); }
.header-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; }

.dashboard-grid {
  width: min(1160px, 100%);
  margin: 2rem auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.voice-panel { display: grid; gap: .7rem; }

.voice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .6rem;
  align-items: center;
}

.explorer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.cms-layout {
  width: min(1160px, 100%);
  margin: 2rem auto;
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: 1rem;
}

.cms-list-panel { grid-column: 1 / -1; }
.cms-editor-panel, .cms-custom-panel { grid-column: 1 / -1; }
.matrix-summary { border-color: var(--accent-primary); }

.cms-editor-panel[hidden] { display: none; }

.cms-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.cms-editor-heading h2 { margin-top: .25rem; }

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

.cms-field {
  display: grid;
  gap: .4rem;
  color: var(--text-primary);
  font-weight: 750;
}

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

.cms-field input, .cms-field select {
  width: 100%;
  min-height: 48px;
  padding: .7rem .8rem;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 12px;
  font: inherit;
}

.cms-field small { color: var(--text-secondary); font-weight: 500; }
.cms-form-error { min-height: 1.5rem; margin: .8rem 0 0; color: var(--error); font-weight: 700; }
.cms-custom-panel .content-row { align-items: flex-start; }
.button-danger { color: var(--error); border-color: color-mix(in srgb, var(--error) 55%, var(--border)); }

.content-list { border-top: 1px solid var(--border); }

.cms-filters {
  margin: .5rem 0 1rem;
  display: flex;
  gap: 1rem;
}

.cms-filters .is-active-filter { color: var(--text-primary); text-decoration-thickness: 3px; }

.content-row {
  padding: 1.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

.content-row h3 { margin: .35rem 0 .2rem; font-size: 1.15rem; }
.content-row p { margin: 0; }

.content-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .6rem;
  flex-wrap: wrap;
}

.content-language, .content-status {
  display: inline-flex;
  min-height: 30px;
  padding: .3rem .55rem;
  align-items: center;
  color: #fff;
  background: var(--accent-primary);
  border-radius: 9px;
  font-size: .78rem;
  font-weight: 800;
}

.content-language-en { background: var(--accent-secondary); }

.content-status {
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.design-system-layout {
  width: min(1160px, 100%);
  margin: 2rem auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.theme-showcase {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.calm-showcase { color: #20252b; background: #f4f5f6; }
.natural-showcase { color: #253044; background: #fff9f1; }
.theme-showcase p:not(.eyebrow) { color: #5a626b; }

.swatch-grid {
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}

.swatch {
  min-height: 96px;
  padding: .8rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(20, 30, 40, .12);
  border-radius: 16px;
}

.swatch span { font-weight: 800; }
.swatch code { font-size: .78rem; }
.swatch-calm-bg { background: #f4f5f6; }
.swatch-calm-primary { color: #fff; background: #657487; }
.swatch-calm-secondary { color: #fff; background: #879685; }
.swatch-calm-success { color: #fff; background: #5e7d68; }
.swatch-natural-bg { background: #fff9f1; }
.swatch-natural-primary { color: #fff; background: #4e72c2; }
.swatch-natural-secondary { color: #fff; background: #d88d49; }
.swatch-natural-success { color: #fff; background: #4b8f6b; }

.state-showcase { grid-column: 1 / -1; }
.state-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.state-sample { padding: .8rem 1rem; border: 3px solid transparent; border-radius: 14px; font-weight: 800; }
.state-focus { border-color: var(--focus); background: var(--bg-surface); }
.state-success { color: var(--success); border-color: var(--success); background: var(--bg-surface); }
.state-retry { color: var(--warning); border-color: var(--warning); background: var(--bg-surface); }

.panel { padding: clamp(1.25rem, 3vw, 2rem); }
.panel p { color: var(--text-secondary); }

.metric {
  margin: 1rem 0;
  color: var(--text-primary) !important;
  font-size: 3.5rem;
  font-weight: 800;
}
.metric span { display: block; font-size: 1rem; font-weight: 650; }

.skill-row {
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.skill-row strong { color: var(--success); }

.theme-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  margin: 1rem 0;
}

.theme-choice button {
  min-height: 52px;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-weight: 750;
}

.theme-choice button.is-selected { border-color: var(--accent-primary); }

.toggle-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: .7rem;
}
.toggle-row input { width: 22px; height: 22px; }

.security-list { padding: 0; list-style: none; }
.security-list li { display: flex; align-items: center; gap: .7rem; margin: .8rem 0; }

.status-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; }
.status-dot.is-good { background: var(--success); }
.status-dot.is-warn { background: var(--warning); }

.text-button {
  min-height: 44px;
  padding: 0;
  color: var(--accent-primary);
  background: transparent;
  border: 0;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: 420px;
  padding: 1rem 1.1rem;
  color: #fff;
  background: var(--text-primary);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
}

.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .screen { padding: 1.15rem; }
  .welcome-grid, .dashboard-grid, .cms-layout, .profile-select-grid, .design-system-layout { grid-template-columns: 1fr; }
  .welcome-grid { padding-top: 3.5rem; }
  .calm-card { margin-bottom: 1rem; }
  .path-grid { grid-template-columns: 1fr; }
  .guide-invitation { grid-template-columns: auto 1fr; }
  .guide-start-button { grid-column: 1 / -1; width: 100%; }
  .today-lab-heading { flex-direction: column; }
  .today-lab-grid { grid-template-columns: 1fr; }
  .path-card { min-height: 170px; }
  .option-grid { gap: .65rem; }
  .letter-option { min-height: 96px; border-radius: 18px; }
  .child-header { gap: .55rem; }
  .child-header .icon-button { padding-inline: .7rem; font-size: .78rem; }
  .save-exit-button { max-width: 92px; }
  .audio-button { max-width: 92px; }
  .step-dots { gap: 3px; }
  .adult-header { align-items: flex-start; flex-direction: column; }
  .theme-choice { grid-template-columns: 1fr; }
  .login-fields { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: 1fr; }
  .story-heading { align-items: flex-start; flex-direction: column; }
  .cms-form-grid { grid-template-columns: 1fr; }
  .cms-field-wide { grid-column: auto; }
  .state-showcase { grid-column: auto; }
  .header-actions { justify-content: flex-start; }
}

@media (max-width: 430px) {
  .child-header { align-items: flex-start; }
  .profile-chip span:last-child { display: none; }
  .option-grid { grid-template-columns: 1fr; }
  .letter-option { aspect-ratio: auto; min-height: 100px; }
  .activity-wrap { margin-top: 2rem; }
  .welcome-theme-preview { grid-template-columns: 1fr; }
  .guide-invitation { grid-template-columns: 1fr; text-align: center; }
  .guide-mark { margin-inline: auto; }
  .practice-language-choice { width: 100%; }
  .practice-language-choice button { flex: 1; }
  .letter-option.is-visual { min-height: 160px; }
  .match-layout { grid-template-columns: 1fr; }
  .sequence-slots, .sequence-bank { grid-template-columns: 1fr; }
  .activity-guide { grid-template-columns: auto 1fr; }
  .guide-adult-button { grid-column: 1 / -1; margin: .35rem auto 0; }
}

@media (hover: hover) and (pointer: fine) {
  .path-card:hover { transform: translateY(-3px); }
}

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

:root[data-reduce-motion="true"] *, :root[data-reduce-motion="true"] *::before, :root[data-reduce-motion="true"] *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}
