/* Look: Portland stone ground, slate blocks, one deep red for what matters most; Garamond for English and
   numbers, the phone's own Korean sans for Korean. Fonts are served from /fonts (SIL Open Font License). */

@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(/fonts/eb-garamond.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/eb-garamond-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/jost.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #ebe6db;
  --paper: #f7f4ed;
  --tint: #f2ece0;
  --text: #22262d;
  --muted: #615f59;
  --line: #cbc3b2;
  --slate: #2b313b;
  --on-slate: #ece8df;
  --on-slate-muted: #b9bec7;
  --primary-bg: #2b313b;
  --primary-text: #ece8df;
  --accent: #8e2a24;
  --accent-text: #f7efe6;
  --danger: #8e2a24;
  --serif: 'EB Garamond', 'Noto Serif KR', 'Apple SD Gothic Neo', serif;
  --sans: system-ui, -apple-system, 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  --label: 'Jost', system-ui, sans-serif;
  color-scheme: light;
}

/* Dark: London at dusk. Soft grey ground, deep grey blocks, and small lamp-yellow lights for what matters. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2b2f34;
    /* Cards let the street lights behind them through, faintly. */
    --paper: rgba(52, 57, 64, 0.88);
    --tint: rgba(59, 63, 69, 0.9);
    --text: #eeebe4;
    --muted: #b1b3b5;
    --line: #4b5057;
    --slate: #1d2024;
    --on-slate: #f1eee7;
    --on-slate-muted: #a7abb1;
    --primary-bg: #ece7dc;
    --primary-text: #1d2024;
    --accent: #f1bd5b;
    --accent-text: #1d2024;
    --danger: #f2a093;
    --lamp: #f1bd5b;
    color-scheme: dark;
  }
  /* Street lights out of focus behind the page: a few soft warm glows peeking out around the cards and
     buttons, breathing slowly. Small spots only, never a wash over the whole screen. */
  :root:not([data-theme="light"]) body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(circle at 95% 12%, rgba(241, 189, 91, 0.55) 0, rgba(241, 189, 91, 0.30) 22px, rgba(241, 189, 91, 0) 62px),
      radial-gradient(circle at 98% 46%, rgba(244, 178, 96, 0.45) 0, rgba(244, 178, 96, 0.22) 28px, rgba(244, 178, 96, 0) 80px),
      radial-gradient(circle at 3% 58%, rgba(233, 150, 112, 0.42) 0, rgba(233, 150, 112, 0.20) 30px, rgba(233, 150, 112, 0) 86px),
      radial-gradient(circle at 10% 73%, rgba(241, 189, 91, 0.30) 0, rgba(241, 189, 91, 0.12) 18px, rgba(241, 189, 91, 0) 48px),
      radial-gradient(circle at 97% 72%, rgba(247, 205, 130, 0.45) 0, rgba(247, 205, 130, 0.20) 26px, rgba(247, 205, 130, 0) 72px),
      radial-gradient(circle at 2% 90%, rgba(241, 189, 91, 0.45) 0, rgba(241, 189, 91, 0.20) 30px, rgba(241, 189, 91, 0) 84px),
      radial-gradient(circle at 60% 99%, rgba(241, 189, 91, 0.26) 0, rgba(241, 189, 91, 0.10) 40px, rgba(241, 189, 91, 0) 110px);
    filter: blur(10px);
    animation: street-lights 9s ease-in-out infinite alternate;
  }
  :root:not([data-theme="light"]) body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(circle at 90% 28%, rgba(241, 189, 91, 0.32) 0, rgba(241, 189, 91, 0.14) 14px, rgba(241, 189, 91, 0) 36px),
      radial-gradient(circle at 7% 44%, rgba(241, 200, 120, 0.30) 0, rgba(241, 200, 120, 0.12) 14px, rgba(241, 200, 120, 0) 38px),
      radial-gradient(circle at 91% 88%, rgba(233, 150, 112, 0.34) 0, rgba(233, 150, 112, 0.14) 16px, rgba(233, 150, 112, 0) 44px),
      radial-gradient(circle at 22% 82%, rgba(241, 189, 91, 0.24) 0, rgba(241, 189, 91, 0.10) 12px, rgba(241, 189, 91, 0) 30px);
    filter: blur(6px);
    animation: street-lights 13s ease-in-out -4s infinite alternate-reverse;
  }
  @keyframes street-lights { from { opacity: 0.7; } to { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { :root body::before, :root body::after { animation: none; } }
  :root:not([data-theme="light"]) :is(.progress-line div, .meter div) { background: var(--lamp); }
  :root:not([data-theme="light"]) :is(.slate .eyebrow, .cue-clock .eyebrow) { color: #d9c08e; }
}

/* The app's brightness setting (coach.js sets data-theme on <html>) overrides the phone's. */
:root[data-theme="dark"] {
    --bg: #2b2f34;
    /* Cards let the street lights behind them through, faintly. */
    --paper: rgba(52, 57, 64, 0.88);
    --tint: rgba(59, 63, 69, 0.9);
    --text: #eeebe4;
    --muted: #b1b3b5;
    --line: #4b5057;
    --slate: #1d2024;
    --on-slate: #f1eee7;
    --on-slate-muted: #a7abb1;
    --primary-bg: #ece7dc;
    --primary-text: #1d2024;
    --accent: #f1bd5b;
    --accent-text: #1d2024;
    --danger: #f2a093;
    --lamp: #f1bd5b;
    color-scheme: dark;
}
:root[data-theme="dark"] :is(.progress-line div, .meter div) { background: var(--lamp); }
:root[data-theme="dark"] :is(.slate .eyebrow, .cue-clock .eyebrow) { color: #d9c08e; }

/* The signed-in app fills the screen. */
#coach { position: fixed; inset: 0; z-index: 5; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
html, body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

/* ---- type ---- */
.top { padding: 4px 0 14px; display: flex; justify-content: space-between; align-items: baseline; }
.brand { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-family: var(--label); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; }
.brand-icon { width: 32px; height: 32px; object-fit: contain; flex: 0 0 auto; }
.brand-name { white-space: nowrap; }
.beta { font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.04em; color: var(--muted); margin-left: 6px; text-transform: none; }

h1 { font-size: 1.45rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; margin: 6px 0 10px; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 10px; }
.lede { color: var(--muted); margin: 0 0 16px; }
.eyebrow { margin: 0; font-family: var(--label); font-weight: 500; font-size: 0.66rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
/* Korean set in the label style: no wide tracking. */
.eyebrow.ko { font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.02em; }
.serif { font-family: var(--serif); }
.quote { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--muted); }
.rule { width: 28px; height: 1px; background: var(--text); border: 0; margin: 14px 0; }
.hint { margin: 0; color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); margin: 0; font-size: 0.92rem; }

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 18px;
}
.card ul { margin: 0; padding-left: 20px; }
.card li + li { margin-top: 6px; }

/* ---- forms and buttons ---- */
label { font-weight: 600; font-size: 0.9rem; }
input, select {
  font: inherit; font-size: 1rem; padding: 12px 14px; border-radius: 0;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
select { width: 100%; min-width: 0; }

button {
  font: inherit; font-weight: 500; font-size: 0.98rem; letter-spacing: 0.01em; border-radius: 0;
  padding: 14px 18px; border: 0; cursor: pointer; min-height: 52px;
}
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--primary-bg); color: var(--primary-text); }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.accent { background: var(--accent); color: var(--accent-text); }
.danger { background: transparent; color: var(--muted); border: 0; font-size: 0.9rem; min-height: 44px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--text); font-weight: 500; font-size: 0.9rem; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link { display: inline-block; margin-top: 8px; color: var(--text); font-weight: 500; text-underline-offset: 3px; }
.link-inline { color: inherit; text-underline-offset: 3px; }
.button-link { display: block; text-align: center; text-decoration: none; padding: 15px 18px; font-weight: 500; letter-spacing: 0.04em; }
a.primary, a.secondary { color: inherit; }
a.primary { color: var(--primary-text); }

