/* Shared styles every page loads: colour tokens, the header, buttons, the
   breadcrumb, the practice/result engine Loquor and Głoska share (and the
   core/ modules draw into), and the login, account and privacy pages.
   Anything only one app uses lives in that app's own stylesheet:
   executive.css, loquor.css, gloska.css. */

:root {
  --bg: #f2efe7;
  --card: #ffffff;
  --card-alt: #faf8f3;
  --border: rgba(28, 37, 65, 0.1);
  --border-strong: rgba(28, 37, 65, 0.2);
  --navy-900: #11182c;
  --navy-800: #1c2541;
  --navy-700: #2a3458;
  --ink-0: #1c2541;
  --ink-1: #565f80;
  --ink-2: #8991ab;
  --accent: #c15a2e;
  --accent-soft: #e08552;
  --accent-tint: #f6e2d4;
  --green: #2f9e5c;
  --green-tint: #e3f3e9;
  --yellow: #c98a1a;
  --yellow-tint: #faf0dc;
  --red: #c7493f;
  --red-tint: #fbe6e3;
  --radius: 14px;
  --shadow: 0 10px 28px -18px rgba(28, 37, 65, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink-0);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.hidden { display: none !important; }

a { color: inherit; }

/* --- Top chrome ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--navy-800);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}

.brand-name { font-weight: 700; font-size: 16px; color: var(--ink-0); }
.brand-sub { font-size: 12px; color: var(--ink-2); }

.sibling-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* "Demo" badge - shown only while scores are placeholders, see
   /api/v1/scoring-mode in server/app.js. Quiet (status, not a call to
   action) but hard to miss next to a score. */
.demo-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--yellow);
  background: var(--yellow-tint);
  border: 1px solid var(--yellow-tint);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.sibling-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.sibling-link:hover { text-decoration: underline; }

/* Switch between the apps this account can open (public/core/apps.js) -
   the same pills, in the same order, in every app's header. */
.app-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--card-alt); border: 1px solid var(--border); border-radius: 999px; }
.app-switch-item {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 12px;
  border-radius: 999px;
}
a.app-switch-item:hover { color: var(--accent); background: var(--card); }
.app-switch-item.active { background: var(--navy-800); color: #fff; }

/* Signed-in tester's name, linking to /account (public/core/account.js). */
.account-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-0);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.account-link:hover { border-color: var(--accent); color: var(--accent); }

/* "Was this score fair? 👍 👎" (public/core/score-feedback.js). Full-width
   inside flex rows like Track 1's repeat list. */
.score-feedback {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-2);
}
.score-feedback-q { margin-right: 4px; }
.score-feedback-btn {
  border: 1px solid var(--border-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.75;
}
.score-feedback-btn:hover:not(:disabled) { border-color: var(--accent); filter: none; opacity: 1; }
.score-feedback-btn.chosen { border-color: var(--navy-800); background: var(--card-alt); filter: none; opacity: 1; }

/* --- Shared "page" containers --------------------------------------------- */

.track-crumb,
.layout {
  max-width: 1200px;
  margin: 0 auto;
}

.track-crumb {
  padding: 14px 32px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: none; }

.track-crumb-title { font-size: 13px; color: var(--ink-2); }

/* Breadcrumb trail: every segment after the first gets a "/" divider,
   whether the segment before it was a clickable link or the plain current
   title - see renderCrumb() in executive.js / gloska.js. */
.track-crumb .crumb-seg + .crumb-seg::before { content: "/"; margin-right: 10px; color: var(--ink-2); }

/* --- Buttons --------------------------------------------------------------- */

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.12s ease;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }

.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--navy-900); }
/* :hover too: on a phone the tapped Record button keeps :hover, which would
   otherwise paint "Stop" navy instead of red for the whole take. */
