/* One component language. Themes change accents/art, never layout or labels. */
:root, :root[data-theme] {
  color-scheme: light dark;
  --paper: #F6F7FA; --paper-2: #EDF0F5; --card: #FFFFFF;
  --ink: #17202F; --ink-2: #596474; --ink-3: #6C7787; --rule: #E1E5EC;
  --velvet: #0866D9; --velvet-mid: #0866D9; --velvet-deep: #0754B5; --velvet-soft: #EAF2FF;
  --emerald: #16764F; --emerald-soft: #E8F4EE; --coral: #A64F1B; --coral-soft: #FFF1E7;
  --gold: #8A6412; --gold-soft: #FFF6DF; --radius: 16px; --radius-card: 16px;
  --shadow: 0 1px 2px rgb(20 30 50 / .025);
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; --display: var(--ui);
}
:root[data-theme='atelier'] { --velvet: #A83268; --velvet-mid: #A83268; --velvet-deep: #8D2857; --velvet-soft: #F9EBF1; }
:root[data-theme='pitch'] { --velvet: #087B57; --velvet-mid: #087B57; --velvet-deep: #096345; --velvet-soft: #E5F4EB; }
:root[data-theme='peranakan'] { --velvet: #087B80; --velvet-mid: #087B80; --velvet-deep: #066266; --velvet-soft: #E3F3F3; }
@media (prefers-color-scheme: dark) {
  :root, :root[data-theme] {
    --paper: #101216; --paper-2: #20242B; --card: #1A1E25; --ink: #F4F5F8;
    --ink-2: #ADB7C5; --ink-3: #99A5B5; --rule: #343B47; --shadow: none;
    --velvet: #75ADFF; --velvet-mid: #75ADFF; --velvet-deep: #4C8CE9; --velvet-soft: #192F4C;
    --emerald: #70D6A5; --emerald-soft: #153A2A; --coral: #FFB380; --coral-soft: #402818;
  }
  :root[data-theme='atelier'] { --velvet: #EE94BB; --velvet-mid: #EE94BB; --velvet-soft: #412333; }
  :root[data-theme='pitch'] { --velvet: #6AD6AC; --velvet-mid: #6AD6AC; --velvet-soft: #16372D; }
  :root[data-theme='peranakan'] { --velvet: #67D3D8; --velvet-mid: #67D3D8; --velvet-soft: #15363B; }
}
html { scroll-behavior: auto; }
body { background-image: none; background-color: var(--paper); line-height: 1.5; }
body.in-session { background: var(--card); }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { font-weight: 600; }
.ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#app, #app.tab-today, #app.tab-practice, #app.tab-stars, #app.tab-profile { max-width: 680px; padding: 20px 20px 30px; }
#app.tab-progress { max-width: 820px; }
#app.tab-question { max-width: 660px; padding-top: 12px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 24px; }
.page-heading h1, .screen-title { font: 750 clamp(1.8rem, 6vw, 2.1rem)/1.2 var(--ui); letter-spacing: -.035em; margin: 0; text-align: left; }
.page-heading p { color: var(--ink-2); font-size: .94rem; margin-top: 6px; }
.profile-button { flex-shrink: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--paper-2); color: var(--velvet); cursor: pointer; }
.profile-button svg { width: 24px; height: 24px; }
.back-button { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; color: var(--velvet); min-height: 44px; margin: -8px 0 10px; padding: 0 8px 0 0; cursor: pointer; }
.screen-sub { font-size: 1rem; margin: 8px 0 18px; color: var(--ink-2); }
.section-title { font-family: var(--ui); font-size: 1rem; letter-spacing: -.015em; margin-bottom: 12px; }
.eyebrow, .chart-title { font-family: var(--ui); text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--ink-2); }
.card { padding: 20px; border: 1px solid var(--rule); box-shadow: none; margin-bottom: 20px; }
.btn { border-radius: 13px; min-height: 50px; font: 650 1rem/1.3 var(--ui); padding: 14px 18px; background: var(--velvet); box-shadow: none; color: white; letter-spacing: 0; }
.btn::before, .btn::after { display: none; }
.btn.ghost { background: var(--paper-2); border: 0; color: var(--velvet); box-shadow: none; }
.btn.small { min-height: 44px; padding: 10px 12px; font-size: .88rem; }
.text-button { text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; padding: 10px 4px; }
.btn:active, .profile-button:active, .list-row:is(button):active { transform: scale(.985); }
@media (prefers-color-scheme: dark) {
  .btn:not(.ghost) { color: #102030; }
  :focus-visible { outline-color: #A8CAFF; }
}
.focus-plan { padding: 4px 0 20px; }
.plan-symbol { display: block; color: var(--velvet); margin: 0 0 18px; }
.plan-symbol svg { width: 46px; height: 46px; }
.focus-plan h2 { font: 720 1.55rem/1.25 var(--ui); letter-spacing: -.025em; text-align: left; }
.plan-detail { color: var(--ink-2); margin: 8px 0 20px; }
.focus-plan .field-help { margin-top: 12px; max-width: 48ch; }
.focus-section { margin-bottom: 20px; }
.grouped-list { overflow: hidden; border: 1px solid var(--rule); border-radius: 16px; background: var(--card); }
.list-row { display: flex; align-items: center; width: 100%; gap: 12px; min-height: 70px; padding: 16px; background: var(--card); color: var(--ink); border: 0; text-align: left; }
.list-row + .list-row { border-top: 1px solid var(--rule); }
button.list-row, .collection-preview { cursor: pointer; }
.row-symbol { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; color: var(--velvet); background: var(--velvet-soft); }
.row-symbol svg { width: 22px; height: 22px; }
.row-copy { display: block; flex: 1; min-width: 0; }
.row-copy strong { display: block; font-size: .98rem; font-weight: 600; line-height: 1.35; }
.row-copy small { display: block; color: var(--ink-2); font-size: .84rem; font-weight: 400; margin-top: 4px; }
.row-value { color: var(--ink-2); font-size: .86rem; white-space: nowrap; }
.standalone-row { border: 1px solid var(--rule); border-radius: 16px; margin: 0 0 16px; }
.collection-preview { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border: 1px solid var(--rule); border-radius: 16px; background: var(--card); color: var(--ink); text-align: left; }
.collection-preview img { width: 66px; height: 66px; object-fit: cover; border-radius: 10px; }
.today-note { color: var(--ink-2); font-size: .86rem; margin: 18px 0; }
nav.tabbar { bottom: max(10px, env(safe-area-inset-bottom)); left: 20px; right: 20px; border-radius: 24px; padding: 6px; border: 1px solid var(--rule); background: var(--card); box-shadow: 0 3px 18px rgb(20 30 50 / .09); }
nav.tabbar button { min-height: 54px; font-size: .75rem; letter-spacing: 0; border-radius: 18px; color: var(--ink-2); }
nav.tabbar button.active { color: var(--velvet); background: var(--velvet-soft); }
nav.tabbar svg { width: 23px; height: 23px; }
.chapter-item { border-radius: 14px; border: 1px solid var(--rule); padding: 16px; margin-bottom: 10px; box-shadow: none; gap: 18px; background: var(--card); }
.grouped-list .chapter-item { border-radius: 0; border: 0; margin: 0; }
.grouped-list .chapter-item + .chapter-item { border-top: 1px solid var(--rule); }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading .section-title { margin: 0; }
.coach-panel > .form-stack { margin-top: 18px; }
.profile-subject { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.profile-subject + .profile-subject { margin-top: 8px; }
.profile-subject .text-button { justify-self: start; }
#profileSubjects { margin-bottom: 16px; }
.student-context p { margin: 6px 0; overflow-wrap: anywhere; }
.student-row > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.tab-profile > .card { grid-column: 1 / -1; }
.ch-title { font: 600 1rem/1.4 var(--ui); }
.ch-sub { font-size: .84rem; }
.theme-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.theme-gallery .theme-option { display: flex; padding: 12px; border-radius: 14px; }
.theme-option strong { align-self: auto; margin: 10px 0 0; }
.theme-option .theme-check { top: 10px; right: 10px; left: auto; }
.theme-option img, .theme-plain { aspect-ratio: 3/2; height: auto; width: 100%; border-radius: 8px; object-fit: cover; }
/* Match the legacy span:not(.theme-check) specificity in styles.css. */
.theme-option > .theme-plain:not(.theme-check) { display: grid; place-items: center; background: #EAF2FF; color: #0866D9; font-size: 2.5rem; font-weight: 800; margin: 0; }
@media (prefers-color-scheme: dark) {
  .theme-option > .theme-plain:not(.theme-check) { background: #192F4C; color: #75ADFF; }
}
.theme-option.selected { background: var(--velvet-soft); }
.form-stack input, .form-stack select, .form-stack textarea { font-size: 1rem; }
.question-toolbar { gap: 10px; flex-wrap: wrap; min-height: 44px; }
.question-toolbar > span { font-variant-numeric: tabular-nums; }
.qcard { border: 0; padding: 10px 0; border-radius: 0; box-shadow: none; background: transparent; }
.question-meta { margin: 0 0 16px; }
.qtext { font-size: 1.18rem; line-height: 1.65; }
.qtext.fluency-question { font-family: var(--ui); font-size: 1.05rem; line-height: 1.5; text-align: center; padding: 12px 0; }
.fluency-question .math { font-family: var(--ui); }
.fluency-question .mblock { font-size: clamp(2rem, 9vw, 3rem); line-height: 1.4; letter-spacing: -.025em; margin: 14px 0; }
.qcard .chapter-tag { text-transform: none; letter-spacing: 0; background: none; color: var(--ink-2); padding: 0; font-size: .82rem; }
.qcard .answer, .qcard .answer::placeholder { font-family: var(--ui); }
.fluency-note { text-align: center; color: var(--ink-2); font-size: .88rem; margin: 8px 0 0; }
.answer-label { color: var(--ink-2); font-size: .88rem; }
.qcard .answer { border: 1px solid var(--rule); border-radius: 12px; min-height: 54px; font-size: 1.3rem; background: var(--paper); color: var(--ink); padding: 12px; }
.qcard:has(.fluency-question) .answer { text-align: center; font-size: 1.6rem; }
.keystrip { gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.keystrip button { min-width: 44px; min-height: 44px; border-radius: 9px; font-size: 1.1rem; background: var(--paper-2); border: 0; color: var(--velvet); }
#answerControls #actions { gap: 6px; margin-top: 14px; }
#revealBtn, #hintBtn { min-height: 44px; background: none; }
.feedback { border-radius: 12px; padding: 14px; margin-top: 16px; font-size: .95rem; }
.step { font-size: 1rem; line-height: 1.6; }
.pause-panel { border-radius: 16px; padding: 24px; }
.curtain { min-height: 60vh; padding: 30px 0; background: none; color: var(--ink); }
.curtain .spot { display: none; }
.curtain .inner { max-width: 580px; margin: auto; }
.curtain .bow { font-family: var(--ui); font-size: 1.9rem; letter-spacing: -.03em; color: var(--ink); }
.curtain .score { color: var(--ink-2); font-size: 1rem; }
.curtain .gown { width: 130px; margin: 0 auto 24px; }
.completion-symbol { display: grid; place-items: center; font-size: 3rem; color: var(--emerald); width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 24px; background: var(--emerald-soft); }
.rehearsal-card .screen-title { font-size: 1.3rem; }
.rehearsal-card { border-color: var(--rule); }
.student-context { position: static; padding: 0 0 16px; border: 0; background: none; box-shadow: none; }
.student-context .eyebrow { display: none; }
.coach-layout { gap: 24px; }
.student-roster { box-shadow: none; }
.student-row { min-height: 66px; }
.student-row small { font-size: .83rem; line-height: 1.45; }
.student-row strong { font-size: 1rem; }
.coach-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 20px; }
.coach-actions button { min-height: 48px; }
.coach-panel summary { font-size: 1rem; }
.coach-panel summary small { display: block; color: var(--ink-2); font-size: .84rem; font-weight: 400; margin-top: 4px; }
.login-wrap { max-width: 390px; margin: 8vh auto 0; text-align: left; padding: 0; }
.login-wrap h1 { font-family: var(--ui); font-size: 2.4rem; letter-spacing: -.05em; }
.login-wrap .brand-gown { width: 64px; height: 64px; margin: 0 0 24px; }
.login-wrap .brand-gown img { width: 64px; height: 64px; border-radius: 14px; }
.login-wrap p { font-size: 1rem; }
.login-wrap input { text-align: left; letter-spacing: normal; font-size: 1.1rem; border-radius: 12px; min-height: 52px; }
/* The iOS navigation controller owns chrome and safe areas for hosted details. */
html.native-presentation body { padding: 0 !important; min-height: 100%; }
html.native-presentation #app { padding-top: 12px; }
html.native-presentation .page-heading, html.native-presentation .back-button,
html.native-presentation .account-strip, html.native-presentation nav.tabbar,
html.native-presentation #quitBtn { display: none !important; }
html.native-presentation #app.tab-admin { padding: 16px; }
html.native-presentation .student-roster, html.native-presentation .tab-admin > .screen-heading { display: none; }
html.native-presentation .coach-layout { grid-template-columns: 1fr; }
html.native-presentation .native-invite .student-roster { display: block; position: static; }
html.native-presentation .native-invite #studentDetail, html.native-presentation .native-invite #roster,
html.native-presentation .native-invite #studentSearch, html.native-presentation .native-invite .student-roster > h2 { display: none; }
@media (max-width: 360px) {
  #app, #app.tab-today, #app.tab-practice, #app.tab-profile { padding-left: 16px; padding-right: 16px; }
  .list-row { padding: 12px; gap: 10px; }
  .row-value { white-space: normal; }
  .coach-actions { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
  body:not(.on-login):not(.in-session) { padding-left: 210px; }
  body.on-login, body.in-session { padding-left: 0; }
  nav.tabbar { left: 20px; right: auto; top: 24px; bottom: 24px; width: 170px; border-radius: 18px; }
  #app.tab-admin { max-width: 1160px; }
  #app.tab-today { max-width: 700px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn:active, .theme-option:hover, .profile-button:active, .list-row:is(button):active { transform: none; }
}
@media (prefers-contrast: more) { :root, :root[data-theme] { --rule: #7E8793; } }
