/* study-v8.css — Study UI (DESIGN §5). Loaded AFTER app.css so it may override
   study rules from the old page. Colors ONLY via app.css theme custom properties
   (--bg, --panel*, --text, --muted, --accent*, --danger, --border, --radius-*,
   --shadow). Mobile-first and calm: one primary card, with an optional deck rail. */

.study8-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-7) 40px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* Align the route title to the same 1180px content grid as the Study shell.
   This route stylesheet loads after app.css, so one real H1 remains visible. */
.study8-page-head {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--space-7);
}
body[data-dsl-page='study'] .study8-page-head .page-title { display: block; }

/* ---- Header: deck scope + mode toggle ---- */
.study8-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.study8-scope {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1 1 auto;
}
.study8-scope-label {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.study8-scope-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  max-width: 340px;
  font-size: 16px; /* iOS zoom guard */
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.study8-scope-select:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.study8-browse-deck-row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-width: 0;
}
.study8-browse-deck-row .study8-scope-select {
  flex: 1 1 230px;
  min-width: 0;
}
.study8-browse-deck-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}
.study8-mode {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--panel-3);
}
.study8-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-lg);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-pill);
  cursor: pointer;
  min-height: 44px;
}
.study8-mode-btn.is-active {
  background: var(--accent);
  color: var(--bg);
}
.study8-mode-btn:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ---- Progress bar + counts pill ---- */
.study8-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.study8-progress-track {
  flex: 1 1 auto;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--panel-3);
  overflow: hidden;
  border: 1px solid var(--border);
}
.study8-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--motion-slow) ease;
}
.study8-counts-pill {
  flex: 0 0 auto;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.study8-browse-banner {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--accent-3, var(--accent));
  font-weight: 600;
  font-size: var(--text-lg);
  padding: var(--space-5) var(--space-7);
  text-align: center;
}

/* ---- Card stage ---- */
.study8-stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.study8-session-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(250px, 320px);
  align-items: start;
  justify-content: center;
  gap: 18px;
}
.study8-stage > .study8-card,
.study8-stage > .study8-empty,
.study8-stage > .study8-complete {
  width: min(100%, 760px);
  margin-inline: auto;
}
.study8-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 26px var(--space-9) 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Prompt zone */
.study8-prompt-zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  align-items: center;
  text-align: center;
}
.study8-phase-tag {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.study8-phase-tag[data-phase="new"] { color: var(--accent); }
.study8-phase-tag[data-phase="learning"] { color: var(--accent-3, var(--accent)); }
.study8-prompt-english {
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.study8-prompt-direction {
  font-size: var(--text-lg);
  color: var(--muted);
}

/* Listening prompt */
.study8-listen-prompt {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  align-items: center;
}
.study8-listen-big-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent);
  width: 96px;
  height: 96px;
  border-radius: var(--radius-round);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.study8-listen-big-btn:active { transform: scale(0.96); }
.study8-listen-big-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 3px; }
.study8-listen-big-btn svg { width: 44px; height: 44px; }
.study8-listen-hint { font-size: var(--text-lg); color: var(--muted); }

/* Pinyin input */
.study8-input-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
}
.study8-input {
  width: 100%;
  font-size: 18px; /* >= 16px iOS zoom guard */
  padding: var(--space-7) var(--space-8);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-align: center;
  letter-spacing: 0.01em;
}
.study8-input::placeholder { color: var(--muted); opacity: 0.7; }
.study8-input:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

.study8-reveal-btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: var(--text-xl);
  min-height: 50px;
  padding: 0 var(--space-9);
  cursor: pointer;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}