.btn-primary.recording, .btn-primary.recording:not(:disabled):hover { background: var(--red); }
.btn-secondary { background: var(--card); color: var(--ink-0); border: 1px solid var(--border-strong); }
.btn-secondary:not(:disabled):hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-0); border: 1px solid var(--border-strong); }
.btn-ghost:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.rec-indicator { font-size: 12px; color: var(--red); font-weight: 600; }

/* --- Page titles ----------------------------------------------------------- */

/* Every app's views use these; "t1-" because they started in Track 1. */
.t1-page-title { font-size: 21px; font-weight: 700; margin: 4px 0 4px; color: var(--ink-0); }
.t1-page-sub { font-size: 13px; color: var(--ink-1); margin: 0 0 22px; }

/* Word-pair chips on Executive English rule pages and Loquor rule cards. */
.rule-pair {
  font-size: 12px;
  color: var(--ink-0);
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

/* --- Progress on the lists (public/core/progress.js) ----------------------- */

/* "Continue where you left off", above each app's list. */
.continue-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  margin: 0 0 18px;
  padding: 14px 20px;
  background: var(--navy-800);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  transition: background 0.12s ease, transform 0.1s ease;
}
.continue-card:hover { background: var(--navy-900); transform: translateY(-1px); }
.continue-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.continue-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-soft); }
.continue-card-title { font-size: 16px; font-weight: 700; }
.continue-card-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.continue-card .band-count { color: #fff; }
.continue-card-arrow { flex-shrink: 0; font-size: 18px; }

/* Under a set/topic/category card: its items as a bar coloured by how each
   last scored, then "Practised: x of y" and the count in each colour. */
/* Pushed to the bottom of a flex-column card, so the bars in one grid row
   line up whatever the length of the text above them. */
.card-progress { margin-top: auto; padding-top: 10px; }
.progress-bar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--bg); }
.progress-seg.green { background: var(--green); }
.progress-seg.yellow { background: var(--yellow); }
.progress-seg.red { background: var(--red); }
.progress-seg.unscored { background: var(--ink-2); }
.progress-seg.todo { background: transparent; }
.progress-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--ink-1); }
.band-count { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.band-dot { width: 8px; height: 8px; border-radius: 50%; }
.band-dot.green { background: var(--green); }
.band-dot.yellow { background: var(--yellow); }
.band-dot.red { background: var(--red); }

/* A previous score inside a line of text, in its colour. */
.score-chip { display: inline-block; min-width: 2.2em; padding: 1px 6px; border-radius: 6px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.score-chip.green { background: var(--green-tint); color: var(--green); }
.score-chip.yellow { background: var(--yellow-tint); color: var(--yellow); }
.score-chip.red { background: var(--red-tint); color: var(--red); }

/* --- Practice engine (Loquor, Głoska): exercise card + result card ------- */

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 24px;
  padding: 28px 32px 48px;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}

/* --- Going through a set (public/core/sequence.js) ------------------------ */

/* Above both cards: "Phrase 3 of 30" and one bar segment per item,
   coloured by how it last scored, the open one taller and outlined. The
   whole strip is one button that opens the item list. */
.sequence {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 10px 14px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink-0);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.sequence:hover { border-color: var(--accent); }
.sequence-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sequence-label { font-size: 13px; font-weight: 700; }
.sequence-open { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.sequence-bar { display: flex; align-items: center; gap: 2px; height: 12px; }
.sequence-seg { flex: 1; height: 6px; border-radius: 2px; background: var(--border); }
.sequence-seg.green { background: var(--green); }
.sequence-seg.yellow { background: var(--yellow); }
.sequence-seg.red { background: var(--red); }
.sequence-seg.unscored { background: var(--ink-2); }
.sequence-seg.current { height: 12px; box-shadow: inset 0 0 0 2px var(--navy-800); }

/* The item list: a dialog over the page (a sheet from the bottom on
   phones), and the same rows in the end-of-set summary. */
.item-list-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink-0);
  box-shadow: 0 24px 60px -20px rgba(17, 24, 44, 0.45);
}
.item-list-dialog[open] { display: flex; flex-direction: column; }
.item-list-dialog::backdrop { background: rgba(17, 24, 44, 0.45); }
.item-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 18px; border-bottom: 1px solid var(--border); }
.item-list-title { margin: 0; font-size: 15px; font-weight: 700; }
.item-list-close { border: 0; background: transparent; color: var(--ink-1); font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.item-list-close:hover { background: var(--card-alt); }
.item-list-dialog .item-list { overflow-y: auto; padding: 6px 8px 12px; }

.item-list-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); padding: 14px 10px 4px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-0);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.item-row:hover { background: var(--card-alt); }
.item-row.current { background: var(--accent-tint); font-weight: 600; }
.item-row-num { flex-shrink: 0; width: 1.8em; text-align: right; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.item-row-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-row-mark { flex-shrink: 0; }
.item-row-done { color: var(--ink-2); font-weight: 700; }

/* Under Listen/Record: on to the next item without recording this one. */
.skip-row { display: flex; justify-content: flex-end; margin-top: 10px; }

/* After the last item, in place of both cards and the strip above them
   (.phase-summary): it draws the set's bar itself. */
.set-summary { grid-column: 1 / -1; width: 100%; max-width: 640px; justify-self: center; }
.layout:not(.phase-summary) .set-summary,
.layout.phase-summary .sequence,
.layout.phase-summary .exercise-card,
.layout.phase-summary .result-card { display: none; }
.set-summary-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.set-summary-title { font-size: 20px; font-weight: 700; margin: 4px 0 14px; overflow-wrap: break-word; }
.set-summary-average { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.set-summary-note { font-size: 13px; color: var(--ink-1); margin: 12px 0 0; }
.set-summary-subtitle { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin: 20px 0 4px; }
.set-summary .item-list { margin: 0 -10px; }
.set-summary-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.set-summary-actions .btn { flex: 1 1 auto; font-size: 15px; padding: 12px 16px; }

/* The open item's level (Loquor: its set; Głoska: syllables, words...). */
.level-pill {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent-tint);
  background: var(--accent-tint);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 14px;
}

.nav-hint { font-size: 12px; color: var(--ink-2); margin: -2px 0 16px; display: flex; flex-direction: column; gap: 5px; }
.nav-hint-row { display: flex; align-items: center; gap: 5px; }
.nav-hint-row span { margin-left: 2px; }
.nav-hint kbd {
  display: inline-block;
  font-family: inherit;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--card-alt);
}

