/* Approved brand colours; interface styles only, no learning-state changes. */
:root {
  color-scheme: light;
  --navy: #093C6C;
  --grey: #53545A;
  --orange: #FD7402;
  --orange-mid: #FC8D22;
  --orange-light: #FCA742;
  --orange-deep: #F16F0D;
  --orange-bright: #FE9629;
  --ink: #18344F;
  --paper: #FAF8F5;
  --surface: #FFFFFF;
  --line: #DCE1E7;
  --tint: #F1F5FA;
  --selected: #FFF2E6;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select { font: inherit; -webkit-tap-highlight-color: transparent; }
button, select { min-height: 52px; }
button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 20px;
  background: var(--surface);
  color: var(--navy);
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color .16s, border-color .16s, box-shadow .16s;
}
button:hover:not(:disabled) { background: var(--tint); border-color: #A9BDD0; }
button:active:not(:disabled) { box-shadow: inset 0 2px 4px #093c6c12; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--navy); outline-offset: 4px; }
.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.primary:hover:not(:disabled) { background: #062D52; border-color: #062D52; }
.site-header {
  max-width: 1160px;
  margin: auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; flex: 0 0 auto; border-radius: 8px; }
.brand picture, .brand img { display: block; }
.brand img { width: 220px; height: 99px; object-fit: contain; }
.header-note { font-size: 13px; color: var(--grey); }
main { max-width: 1120px; padding: 0 24px; margin: 32px auto 44px; }
#welcome { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr); gap: 20px 32px; align-items: start; }
.welcome-copy { grid-column: 1; }
.intro { padding-top: 10px; }
.eyebrow { font-size: 11px; font-weight: 750; letter-spacing: .14em; color: var(--navy); }
.welcome-heading { margin: 16px 0 18px; }
.intro h1 { font-size: clamp(36px, 3.8vw, 48px); line-height: 1.12; letter-spacing: -.045em; font-weight: 700; color: var(--navy); margin: 0; }
.bloom-word { display: inline-block; border-bottom: 4px solid var(--orange); padding-bottom: 2px; }
.intro p:not(.eyebrow) { color: var(--grey); font-size: 16px; line-height: 1.7; margin: 0; }
.intro .ui-th { font-size: 14px; margin-top: 8px; }
.demo-note { font-size: 12px; line-height: 1.65; color: var(--grey); border-left: 3px solid var(--orange-light); padding-left: 12px; margin: 24px 0 0; max-width: 430px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 8px 28px #093c6c06; }
#selection { grid-column: 2; }
h2 { color: var(--navy); font-size: 25px; letter-spacing: -.025em; line-height: 1.3; margin: 10px 0 24px; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
label { font-size: 13px; font-weight: 650; color: var(--navy); }
.filters select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 48px 10px 12px;
  color: var(--ink);
  background-color: var(--paper);
  border: 1px solid #B4C0CD;
  border-radius: 12px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23093C6C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 12px 8px;
  background-position: right 24px center;
  text-overflow: ellipsis;
}
.filters select:focus-visible { outline-width: 2px; outline-offset: 3px; }
.selection-bottom { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.selection-bottom p { color: var(--grey); font-size: 13px; margin: 0 0 16px; line-height: 1.55; }
#start { width: 100%; }
.ui-en, .ui-th { display: block; }
.ui-th { font-size: max(12px, .82em); font-weight: 400; line-height: 1.6; letter-spacing: normal; text-transform: none; margin-top: 3px; }
button .ui-th { font-size: 13px; }
h2 .ui-th { font-size: 14px; letter-spacing: normal; }
label .ui-th { font-size: 12px; color: var(--grey); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Study: compact context, prominent card, independent native controls. */
.studying main { max-width: 850px; margin-top: 20px; }
.studying .brand img { width: 180px; height: 81px; }
.study-navigation { margin: 0 0 10px; }
.text-button { border: 1px solid transparent; background: transparent; padding: 7px 10px; font-size: 14px; color: var(--grey); }
.text-button:hover:not(:disabled) { background: var(--tint); border-color: transparent; color: var(--navy); }
.study-navigation .text-button { text-align: left; padding-left: 0; }
.study-banner { padding: 12px 20px; margin-bottom: 14px; color: #fff; background: var(--navy); border-radius: 16px; }
.study-banner-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.course-context { min-width: 0; font-size: 12px; line-height: 1.6; color: #E4ECF5; }
.course-line { display: block; overflow-wrap: anywhere; }
.demo-badge { flex-shrink: 0; padding: 3px 8px; border: 1px solid #7F9BB7; border-radius: 8px; text-align: center; }
.demo-badge .ui-en, .demo-badge .ui-th { font-size: 11px; }
.demo-badge .ui-th { margin: 0; }
.study-banner h2 { font-size: 23px; color: #fff; margin: 6px 0 8px; }
.study-banner h2 .ui-th { color: #E4ECF5; }
.study-progress { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#review-mode { margin: 0; font-size: 13px; line-height: 1.6; color: #E4ECF5; min-width: 0; }
#review-mode .ui-en, #review-mode .ui-th { display: inline; }
#review-mode .ui-th { font-size: 12px; margin: 0; }
#progress { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 14px; }
.progress-track { height: 4px; border-radius: 4px; overflow: hidden; background: #3C6287; margin-top: 8px; }
#progress-fill { height: 100%; background: var(--orange-light); transition: width .2s; }
.card { position: relative; overflow: hidden; border-radius: 18px; border: 1px solid #D4DDE6; background: #fff; box-shadow: 0 10px 30px #093c6c09; }
.card-surface { display: block; width: 100%; border: 0; border-radius: inherit; padding: 24px 24px 96px; min-height: 380px; background: transparent; font-weight: 400; }
.card-surface:hover:not(:disabled) { background: #FFFEFC; }
.card-surface:focus-visible { outline-offset: -5px; }
.vocabulary-visual { display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 560px; min-height: 160px; margin: 0 auto 12px; background: #F5F3EF; border-radius: 10px; overflow: hidden; }
.vocabulary-visual img { display: block; width: 100%; height: 240px; object-fit: contain; }
/* Technical test files keep their visible TEST label; real photos are untouched. */
.vocabulary-visual img[src$="-test.svg"] { filter: grayscale(1); }
.visual-label { display: block; font-size: 12px; color: var(--grey); padding: 16px 18px 6px; }
.visual-context { display: block; padding: 0 18px 16px; font-size: 16px; line-height: 1.7; color: var(--grey); }
.word { display: block; font-size: clamp(34px, 6vw, 48px); font-weight: 700; color: var(--navy); letter-spacing: -.03em; line-height: 1.3; margin: 12px 0; }
.thai { display: block; font-size: 28px; color: var(--navy); line-height: 1.7; }
.example { display: block; font-size: 17px; line-height: 1.75; max-width: 540px; margin: 20px auto 0; padding: 12px 18px; border-left: 3px solid var(--orange-light); background: var(--paper); text-align: left; border-radius: 0 12px 12px 0; }
.explanation { display: block; font-size: 14px; color: var(--grey); line-height: 1.8; margin: 12px auto 0; max-width: 540px; }
.word, .thai, .example, .explanation, .visual-context { overflow-wrap: anywhere; }
.speak { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); border: 1px solid #B4C6D8; border-radius: 32px; padding: 8px 24px; background: var(--tint); min-width: 128px; font-size: 14px; }
.hint { font-size: 13px; color: var(--grey); line-height: 1.6; text-align: center; margin: 8px 0; }
.hint .ui-th { font-size: 12px; }
#flip-hint { margin: 8px 0 12px; }
#flip-hint .ui-en, #flip-hint .ui-th { display: inline; }
#flip-hint .ui-th { margin: 0; }
#speech-status:empty, #action-status:empty { display: none; }
.classification { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
.choice-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: none; margin: auto; }
.choice-buttons button { min-width: 0; }
.choice-buttons button[aria-pressed="true"] { background: var(--selected); border: 2px solid var(--orange); padding: 9px 19px; }
.choice-buttons button[aria-pressed="true"] .ui-en { font-weight: 750; }
.navigation { display: flex; gap: 12px; }
.navigation button { flex: 1; min-width: 0; }
.deck-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 8px; }
#full-deck { display: block; margin: 6px auto; }
.turning { animation: turn .18s ease-out; }
@keyframes turn { from { opacity: .75; transform: perspective(900px) rotateY(-3deg); } to { opacity: 1; transform: perspective(900px) rotateY(0); } }

/* Completion stays a revision summary, never a grade or Moodle completion. */
#completion { max-width: 660px; margin: auto; box-shadow: none; }
#completion-title { font-size: clamp(25px, 4vw, 30px); margin-bottom: 12px; }
#completion-title:focus { outline: none; }
#completion-context { font-size: 12px; color: var(--grey); line-height: 1.6; }
#completion-message { line-height: 1.6; margin: 12px 0; }
.summary-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 12px; padding: 16px 0; border-block: 1px solid var(--line); }
.summary-counts div { text-align: center; }
.summary-counts dt { font-size: 13px; line-height: 1.6; }
.summary-counts dd { font-size: 24px; margin: 6px 0 0; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.completion-actions { display: flex; flex-direction: column; gap: 8px; max-width: 400px; margin: 18px auto; }
.completion-actions .hint { margin: 0 0 4px; }
.moodle-note { border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; line-height: 1.7; color: var(--grey); }
.moodle-note p { margin: 0 0 6px; }
footer { max-width: 1160px; margin: auto; border-top: 1px solid var(--line); padding: 24px 32px; display: flex; justify-content: space-between; gap: 20px; color: var(--grey); font-size: 12px; line-height: 1.7; }
.studying footer [data-ui="moodle"] { display: none; }

@media (max-width: 899px) {
  #welcome { display: block; }
  .intro { padding: 0; max-width: 680px; }
  .intro h1 { font-size: 40px; }
  .demo-note { margin: 22px 0 18px; max-width: none; }
}
@media (min-width: 700px) and (max-width: 899px) { .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .site-header { padding: 12px 20px; }
  .brand img, .studying .brand img { width: 56px; height: 56px; }
  .header-note { font-size: 12px; max-width: 170px; text-align: right; }
  main { padding: 0 20px; margin-top: 22px; }
  .intro h1 { font-size: clamp(32px, 8vw, 38px); }
  .welcome-heading { margin: 12px 0 16px; }
  .panel { padding: 20px; border-radius: 18px; }
  h2 { font-size: 23px; }
  .filters { gap: 16px 12px; }
  .studying main { margin-top: 12px; }
  .study-banner { padding: 12px 16px; margin-bottom: 12px; }
  .study-banner h2 { font-size: 22px; }
  .card-surface { padding: 20px 16px 92px; min-height: 350px; }
  .vocabulary-visual img { height: 190px; }
  .word { font-size: 36px; }
  .thai { font-size: 26px; }
  .summary-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-tools { gap: 4px 12px; }
  footer { padding: 24px 20px; flex-direction: column; gap: 8px; }
}
@media (max-width: 600px) {
  .filters { grid-template-columns: 1fr; gap: 12px; }
  .filters label { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 8px; align-items: center; }
  .filters select { margin-top: 0; padding-left: 8px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .filters select { appearance: auto; background-image: none; }
  .choice-buttons button[aria-pressed="true"] { outline: 2px solid Highlight; }
}