.study8-reveal-btn:hover { filter: brightness(1.06); }
.study8-reveal-btn:focus-visible { outline: 2px solid var(--text); outline-offset: var(--focus-ring-offset); }
.study8-reveal-kbd {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ---- Answer zone ---- */
.study8-answer {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  border-top: 1px solid var(--border);
  padding-top: var(--space-8);
}
.study8-answer-audio {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
}
.study8-answer .sentence-focus-card,
.study8-answer .study-answer-word-breakdown {
  width: 100%;
}
.study8-match {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-4);
  font-size: var(--text-lg);
  color: var(--muted);
}
.study8-match strong { font-size: var(--text-2xl); color: var(--text); }
.study8-match.is-again strong { color: var(--danger); }
.study8-match.is-good strong { color: var(--accent-2); }

.study8-sentence {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  text-align: center;
}
.study8-hanzi {
  font-size: clamp(22px, 5.4vw, 30px);
  line-height: 1.35;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  justify-content: center;
}
.study8-hanzi .sentence-segment-hanzi { font-weight: 600; }
.study8-pinyin {
  font-size: var(--text-body);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  justify-content: center;
}
.study8-soundslike {
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--accent-3, var(--accent));
}
.study8-english-echo { font-size: var(--text-lg); color: var(--muted); }

/* Word chips */
.study8-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
}
.study8-chip-wrap {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  transition: border-color var(--motion-base) ease, box-shadow var(--motion-base) ease, transform var(--motion-base) ease;
}
.study8-chip-wrap:hover { transform: translateY(-1px); }
.study8-chip-wrap:focus-within { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-chip-wrap.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.study8-chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 0;
  padding: var(--space-4) var(--space-6);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-height: 48px;
  min-width: 56px;
}
.study8-chip.is-active { box-shadow: none; }
.study8-chip-hanzi { font-size: 18px; font-weight: 600; } /* display hanzi: exempt from the text scale — legibility of strokes beats step purity */
.study8-chip-py { font-size: var(--text-sm); color: var(--muted); }
.study8-chip-en { font-size: var(--text-xs); color: var(--muted); }

/* Word detail card */
.study8-word-detail {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  overflow-wrap: anywhere;
}
.study8-wd-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.study8-wd-hanzi { font-size: 22px; font-weight: 700; color: var(--text); } /* display hanzi: exempt from the text scale */
.study8-wd-py { font-size: var(--text-lg); color: var(--accent); }
.study8-wd-en { font-size: var(--text-lg); color: var(--muted); }
.study8-wd-audio-row { display: flex; gap: var(--space-4); }
.study8-wd-audio-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent);
  border-radius: var(--radius-sm);
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.study8-wd-audio-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-wd-audio-btn svg { width: 20px; height: 20px; }
.study8-wd-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
.study8-wd-block .study8-wd-label {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 3px;
}
.study8-wd-block p { margin: 0; font-size: var(--text-body); color: var(--text); }
.study8-wd-example { font-size: var(--text-lg); }
.study8-wd-example .ex-cn { color: var(--text); }
.study8-wd-example .ex-py { color: var(--accent); }
.study8-wd-example .ex-en { color: var(--muted); }
.study8-example-target {
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Memory hook flash on Again */
.study8-hook {
  border: 1px solid var(--danger);
  background: var(--panel-2);
  border-radius: var(--radius-lg);
  padding: 18px var(--space-8);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  animation: study8-hook-in var(--motion-base) ease;
}
@keyframes study8-hook-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.study8-hook-kicker {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--danger);
}
.study8-hook-soundslike { font-size: var(--text-2xl); font-style: italic; color: var(--text); }
.study8-hook-structure { font-size: var(--text-lg); color: var(--muted); }
.study8-hook-skip { font-size: var(--text-sm); color: var(--muted); }

/* ---- Grade bar ----
   Grading is the most-repeated action in the app, and on desktop the bar was
   landing below the fold on every realistic window size — even for the shortest
   card — so every single review cost a scroll. It now sticks to the bottom of
   the viewport at all widths. The <=640px block further down keeps its own
   `bottom` offset so the bar clears the phone tab bar.
   margin-top: the card's own flex `gap` (18px) already spaces every child
   from the one before it; this used to add a full var(--space-4) (8px) on
   top of that gap (measured 26px above the grade bar vs. the card's uniform
   18px everywhere else). Matches the <=640px override's own var(--space-2),
   which already proved a smaller nudge reads fine here. */