.reference-text { font-size: 22px; line-height: 1.4; font-weight: 600; margin: 6px 0 6px; color: var(--ink-0); overflow-wrap: break-word; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Full-size buttons side by side: Loquor's Listen/Record (Cancel/Stop while
   recording), Głoska's Cancel/Stop. */
.player-actions { display: flex; gap: 10px; }
.player-actions > .btn { flex: 1; font-size: 15px; padding: 13px 14px; }

.audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
}

.player-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--navy-800);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.player-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.player-btn:not(:disabled):hover { transform: scale(1.06); }
.player-btn.loading {
  background: transparent;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: player-spin 0.8s linear infinite;
}

@keyframes player-spin { to { transform: rotate(360deg); } }

.player-track { flex: 1; height: 6px; border-radius: 999px; background: var(--border); cursor: pointer; overflow: hidden; }
.player-track.disabled { cursor: not-allowed; opacity: 0.6; }
.player-progress { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; }

.player-time { flex-shrink: 0; font-size: 11px; color: var(--ink-1); min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }

/* Playback speed - a visible, labeled segmented control (not a single
   cycling button) so slowing a recording down is obvious at a glance. */
.speed-control {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  transition: opacity 0.12s ease;
}

.speed-control-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.speed-group {
  display: inline-flex;
  gap: 2px;
  background: var(--card-alt);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px;
}