/* ---- lists of tips ---- */
.tips { margin: 0; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }
.tips li + li { margin-top: 4px; }
details summary { cursor: pointer; font-weight: 500; }
details[open] summary { margin-bottom: 10px; }
/* ---- slate blocks (the test bar) ---- */
.slate { background: var(--slate); color: var(--on-slate); margin: 0 -20px; padding: 20px; }
.slate .eyebrow { color: var(--on-slate-muted); }
.slate .quote { color: var(--on-slate-muted); }
.slate-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.progress-line { margin-top: 12px; height: 2px; background: rgba(255,255,255,0.18); }
.progress-line div { height: 2px; width: 0; background: var(--on-slate); transition: width 300ms ease; }

/* ---- live test ---- */
.live { min-height: calc(100dvh - 80px); }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pill { font-size: 0.82rem; color: var(--on-slate-muted); }
.pill.speaking { color: var(--on-slate); font-weight: 600; }
.timer { font-family: var(--serif); font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.meter { height: 2px; background: var(--line); overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--text); transition: width 80ms linear; }
.question { padding: 22px 0 4px; }
.question-text { margin: 14px 0 0; font-family: var(--serif); font-size: 1.95rem; line-height: 1.22; overflow-wrap: anywhere; }
.live.scripted #transcript { display: none; }
/* During Part 2 the card's own clock is the bar at the top. */
.live.cueing > .slate { display: none; }
#next-button { margin-top: auto; min-height: 64px; }
#next-button:not([hidden]) + .danger { margin-top: 0; }
.danger { margin-top: auto; }

