:root {
  color-scheme: light;
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #edf3f6;
  --text: #132733;
  --muted: #4d6573;
  --brand: #123b55;
  --brand-2: #1d617f;
  --accent: #f1b94b;
  --line: #758b9a;
  --success: #166534;
  --danger: #a52121;
  --shadow: 0 18px 55px rgba(18,59,85,.10);
  --radius: 20px;
  --max: 1180px;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08141c;
  --surface: #10222d;
  --surface-2: #17303d;
  --text: #edf5f8;
  --muted: #b6c7d0;
  --brand: #8ed2ee;
  --brand-2: #b5e3f4;
  --accent: #f5c96c;
  --line: #6f8998;
  --success: #8bd3a6;
  --danger: #ff9c9c;
  --shadow: 0 18px 55px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
a { color: var(--brand-2); text-underline-offset: .2em; }
button, input, select { font: inherit; }
button, select, input, .button { min-height: 44px; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--surface); padding: .75rem 1rem; border: 2px solid var(--brand-2); border-radius: 10px; }
.skip-link:focus { top: 1rem; }
.global-feedback { position: fixed; z-index: 80; left: 50%; top: 1rem; transform: translateX(-50%); width: min(92vw, 720px); padding: .85rem 1rem; border-radius: 14px; background: var(--surface); border: 2px solid var(--brand-2); box-shadow: var(--shadow); display: flex; align-items: center; gap: 1rem; justify-content: space-between; }
.global-feedback.error { border-color: var(--danger); }
.text-button { border: 0; background: transparent; color: var(--brand-2); text-decoration: underline; padding: .3rem; }
.site-header { position: sticky; top: 0; z-index: 40; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem max(1rem, calc((100vw - var(--max))/2)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; }
.wordmark-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: var(--surface); font-weight: 900; letter-spacing: -.04em; }
html[data-theme="dark"] .wordmark-mark { color: #08141c; }
.wordmark strong, .wordmark small { display: block; }
.wordmark small { color: var(--muted); font-size: .76rem; }
.header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.page-shell { width: min(calc(100% - 2rem), var(--max)); margin: 0 auto; padding: 2.5rem 0 4rem; }
.hero { display: grid; grid-template-columns: 1.4fr .8fr; gap: 2rem; align-items: stretch; padding: 2rem 0 3rem; }
.eyebrow { margin: 0 0 .4rem; color: var(--brand-2); font-size: .78rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 .75rem; letter-spacing: -.025em; }
h1 { font-size: clamp(2.6rem, 7vw, 5.6rem); max-width: 12ch; }
h2 { font-size: clamp(1.7rem, 3vw, 2.7rem); }
h3 { font-size: clamp(1.18rem, 2vw, 1.5rem); }
p { margin-top: 0; }
.hero-copy { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--muted); max-width: 62ch; }
.hero-actions, .inline-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--brand); border-radius: 999px; padding: .65rem 1.05rem; background: var(--brand); color: #fff; font-weight: 800; text-decoration: none; }
html[data-theme="dark"] .button { color: #08141c; }
.button-secondary { background: var(--surface); color: var(--brand-2); border-color: var(--brand-2); }
.button-quiet { background: transparent; color: var(--text); border-color: var(--line); }
.button-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.dashboard-card, .lesson-shell, .practice-card, .mission-card, .progress-tools, .builder-card, .resource-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dashboard-card { padding: 1.4rem; display: flex; flex-direction: column; justify-content: center; }
.dashboard-card > p { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; margin: .75rem 0 1rem; }
.metric-grid div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: .75rem; }
.metric-grid strong, .metric-grid span { display: block; }
.metric-grid strong { font-size: 1.55rem; }
.metric-grid span { color: var(--muted); font-size: .82rem; }
.progress-label-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; margin-bottom: .45rem; }
.progress-track { height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.progress-track > div { height: 100%; width: 0; background: var(--brand-2); transition: width .25s ease; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.25rem; }
.section-heading > p { color: var(--muted); max-width: 56ch; }
.compact-heading { align-items: center; }
.lesson-path { padding: 1rem 0 3rem; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.lesson-card { width: 100%; text-align: left; padding: 1rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: none; }
.lesson-card:hover { border-color: var(--brand-2); transform: translateY(-1px); }
.lesson-card.is-active { border: 3px solid var(--brand-2); padding: calc(1rem - 2px); }
.lesson-card small, .lesson-card span { display: block; color: var(--muted); }
.lesson-card strong { display: block; font-size: 1.08rem; margin: .25rem 0; }
.lesson-card .mini-progress { height: 6px; margin-top: .65rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.lesson-card .mini-progress i { display: block; height: 100%; background: var(--brand-2); }
.lesson-shell { overflow: clip; }
.lesson-header { display: flex; justify-content: space-between; align-items: end; gap: 2rem; padding: 1.5rem; border-bottom: 1px solid var(--line); }
.lesson-header > div { max-width: 68ch; }
.lesson-header p { color: var(--muted); }
.lesson-select { min-width: min(330px,100%); }
.lesson-select span, label > span { display: block; font-weight: 750; margin-bottom: .35rem; }
select, input[type="text"], input[type="search"] { width: 100%; border: 2px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: .65rem .75rem; }
.tab-list { position: sticky; top: 68px; z-index: 20; display: grid; grid-template-columns: repeat(4,1fr); background: var(--surface); border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 4px solid transparent; background: transparent; color: var(--muted); font-weight: 850; }
.tab.is-active { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.panel { padding: 1.5rem; }
.panel[hidden] { display: none; }
.objective-grid, .card-grid, .pattern-grid, .builder-grid, .resource-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.objective { padding: .85rem 1rem; border-left: 5px solid var(--accent); background: var(--surface-2); border-radius: 0 14px 14px 0; }
.toolbar { display: grid; grid-template-columns: 1fr minmax(180px,.35fr); gap: 1rem; margin: 1.5rem 0 .5rem; }
.search-status { min-height: 1.5rem; color: var(--muted); }
.lesson-group { margin: 1.5rem 0; }
.vocab-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.vocab-card { display: grid; grid-template-columns: 1fr auto; gap: .8rem; padding: .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.vocab-card strong { display: block; font-size: 1.08rem; }
.vocab-card span, .vocab-card small { display: block; color: var(--muted); }
.vocab-actions { display: flex; gap: .35rem; align-items: start; }
.icon-button { min-width: 44px; min-height: 44px; border: 2px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; font-weight: 900; }
.icon-button.is-active { border-color: var(--success); color: var(--success); }
.subsection { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.note-card, .pattern-card { padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.pattern-card .tagalog { font-weight: 850; font-size: 1.08rem; }
.practice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.practice-card { padding: 1.15rem; box-shadow: none; }
.quiz-card { grid-column: 1 / -1; }
.card-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.review-card { min-height: 430px; }
.review-direction { color: var(--brand-2); font-weight: 800; }
.review-prompt, .large-prompt { font-size: clamp(1.5rem,3vw,2.35rem); font-weight: 850; margin: 1.25rem 0; }
.review-answer { margin: 1rem 0; padding: 1rem; border-radius: 14px; background: var(--surface-2); }
.review-answer strong, .review-answer span { display: block; }
.review-answer strong { font-size: 1.35rem; }
.rating-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: .6rem; margin-top: 1rem; }
.rating-button { border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); padding: .7rem; }
.rating-button strong, .rating-button span { display: block; }
.rating-button span { color: var(--muted); font-size: .78rem; }
.feedback { min-height: 1.5rem; margin-top: .75rem; }
.feedback.success { color: var(--success); font-weight: 750; }
.feedback.error { color: var(--danger); font-weight: 750; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 1.2rem; font-weight: 850; margin-bottom: 1rem; }
.choice-list { display: grid; gap: .65rem; }
.choice-list label { display: flex; gap: .75rem; align-items: center; padding: .75rem; border: 2px solid var(--line); border-radius: 12px; }
.choice-list input { width: 20px; height: 20px; }
.result-card, .example-box { padding: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; margin-top: 1rem; }
.speak-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.shadow-card { padding: 1.5rem; margin: 1rem 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.shadow-card strong, .shadow-card span { display: block; }
.shadow-card strong { font-size: 1.7rem; }
audio { width: 100%; margin-top: 1rem; }
.builder-card, .mission-card, .progress-tools, .resource-card { padding: 1.15rem; box-shadow: none; }
.builder-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.builder-output { white-space: pre-wrap; font-size: 1.1rem; }
.mission-card { margin-top: 1.25rem; }
.resource-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.resource-card .resource-type { color: var(--brand-2); font-weight: 800; font-size: .82rem; }
.progress-tools { margin-top: 1.25rem; }
.file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.site-footer { width: min(calc(100% - 2rem), var(--max)); margin: 0 auto; padding: 2rem 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.empty-state { padding: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
@media (max-width: 900px) {
  .hero, .lesson-header, .speak-grid { grid-template-columns: 1fr; display: grid; }
  .lesson-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .practice-grid { grid-template-columns: 1fr; }
  .quiz-card { grid-column: auto; }
}
@media (max-width: 640px) {
  .page-shell { width: min(calc(100% - 1rem), var(--max)); padding-top: 1rem; }
  .site-header { padding: .55rem .7rem; }
  .wordmark small { display: none; }
  .header-actions { justify-content: end; }
  .button { padding: .58rem .82rem; }
  .hero { padding-top: 1rem; gap: 1rem; }
  h1 { font-size: clamp(2.25rem,12vw,3.8rem); }
  .lesson-grid, .objective-grid, .card-grid, .pattern-grid, .builder-grid, .resource-grid, .vocab-grid, .toolbar, .builder-fields { grid-template-columns: 1fr; }
  .lesson-header { padding: 1rem; gap: 1rem; }
  .panel { padding: 1rem; }
  .tab-list { top: 56px; }
  .tab { font-size: .9rem; }
  .rating-grid { grid-template-columns: 1fr; }
  .section-heading, .site-footer { align-items: start; flex-direction: column; }
  .vocab-card { grid-template-columns: 1fr; }
  .vocab-actions { justify-content: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .site-header, .hero, .lesson-path, .tab-list, .toolbar, .vocab-actions, .header-actions, .hero-actions, .progress-tools, .site-footer { display: none !important; }
  body, .page-shell, .lesson-shell, .panel { background: #fff; color: #000; box-shadow: none; border: 0; width: 100%; margin: 0; padding: 0; }
  .panel[hidden] { display: none !important; }
}

/* Release-candidate path clarity */
.lesson-card-meta { display: flex !important; align-items: center; justify-content: space-between; gap: .75rem; }
.lesson-card-meta small, .lesson-card-meta .lesson-status { display: inline-block; }
.lesson-status { font-size: .78rem; font-weight: 850; color: var(--brand-2) !important; }
.lesson-card.is-complete { border-color: var(--success); }
.lesson-card.is-complete .lesson-status { color: var(--success) !important; }
.lesson-card.is-complete .mini-progress i { background: var(--success); }
.lesson-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1rem; }
@media (max-width: 640px) {
  .lesson-actions .button { width: 100%; }
}

/* Public information pages */
.appearance-toggle { min-width: 6.4rem; padding-inline: 1.15rem; }
.information-shell { max-width: 900px; padding-top: clamp(3rem, 7vw, 6rem); padding-bottom: clamp(4rem, 8vw, 7rem); }
.information-card { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: clamp(1.75rem, 5vw, 4rem); }
.information-card h1 { max-width: 14ch; margin: .35rem 0 1rem; font-size: clamp(2.5rem, 7vw, 4.8rem); line-height: .98; letter-spacing: -.045em; }
.information-lead { max-width: 46rem; color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.3rem); line-height: 1.7; }
.prose { margin-top: 2.5rem; display: grid; gap: 1.75rem; }
.prose section { padding-top: 1.5rem; border-top: 1px solid var(--line); }
.prose h2 { margin: 0 0 .65rem; font-size: 1.2rem; }
.prose p { margin: 0; max-width: 48rem; color: var(--muted); line-height: 1.75; }
.information-action { margin: 2.5rem 0 0; }
@media (max-width: 640px) {
  .appearance-toggle { min-width: auto; padding-inline: .95rem; }
  .information-card { border-radius: 22px; }
}