.speed-opt {
  border: none;
  background: transparent;
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.speed-opt:hover { color: var(--ink-0); }
.speed-opt.active { background: var(--accent); color: #fff; }

.hint { font-size: 12px; color: var(--ink-2); margin-top: 16px; min-height: 16px; }
.hint.error { color: var(--red); }

.result-card { min-height: 380px; display: flex; }
.result-empty { margin: auto; color: var(--ink-2); font-size: 14px; text-align: center; max-width: 320px; }

.result-body.hidden { display: none !important; }
.result-body { width: 100%; }

.scores-row { display: flex; gap: 24px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }

.score-ring {
  width: 104px; height: 104px;
  border-radius: 50%;
  border: 6px solid var(--accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card-alt);
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}
.score-ring.green { border-color: var(--green); }
.score-ring.yellow { border-color: var(--yellow); }
.score-ring.red { border-color: var(--red); }
.score-value { font-size: 26px; font-weight: 700; color: var(--ink-0); }
.score-label { font-size: 11px; color: var(--ink-2); text-transform: uppercase; }

.score-mini { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-1); }
.score-mini-item { display: flex; align-items: center; gap: 8px; }
.score-mini-item strong { color: var(--ink-0); margin-left: auto; }
.score-mini-item.muted { color: var(--ink-2); font-size: 12px; }
.pace-target { font-size: 11px; color: var(--ink-2); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.accuracy { background: var(--accent); }
.dot.fluency { background: #4f7fb3; }
.dot.prosody { background: #8a63b3; }

.waveform-block { margin-bottom: 20px; }
.waveform-block .speed-control { margin-top: 10px; }
.waveform-label { font-size: 11px; color: var(--ink-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.waveform-block canvas { width: 100%; display: block; margin-bottom: 12px; border-radius: 8px; background: var(--card-alt); }

.transcript-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.legend-hint { margin-left: auto; font-style: italic; }
.dot-legend { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-legend.green { background: var(--green); }
.dot-legend.yellow { background: var(--yellow); }
.dot-legend.red { background: var(--red); }

.transcript { font-size: 24px; line-height: 2; }
.transcript .word { cursor: pointer; padding: 2px 3px; border-radius: 6px; transition: background 0.12s ease; }
.transcript .word:hover { background: var(--card-alt); }
.transcript .word.green { color: var(--green); }
.transcript .word.yellow { color: var(--yellow); }
.transcript .word.red { color: var(--red); font-weight: 600; }
.transcript .word.selected { outline: 1px dashed currentColor; }

.phoneme-detail { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; min-height: 20px; }
.phoneme-chip { font-size: 13px; border-radius: 999px; padding: 4px 10px; background: var(--card-alt); border: 1px solid var(--border); }
.phoneme-chip.green { color: var(--green); border-color: rgba(47, 158, 92, 0.35); }
.phoneme-chip.yellow { color: var(--yellow); border-color: rgba(201, 138, 26, 0.35); }
.phoneme-chip.red { color: var(--red); border-color: rgba(199, 73, 63, 0.35); }
.phoneme-chip .err { color: var(--ink-2); font-size: 11px; margin-left: 4px; }

.result-next-btn { width: 100%; margin-top: 22px; font-size: 15px; padding: 13px 18px; }

/* Mobile-only "back to recording" link + phrase recap at the top of a
   result screen - see the phase-result rules under the 600px breakpoint
   below. On wider screens the exercise card stays visible alongside the
   result, so both are irrelevant there and stay hidden. */
.result-back-btn { display: none; }
.result-phrase-echo {
  display: none;
  font-size: 17px;
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-strong);
  overflow-wrap: break-word;
}

/* A word the scorer couldn't make out, in place of its scores
   (unrecognisedHtml() in core/assessment.js). Yellow, not red: the take
   wasn't judged wrong, it wasn't judged. */
.result-unrecognised,
.gl-verdict.unrecognised {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--yellow-tint);
  color: var(--ink-0);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}
.unrecognised-message { margin: 0; font-weight: 600; }
.unrecognised-tips { margin: 8px 0 0; padding-left: 18px; }
.unrecognised-tips li + li { margin-top: 6px; }

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 600px) {
  .track-crumb { padding: 0 14px; }

  .topbar { padding: 14px 16px; flex-wrap: wrap; row-gap: 6px; }
  .sibling-links { flex-basis: 100%; gap: 8px 10px; }
  .sibling-link { white-space: normal; }
  .app-switch-item { padding: 4px 9px; font-size: 12px; }

  .layout { padding: 16px 14px 32px; gap: 16px; }
  .card { padding: 16px; }

  /* Two-screen flow: listening/recording and the result are each a full
     screen instead of one long stacked page, so the "next" action is never
     more than a short scroll away. JS toggles .phase-result on .layout once
     a result comes back (and off again when moving to a new phrase), see
     setPhase() in loquor.js / gloska.js. */
  .layout:not(.phase-result) .result-card { display: none; }
  .layout.phase-result .exercise-card { display: none; }
  .layout.phase-result .result-card { min-height: 0; }
  .result-back-btn { display: inline-flex; margin-bottom: 14px; }
  .result-phrase-echo { display: block; }

  .nav-hint { display: none; }

  .controls { flex-direction: column; align-items: stretch; }
  .audio-player { min-width: 0; }
  .controls > .btn-primary { width: 100%; }
  .speed-control { justify-content: space-between; }
  .speed-group { flex: 1; justify-content: center; }

  .player-btn { width: 36px; height: 36px; }

  .item-list-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .item-row { padding: 12px 10px; }
  .transcript { font-size: 20px; }

}

/* --- Login, account and privacy pages (public/login.*, account.*) -------- */

.page-narrow { max-width: 560px; margin: 0 auto; padding: 32px 16px 56px; }
.page-wide { max-width: 860px; margin: 0 auto; padding: 32px 16px 56px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.page-sub { font-size: 13px; color: var(--ink-1); margin: 0 0 20px; line-height: 1.5; }
.page-section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.page-group-title { font-size: 17px; font-weight: 700; margin: 36px 0 4px; }
.page-narrow .card + .card, .page-wide .card + .card { margin-top: 18px; }

/* PL | EN switch in the header (public/core/i18n.js). */
.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.lang-switch-btn {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.lang-switch-btn + .lang-switch-btn { border-left: 1px solid var(--border-strong); }
.lang-switch-btn.active { background: var(--navy-800); color: #fff; }

.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tab {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--card-alt);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
  cursor: pointer;
}
.auth-tab.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

.form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-field label { font-size: 12px; font-weight: 600; color: var(--ink-1); }
.form-field input {
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink-0);
  width: 100%;
}
.form-field input:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.form-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-1); line-height: 1.5; margin-bottom: 12px; }
.form-check input { margin-top: 3px; flex-shrink: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.form-message { font-size: 13px; margin: 12px 0 0; min-height: 18px; color: var(--ink-1); }
.form-message.error { color: var(--red); }
.form-message.ok { color: var(--green); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:not(:disabled):hover { filter: brightness(0.92); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-tile { background: var(--card-alt); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-tile-label { font-size: 12px; color: var(--ink-1); }
.stat-tile-value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-tile-note { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

.table-scroll { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 8px; border-bottom: 1px solid var(--border-strong); }
.history-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.history-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-table .score-pill { display: inline-block; min-width: 34px; text-align: center; border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.score-pill.green { background: var(--green-tint); color: var(--green); }
.score-pill.yellow { background: var(--yellow-tint); color: var(--yellow); }
.score-pill.red { background: var(--red-tint); color: var(--red); }
.history-empty { font-size: 13px; color: var(--ink-2); }

.prose { font-size: 14px; line-height: 1.65; color: var(--ink-0); }
.prose h2 { font-size: 16px; margin: 22px 0 6px; }
.prose ul { padding-left: 20px; }
.prose p, .prose li { color: var(--ink-1); }
