/* Design system components (docs/design-system/components). New screens use these .sv-* classes;
   tokens live in application.css. Built screen by screen in the redesign PRs. */

/* Buttons */
.sv-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 48px; padding: 0 var(--space-5); border: 0; border-radius: var(--radius-control); background: var(--action); color: var(--on-action); font: 600 16px/1 var(--font-sans); cursor: pointer; box-shadow: var(--shadow-primary); transition: transform 120ms ease, opacity 200ms ease; }
.sv-btn:active, .sv-btn.is-pressed { transform: scale(.97); }
.sv-btn[disabled] { opacity: .45; box-shadow: none; cursor: default; }
.sv-btn--secondary { background: var(--panel); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.sv-btn--quiet { min-height: 44px; padding: 0 var(--space-2); background: transparent; color: var(--muted); box-shadow: none; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.sv-btn--block { width: 100%; }
.sv-chip-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill); background: var(--blue-tint); color: var(--blue); font: 600 14px/1 var(--font-sans); cursor: pointer; }
.sv-kbd { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: var(--radius-key); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 var(--line); color: var(--text); font: 600 12px/1 var(--font-sans); }

/* Study session button: one button, label plus a second line with what is left and the estimate. */
.sv-session { display: flex; align-items: stretch; min-height: 60px; border-radius: var(--radius-button); background: var(--action); color: var(--on-action); box-shadow: var(--shadow-primary); overflow: hidden; }
.sv-session button { border: 0; background: transparent; color: inherit; font-family: var(--font-sans); cursor: pointer; }
.sv-session__main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; padding: 0 var(--space-5); text-align: left; font-size: 17px; font-weight: 600; }
.sv-session__sub { font-size: 13px; font-weight: 500; opacity: .85; }

/* Card surface and the text stack */
.sv-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-surface); }
.sv-context { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--muted); }
.sv-hero { margin: 0; font-size: 36px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; color: var(--text); text-wrap: balance; }
.sv-cue { margin: 0; font-size: 15px; font-weight: 600; color: var(--blue); }
.sv-detail { margin: 0; font-size: 16px; color: var(--muted); }
.sv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--line); }
@media (max-width: 520px) { .sv-card { padding: var(--space-5) var(--space-4); border-radius: var(--radius-card-phone); } .sv-kbd { display: none; } }

/* Labels */
.sv-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--yellow); color: var(--on-yellow); font-size: 12px; font-weight: 600; }
.sv-label { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }

/* Round bar: one slot per word left in the round (max 10) */
.sv-roundbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.sv-roundbar span { height: 6px; border-radius: var(--radius-pill); background: var(--track); }
.sv-roundbar [data-s=right] { background: var(--blue); }
.sv-roundbar [data-s=missed] { background: var(--line-strong); }
.sv-roundbar [data-s=now] { background: var(--level-2); }

/* Answer field */
.sv-field { display: flex; flex-direction: column; gap: var(--space-2); }
.sv-field label { font-size: 15px; font-weight: 600; color: var(--blue); }
.sv-field input { width: 100%; min-height: 52px; padding: 0 var(--space-4); border: 1.5px solid var(--line-strong); border-radius: var(--radius-control); background: var(--panel); color: var(--text); font: 500 20px/1 var(--font-sans); }
.sv-field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.sv-field input::placeholder { color: var(--muted); font-weight: 400; }

/* Heard words: what the mic heard, one chip per word, coloured by outcome */
.sv-heard { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sv-word { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-control); font-size: 18px; font-weight: 600; }
.sv-word[data-o=right] { background: var(--green-tint); color: var(--green); }
.sv-word[data-o=ok] { background: var(--amber-tint); color: var(--amber); }
.sv-word[data-o=wrong] { background: var(--red-tint); color: var(--red); }
.sv-word[data-o=waiting] { box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }
.sv-mark { text-decoration: underline 3px; text-underline-offset: 5px; }