.study8-grade-bar,
.study8-browse-nav {
  position: sticky;
  bottom: var(--space-2);
  z-index: var(--z-sticky);
  margin-top: var(--space-2);
  padding: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 -8px 26px rgb(0 0 0 / 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.study8-grade-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.study8-grade-bar:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.study8-grade-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-md);
  min-height: 62px; /* thumb-height, > 48px */
  padding: var(--space-4) var(--space-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.study8-grade-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-grade-name { font-size: 14px; font-weight: 700; } /* owner-approved rating bar: sizes pinned */
.study8-grade-interval { font-size: 12px; color: var(--muted); } /* owner-approved rating bar */
.study8-grade-key {
  font-size: var(--text-2xs);
  color: var(--muted);
  opacity: 0.7;
}
.study8-grade-btn.grade-forgotten .study8-grade-name { color: var(--danger); }
.study8-grade-btn.grade-remembered .study8-grade-name { color: var(--text); }
.study8-grade-btn.grade-easy .study8-grade-name { color: var(--accent-2); }
.study8-grade-btn.is-suggested {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset;
  background: var(--panel-3);
}
.study8-grade-btn.is-suggested .study8-grade-interval { color: var(--text); }

/* Last-seen line */
.study8-lastseen {
  font-size: var(--text-sm);
  color: var(--muted);
  text-align: center;
}

/* ---- Save current phrase to a new user deck ---- */
.study8-save-new-deck { color: var(--accent); }
.study8-new-deck-panel {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-3);
}
.study8-new-deck-panel > label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.study8-new-deck-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--space-4);
}
.study8-new-deck-controls input {
  min-width: 0;
  min-height: 44px;
  padding: 9px var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px; /* >= 16px iOS zoom guard */
}
.study8-new-deck-save,
.study8-new-deck-cancel {
  appearance: none;
  min-height: 44px;
  padding-inline: var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 700;
}
.study8-new-deck-save { border-color: transparent; background: var(--accent); color: var(--bg); }
.study8-new-deck-cancel { background: var(--panel-2); color: var(--text); }
.study8-new-deck-controls :focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-new-deck-status { min-height: 1.2em; color: var(--muted); font-size: var(--text-sm); }

/* ---- Full-deck / upcoming sidebar ---- */
.study8-deck-preview {
  position: sticky;
  top: var(--space-8);
  max-height: calc(100vh - var(--space-12));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.study8-deck-preview details { height: 100%; }
.study8-deck-preview summary {
  display: flex;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 52px;
  padding: var(--space-7) var(--space-8);
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-lg);
  font-weight: 800;
}
.study8-deck-preview summary::marker { color: var(--accent); }
.study8-deck-preview summary span:last-child { color: var(--muted); font-weight: 600; }
.study8-deck-preview-hint { margin: 0; padding: 0 var(--space-8) var(--space-5); color: var(--muted); font-size: var(--text-xs); }
.study8-deck-preview-list {
  display: grid;
  gap: var(--space-3);
  max-height: calc(100vh - 132px);
  margin: 0;
  padding: 0 var(--space-5) var(--space-6);
  overflow-y: auto;
  list-style: none;
  scrollbar-gutter: stable;
}
.study8-deck-preview-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  min-height: 52px;
  padding: var(--space-4) 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
}
.study8-deck-preview-item.is-current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-2));
  box-shadow: inset 3px 0 0 var(--accent);
}
.study8-deck-preview-number { color: var(--muted); font-size: var(--text-xs); text-align: center; }
.study8-deck-preview-copy { display: grid; min-width: 0; gap: var(--space-1); }
.study8-deck-preview-copy strong,
.study8-deck-preview-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.study8-deck-preview-copy strong { color: var(--text); font-size: var(--text-sm); }
.study8-deck-preview-copy span { color: var(--muted); font-size: var(--text-sm); }
.study8-deck-preview-state {
  padding: 3px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--panel-3);
  color: var(--muted);
  font-size: var(--text-3xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.study8-deck-preview-item.is-current .study8-deck-preview-state { color: var(--accent); }

/* ---- Browse mode extras ---- */
.study8-browse-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.study8-browse-arrow {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-md);
  min-height: 48px;
  min-width: 92px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.study8-browse-arrow:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-browse-frac { font-size: var(--text-lg); color: var(--muted); }
.study8-audio-row { display: flex; gap: var(--space-5); justify-content: center; }
.study8-audio-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent);
  border-radius: var(--radius-md);
  min-height: 44px;
  min-width: 52px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.study8-audio-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-audio-btn svg { width: 22px; height: 22px; }

