:root {
  --bg: #14161a;
  --surface: #1b1e23;
  --surface-raised: #20242a;
  --selected: #2a3038;
  --border: #2c313a;
  --border-strong: #3a404a;
  --border-soft: #23272e;
  --row-hover: #1f2329;
  --text: #ece8e1;
  --muted: #a1a7af;
  --faint: #6b717a;
  --original: #7cc4b8;
  --original-hover: #a6dcd2;
  --you: #f2765a;
  --you-hover: #f58a71;
  --first: #b79be0;
  --fair: #e0b25c;
  --on-you: #1a0f0b;
  --on-text-hover: #ffffff;
  --pressed-sub: #4a4f57;
  --screen: #0b0c0e;
  --tint-good: #1f3a33;
  --tint-fair: #3a3120;
  --tint-low: #3a2320;
  --toggle-bg: #23332f;
  --toggle-border: #3f6b63;
  --banner-bg: #1e2a27;
  --notice-text: #ffd2c7;
  --error: #ff9c86;
  --shade-1: #6b3b31;
  --shade-2: #9e4f3e;
  --shade-3: #c9614b;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: dark;
}

/* The light theme keeps every meaning and darkens the accents, so teal and coral still read as text
   on a white ground and coral buttons carry white type. theme.js sets data-theme before first paint. */
:root[data-theme="light"] {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-raised: #eef0ed;
  --selected: #e1eae6;
  --border: #dadddb;
  --border-strong: #c4c9c3;
  --border-soft: #e6e9e5;
  --row-hover: #f0f2ef;
  --text: #16181c;
  --muted: #5a6068;
  --faint: #737982;
  --original: #2a7a6d;
  --original-hover: #1f5e54;
  --you: #c94e32;
  --you-hover: #b2432a;
  --first: #7b5bc4;
  --fair: #9a6a0e;
  --on-you: #ffffff;
  --on-text-hover: #2a2d33;
  --pressed-sub: #b8bec6;
  --screen: #e4e7e3;
  --tint-good: #e2f1ed;
  --tint-fair: #faf0da;
  --tint-low: #fbe9e4;
  --toggle-bg: #e2f1ed;
  --toggle-border: #9fcfc4;
  --banner-bg: #e8f4f0;
  --notice-text: #9a3a24;
  --error: #b23e26;
  --shade-1: #f3c9be;
  --shade-2: #e59a86;
  --shade-3: #d6735c;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
a { color: var(--original); }
a:hover { color: var(--original-hover); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--original); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Layout */
.topbar { height: 72px; padding: 0 48px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--text); text-decoration: none; }
/* The logo's name: Sada in Plex Sans, صدى in Reem Kufi, beside the same bars in both languages. */
.brand-name { font-family: 'IBM Plex Sans', system-ui, sans-serif; font-weight: 600; letter-spacing: -0.01em; }
:root[lang="ar"] .brand-name { font-family: 'Reem Kufi', 'IBM Plex Sans Arabic', sans-serif; font-weight: 700; letter-spacing: 0; }
.back { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; text-decoration: none; }
.divider { width: 1px; height: 24px; background: var(--border); }
.topbar-title { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex-grow: 1; }
.page { padding: 56px 48px; display: flex; flex-direction: column; gap: 48px; max-width: 1440px; margin-inline: auto; }
.workspace { padding: 28px 48px 24px; display: flex; gap: 28px; height: calc(100vh - 72px); min-height: 760px; }
.column { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.column > * { flex-shrink: 0; }
.compare-stage .screen { max-height: 24vh; }

/* Type */
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
h1, h2 { font-family: var(--display); font-weight: 600; margin: 0; }
.hero-title { font-size: 52px; line-height: 1.08; letter-spacing: -0.02em; }
.hero-text { margin: 0; font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 680px; }
.section-title { font-size: 28px; }
.panel-title { font-size: 22px; }

/* Controls */
.btn { height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border-strong); background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface-raised); color: var(--text); }
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn-small { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn-record { background: var(--you); border-color: var(--you); color: var(--on-you); font-weight: 600; }
.btn-record:hover { background: var(--you-hover); color: var(--on-you); }
.btn-record .dot { width: 12px; height: 12px; border-radius: 6px; background: var(--on-you); }
.btn-record.is-recording .dot { border-radius: 2px; }
.btn-light { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.btn-light:hover { background: var(--on-text-hover); color: var(--bg); }
.btn-round { width: 48px; padding: 0; border-radius: 24px; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 10px; color: var(--muted); border-color: var(--border); }
.toggle[aria-pressed="true"] { background: var(--toggle-bg); color: var(--original); border-color: var(--toggle-border); }
.segmented { height: 44px; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; display: flex; gap: 2px; }
.segmented button { border: 0; border-radius: 7px; padding: 0 14px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; }
.segmented button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.segmented .mono { font-size: 13px; }
kbd { padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 6px; font-family: var(--mono); font-size: 12px; color: var(--text); }
.input { height: 56px; padding: 0 18px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; font-size: 16px; }
.label { font-size: 13px; font-weight: 500; color: var(--muted); }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.badge { padding: 3px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-human { color: var(--original); }
.badge-auto { color: var(--fair); }
.badge-pasted { color: var(--original); }
.badge-none { color: var(--muted); }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--original); transition: width 0.3s; }
.progress-thin { height: 4px; }
.progress-thin > div { background: var(--you); }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--tint-low); color: var(--notice-text); font-size: 14px; display: flex; align-items: center; gap: 12px; }
.notice button { margin-inline-start: auto; }
.status { font-size: 14px; color: var(--muted); min-height: 20px; }

