@charset "UTF-8";

:root {
  color-scheme: dark;
  --bg: #0d0f0e;
  --panel: #151816;
  --panel-light: #1b1e1b;
  --gold: #e2bc73;
  --gold-bright: #f0cc87;
  --gold-dim: #806a43;
  --text: #f2f0e9;
  --muted: #a3a79e;
  --line: #2d322c;
  --correct: #86efac;
  --correct-bg: #123c28;
  --correct-border: #4ade80;
  --wrong: #ffb4b4;
  --wrong-bg: #4b1d1d;
  --wrong-border: #f87171;
  font-family: "Segoe UI", "Leelawadee UI", Tahoma, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 80% -15%, #b08d3610, transparent 55%); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a, input { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 5px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
button { -webkit-appearance: none; }
input[type="checkbox"] { flex: 0 0 19px; width: 19px; height: 19px; margin: 0; accent-color: var(--gold); cursor: pointer; }
input[type="checkbox"]:disabled { opacity: .35; cursor: default; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.site-shell { max-width: 1240px; padding: 0 48px; margin: auto; min-height: 100svh; display: flex; flex-direction: column; }
.site-header { min-height: 96px; padding: 22px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-symbol { display: grid; place-items: center; width: 44px; height: 48px; font-family: Tahoma, sans-serif; font-size: 37px; line-height: 1; border: 1px solid var(--gold-dim); border-radius: 10px 3px 10px 3px; color: var(--gold); padding-bottom: 6px; }
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: 2px; }
.brand-name > span { color: var(--gold); }
.brand-name small { display: block; font-size: 10px; font-weight: 500; letter-spacing: 2.1px; color: var(--muted); margin-top: 4px; }
.header-context { display: flex; align-items: center; gap: 22px; }
.header-context:empty { display: none; }
.setup-view { padding: 36px 0 40px; }
.header-motto { font-size: 14px; color: var(--muted); }
.thai-wordmark { color: var(--gold); font-size: 22px; border-left: 1px solid var(--line); padding-left: 22px; }
main { flex: 1; }
.intro { padding: 44px 0 34px; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 650; letter-spacing: 2px; line-height: 1.6; margin: 0 0 12px; }
h1, h2, h3, p { margin-top: 0; }
.intro h1 { font-size: clamp(38px, 4.3vw, 58px); font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -2px; margin-bottom: 13px; line-height: 1.12; }
.intro h1 em { color: var(--gold); font-weight: 400; }
.intro-copy { color: var(--muted); margin: 0; font-size: 16px; line-height: 1.65; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.vocabulary-panel, .settings-panel { padding: 28px; }
.settings-panel { display: flex; flex-direction: column; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.panel-heading .eyebrow { font-size: 10px; margin-bottom: 7px; }
.panel-heading h1, .panel-heading h2 { font-size: 22px; font-weight: 600; letter-spacing: -.55px; line-height: 1.3; margin: 0; }
.vocabulary-panel .panel-heading { flex-wrap: wrap; gap: 4px 16px; }
.lesson-selection-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.lesson-selection-actions .text-button { padding: 9px 0; }
.text-button { background: none; border: none; color: var(--gold); padding: 9px 0 9px 12px; font-size: 14px; white-space: nowrap; }
.text-button:hover { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 4px; }
.text-button:disabled, .text-button:disabled:hover { color: #878f7f; cursor: default; text-decoration: none; }
.panel-description { font-size: 14px; color: var(--muted); line-height: 1.65; margin: 12px 0 24px; }
.course-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.course { border-bottom: 1px solid var(--line); }
.course:last-child { border-bottom: none; }
.course-row { min-height: 65px; display: flex; align-items: center; gap: 15px; padding-left: 18px; }
.course.is-open { background: #1a1d18; }
.course-toggle { min-width: 0; flex: 1; min-height: 65px; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; padding: 14px 15px 14px 0; }
.course-toggle:hover .course-title { color: var(--gold-bright); }
.course-icon { width: 19px; height: 19px; color: var(--muted); }
.course.is-open .course-icon { color: var(--gold); }
.course-title { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; font-weight: 500; }
.word-count { color: #93998e; font-size: 12px; white-space: nowrap; }
.disclosure { width: 19px; height: 19px; color: var(--muted); transition: transform .2s ease; }
.is-open .disclosure { transform: rotate(180deg); color: var(--gold); }
.course-children { padding: 0 15px 15px 52px; }
.lesson-row { display: flex; align-items: center; gap: 13px; min-height: 48px; background: #25291e; border: 1px solid #4d4a32; border-radius: 7px; padding: 10px 13px; font-size: 14px; cursor: pointer; }
.lesson-row:has(input:not(:checked)) { background: transparent; border-color: var(--line); }
.lesson-row + .lesson-row { margin-top: 7px; }
.lesson-row > span:first-of-type { flex: 1; }
.lesson-count { color: var(--gold); font-size: 12px; white-space: nowrap; }
.empty-course { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 0; padding: 2px 0 5px; }
.selection-tag { margin-left: auto; font-size: 9px; letter-spacing: 1.4px; color: #969d90; white-space: nowrap; }
fieldset { border: none; margin: 0; min-width: 0; padding: 0; }
legend { padding: 0; width: 100%; }
.mode-fieldset legend { margin-bottom: 12px; font-size: 14px; font-weight: 500; }
.settings-panel > .fieldset-title { margin: 0 0 23px; }
.random-choice { cursor: pointer; padding-right: 18px; }
.random-choice:hover { background: #24271d; }
.random-choice .course-icon { display: flex; color: var(--gold); }
.progress-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
.progress-totals > div { padding: 18px; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.progress-totals dt { color: var(--muted); font-size: 14px; }
.progress-totals dd { margin: auto 0 0; color: var(--gold-bright); font-size: 32px; font-weight: 600; }
.daily-progress { margin: 28px 0 0; }
.daily-progress figcaption { font-size: 16px; font-weight: 600; }
.daily-progress figcaption span { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.daily-progress svg { display: block; width: 100%; height: auto; margin-top: 12px; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.chart-tick { fill: var(--muted); font-size: 13px; }
.chart-label { fill: var(--text); font-size: 15px; }
.chart-bar { fill: var(--gold); }
.chart-bar:hover { fill: var(--gold-bright); }
.progress-definition, .chart-empty, .progress-sync { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 16px 0 0; }
@media (max-width: 600px) {
  .daily-progress .chart-label { font-size: 28px; }
  .daily-progress .chart-tick { font-size: 24px; }
}
.mode-fieldset legend .eyebrow { display: block; font-size: 10px; margin-bottom: 7px; }
.fieldset-title { display: block; font-size: 22px; line-height: 1.3; letter-spacing: -.55px; font-weight: 600; }
.mode-option { position: relative; min-height: 86px; display: flex; align-items: center; gap: 15px; padding: 16px; margin-bottom: 11px; border: 1px solid #373c34; border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.mode-option:hover { border-color: var(--gold-dim); }
.mode-option.is-selected { border-color: #b09156; background: #24271d; }
.mode-option:has(input:disabled) { opacity: .5; cursor: not-allowed; border-color: var(--line); }
.mode-option input, .voice-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-option:has(input:focus-visible), .voice-option:has(input:focus-visible) { outline: 3px solid var(--gold-bright); outline-offset: 4px; }
.mode-icon { display: grid; place-items: center; color: #a9aea3; }
.mode-icon .icon { width: 26px; height: 26px; }
.is-selected .mode-icon { color: var(--gold); }
.mode-copy { flex: 1; }
.mode-copy strong { display: block; font-size: 16px; font-weight: 600; margin-bottom: 5px; }
.mode-copy > span { display: block; color: var(--muted); font-size: 14px; line-height: 1.5; }
.radio-indicator { flex-shrink: 0; width: 18px; height: 18px; border: 1px solid #69705e; border-radius: 50%; }
.is-selected .radio-indicator { border: 5px solid var(--gold); background: var(--panel); }
.voice-fieldset { padding-top: 20px; }
.voice-fieldset legend { float: left; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.voice-control { display: flex; gap: 4px; padding: 4px; border: 1px solid #353b31; border-radius: 9px; clear: both; background: #101310; }
.voice-option { position: relative; flex: 1; text-align: center; cursor: pointer; border-radius: 5px; }
.voice-option input { inset: 0; width: 100%; height: 100%; margin: 0; z-index: 1; cursor: pointer; }
.voice-option > span { display: block; color: var(--muted); font-size: 14px; padding: 10px 3px; border: 1px solid transparent; border-radius: inherit; }
.voice-option input:checked + span { color: var(--gold-bright); background: #2a2d20; border-color: #585236; font-weight: 600; }
.voice-description { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; }
.start-block { border-top: 1px solid var(--line); padding-top: 21px; margin-top: 24px; }
.round-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-size: 13px; }
.round-summary > span { color: var(--muted); }
.round-summary strong { font-weight: 500; }
.round-summary strong span { color: var(--gold-dim); margin: 0 5px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid transparent; border-radius: 8px; min-height: 48px; padding: 12px 23px; font-size: 15px; font-weight: 600; line-height: 1.5; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
.button-primary { background: var(--gold); color: #15170e; box-shadow: inset 0 1px #ffe2a733; }
.button-primary:hover:not(:disabled) { background: var(--gold-bright); transform: translateY(-1px); }
.button-primary:disabled { background: #393b2f; color: #a1a491; box-shadow: none; }
.play-button { width: 100%; min-height: 51px; font-size: 16px; }
.play-button .icon { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.start-note { text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6; margin: 12px 0 0; }
.button-secondary, .button-quiet { border-color: #414637; background: transparent; color: var(--text); }
.button-secondary:hover, .button-quiet:hover { background: #20251d; border-color: var(--gold-dim); }
.button-quiet { min-height: 40px; font-size: 13px; padding: 9px 15px; font-weight: 500; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; color: #959c8e; padding: 30px 0 24px; margin-top: 22px; font-size: 12px; line-height: 1.6; }
.site-footer em { color: #c2b38e; font-style: normal; }
.session-header-label { font-size: 10px; letter-spacing: 1.5px; color: var(--muted); }
.game-view { padding-top: 30px; }
.game-view.has-answer { animation: none; }
.round-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.round-context { display: flex; gap: 16px; align-items: center; }
.mode-badge { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gold); border: 1px solid #49422d; background: #222319; border-radius: 30px; padding: 8px 13px; }
.mode-badge .icon { width: 17px; height: 17px; }
.round-lesson { font-size: 14px; color: var(--muted); }
.score-chip { display: flex; align-items: center; gap: 13px; }
.score-chip > span { font-size: 13px; color: var(--muted); }
.score-chip strong { font-size: 23px; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.score-chip strong span { font-size: 17px; font-weight: 400; color: var(--muted); }
.progress-track { height: 4px; background: #2b3027; overflow: hidden; border-radius: 5px; }
.progress-track > span { display: block; background: var(--gold); height: 100%; transition: width .3s ease; border-radius: inherit; }
.question-stage { min-height: 320px; padding: 26px 0 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.question-core { display: flex; align-items: center; justify-content: center; gap: 28px; width: 100%; }
.question-content { flex: 0 1 auto; min-width: 0; max-width: 650px; display: flex; flex-direction: column; align-items: center; }
.question-details { max-width: 100%; }
.result-slot { flex: 0 0 76px; display: grid; place-items: center; }
.result-badge { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--correct-border); --result-glow: #4ade8018; }
.result-badge.is-wrong { color: var(--wrong-border); --result-glow: #f8717118; }
.result-disc { position: relative; width: 76px; height: 76px; border-radius: 50%; background: var(--result-glow); }
.result-disc::before { content: ""; position: absolute; inset: 4px; border-radius: inherit; background: var(--result-glow); filter: blur(12px); }
.result-drawing { position: relative; width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; }
.result-track { stroke-width: 1.3; opacity: .18; }
.result-ring { stroke-width: 1.3; stroke-dasharray: 1; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: 32px 32px; opacity: .85; }
.result-stroke { stroke-width: 3.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.result-halo { position: absolute; inset: 0; border: 1px solid currentColor; border-radius: inherit; opacity: 0; }
.result-spark { position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: currentColor; opacity: 0; pointer-events: none; }
.result-caption { font-size: 14px; line-height: 1.4; color: var(--muted); }
.question-count { font-size: 10px; margin-bottom: 20px; color: #bcb08f; }
.audio-orb { position: relative; display: grid; place-items: center; width: 94px; height: 94px; border-radius: 50%; background: #2a2b1d; color: var(--gold-bright); border: 1px solid #7f6e42; box-shadow: 0 0 0 11px #b6924110, 0 0 0 24px #b6924108; margin: 13px 0 25px; }
.audio-orb:hover { background: #363724; border-color: var(--gold); }
.audio-orb > .icon { width: 39px; height: 39px; }
.sound-bars { display: none; align-items: center; justify-content: center; gap: 5px; height: 38px; }
.sound-bars i { display: block; width: 4px; height: 20px; border-radius: 3px; background: var(--gold); animation: sound .7s ease-in-out infinite alternate; }
.sound-bars i:nth-child(2) { height: 34px; animation-delay: -.4s; }
.sound-bars i:nth-child(3) { height: 29px; animation-delay: -.2s; }
.sound-bars i:nth-child(4) { height: 14px; animation-delay: -.5s; }
.audio-orb.is-playing > .icon { display: none; }
.audio-orb.is-playing .sound-bars { display: flex; }
.listening-title { font-family: Georgia, "Times New Roman", serif; font-size: 36px; font-weight: 400; letter-spacing: -.75px; margin: 0 0 8px; line-height: 1.2; }
.audio-state { color: var(--muted); font-size: 13px; margin: 0; }
.thai-prompt { font-family: "Leelawadee UI", Tahoma, sans-serif; font-size: clamp(52px, 6.5vw, 76px); font-weight: 400; line-height: 1.5; letter-spacing: 0; color: var(--gold-bright); margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.shows-script .question-count { margin-bottom: 8px; }
.pronunciation-guide { font-size: 18px; color: #b7bdaf; margin: 6px 0 17px; line-height: 1.6; }
.replay-small { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; border: 1px solid #4e513c; background: #1f231b; padding: 8px 14px; border-radius: 40px; color: var(--gold); font-size: 13px; }
.replay-small:hover { border-color: var(--gold-dim); }
.replay-small .icon { width: 18px; height: 18px; }
.voice-credit { border-left: 1px solid #454934; padding-left: 10px; margin-left: 2px; font-size: 11px; color: var(--muted); }
.audio-message { font-size: 14px; line-height: 1.6; color: var(--gold-bright); margin: 14px 0 0; max-width: 420px; }
.answers-section h2 { font-size: 14px; font-weight: 400; color: var(--muted); text-align: center; margin: 0 0 17px; }
.answer-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.answer-card { position: relative; min-width: 0; min-height: 64px; border: 1px solid #3a4034; background: #181c16; text-align: center; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; gap: 6px; transition: border-color .15s, background .15s, transform .15s; }
.answer-card:not(:disabled):hover { border-color: var(--gold); background: #262a1f; transform: translateY(-4px); }
.answer-mark { position: absolute; top: 8px; right: 8px; display: flex; }
kbd { display: inline-grid; place-items: center; font: 11px "Segoe UI", sans-serif; width: 23px; height: 23px; border: 1px solid #4b5243; border-radius: 5px; color: #b0b7a6; }
.answer-mark > .icon { width: 18px; height: 18px; }
.answer-meaning { font-size: 18px; font-weight: 500; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.answer-translation { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; line-height: 1.5; color: var(--muted); }
.answer-card.is-correct { border-color: var(--correct-border); background: var(--correct-bg); color: var(--correct); box-shadow: 0 0 0 1px var(--correct-border); padding-inline: 26px; }
.answer-card.is-wrong { border-color: var(--wrong-border); background: var(--wrong-bg); color: var(--wrong); box-shadow: 0 0 0 1px var(--wrong-border); padding-inline: 26px; }
.answer-card.is-correct .answer-translation, .answer-card.is-wrong .answer-translation { color: inherit; }
.answer-card.is-muted { opacity: .52; }
.answer-verdict { font-size: 14px; line-height: 1.4; }
.round-bottom { min-height: 104px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 28px 0 0; }
.round-bottom.is-complete { justify-content: flex-end; }
.answer-hint { color: var(--muted); font-size: 12px; text-align: center; width: 100%; line-height: 1.8; margin: 0; }
.answer-hint > span { display: block; }
.keyboard-hint { margin-top: 5px; font-size: 11px; }
.keyboard-hint kbd { width: 18px; height: 18px; font-size: 10px; vertical-align: 0; }
.next-button { flex-shrink: 0; min-width: 151px; }
.results-view { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; padding-top: 48px; }
.results-main { text-align: center; padding: 16px 0; }
.results-spark { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 19px; color: var(--gold); border: 1px solid #635936; background: #24271b; border-radius: 50%; }
.results-spark .icon { width: 28px; height: 28px; }
.results-main h1 { font-family: "Leelawadee UI", Tahoma, sans-serif; font-size: 55px; font-weight: 400; line-height: 1.55; color: var(--gold-bright); margin-bottom: 4px; }
.results-subtitle { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0; }
.result-score { margin: 20px 0 21px; }
.result-score > strong { display: block; font-size: 96px; font-weight: 400; letter-spacing: -5px; color: var(--gold-bright); line-height: 1.2; font-variant-numeric: tabular-nums; }
.result-score strong > span { font-size: 47px; letter-spacing: -3px; color: #848d78; }
.result-score > span { font-size: 14px; color: var(--muted); display: block; margin-top: 4px; }
.result-stats { display: flex; gap: 20px; justify-content: center; margin-bottom: 30px; font-size: 13px; color: #c9c8b5; }
.result-stats > span + span { border-left: 1px solid var(--line); padding-left: 20px; }
.results-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.review-panel { padding: 27px; }
.review-panel > .panel-heading > .icon { color: var(--gold); }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--line); }
.review-thai { display: block; font-size: 25px; color: #e3dcc7; line-height: 1.5; }
.review-english { display: block; color: var(--muted); font-size: 14px; margin-top: 3px; }
.review-audio { display: grid; place-items: center; border: 1px solid #49513a; background: transparent; color: var(--gold); border-radius: 50%; width: 43px; height: 43px; flex-shrink: 0; }
.review-audio:hover { background: #2a301f; }
.review-audio .icon { width: 20px; height: 20px; }
.loading-state, .load-error { padding: 80px 0; text-align: center; color: var(--muted); line-height: 1.7; }
.load-error h1 { color: var(--text); font: 40px Georgia, serif; }
.load-error .button { margin-top: 16px; }
.noscript { text-align: center; padding: 24px; color: var(--gold); }
.consonant-practice-note { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 14px 0 0; }
.thai-prompt.consonant-prompt { font-size: 100px; line-height: 1.4; }
.answer-meaning.thai-answer { font-family: "Leelawadee UI", Tahoma, sans-serif; font-size: 3rem; line-height: 1.3; font-weight: 400; align-self: center; }
.letter-name { font-size: 23px; color: var(--text); margin: 0 0 6px; }
.answer-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto 24px; }
.answer-summary .answer-card:last-child { grid-column: auto; }
.answer-summary .answer-card:only-child { grid-column: 1 / -1; width: min(100%, 280px); justify-self: center; }
.consonant-step h2 { font-size: 16px; font-weight: 500; margin-bottom: 18px; color: var(--text); }
.answer-grid.class-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.answer-grid:has(> .answer-card:only-child) { grid-template-columns: minmax(0, 1fr); max-width: 320px; margin-inline: auto; }
.review-class { display: block; color: var(--muted); font-size: 14px; line-height: 1.6; margin-top: 5px; }
.view-enter { animation: enter .3s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sound { to { transform: scaleY(.4); } }

@media (min-width: 1400px) {
  .site-shell { max-width: 1290px; padding: 0 58px; }
  .intro { padding: 48px 0 37px; }
  .vocabulary-panel, .settings-panel { padding: 32px; }
  .course-row, .course-toggle { min-height: 69px; }
  .game-view { padding-top: 40px; }
  .question-stage { min-height: 348px; }
}

@media (max-width: 1050px) {
  .site-shell { padding: 0 32px; }
  .setup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .vocabulary-panel, .settings-panel { padding: 23px; }
  .selection-tag { display: none; }
  .course-icon { display: none; }
  .course-row { gap: 12px; padding-left: 14px; }
  .course-toggle { gap: 8px; padding-right: 10px; }
  .course-children { padding-left: 42px; }
  .course-title { font-size: 14px; }
  .mode-option { gap: 11px; padding: 14px 12px; }
  .mode-copy > span { font-size: 14px; }
  .answer-grid { gap: 10px; }
  .answer-card { padding: 14px 12px; }
  .answer-meaning { font-size: 16px; }
  .session-header-label { display: none; }
  .results-view { gap: 32px; }
}

@media (max-width: 760px) {
  .question-core { gap: 12px; }
  .result-slot { flex-basis: 48px; }
  .result-disc { width: 48px; height: 48px; }
  .result-badge { gap: 5px; }
  .answer-grid.class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .class-grid .answer-card:last-child { grid-column: auto; }
  .thai-prompt.consonant-prompt { font-size: 84px; }
  .site-shell { max-width: 620px; padding: 0 22px; }
  .site-header { min-height: 91px; padding: 19px 0; }
  .brand-symbol { width: 36px; height: 40px; font-size: 30px; padding-bottom: 5px; }
  .brand { gap: 10px; }
  .brand-name { font-size: 18px; letter-spacing: 1.6px; }
  .brand-name small { font-size: 8px; letter-spacing: 1.6px; }
  .header-motto { display: none; }
  .thai-wordmark { border: none; padding: 0; font-size: 20px; }
  .intro { padding: 32px 0 28px; }
  .intro h1 { font-size: 43px; letter-spacing: -1.8px; max-width: 450px; }
  .intro .eyebrow { font-size: 9px; letter-spacing: 1.6px; }
  .intro-copy { font-size: 14px; line-height: 1.7; max-width: 330px; }
  .setup-grid { grid-template-columns: 1fr; gap: 20px; }
  .vocabulary-panel, .settings-panel { padding: 24px; }
  .panel-heading h1, .panel-heading h2, .fieldset-title { font-size: 21px; }
  .course-icon { display: block; }
  .course-toggle { gap: 10px; padding-right: 12px; }
  .course-title { font-size: 14px; }
  .course-children { padding-left: 42px; }
  .word-count { font-size: 11px; }
  .panel-description { margin-bottom: 20px; }
  .mode-option { min-height: 88px; padding: 16px; gap: 17px; }
  .mode-copy > span { font-size: 14px; }
  .voice-fieldset { padding-top: 18px; }
  .voice-fieldset legend { font-size: 14px; }
  .site-footer { font-size: 11px; margin-top: 10px; padding: 24px 0; }
  .site-footer > span:last-child { display: none; }
  .game-view { padding-top: 23px; }
  .button-quiet { font-size: 12px; padding: 8px 11px; }
  .round-toolbar { margin-bottom: 16px; }
  .round-context { gap: 10px; }
  .mode-badge { padding: 7px 11px; font-size: 12px; }
  .round-lesson { font-size: 12px; }
  .score-chip { gap: 8px; }
  .score-chip strong { font-size: 21px; }
  .score-chip > span { font-size: 12px; }
  .score-chip strong span { font-size: 14px; }
  .question-stage { min-height: 260px; padding: 22px 0 23px; }
  .question-count { font-size: 9px; margin-bottom: 14px; }
  .audio-orb { width: 76px; height: 76px; margin: 12px 0 23px; box-shadow: 0 0 0 9px #b6924110, 0 0 0 19px #b6924108; }
  .audio-orb > .icon { width: 31px; height: 31px; }
  .listening-title { font-size: 30px; }
  .thai-prompt { font-size: 51px; line-height: 1.55; }
  .pronunciation-guide { font-size: 16px; margin-bottom: 12px; }
  .answers-section h2 { font-size: 13px; margin-bottom: 14px; }
  .answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .answer-card { min-height: 56px; padding: 12px 14px; }
  .answer-card:last-child { grid-column: 1 / -1; }
  .answer-meaning { font-size: 16px; line-height: 1.4; }
  .round-bottom { padding-top: 22px; gap: 20px; flex-wrap: wrap; }
  .next-button { width: 100%; min-height: 49px; }
  .keyboard-hint { display: none !important; }
  .answer-hint { font-size: 12px; }
  .results-view { grid-template-columns: 1fr; gap: 26px; padding-top: 27px; }
  .results-main { padding: 5px 0 8px; }
  .results-main h1 { font-size: 48px; }
  .results-spark { width: 50px; height: 50px; margin-bottom: 13px; }
  .result-score { margin: 12px 0 18px; }
  .result-score > strong { font-size: 83px; }
  .result-stats { margin-bottom: 24px; }
  .results-actions .button { flex: 1; padding-inline: 14px; }
  .review-panel { padding: 24px; }
}

@media (max-width: 380px) {
  .site-shell { padding: 0 16px; }
  .vocabulary-panel, .settings-panel { padding: 19px; }
  .course-row { padding-left: 12px; gap: 10px; }
  .course-toggle { gap: 8px; padding-right: 8px; }
  .course-icon { display: none; }
  .course-title { font-size: 13px; }
  .word-count { font-size: 10px; }
  .round-lesson { display: none; }
  .intro h1 { font-size: 39px; }
  .panel-heading h1, .panel-heading h2, .fieldset-title { font-size: 19px; }
  .mode-option { gap: 11px; padding: 13px; }
}

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

.header-actions, .account-context { display: flex; align-items: center; gap: 14px; }
.header-actions { margin-left: auto; justify-content: flex-end; flex-wrap: wrap; }
.header-context:empty { display: none; }
.account-context .button { padding: 9px 14px; font-size: .875rem; white-space: nowrap; }
.account-context .text-button { padding: 9px 0; }
.custom-add-row { margin-top: 7px; }
.custom-add-row .text-button { display: block; width: 100%; min-height: 44px; padding: 10px 13px; text-align: left; }
.skip-button { margin-left: auto; }
.round-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 18px 0; margin: 0 0 20px; border-block: 1px solid var(--line); }
.round-stats dt { color: var(--muted); font-size: .875rem; margin-bottom: 8px; }
.round-stats dd { font-size: 1.5rem; margin: 0; font-variant-numeric: tabular-nums; }
.stat-correct { color: var(--correct); }
.stat-wrong { color: var(--wrong); }
.save-score-prompt { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.save-score-prompt p { font-size: .9375rem; color: var(--muted); line-height: 1.6; }
.save-score-prompt p.stat-correct { color: var(--correct); }
.save-score-prompt .button { padding: 10px 18px; }
.account-dialog { color: var(--text); background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 18px; padding: 32px; width: min(480px, calc(100vw - 32px)); max-height: calc(100svh - 40px); overflow-y: auto; box-shadow: 0 30px 120px #0009; }
.account-dialog::backdrop { background: #050705cf; backdrop-filter: blur(7px); }
.account-dialog h2 { font-size: 1.5rem; line-height: 1.3; margin: 8px 28px 12px 0; }
.account-dialog p { color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.dialog-close { position: absolute; right: 16px; top: 16px; border: 0; background: none; color: var(--muted); padding: 8px; line-height: 0; }
.dialog-close .icon { width: 20px; height: 20px; }
.social-options { display: grid; gap: 10px; margin-top: 24px; }
.account-dialog .button { min-height: 46px; padding: 12px 16px; }
.account-dialog button:disabled { opacity: .45; }
.auth-divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .875rem; margin: 22px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.account-dialog form { display: grid; gap: 18px; }
.account-dialog form > label { display: grid; gap: 8px; font-size: .9375rem; }
.account-dialog input:not([type=radio]) { background: var(--bg); color: var(--text); border: 1px solid #454d42; border-radius: 8px; width: 100%; padding: 12px; font-size: 1rem; }
.account-dialog input::placeholder { color: #858d80; }
.account-dialog .text-button { padding: 8px 0; white-space: normal; text-align: left; }
.auth-switch { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 16px; }
.service-notice { border-left: 2px solid var(--gold-dim); padding-left: 12px; font-size: .875rem; line-height: 1.6; color: var(--muted); }
.dialog-message { margin: 18px 0 0; }
.dialog-message.is-error { color: var(--wrong); }
.account-dialog.is-custom, .account-dialog.is-progress { width: min(760px, calc(100vw - 32px)); }
.custom-grid { width: 100%; table-layout: fixed; border-collapse: collapse; }
.custom-grid th { color: var(--muted); font-size: .875rem; font-weight: 400; text-align: left; padding: 0 6px 12px; line-height: 1.5; }
.custom-grid td { width: 50%; padding: 6px; vertical-align: top; }
.custom-grid td:first-child, .custom-grid th:first-child { padding-left: 0; }
.custom-grid td:last-child, .custom-grid th:last-child { padding-right: 0; }
.custom-grid input { min-width: 0; }
.custom-grid .is-saved input { color: var(--muted); border-color: #315a40; }
.custom-grid .is-error input { border-color: var(--wrong); }
.custom-row-status { display: block; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; margin: 5px 0 2px; color: var(--muted); }
.custom-row-status:empty { display: none; }
.is-saved .custom-row-status { color: var(--correct); }
.is-error .custom-row-status { color: var(--wrong); }
.custom-grid-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.history-list { list-style: none; padding: 0; margin: 20px 0 0; }
.history-list li { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--line); }
.history-list div { min-width: 0; }
.history-list strong { font-size: 1rem; overflow-wrap: anywhere; }
.history-list span { display: block; font-size: .875rem; line-height: 1.6; color: var(--muted); margin-top: 5px; }
.history-list li > strong { flex-shrink: 0; color: var(--gold); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .site-header { gap: 12px; }
  .header-actions { max-width: 48%; gap: 6px; }
  .account-context { gap: 10px; }
  .header-context { order: 2; }
  .account-context .button { padding: 8px 10px; }
  .account-context .text-button { font-size: .875rem; }
  .account-dialog { padding: 24px; }
  .round-bottom .skip-button { width: 100%; margin-left: 0; }
}
@media (max-width: 380px) {
  .brand { gap: 8px; }
  .brand-name { font-size: 14px; letter-spacing: .8px; }
  .account-context .button { padding-inline: 8px; }
}