/* ---- Completion screen ----
   .study8-card / .study8-complete / .study8-empty are alternates of the same
   primary-card slot (see the shared `.study8-stage >` sizing rule below) —
   unified here onto .study8-card's own padding recipe (measured: this was
   30px 22px, .study8-empty was 34px 22px, .study8-card is 26px/var(--space-9)/
   22px base and var(--space-12)/30px/26px at >=620px — three different
   values for one visual role). */
.study8-complete {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 26px var(--space-9) 22px;
  display: flex;
  flex-direction: column;
  gap: var(--space-9);
  align-items: center;
  text-align: center;
}
.study8-complete-title { font-size: var(--text-3xl); font-weight: 800; margin: 0; color: var(--text); }
.study8-complete-streak {
  font-size: var(--text-body);
  color: var(--accent-3, var(--accent));
  font-weight: 700;
}
.study8-complete-sub { font-size: var(--text-lg); color: var(--muted); margin: 0; }
.study8-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: var(--space-5);
  width: 100%;
}
.study8-summary-cell {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.study8-summary-num { font-size: var(--text-2xl); font-weight: 800; color: var(--text); }
.study8-summary-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}
.study8-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  justify-content: center;
}
/* Standalone completion / empty-state CTAs reuse the shared .primary-btn /
   .secondary-btn language (contract §3). This adds only <a> layout + a
   comfortable standalone-CTA height; colours, radius, hover-lift and
   :focus-visible all come from app.css so Study matches Tones and the app. */
.study8-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  min-height: 48px;
  padding-inline: var(--space-9);
  font-weight: 700;
  text-decoration: none;
}
.study8-forecast-line { font-size: var(--text-lg); color: var(--muted); }
.study8-complete-ahead-note { font-size: var(--text-md); color: var(--muted); margin: var(--space-2) 0 0; max-width: 42ch; }

.study8-empty {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 26px var(--space-9) 22px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  align-items: center;
}
.study8-empty h2 { color: var(--text); margin: 0; }

.hidden { display: none !important; }

/* Desktop niceties: two-column word-detail grid, roomier stage */
@media (min-width: 620px) {
  .study8-wd-grid { grid-template-columns: 1fr 1fr; }
  .study8-card,
  .study8-complete,
  .study8-empty { padding: var(--space-12) 30px 26px; }
}

@media (max-width: 900px) {
  .study8-shell { max-width: 760px; }
  .study8-session-layout { grid-template-columns: minmax(0, 1fr); }
  .study8-deck-preview {
    position: static;
    max-height: none;
    order: 2;
  }
  .study8-deck-preview-list { max-height: min(58vh, 520px); }
}