.cue { padding: 0; border: 0; background: transparent; display: flex; flex-direction: column; gap: 14px; }
.cue p { margin: 0; }
.cue-clock { background: var(--slate); color: var(--on-slate); margin: 0 -20px; padding: 18px 20px 20px; }
.cue-clock .eyebrow { color: var(--on-slate-muted); }
.cue-clock .timer { display: block; margin-top: 8px; font-size: 3.6rem; line-height: 1; color: var(--on-slate); }
.cue-paper { background: var(--paper); border: 1px solid var(--line); padding: 22px 20px; text-align: center; }
.cue-topic { margin-top: 12px !important; font-family: var(--serif); font-size: 1.55rem; line-height: 1.25; }
.cue-say { margin-top: 16px !important; font-family: var(--serif); font-style: italic; color: var(--muted); }
.cue ul { list-style: none; margin: 6px 0 0; padding: 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; }

.transcript { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 96px; }
.live > * { flex-shrink: 0; }
.live > .transcript { flex-shrink: 1; }
.transcript.static { max-height: none; margin-top: 12px; }
.bubble { padding: 10px 14px; max-width: 88%; font-size: 0.94rem; overflow-wrap: anywhere; }
.bubble.examiner { background: var(--paper); border: 1px solid var(--line); align-self: flex-start; font-family: var(--serif); font-size: 1.05rem; }
.bubble.candidate { background: var(--tint); align-self: flex-end; }
.hard-mark { display: block; margin-top: 10px; font-size: 0.82rem; }
.bubble .hard-mark { margin-top: 6px; font-family: var(--sans, inherit); font-size: 0.76rem; }
.bubble .who { display: block; font-family: var(--label); font-size: 0.62rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

/* ---- conversation practice (on the test screen) ---- */
.before { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--accent); }
button.link.quiet { color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.practice-card { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.practice-card p { margin: 0; }
.practice-target { font-family: var(--serif); font-size: 1.75rem; line-height: 1.25; overflow-wrap: anywhere; }
.practice-card .secondary { align-self: flex-start; min-height: 44px; padding: 10px 16px; }
.verdict { padding: 10px 12px; border: 1px solid var(--line); font-size: 0.9rem; }
.verdict.good { border-color: var(--text); }
.verdict strong { font-weight: 600; }
/* ---- consent, legal, policy ---- */
.consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 0.84rem; color: var(--muted); line-height: 1.55; }
.consent input { margin-top: 3px; flex-shrink: 0; width: 18px; height: 18px; }
.legal { margin-top: 32px; font-size: 0.74rem; color: var(--muted); line-height: 1.55; }
.legal p { margin: 0 0 6px; }
.policy h2 { margin-top: 24px; }
.policy ul { padding-left: 20px; margin: 0; }
.policy li { margin-bottom: 8px; font-size: 0.94rem; }
.policy p { font-size: 0.94rem; }

/* ---- buying by transfer, the order ---- */
.plan-option { display: flex; gap: 10px; align-items: center; padding: 12px 14px; font-weight: 500; }
.plan-option input { width: 18px; height: 18px; }
.order-amount { margin: 0; font-size: 1.05rem; }
.code-value { margin: 0; font-family: var(--serif); font-size: 1.8rem; letter-spacing: 0.04em; user-select: all; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); font-weight: 500; }
.account-row .link { white-space: nowrap; flex-shrink: 0; margin: 0; }
pre.hint { white-space: pre-wrap; font-family: inherit; margin: 0; }

/* ---- lab page ---- */
.row { display: flex; gap: 8px; }
.tag { font-size: 0.72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; margin-left: 4px; }
.stt-result { margin: 0; font-size: 1.05rem; font-weight: 600; min-height: 1.5em; overflow-wrap: anywhere; }

/* Owner's desk: cost of each pass against its price. */
.cost .cost-value { font-weight: 600; margin: 4px 0; }
.cost.warn { border-color: #c9a227; }
.cost.over { border-color: var(--accent); }
.cost.over .cost-value { color: var(--accent); }