/* The one living control: hold to speak */
.sv-orb { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 104px; height: 104px; border: 0; border-radius: 50%; color: var(--on-action); font: 700 15px/1.15 var(--font-sans); text-align: center; cursor: pointer; background: radial-gradient(circle at 32% 28%, var(--orb-hi) 0%, var(--orb-mid) 40%, var(--orb-deep) 80%); box-shadow: var(--shadow-orb); }
.sv-orb::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--blue-tint); }
.sv-orb.is-listening { transform: scale(1.08); }
.sv-orb.is-listening::after { inset: -22px; box-shadow: inset 0 0 0 2px var(--level-1); }
.sv-orb-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.sv-orb-wrap .sv-status { text-align: center; }

/* Status line: one line that rewrites in place */
.sv-status { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--muted); }

/* Thin progress line with labels either side */
.sv-progress { display: flex; align-items: center; gap: var(--space-3); font-size: 13px; color: var(--muted); }
.sv-progress__track { flex: 1 1 auto; height: 6px; border-radius: var(--radius-pill); background: var(--track); overflow: hidden; }
.sv-progress__fill { height: 100%; border-radius: inherit; background: var(--blue); }
.sv-progress__fill[data-o=behind] { background: var(--amber); }

/* This week: seven quiet dots and a total */
.sv-week { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 14px; color: var(--muted); }
.sv-week ol { display: inline-flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sv-week li { width: 10px; height: 10px; border-radius: 3px; background: var(--track); }
.sv-week li[data-l="1"] { background: var(--level-1); } .sv-week li[data-l="2"] { background: var(--level-2); }
.sv-week li[data-l="3"] { background: var(--level-3); } .sv-week li[data-l="4"] { background: var(--level-4); }
.sv-week li[data-today] { outline: 2px solid var(--text); outline-offset: 1px; }

/* Segmented tabs with a sliding thumb */
.sv-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px; border-radius: var(--radius-control); background: var(--track); }
.sv-tabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 15px/1 var(--font-sans); cursor: pointer; }
.sv-tabs button[aria-selected=true] { background: var(--panel); color: var(--text); box-shadow: var(--shadow-bar); }

/* Chapter row */
.sv-chapter { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.sv-chapter__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sv-chapter__name { font-size: 17px; font-weight: 600; }
.sv-chapter__ready { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sv-chapter__kinds { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-3); font-size: 14px; color: var(--muted); }
.sv-chapter__buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-1); }

/* Top bar (menu option A) and the study session bar */
.sv-topbar { display: flex; align-items: center; gap: var(--space-5); min-height: 56px; padding: 0 var(--space-4); background: var(--panel); box-shadow: var(--shadow-bar); }
.sv-brand { font-weight: 700; color: var(--text); text-decoration: none; border-bottom: 3px solid var(--yellow); }
.sv-topbar nav { display: flex; gap: var(--space-5); flex: 1 1 auto; }
.sv-topbar nav a { color: var(--text); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.sv-topbar nav a[aria-current=page] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.sv-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text); cursor: pointer; }
.sv-menu-btn { min-height: 44px; padding: 0 var(--space-2); border: 0; background: transparent; color: var(--text); font: 500 16px/1 var(--font-sans); }
.sv-studybar { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: 0 var(--space-4); }
.sv-listbar { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sv-listbar__label { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-listbar__label b { color: var(--text); font-weight: 600; }
.sv-listbar__track { display: block; height: 4px; border-radius: var(--radius-pill); background: var(--track); overflow: hidden; }
.sv-listbar__track > span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.sv-stop { min-height: 36px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-control); background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text); font: 600 14px/1 var(--font-sans); cursor: pointer; }

/* Phone dock: the screen's one primary action, pinned under the thumb */
.sv-dock { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); }

@media (prefers-reduced-motion: reduce) { [class^="sv-"], [class*=" sv-"] { transition: none !important; animation: none !important; } }