@media (max-width: 620px) {
  .study8-new-deck-controls { grid-template-columns: 1fr 1fr; }
  .study8-new-deck-controls input { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .study8-page-head { padding-inline: 0; }
  .study8-shell {
    padding-inline: 0;
    gap: var(--space-6);
  }
  /* The status line's collapse cancels the shell gap, so it has to track the
     gap at every tier — the base value is --space-8 and this tier is --space-6.
     Without this the card was pulled 4px too far up on every phone: cramped
     rather than compact. */
  .study8-status:not(.is-visible) {
    margin-top: calc(-1 * var(--space-6));
  }
  .study8-card,
  .study8-complete,
  .study8-empty {
    padding: 22px var(--space-7) 18px;
  }
  .study8-card {
    gap: var(--space-8);
  }
  .study8-browse-deck-row {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }
  .study8-browse-deck-row .study8-scope-select {
    flex-basis: auto;
    max-width: none;
  }
  .study8-browse-deck-count { padding-left: var(--space-1); }
  .study8-browse-arrow { min-width: 84px; }
  .study8-grade-bar { gap: var(--space-3); }
  .study8-grade-btn { min-width: 0; padding-inline: var(--space-1); }
  .study8-grade-name { font-size: 12px; } /* owner-approved rating bar */
  .study8-deck-preview-item { grid-template-columns: 22px minmax(0, 1fr); }
  .study8-deck-preview-state { grid-column: 2; justify-self: start; }
}

/* v8.1: tone-accuracy chip beside the pinyin-match banner (shown only when the
   user typed tone digits, e.g. "xian4 zai4" — tones are opt-in, never a penalty) */
.study8-tone-chip {
  margin-left: var(--space-5);
  padding: var(--space-1) var(--space-5);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid var(--border);
  font-size: 0.85em;
  white-space: nowrap;
}

/* =====================================================================
   v9 "Daily Menu" additions (DESIGN §11-§13):
   scope label, transient status line, triage buttons, +5 curriculum
   strip, wins-first completion line. Theme variables only, mobile-first.
   ===================================================================== */

/* ---- Static scope label (shown in 'mine'/'all' scope instead of the select) ---- */
.study8-scope-static {
  display: flex;
  align-items: baseline;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.study8-scope-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
}
.study8-scope-hint {
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
.study8-scope-hint:hover { color: var(--accent); border-bottom-color: var(--accent); }
.study8-scope-hint:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* ---- Transient status line (triage / curriculum feedback) ----
   Empty 95%+ of the time (no message). Measured: with only max-height/padding
   collapsed, the always-on 1px border plus the shell's flex `gap` on both
   sides still cost ~18px of dead space above the card even when there is
   nothing to show. border-width and margin-top now collapse to 0 too, and
   margin-top cancels the shell gap above it — so an inactive status line
   costs nothing and the progress row sits its normal one-gap away from the
   card, same as if the element were not there. */
.study8-status {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--panel-3);
  border: 0 solid var(--border);
  padding: 0;
  margin-top: calc(-1 * var(--space-8));
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity var(--motion-base) ease, max-height var(--motion-base) ease, padding var(--motion-base) ease, border-width var(--motion-base) ease, margin-top var(--motion-base) ease;
}
.study8-status.is-visible {
  opacity: 1;
  max-height: 64px;
  padding: var(--space-5) var(--space-7);
  border-width: 1px;
  margin-top: 0;
}

/* ---- Triage row: slim ghost buttons above the prompt (min 40px tap targets).
   Deliberately understated so they never compete with the grade bar. ---- */
.study8-triage-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-4);
  margin-top: -6px; /* pull snug against the top edge of the card */
}
.study8-triage-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: 44px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.study8-triage-btn:hover { color: var(--text); border-color: var(--text); }
.study8-home-pin { display: inline-flex; align-items: center; gap: var(--space-3); margin-right: auto; }
.study8-home-pin span { color: var(--warning, #fbbf24); font-size: 1.05rem; line-height: 1; }
.study8-home-pin.is-pinned { color: var(--text); border-color: color-mix(in srgb, var(--warning, #fbbf24) 65%, var(--border)); background: color-mix(in srgb, var(--warning, #fbbf24) 10%, transparent); }
.study8-triage-btn[data-triage="retire"]:hover { color: var(--danger); border-color: var(--danger); }
.study8-triage-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* ---- +5 from curriculum strip ---- */
.study8-curriculum { display: flex; flex-direction: column; }
.study8-curio-pill {
  appearance: none;
  align-self: center;
  border: 1px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: var(--text-lg);
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.study8-curio-pill:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.study8-curio-pill:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

.study8-curio-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.study8-curio-head {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.study8-curio-list { display: flex; flex-direction: column; gap: var(--space-3); }
.study8-curio-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  cursor: pointer;
  min-height: 44px;
}
.study8-curio-check { width: 20px; height: 20px; flex: 0 0 auto; cursor: pointer; accent-color: var(--accent); }
.study8-curio-hanzi { font-size: var(--text-xl); font-weight: 600; color: var(--text); }
.study8-curio-py { font-size: var(--text-lg); color: var(--accent); }
.study8-curio-en { font-size: var(--text-lg); color: var(--muted); margin-left: auto; text-align: right; }
.study8-curio-actions { display: flex; justify-content: flex-end; gap: var(--space-5); }
.study8-curio-add,
.study8-curio-cancel {
  appearance: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: var(--text-lg);
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
}
.study8-curio-add { border: 0; background: var(--accent); color: var(--bg); }
.study8-curio-cancel { border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.study8-curio-add:focus-visible,
.study8-curio-cancel:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* ---- Wins-first completion line ---- */
.study8-nailed {
  font-size: clamp(22px, 6.4vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}
.study8-nailed strong { color: var(--accent-2, var(--accent)); }

/* =====================================================================
   Sheet mode — a study-sheet register reworked to feel native + finished
   (owner: the old table "looks cheap and half finished"). Every row is now
   a proper card that borrows the Generate-Preview `.sentence-focus-card`
   chrome (18px radius, 1px --border, rgba(255,255,255,.035) fill), with a
   left-edge score tint, a right-aligned action column, and a compact
   canonical sentence block on reveal. Mobile-first flex layout — no shared
   breakdown-table grid, so nothing crushes on narrow screens.
   ===================================================================== */
.study8-sheet {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.study8-sheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.study8-sheet-quizside {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--panel-3);
}
.study8-sheet-toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--space-4) var(--space-7);
  border-radius: var(--radius-pill);
  cursor: pointer;
  min-height: 44px;
}
.study8-sheet-toggle-btn.is-active { background: var(--accent); color: var(--bg); }
.study8-sheet-toggle-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-sheet-toolbar-actions { display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: center; }

/* Shared "⌨ Type answers" toggle (sheet header + session triage row). */
.study8-type-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: 44px;
  padding: 0 var(--space-7);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.study8-type-toggle:hover { color: var(--text); border-color: var(--text); }
.study8-type-toggle.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.study8-type-toggle:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* ---- Row list ---- */
.study8-sheet-list { display: flex; flex-direction: column; gap: var(--space-5); }
.study8-sheet-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: var(--text-sm);
}
.study8-sheet-load-more {
  appearance: none;
  min-height: 44px;
  padding: 0 var(--space-7);
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--border));
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.study8-sheet-load-more:hover { border-color: var(--accent); }
.study8-sheet-load-more:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* Group header as a subtle uppercase kicker (matches dictionary section
   labels / .sentence-focus-kicker: .72rem, .12em tracking, accent). */
.study8-sheet-group-kicker {
  padding: var(--space-6) var(--space-1) var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.study8-sheet-group-kicker:first-child { padding-top: var(--space-1); }

/* ---- The row card (matches .sentence-focus-card chrome) ---- */
.study8-sheet-row {
  position: relative;
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .035);
  padding: var(--space-7) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  transition: border-color var(--motion-base) ease, box-shadow var(--motion-base) ease, transform var(--motion-base) ease, background var(--motion-base) ease;
}
.study8-sheet-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateY(-1px); }
.study8-sheet-row:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-sheet-row.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.study8-sheet-row.is-revealed { background: rgba(255, 255, 255, 0.045); }
.study8-sheet-row.is-rated .study8-sheet-prompt-en { color: var(--muted); }
/* Left-edge score tint by last rating (req 7) — layered inside so it coexists
   with the .active inset ring; transparent when never rated (no attribute). */
.study8-sheet-row[data-last-rating] { border-left-color: transparent; }
.study8-sheet-row[data-last-rating]::before {
  content: "";
  position: absolute;
  left: 0; top: var(--space-5); bottom: var(--space-5);
  width: 3px;
  border-radius: 3px;
}
.study8-sheet-row[data-last-rating="forgotten"]::before { background: var(--danger); }
.study8-sheet-row[data-last-rating="remembered"]::before { background: color-mix(in srgb, var(--accent-2, #31d38a) 55%, var(--muted)); }
.study8-sheet-row[data-last-rating="easy"]::before { background: var(--accent-2, #31d38a); }
/* Remove animation (req 8) */
.study8-sheet-row.is-removing {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.18s ease, transform 0.22s ease;
}

/* Day theme: the card fill above is a barely-there WHITE tint meant to read as
   "slightly raised" against the dark page background. On the light theme the
   page itself is near-white, so that same tint is invisible — bump it toward
   the opaque, near-white card fill the day theme already uses elsewhere
   (matches .study-answer-panel .sentence-focus-card's day override in app.css). */
:root[data-theme='day'] .study8-sheet-row {
  background: rgba(255, 255, 255, 0.65);
}
:root[data-theme='day'] .study8-sheet-row.is-revealed {
  background: rgba(255, 255, 255, 0.8);
}

.study8-sheet-row-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
}
.study8-sheet-prompt { flex: 1 1 auto; min-width: 0; }
.study8-sheet-row-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Prompt / answer text */
.study8-sheet-prompt-en { font-weight: 600; font-size: var(--text-body); color: var(--text); }
.study8-sheet-english { font-weight: 600; font-size: var(--text-body); color: var(--text); }

/* Compact canonical sentence block — same classes as Generate Preview, scaled
   down and transparent (it already sits inside the row card). */
.study8-sheet-focus.sentence-focus-card {
  border: 0;
  background: transparent;
  padding: var(--space-1) 0 0;
  border-radius: 0;
  gap: var(--space-2);
}
.study8-sheet-focus .sentence-focus-hanzi { font-size: clamp(1.5rem, 3.4vw, 2rem); line-height: 1.12; }
.study8-sheet-focus .sentence-focus-pinyin { font-size: clamp(0.95rem, 2vw, 1.15rem); margin-top: var(--space-2); color: var(--accent); }
.study8-sheet-focus .sentence-focus-soundslike { margin-top: var(--space-2); }
.study8-sheet-focus .sentence-focus-soundslike p { font-size: 0.85rem; }

/* Obscured pill (collapsed body) */
.study8-sheet-obscured {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: var(--space-2) var(--space-7);
  border-radius: var(--radius-pill);
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

/* Reveal animation */
.study8-sheet-answer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  animation: study8-sheet-reveal-in 140ms ease;
}
@keyframes study8-sheet-reveal-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: none; }
}

/* Typed-answer input (req 4) */
.study8-sheet-input-shell { margin-bottom: var(--space-3); }
.study8-sheet-input {
  width: 100%;
  max-width: 340px;
  font-size: 16px; /* >= 16px iOS zoom guard */
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
.study8-sheet-input::placeholder { color: var(--muted); opacity: 0.7; }
.study8-sheet-input:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* Per-row typed pinyin-match chip */
.study8-sheet-match { justify-content: flex-start; margin-top: var(--space-4); font-size: var(--text-sm); }
.study8-sheet-match strong { font-size: var(--text-xl); }

/* Last-result status chip (req 2 — replaces the phase chip) */
.study8-sheet-result {
  flex: 0 0 auto;
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.study8-sheet-result.is-forgotten {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}
.study8-sheet-result.is-remembered {
  color: color-mix(in srgb, var(--accent-2, #31d38a) 72%, var(--muted));
  background: color-mix(in srgb, var(--accent-2, #31d38a) 8%, transparent);
}
.study8-sheet-result.is-easy {
  color: var(--accent-2, #31d38a);
  background: color-mix(in srgb, var(--accent-2, #31d38a) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent-2, #31d38a) 40%, var(--border));
}

/* Remove (X) ghost button — two-tap confirm morphs it in place */
.study8-sheet-x {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  min-height: 32px;
  min-width: 32px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
}
.study8-sheet-x:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.study8-sheet-x:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-sheet-x.is-confirm {
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 0 var(--space-6);
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}

/* Rating buttons (revealed row) */
.study8-sheet-rate-row { display: flex; gap: var(--space-3); margin-top: var(--space-5); flex-wrap: wrap; }
.study8-sheet-rate-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 0 var(--space-7);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  flex: 1 1 auto;
}
.study8-sheet-rate-btn:hover { border-color: var(--accent); }
.study8-sheet-rate-btn.grade-forgotten { color: var(--danger); }
.study8-sheet-rate-btn.grade-easy { color: var(--accent-2); }
.study8-sheet-rate-btn:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* Audio icon-btn — both quiz sides (req 3) */
.study8-sheet-audio-btn { min-height: 44px; min-width: 44px; }

@media (max-width: 420px) {
  .study8-sheet-toolbar { flex-direction: column; align-items: stretch; }
  .study8-sheet-toolbar-actions { justify-content: stretch; }
  .study8-sheet-toolbar-actions .study8-triage-btn,
  .study8-sheet-toolbar-actions .study8-type-toggle { flex: 1 1 auto; }
  .study8-sheet-quizside { justify-content: center; }
  .study8-sheet-pagination { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .study8-progress-bar,
  .study8-status,
  .study8-chip-wrap,
  .study8-sheet-row {
    transition: none;
  }
  .study8-hook {
    animation: none;
  }
  .study8-sheet-answer-inner {
    animation: none;
  }
  .study8-sheet-row:hover { transform: none; }
}

/* v10.7: word breakdown inside revealed sheet rows — collapsible, flattened
   chrome (the row card already provides the border/background). */
.study8-sheet-breakdown { margin-top: var(--space-6); }
.study8-sheet-breakdown-summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: var(--radius-xs);
}
.study8-sheet-breakdown-summary::before { content: '▸'; transition: transform 0.15s ease; }
.study8-sheet-breakdown[open] .study8-sheet-breakdown-summary::before { transform: rotate(90deg); }
.study8-sheet-breakdown-summary:hover { color: var(--text); background: color-mix(in srgb, var(--border) 30%, transparent); }
.study8-sheet-breakdown-summary:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.study8-sheet-breakdown .breakdown-list-card {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin-top: var(--space-3);
}

/* v38 · loop controls and phone-native study docks */
.study8-listen-controls,
.study8-sheet-audio-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .study8-shell {
    min-height: calc(100dvh - 92px - env(safe-area-inset-top, 0px));
  }
  .study8-progress-row {
    position: sticky;
    z-index: 110;
    top: 68px;
    margin-inline: -2px;
    padding: 9px var(--space-4);
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: 13px;
    background: color-mix(in srgb, var(--panel) 90%, transparent);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .14);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .study8-progress-track {
    height: 10px;
  }
  .study8-counts-pill {
    max-width: 44vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .study8-grade-bar,
  .study8-browse-nav {
    position: sticky;
    z-index: 105;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    margin: var(--space-2) -7px -7px;
    padding: var(--space-4);
    border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    box-shadow: 0 -8px 26px rgba(0, 0, 0, .18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .study8-grade-btn {
    min-height: 58px;
  }
  .study8-grade-key {
    display: none;
  }
  .study8-browse-arrow {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
  }
  .study8-answer-audio {
    position: sticky;
    z-index: 30;
    top: 123px;
    align-self: flex-end;
    width: max-content;
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--panel-2) 90%, transparent);
    backdrop-filter: blur(12px);
  }
  body.mobile-keyboard-open .study8-grade-bar,
  body.mobile-keyboard-open .study8-browse-nav {
    bottom: var(--space-4);
  }
  body.mobile-keyboard-open .study8-progress-row {
    position: static;
  }
}