/* Library */
.add-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.add-row { display: flex; gap: 12px; }
.add-row .input { width: 660px; max-width: 100%; }
.add-row .btn { height: 56px; padding: 0 28px; border-radius: 10px; }
.form-error { margin: 0; min-height: 20px; color: var(--error); font-size: 14px; }
.downloads { display: flex; flex-direction: column; gap: 12px; max-width: 880px; }
.download { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.download-head { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.download-error { font-size: 13px; color: var(--error); }
.download-actions { display: flex; gap: 8px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.video-card { overflow: hidden; display: flex; flex-direction: column; }
.thumb { aspect-ratio: 16 / 9; background: var(--screen); position: relative; display: block; }
.minute-progress { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.minute-strip { display: flex; gap: 3px; }
.minute-block { flex-grow: 1; height: 10px; border-radius: 2px; background: var(--border); }
.minute-block.is-done { background: var(--you); }
.minute-block.is-next { background: var(--original); }
.card-actions { display: flex; gap: 10px; }
.card-actions .btn { height: 44px; border-radius: 10px; font-size: 14px; }
.btn-grow { flex-grow: 1; }
/* History */
.history-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; min-width: 800px; }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat strong { font-family: var(--display); font-size: 26px; font-weight: 600; }
.stat span { font-size: 13px; color: var(--muted); }
.history-strip { display: flex; gap: 4px; }
.history-strip a { flex-grow: 1; min-width: 0; height: 28px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; text-decoration: none; color: var(--faint); background: var(--border); }
.history-strip a.shade-1 { background: var(--shade-1); color: var(--text); }
.history-strip a.shade-2 { background: var(--shade-2); color: var(--text); }
.history-strip a.shade-3 { background: var(--shade-3); color: var(--text); }
.history-strip a.shade-4 { background: var(--you); color: var(--on-you); }
.history-table { overflow: hidden; }
.history-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 60px 150px 150px 170px 190px; gap: 16px; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.history-row.is-header { padding: 12px 24px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); border-bottom-color: var(--border); }
.history-row.starts-minute { border-top: 1px solid var(--border); }
.history-row .when { color: var(--muted); }
.history-row .btn { height: 36px; border-radius: 8px; font-size: 13px; }
/* Minute done banner */
.done-banner { padding: 18px 22px; background: var(--banner-bg); border: 1px solid var(--toggle-border); border-radius: 14px; display: flex; align-items: center; gap: 18px; color: var(--original); }
.done-banner .copy { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.done-banner .copy span { font-size: 14px; color: var(--muted); }
.done-banner .btn { height: 44px; border-radius: 10px; font-size: 14px; }
.section-check { color: var(--you); display: flex; }
.section-dot { width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 8px; }
.sidebar-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.sidebar-progress > div { height: 100%; background: var(--you); }
.swatch-first { background: var(--first); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.duration { position: absolute; right: 12px; bottom: 12px; padding: 3px 8px; background: #000; color: #ece8e1; border-radius: 6px; font-family: var(--mono); font-size: 12px; }
.video-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.video-card-title { font-size: 17px; font-weight: 600; line-height: 1.35; }
.empty { padding: 32px; color: var(--muted); text-align: center; }

/* Practice */
.stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.screen { aspect-ratio: 16 / 9; max-height: 34vh; width: 100%; background: var(--screen); border: 1px solid var(--border); border-radius: 12px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.screen video { width: 100%; height: 100%; object-fit: contain; display: block; position: relative; z-index: 0; }
/* YouTube's player on the website: the labels sit in strips above and below it, never on top of it. */
.screen:has(> youtube-media) { padding-block: 40px 38px; }
youtube-media { display: block; width: 100%; height: 100%; }
youtube-media iframe { width: 100%; height: 100%; border: 0; display: block; }
.screen-label { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 8px; padding: 4px 10px; background: var(--surface); border-radius: 999px; font-size: 12px; font-weight: 500; z-index: 2; }
.swatch { width: 8px; height: 8px; border-radius: 4px; }
.swatch-original { background: var(--original); }
.swatch-you { background: var(--you); }
.screen-corner { position: absolute; right: 12px; top: 10px; z-index: 2; background: var(--surface); }
.screen-corner:hover { background: var(--surface-raised); }
.screen-time { position: absolute; left: 12px; bottom: 12px; padding: 3px 8px; background: var(--surface); border-radius: 6px; font-family: var(--mono); font-size: 12px; color: var(--text); z-index: 2; }
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; text-align: center; padding: 0 24px; }
.screen.is-recording { border-color: var(--you); }
.current { padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.current-text { margin: 0; font-family: var(--display); font-size: 34px; line-height: 1.25; letter-spacing: -0.01em; }
.current-text.is-minute { font-size: 19px; line-height: 1.5; max-height: 7.5em; overflow-y: auto; padding-inline-end: 8px; }
.controls { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.control-group { display: flex; align-items: center; gap: 10px; }
.hint { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.legend { margin-top: auto; display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }

.sidebar { width: 440px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-head { padding: 20px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sidebar-body { overflow-y: auto; flex-grow: 1; }
.section-head { padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); }
.section-head:first-child { border-top: 0; }
.section-head.is-open { background: var(--surface-raised); }
.section-head.is-selected { background: var(--selected); }
.section-toggle { flex-grow: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border: 0; background: transparent; text-align: start; }
.section-toggle .range { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 14px; }
.section-toggle .info { font-size: 13px; color: var(--muted); }
.line-row { width: 100%; padding: 12px 20px; border: 0; border-bottom: 1px solid var(--border-soft); background: transparent; text-align: start; display: flex; align-items: flex-start; gap: 14px; }
.line-row:hover { background: var(--row-hover); }
.line-row[aria-current="true"] { background: var(--selected); }
.line-row .time { width: 64px; flex-shrink: 0; padding-top: 2px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.line-row[aria-current="true"] .time { color: var(--original); }
.line-row .text { flex-grow: 1; font-size: 14px; line-height: 1.45; }
.takes-badge { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding-top: 2px; font-size: 12px; color: var(--you); }
.takes-badge::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--you); }

/* Compare */
.compare-head { display: flex; flex-direction: column; gap: 8px; }
.compare-text { margin: 0; font-family: var(--display); font-size: 30px; line-height: 1.25; letter-spacing: -0.01em; }
.modes { padding: 4px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.modes button { padding: 12px 16px; border: 0; border-radius: 9px; background: transparent; text-align: start; display: flex; flex-direction: column; gap: 2px; }
.modes button .sub { font-size: 13px; color: var(--muted); }
.modes button strong { font-size: 15px; }
.modes button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.modes button[aria-pressed="true"] .sub { color: var(--pressed-sub); }
.waves { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.wave-row { display: flex; align-items: center; gap: 16px; }
.wave-row .name { width: 72px; flex-shrink: 0; font-size: 13px; font-weight: 500; }
.wave-row canvas { flex-grow: 1; min-width: 0; height: 56px; display: block; }
.axis { padding-inline-start: 88px; display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.playback { display: flex; align-items: center; gap: 24px; }
.balance { flex-grow: 1; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.balance input { flex-grow: 1; accent-color: var(--text); }
.take-row { padding: 14px 20px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 12px; }
.take-row.is-selected { background: var(--selected); }
.take-row .pick { flex-grow: 1; padding: 0; border: 0; background: transparent; text-align: start; display: flex; flex-direction: column; gap: 3px; }
.take-row .pick strong { font-size: 15px; }
.take-row .pick span { font-size: 13px; color: var(--muted); }
.sidebar-foot { margin-top: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); }
.compare-sidebar { width: 380px; }

/* Match score */
.match { padding: 22px 26px; display: flex; gap: 28px; align-items: center; }
.match[hidden] { display: none; }
.match-ring { --ring: var(--you); width: 132px; height: 132px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--ring) calc(var(--value) * 1%), var(--border) 0); }
.match-ring.is-good { --ring: var(--original); }
.match-ring.is-fair { --ring: var(--fair); }
.match-ring > div { width: 110px; height: 110px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.match-ring strong { font-family: var(--display); font-size: 38px; font-weight: 600; line-height: 1; }
.match-ring span { font-size: 13px; color: var(--muted); }
.match-body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.match-words { display: flex; flex-wrap: wrap; gap: 6px; max-height: 128px; overflow-y: auto; }
.word { padding: 4px 10px; border-radius: 7px; font-size: 16px; font-weight: 500; border: 1px solid transparent; }
.word.is-ok, .key.is-ok { background: var(--tint-good); border-color: var(--original); }
.word.is-unclear, .key.is-unclear { background: var(--tint-fair); border-color: var(--fair); }
.word.is-missed, .key.is-missed { background: var(--tint-low); border-color: var(--you); color: var(--you); text-decoration: line-through; }
.word.is-skipped, .key.is-skipped { border: 1px dashed var(--faint); color: var(--faint); }
.match-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); }
.match-legend > span { display: flex; align-items: center; gap: 6px; }
.key { width: 11px; height: 11px; border-radius: 3px; border: 1px solid transparent; }
.match-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.match-stats > div { padding: 10px 12px; background: var(--bg); border-radius: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.match-stats strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-stats span { font-size: 12px; color: var(--muted); }
.match-message { flex-grow: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.match-message .muted { font-size: 14px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--original); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.score-chip { min-width: 48px; padding: 3px 8px; border: 1px solid currentColor; border-radius: 999px; text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 500; }
.score-chip.is-good { color: var(--original); }
.score-chip.is-fair { color: var(--fair); }
.score-chip.is-low { color: var(--you); }
.score-chip.is-pending { color: var(--muted); border-style: dashed; }
.match-change { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; }
.score-text.is-good { color: var(--original); }
.score-text.is-fair { color: var(--fair); }
.score-text.is-low { color: var(--you); }
.delta { font-family: var(--sans); font-size: 12px; }
.delta.is-up { color: var(--original); }
.delta.is-down { color: var(--you); }
.match-note { margin: 0; font-size: 13px; color: var(--fair); }

/* Arabic: one family for both roles — Plex Arabic is the sibling of the Latin face already here. */
:root[lang="ar"] {
  --display: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --sans: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}
:root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] .hero-title,
:root[lang="ar"] .current-text, :root[lang="ar"] .compare-text { font-weight: 600; letter-spacing: 0; }
:root[lang="ar"] .brand b { font-weight: 600; }
:root[dir="rtl"] .screen-label { left: auto; inset-inline-start: 12px; }
:root[dir="rtl"] .screen-corner { right: auto; inset-inline-end: 12px; }
:root[dir="rtl"] .screen-time { left: auto; inset-inline-start: 12px; }
:root[dir="rtl"] .duration { right: auto; inset-inline-end: 12px; }
:root[dir="rtl"] .back svg, :root[dir="rtl"] .section-toggle svg { transform: scaleX(-1); }
:root[dir="rtl"] .hero-title, :root[dir="rtl"] .current-text, :root[dir="rtl"] .compare-text { letter-spacing: 0; }
.brand-sub { font-family: var(--sans); font-size: 12.5px; font-weight: 400; color: var(--muted); margin-inline-start: 8px; }
.privacy-badge { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--tint-good); color: var(--original); font-size: 13px; font-weight: 500; white-space: nowrap; }
.privacy-badge svg { width: 14px; height: 14px; }
.lang-switch { gap: 7px; padding-inline: 11px 13px; color: var(--muted); }
.lang-switch:hover { color: var(--text); }
.lang-switch svg { flex-shrink: 0; }
.lang-switch[lang="ar"] span { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-size: 14px; font-weight: 500; }
.lang-switch[lang="en"] span { font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.btn-icon-small { width: 32px; padding: 0; }
:root[dir="rtl"] .line-row .time, :root[dir="rtl"] .section-toggle .range,
:root[dir="rtl"] .screen-time, :root[dir="rtl"] .axis, :root[dir="rtl"] .match-change { direction: ltr; }
:root[dir="rtl"] .section-toggle .range { justify-content: flex-end; }
/* The axis stays left-to-right, so its own start edge no longer follows the page: the 72px row
   label and its 16px gap are on the right in Arabic, and the indent has to go with them. */
:root[dir="rtl"] .axis { padding-inline-start: 0; padding-inline-end: 88px; }
.devices { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.devices select { max-width: 220px; }

/* Landing page. Built from the app's own tokens and pieces (cards, segmented controls, word chips,
   the score ring), so it changes theme with everything else and looks like the app it describes. */
.lp main { display: flex; flex-direction: column; }
.lp .topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); }
.lp-nav { display: flex; align-items: center; gap: 4px; }
.lp-nav-link { padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; }
.lp-nav-link:hover { background: var(--surface-raised); color: var(--text); }
.lp-section { padding: 96px max(48px, calc((100% - 1280px) / 2)); display: flex; flex-direction: column; gap: 44px; border-top: 1px solid var(--border); }
.lp-alt { background: var(--surface-raised); }
.lp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; }
.lp-section.lp-two { gap: 64px; }
.lp-middle { align-items: center; }
.lp-stack { display: flex; flex-direction: column; gap: 16px; }
.lp-tight { gap: 6px; }
.lp-narrow { max-width: 760px; }
.lp-row { display: flex; align-items: center; gap: 12px; }
.lp-between { justify-content: space-between; }
.lp-center { display: flex; justify-content: center; }
.lp-grow { flex-grow: 1; min-width: 0; }
.lp-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.lp-panel { padding: 28px; }

.lp-h2 { font-size: 42px; line-height: 1.2; letter-spacing: -0.01em; }
.lp-h3 { margin: 0; font-size: 22px; font-weight: 600; }
.lp-body { margin: 0; font-size: 17px; line-height: 1.75; color: var(--muted); }
.lp-body-strong { font-size: 18px; color: var(--text); }
.lp-small { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); }
.lp-fineprint { font-size: 12px; color: var(--faint); }
:root[lang="ar"] .lp-body, :root[lang="ar"] .lp-small, :root[lang="ar"] .lp-lede { line-height: 1.9; }
:root[lang="ar"] .lp-h2, :root[lang="ar"] .lp-title { font-weight: 700; letter-spacing: 0; line-height: 1.35; }

/* Hero */
.lp-hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; align-items: center; padding-top: 72px; border-top: 0; }
.lp-hero-copy { display: flex; flex-direction: column; gap: 24px; }
.lp-badge { align-self: flex-start; padding: 6px 14px; background: var(--tint-good); border: 1px solid var(--toggle-border); border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--original); }
.lp-title { font-size: 52px; line-height: 1.1; letter-spacing: -0.02em; }
:root[lang="ar"] .lp-title { font-size: 58px; }
.lp-accent { color: var(--you); }
.lp-lede { margin: 0; font-size: 19px; line-height: 1.7; color: var(--muted); max-width: 600px; }
.lp-form { display: flex; flex-direction: column; gap: 8px; }
.lp-form .input { height: 58px; font-size: 16px; font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.lp-start { height: 58px; padding: 0 32px; font-size: 17px; }
.lp-chips-row { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.lp-chips-row li { padding: 7px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--muted); }

/* Demo */
.lp-demo { overflow: hidden; display: flex; flex-direction: column; border-radius: 20px; }
.lp-demo-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lp-demo-title { font-size: 14px; font-weight: 600; }
.lp-demo-tabs { display: flex; gap: 6px; }
.lp-demo-tab { height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.lp-demo-tab.is-current { background: var(--surface-raised); border-color: var(--border-strong); color: var(--text); }
.lp-step-dot { width: 20px; height: 20px; border-radius: 10px; background: var(--border-strong); color: var(--bg); font-family: 'IBM Plex Sans', sans-serif; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.lp-demo-tab.is-done .lp-step-dot { background: var(--original); }
.lp-demo-tab.is-current .lp-step-dot { background: var(--you); color: var(--on-you); }
.lp-demo-body { height: 460px; padding: 18px; display: flex; flex-direction: column; }
.lp-stage { flex-grow: 1; display: flex; flex-direction: column; gap: 14px; }
.lp-screen { position: relative; flex-grow: 1; padding: 44px 24px 24px; background: var(--screen); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.lp-karaoke { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; font-size: 26px; font-weight: 600; line-height: 1.5; }
.lp-karaoke-word { padding: 0 6px; border-radius: 8px; color: var(--faint); transition: color 0.2s, background 0.2s; }
.lp-karaoke-word.is-said { color: var(--text); }
.lp-karaoke-word.is-now { color: var(--original); background: var(--tint-good); }
.lp-listen-bar { width: 100%; }
.lp-listen-bar > div { transition: width 0.4s linear; }
.lp-say { margin: 0; font-size: 15px; font-weight: 500; }
.lp-speak.is-recording { border-color: var(--you); }
.lp-camera-preview { width: 220px; height: 110px; border: 1px dashed var(--border-strong); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--faint); font-size: 12px; text-align: center; }
.lp-camera-preview svg { width: 26px; height: 26px; }
.lp-wave { display: flex; align-items: center; gap: 4px; height: 60px; }
.lp-wave span { width: 5px; border-radius: 3px; background: var(--border-strong); transform-origin: center; }
.lp-wave.is-live span { background: var(--you); animation: lp-bar 0.9s ease-in-out infinite; }
@keyframes lp-bar { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.lp-rec-row { display: flex; align-items: center; gap: 16px; }
.lp-rec { width: 72px; height: 72px; border: 0; border-radius: 36px; background: var(--you); display: flex; align-items: center; justify-content: center; }
.lp-rec-icon { width: 26px; height: 26px; border-radius: 13px; background: var(--on-you); transition: border-radius 0.2s, width 0.2s, height 0.2s; }
.lp-rec.is-live { animation: lp-pulse 1.4s ease-out infinite; }
.lp-rec.is-live .lp-rec-icon { width: 22px; height: 22px; border-radius: 4px; }
@keyframes lp-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--you) 50%, transparent); } 50% { box-shadow: 0 0 0 14px transparent; } }
.lp-rec-text { display: flex; flex-direction: column; gap: 2px; }
.lp-score { justify-content: center; gap: 18px; }
.lp-score-top { display: flex; align-items: center; gap: 26px; }
.lp-score-words { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lp-chip { font-family: inherit; cursor: pointer; transition: transform 0.15s; }
.lp-chip:hover { transform: translateY(-2px); }
.lp-chip.is-picked { outline: 2px solid var(--text); outline-offset: 1px; }
.lp-note { margin: 0; min-height: 22px; font-size: 14px; color: var(--muted); }
.lp-stats-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* What it is */
.lp-flow { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; counter-reset: flow; }
.lp-flow-step { padding: 24px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.lp-flow-step strong { font-size: 18px; font-weight: 600; }
.lp-flow-step.is-last { border-color: var(--original); }
.lp-flow-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--surface-raised); color: var(--text); }
.lp-flow-icon svg { width: 24px; height: 24px; }
.lp-flow-icon.is-1 { background: var(--tint-good); color: var(--original); }
.lp-flow-icon.is-2 { background: var(--tint-low); color: var(--you); }
.lp-flow-icon.is-3 { background: transparent; }
.lp-mini-ring { width: 52px; height: 52px; border-radius: 26px; background: conic-gradient(var(--original) 310deg, var(--border) 0); display: flex; align-items: center; justify-content: center; }
.lp-mini-ring::after { content: ''; width: 38px; height: 38px; border-radius: 19px; background: var(--surface); }

/* Tabs that change a preview beside them */
.lp-how { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 32px; align-items: stretch; }
.lp-tab-list { display: flex; flex-direction: column; gap: 12px; }
.lp-tab { padding: 20px 22px; border: 1px solid var(--border); border-radius: 16px; background: transparent; color: var(--text); text-align: start; display: flex; gap: 18px; align-items: flex-start; }
.lp-tab:hover { background: var(--surface); }
.lp-tab[aria-selected="true"] { background: var(--surface); border-color: var(--you); }
.lp-tab-number { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; background: var(--surface-raised); color: var(--muted); font-family: 'IBM Plex Sans', sans-serif; font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.lp-tab[aria-selected="true"] .lp-tab-number { background: var(--you); color: var(--on-you); }
.lp-tab-text { display: flex; flex-direction: column; gap: 6px; }
.lp-tab-text strong { font-size: 19px; font-weight: 600; }
.lp-tab-text span { font-size: 15px; line-height: 1.7; color: var(--muted); }
.lp-preview { min-height: 440px; padding: 22px; display: flex; flex-direction: column; }
/* A div standing in for an input, so it is told what an input does by itself: keep the address on one
   line, give way to the button beside it, and cut the end off rather than wrap when there is no room. */
.lp-fake-input { flex-grow: 1; min-width: 0; height: 48px; line-height: 46px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-color: var(--original); font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; background: var(--bg); }
.lp-video-row { padding: 14px 16px; background: var(--bg); border-radius: 12px; display: flex; align-items: center; gap: 12px; }
.lp-video-thumb { width: 96px; height: 54px; flex-shrink: 0; border-radius: 8px; background: var(--screen); color: var(--faint); display: flex; align-items: center; justify-content: center; }
.lp-minutes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.lp-minute { height: 40px; border-radius: 8px; border: 1px solid var(--border); color: var(--faint); font-size: 13px; font-family: 'IBM Plex Sans', sans-serif; display: flex; align-items: center; justify-content: center; }
.lp-minute.is-doing { background: var(--tint-low); border-color: var(--you); color: var(--you); }
.lp-minute.is-done { background: var(--tint-good); border-color: var(--original); color: var(--original); }
.lp-lines { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.lp-line { padding: 13px 16px; background: var(--bg); border-bottom: 1px solid var(--border-soft); display: flex; gap: 14px; align-items: center; font-size: 15px; color: var(--muted); }
.lp-line:last-child { border-bottom: 0; }
.lp-line.is-current { background: var(--selected); color: var(--text); }
.lp-line-time { width: 44px; font-size: 12px; color: var(--faint); }
.lp-line.is-current .lp-line-time { color: var(--original); }
.lp-two-screens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lp-mini-screen { height: 130px; position: relative; background: var(--screen); border: 1px solid var(--border); border-radius: 12px; }
.lp-mini-screen.is-you { border-color: var(--you); }
.lp-wave-pair { padding: 16px; background: var(--bg); border-radius: 12px; display: flex; flex-direction: column; gap: 10px; }
.lp-bars { display: flex; align-items: center; gap: 3px; height: 40px; }
.lp-bars span { flex: 1 1 0; max-width: 5px; border-radius: 2px; }
.lp-bars.is-original span { background: var(--original); }
.lp-bars.is-you span { background: var(--you); }
.lp-mode-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lp-mode-chip { padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; color: var(--muted); }
.lp-mode-chip.is-on { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Progress */
.lp-attempts { display: flex; gap: 10px; }
.lp-attempt { flex: 1 1 0; height: 66px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lp-attempt strong { font-size: 15px; font-weight: 600; }
.lp-attempt span { font-size: 12px; }
.lp-attempt[aria-selected="true"] { background: var(--surface); color: var(--text); }
.lp-attempt.is-good[aria-selected="true"] { border-color: var(--original); }
.lp-attempt.is-fair[aria-selected="true"] { border-color: var(--fair); }
.lp-attempt.is-low[aria-selected="true"] { border-color: var(--you); }

/* Two ways to practise */
.lp-big-segmented { height: 52px; }
.lp-big-segmented button { padding: 0 20px; font-size: 15px; font-weight: 600; }
.lp-timeline { display: flex; flex-direction: column; gap: 16px; }
.lp-track-row { display: flex; align-items: center; gap: 20px; }
.lp-track-name { width: 90px; flex-shrink: 0; font-size: 14px; font-weight: 500; }
.lp-track-name.is-original { color: var(--original); }
.lp-track-name.is-you { color: var(--you); }
.lp-track { flex-grow: 1; height: 44px; position: relative; background: var(--bg); border-radius: 10px; }
.lp-segment { position: absolute; top: 8px; bottom: 8px; border-radius: 6px; transition: left 0.35s, width 0.35s; }
.lp-segment.is-original { background: var(--original); }
.lp-segment.is-you { background: var(--you); }
.lp-ticks { flex-grow: 1; display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); }

/* Camera or not */
.lp-two-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.lp-choice { padding: 28px; border-width: 2px; color: var(--text); text-align: start; display: flex; flex-direction: column; gap: 16px; }
.lp-choice.is-voice[aria-pressed="true"] { border-color: var(--you); }
.lp-choice.is-camera[aria-pressed="true"] { border-color: var(--original); }
.lp-choice-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lp-choice-title { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 600; }
.lp-choice-icon { width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; }
.lp-choice-icon svg { width: 22px; height: 22px; }
.lp-choice-icon.is-you { background: var(--tint-low); color: var(--you); }
.lp-choice-icon.is-original { background: var(--tint-good); color: var(--original); }
.lp-badge-you { color: var(--you); }
.lp-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lp-fact { padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; display: flex; gap: 14px; align-items: flex-start; font-size: 15px; line-height: 1.7; color: var(--muted); }
.lp-fact svg { flex-shrink: 0; margin-top: 2px; color: var(--original); }
.lp-fact strong { color: var(--text); font-weight: 600; }

/* What you're practising */
.lp-use { align-items: center; }
.lp-use-bar { width: 10px; height: 44px; flex-shrink: 0; border-radius: 5px; background: var(--accent); }
.lp-use[aria-selected="true"] { border-color: var(--accent); }
.lp-sample { min-height: 200px; }
.lp-sample-line { font-size: 26px; font-weight: 600; line-height: 1.5; text-align: center; }
.lp-sample-line[lang="en"] { font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.lp-sample-line[lang="ar"] { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; }
.lp-tip { padding: 16px 18px; background: var(--bg); border-radius: 12px; display: flex; gap: 14px; align-items: flex-start; font-size: 16px; line-height: 1.7; }
.lp-tip svg { flex-shrink: 0; margin-top: 2px; color: var(--fair); }

/* Questions */
.lp-faq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 64px; }
.lp-questions { display: flex; flex-direction: column; gap: 10px; }
.lp-question { padding: 20px 22px; }
.lp-question summary { font-size: 18px; font-weight: 600; cursor: pointer; }
.lp-question .lp-body { margin-top: 12px; }

/* Closing band and footer */
.lp-closing { margin: 0 max(48px, calc((100% - 1280px) / 2)) 88px; padding: 64px; background: var(--tint-low); border: 1px solid var(--shade-1); border-radius: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; align-items: center; }
.lp-closing-sub { font-size: 16px; color: var(--notice-text); }
.lp-footer { padding: 32px max(48px, calc((100% - 1280px) / 2)); border-top: 1px solid var(--border); font-size: 14px; color: var(--faint); }
.lp-footer-note { display: flex; align-items: center; gap: 10px; }
.lp-footer-note svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .lp-wave.is-live span, .lp-rec.is-live { animation: none; }
  .lp-karaoke-word, .lp-listen-bar > div, .lp-segment, .lp-chip, .lp-rec-icon { transition: none; }
}
@media (max-width: 1180px) { .lp-nav { display: none; } }
@media (max-width: 980px) {
  .lp-section { padding: 56px 20px; gap: 32px; }
  .lp-hero, .lp-two, .lp-section.lp-two, .lp-how, .lp-faq, .lp-closing, .lp-two-cards { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .lp-flow, .lp-facts { grid-template-columns: minmax(0, 1fr); }
  .lp-title { font-size: 40px; }
  .lp-h2 { font-size: 30px; }
  .lp-closing { margin: 0 20px 56px; padding: 32px 24px; }
  .lp .topbar { padding: 0 16px; gap: 10px; }
  .lp .topbar .brand-sub, .lp .topbar a.btn { display: none; }
  .lp-demo-body { height: auto; min-height: 420px; }
  .lp-score-top { flex-direction: column; align-items: flex-start; }
  .lp-footer { padding: 24px 20px; }
}
/* Phones: the top bar and the paste preview have to fit 360px, the narrowest phone still in use. */
@media (max-width: 640px) {
  .lp .topbar { gap: 8px; }
  .lp .topbar .btn { flex-shrink: 0; }
  .lp-preview { padding: 16px; }
  .lp-preview .lp-row { gap: 8px; }
  .lp-preview .lp-row .btn { flex-shrink: 0; padding: 0 12px; }
  .lp-fake-input { padding: 0 10px; font-size: 13px; }
  .lp-video-row { padding: 12px; }
  .lp-video-thumb { width: 64px; height: 36px; }
}
@media (max-width: 380px) {
  .lp-demo-head { padding: 12px 12px; gap: 8px; }
  .lp-demo-tabs { gap: 2px; }
  .lp-demo-tab { padding: 0 8px; gap: 6px; }
  .lp .topbar { gap: 6px; }
  .lp .topbar .lang-switch svg { display: none; }
}

/* Library: the video to pick up first and the last seven days, then everything you have added. */
.page.lib { gap: 28px; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.lib-title { display: flex; flex-direction: column; gap: 6px; }
.lib-h1 { font-size: 40px; }
.lib-add { display: flex; flex-direction: column; gap: 6px; width: min(560px, 100%); }
.lib-add-row { display: flex; gap: 10px; }
.lib-add-row .input { flex-grow: 1; height: 48px; font-size: 15px; font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.lib-add-row .btn { height: 48px; padding: 0 24px; border-radius: 10px; }
.lib-add .form-error { min-height: 0; }
.lib-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }

.lib-continue { padding: 20px; display: flex; gap: 24px; align-items: flex-start; border-radius: 18px; }
.lib-continue-thumb { width: 336px; flex-shrink: 0; border-radius: 12px; overflow: hidden; }
.lib-continue-body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.lib-continue-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.lib-eyebrow { font-size: 13px; font-weight: 600; color: var(--original); }
.lib-score { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.lib-ring.match-ring { width: 44px; height: 44px; }
.lib-ring > span { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; font-family: 'IBM Plex Sans', sans-serif; font-size: 12px; font-weight: 600; color: var(--text); }
.lib-continue-title { margin: 0; font-family: var(--sans); font-size: 21px; font-weight: 600; line-height: 1.35; }
.lib-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lib-chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-raised); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.lib-minute-label { font-size: 14px; font-weight: 500; }
.lib-actions { display: flex; align-items: center; gap: 10px; }
.lib-actions .btn { white-space: nowrap; }
.lib-primary { padding: 0 24px; font-size: 16px; font-weight: 600; }

.lib-week { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; border-radius: 18px; }
.lib-week-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; }
.lib-week-title { font-family: var(--sans); font-size: 18px; }
.lib-days { margin: 0; padding: 0; list-style: none; display: flex; justify-content: space-between; }
.lib-days li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); }
.lib-day { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--border); box-sizing: border-box; }
.lib-day.is-done { background: var(--you); border-color: var(--you); }
.lib-day.is-today:not(.is-done) { border-style: dashed; border-color: var(--original); }
.lib-week-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lib-week-stats span { padding: 12px 14px; background: var(--bg); border-radius: 10px; font-size: 15px; font-weight: 600; }
.lib-nudge { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); }

.lib-downloads { display: flex; flex-direction: column; gap: 10px; }
.lib-download { padding: 14px 18px; border-radius: 12px; display: flex; align-items: center; gap: 18px; font-size: 14px; }
.lib-download strong { white-space: nowrap; }
.lib-download-name { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-download-bar { flex-grow: 1; }
.lib-download.is-failed { border-color: var(--error); align-items: flex-start; }
.lib-download.is-failed strong { color: var(--error); }
.lib-download-text { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; }
.lib-hint { font-size: 13px; }
.lib-hint code { margin-inline-start: 6px; }

.lib-collection { display: flex; flex-direction: column; gap: 20px; }
.lib-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.lib-filters { display: flex; gap: 4px; }
.lib-filter { height: 44px; padding: 0 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.lib-filter:hover { color: var(--text); }
.lib-filter[aria-selected="true"] { color: var(--text); border-bottom-color: var(--you); }
.lib-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-raised); color: var(--muted); font-family: 'IBM Plex Sans', sans-serif; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.lib-sort { font-size: 13px; color: var(--muted); }
.lib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.lib-none { grid-column: 1 / -1; margin: 0; padding: 24px 0; }
.lib-card { display: flex; flex-direction: column; }
.lib-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; flex-grow: 1; }
.lib-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.lib-note { font-size: 13px; color: var(--muted); }
.lib-card-actions { margin-top: auto; display: flex; gap: 8px; }
.lib-card-actions .btn { height: 42px; border-radius: 10px; font-size: 14px; white-space: nowrap; }
.lib-card-actions .btn-icon { width: 42px; flex-shrink: 0; }
.lib-watched { position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: var(--border); display: flex; }
.lib-watched > span { height: 100%; background: var(--you); }

.lib-transcript { flex-direction: column; align-items: stretch; gap: 12px; }
.lib-transcript-input { min-height: 140px; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; }
.lib-empty { align-self: center; width: min(640px, 100%); padding: 48px; border-style: dashed; border-color: var(--border-strong); border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.lib-empty svg { width: 40px; height: 40px; }
.lib-empty-title { font-family: var(--sans); font-size: 28px; }
.lib-empty p { margin: 0; max-width: 480px; line-height: 1.8; }
.lib-empty-examples { font-size: 14px; color: var(--faint); }

@media (max-width: 1180px) {
  .lib-top { grid-template-columns: minmax(0, 1fr); }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .lib-continue { flex-direction: column; }
  .lib-continue-thumb { width: 100%; }
  .lib-grid { grid-template-columns: minmax(0, 1fr); }
  .lib-download { flex-wrap: wrap; }
}

.legal-note { margin: 0; font-size: 13px; color: var(--faint); }
.lp-footer .legal-note { margin-top: 12px; }
.lp-guides { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 14px; }

.model-note { font-size: 13px; color: var(--muted); }
.model-note[hidden] { display: none; }

/* Starter talks: one press adds the video and opens it. */
.starters { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: start; }
.starters-head { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.starters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.starter { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.starter:hover { border-color: var(--original); }
.starter:focus-visible { outline: 2px solid var(--original); outline-offset: 2px; }
.starter.is-busy { opacity: 0.6; cursor: progress; }
.starter img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.starter-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.starter-text strong { font-size: 14px; line-height: 1.35; text-align: start; }
.lib-empty { width: min(760px, 100%); }
@media (max-width: 640px) { .starters-grid { grid-template-columns: minmax(0, 1fr); } }

/* Tablets and phones: one column, the video first, the list of lines and takes below it. */
@media (max-width: 980px) {
  .topbar { height: auto; min-height: 60px; padding: 8px 16px; gap: 10px; }
  .topbar .brand-sub, .topbar .privacy-badge, .topbar .badge, .topbar .divider { display: none; }
  .topbar-title { min-width: 0; flex-shrink: 1; }
  .page { padding: 28px 16px; gap: 32px; }
  .workspace { flex-direction: column; height: auto; min-height: 0; padding: 16px; gap: 18px; }
  .column { overflow: visible; }
  .sidebar, .compare-sidebar { width: 100%; max-height: 70vh; }
  .screen, .compare-stage .screen { max-height: none; }
  .current-text { font-size: 26px; }
  .compare-text { font-size: 24px; }
  .stats { min-width: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .history-head { flex-direction: column; align-items: stretch; }
  .history-head .hero-title { font-size: 32px !important; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; }
  .history-row.is-header { display: none; }
  .history-row > :nth-child(2) { grid-column: 1 / -1; }
  .playback { flex-wrap: wrap; }
  .balance { min-width: 240px; }
  .lib-filter-row { flex-wrap: wrap; row-gap: 4px; }
  .lib-filters { overflow-x: auto; max-width: 100%; }
  .match { flex-direction: column; align-items: stretch; }
  .match-ring { align-self: center; }
}
@media (max-width: 640px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .topbar .lang-switch { padding-inline: 8px; }
  .legend { display: none; } /* keyboard shortcuts mean nothing on a phone */
  .axis { padding-inline-start: 0 !important; padding-inline-end: 0 !important; font-size: 10px; }
  .axis span:nth-child(even) { visibility: hidden; } /* three times fit a phone; five run together */
  .lib-filter { padding: 0 10px; font-size: 14px; white-space: nowrap; }
  .controls { justify-content: center; }
  .lib-head { align-items: stretch; }
  .lib-add { width: 100%; }
}
