/* styles.css — Lire */
:root {
  --bg:          #f5f5f5;
  --bg-2:        #ebebeb;
  --surface:     #ffffff;
  --surface-2:   #f5f5f5;
  --ink:         #111827;
  --ink-2:       #374151;
  --muted:       #6b7280;
  --line:        #e5e0da;
  --line-2:      #ddd8d2;
  --accent:      #e8552c;
  --accent-ink:  #c44020;
  --accent-soft: #fff1ec;
  --success:     #16a34a;
  --success-soft:#f0fdf4;
  --error:       #dc2626;
  --error-soft:  #fef2f2;
  --indigo:      #4338ca;
  --indigo-soft: #eef2ff;

  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 8px;
  --radius-xl: 20px;

  --shadow-sm: none;
  --shadow:    0 2px 8px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);

  --font-ui:    "Nunito", sans-serif;
  --font-serif: "Lora", Georgia, serif;
  --font-mono:  "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ===== App shell ===== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-mid   { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: var(--ink); white-space: nowrap; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* keep .brand working inside .topbar-left */
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -0.01em; text-decoration: none; color: inherit;
}
/* Logo wrapper crops the .com from the bottom of the full rslogo.png */
.brand-logo-wrap {
  height: 30px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  flex: none;
}
.brand-logo {
  height: 42px; /* scaled up so top 30px shows books + REVISION SNACKS, .com clips off */
  width: auto;
  display: block;
}
.brand-logo-placeholder {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: white;
  display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 16px; font-style: italic;
}
/* legacy brand-mark — kept for teacher bar */
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  font-style: italic;
}
.brand-text { font-size: 16px; font-weight: 800; color: var(--accent); }
.brand-text em { font-style: italic; font-family: var(--font-serif); font-weight: 500; }

.task-pills {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.task-pills .pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.task-pills .pill.flag {
  background: #fff;
  font-weight: 500;
  color: var(--ink-2);
}

.flag-fr::before { content: "🇫🇷"; margin-right: 4px; }

/* ===== Stepper ===== */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 28px 0;
  font-size: 12px;
  color: var(--muted);
}
.stepper-list {
  display: flex; align-items: center; gap: 0;
  flex-wrap: wrap;
}
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
}
.step + .step::before {
  content: "";
  display: inline-block;
  width: 16px; height: 1px;
  background: var(--line-2);
  margin: 0 2px;
}
.step-dot {
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.step.done .step-dot { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.step.done .step-dot::after { content: "✓"; font-size: 10px; }
.step.done .step-dot span { display: none; }
.step.current { color: var(--ink); }
.step.current .step-dot {
  background: var(--accent); color: white; border-color: var(--accent);
}
.step-label { font-size: 12px; }
@media (max-width: 720px) {
  .stepper { padding: 10px 16px 0; overflow-x: auto; flex-wrap: nowrap; }
  .stepper-list { flex-wrap: nowrap; }
  .step-label { display: none; }
  .step.current .step-label { display: inline; }
}

/* ===== Stage ===== */
.stage {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 28px 80px;
}
@media (max-width: 720px) {
  .stage { padding: 22px 16px 100px; }
}
.stage.wide { max-width: 1080px; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
h1.display, h2.display {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 12px 0 18px;
}
h1.display { font-size: clamp(36px, 5vw, 56px); }
h2.display { font-size: clamp(26px, 3.4vw, 36px); }
h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 64ch;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
}
.card.lg { padding: 28px; }

/* ===== Buttons ===== */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  letter-spacing: -0.005em;
  transition: transform 0.15s ease, background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: #1f2937; box-shadow: 4px 4px 0 var(--ink); }
.btn:active { box-shadow: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.lg { padding: 14px 26px; font-size: 16px; }

.btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--line-2);
}
.btn.ghost:hover { background: var(--surface-2); box-shadow: 4px 4px 0 var(--line); }
.btn.accent {
  background: var(--accent); color: white;
}
.btn.accent:hover { background: var(--accent); box-shadow: 4px 4px 0 var(--accent); }
.btn.link {
  background: transparent; color: var(--ink-2); border: 0; padding: 4px 6px;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
.btn.link:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ===== Inputs ===== */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.input {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ===== Reading body ===== */
.reading-body {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.6;
  color: var(--ink);
  letter-spacing: -0.005em;
}
@media (max-width: 720px) { .reading-body { font-size: 19px; } }

.gloss {
  position: relative;
  cursor: help;
  border-bottom: 1px dashed var(--line-2);
}
.gloss:hover, .gloss.open {
  background: var(--accent-soft);
  border-bottom-color: var(--accent);
}
.gloss .gloss-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  transform: translate(-50%, 4px);
  z-index: 5;
  box-shadow: var(--shadow);
}
.gloss .gloss-tip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.gloss:hover .gloss-tip, .gloss.open .gloss-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Unit vocab — known words, no underline but a subtle highlight on hover */
.unit-vocab { cursor: default; }
.unit-vocab:hover { background: oklch(0.95 0.04 145); }

/* Find-mode: clickable words for "find the phrase" question */
.findable {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
  margin: 0 -2px;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.findable:hover { background: oklch(0.95 0.04 70); }
.findable.selected {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 0 oklch(0.48 0.18 40);
}
.findable.selected:hover { background: var(--accent); }
.find-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid oklch(0.86 0.07 55);
}
.find-pulse {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: findPulse 1.4s infinite;
}
@keyframes findPulse {
  0% { box-shadow: 0 0 0 0 oklch(0.60 0.21 40 / 0.5); }
  70% { box-shadow: 0 0 0 8px oklch(0.60 0.21 40 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.60 0.21 40 / 0); }
}
.find-readout {
  font-family: var(--font-serif);
  font-size: 18px;
  padding: 10px 14px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  background: var(--bg-2);
  min-height: 44px;
  display: flex; align-items: center;
}
.find-readout.empty { color: var(--muted); font-style: italic; font-size: 14px; font-family: var(--font-ui); }

/* Highlighted word (after vocab retrieval success) */
.text-highlight {
  background: var(--accent-soft);
  padding: 0 2px;
  border-radius: 3px;
}

/* ===== Audio player ===== */
.audio-player {
  display: flex; align-items: center; gap: 14px;
  background: var(--ink);
  color: var(--bg);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
}
.audio-player .play-btn {
  width: 44px; height: 44px;
  border-radius: 999px;
  background: var(--accent);
  border: 0;
  color: white;
  display: grid; place-items: center;
  flex: none;
  transition: transform 0.1s, background 0.15s;
}
.audio-player .play-btn:hover { background: oklch(0.54 0.19 40); }
.audio-player .play-btn:active { transform: scale(0.96); }
.audio-player .play-btn svg { width: 18px; height: 18px; }
.audio-player .meta {
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.audio-player .label {
  font-size: 13px;
  color: oklch(0.85 0.01 80);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.audio-player .progress {
  height: 4px;
  background: oklch(0.32 0.02 250);
  border-radius: 999px;
  overflow: hidden;
}
.audio-player .progress > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s linear;
}
.audio-player .replays {
  font-family: var(--font-mono);
  font-size: 12px;
  color: oklch(0.7 0.01 80);
  white-space: nowrap;
}
.audio-player.compact {
  background: var(--surface-2);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.audio-player.compact .play-btn { width: 30px; height: 30px; background: var(--ink); color: var(--bg); }
.audio-player.compact .play-btn:hover { background: oklch(0.28 0.03 258); }
.audio-player.compact .label { color: var(--muted); }
.audio-player.compact .progress { background: var(--line); }
.audio-player.compact .progress > div { background: var(--ink); }

/* ===== Option buttons (MCQ etc) ===== */
.options {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.option {
  appearance: none;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--ink);
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
}
.option:hover:not(:disabled) { border-color: var(--ink-2); background: var(--surface-2); }
.option:active:not(:disabled) { transform: translateY(1px); }
.option .glyph {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font-mono);
}
.option.selected { border-color: var(--ink); background: var(--bg-2); }
.option.correct {
  border-color: var(--success);
  background: var(--success-soft);
}
.option.correct .glyph { background: var(--success); color: white; border-color: var(--success); }
.option.incorrect {
  border-color: var(--error);
  background: var(--error-soft);
}
.option.incorrect .glyph { background: var(--error); color: white; border-color: var(--error); }
.option:disabled { cursor: default; }

/* ===== Feedback ===== */
.feedback {
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.45;
  display: flex; gap: 10px; align-items: flex-start;
}
.feedback .glyph { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.feedback.correct { background: var(--success-soft); border-color: oklch(0.85 0.07 145); color: oklch(0.32 0.1 145); }
.feedback.incorrect { background: var(--error-soft); border-color: oklch(0.85 0.07 25); color: oklch(0.36 0.13 25); }
.feedback.info { background: var(--accent-soft); border-color: oklch(0.86 0.07 60); color: var(--accent-ink); }

/* ===== Pills (tags) ===== */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(232, 85, 44, 0.2);
}
.tag.neutral {
  background: var(--surface-2);
  color: var(--ink-2);
  border-color: var(--line);
}

/* ===== Sentence tiles ===== */
.tile-bank {
  display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 56px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px dashed var(--line-2);
}
.tile-bank.target {
  background: var(--surface);
  border-style: solid;
  border-color: var(--line);
}
.tile {
  font-family: var(--font-serif);
  font-size: 18px;
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.tile.placed { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ===== Vocab grid (summary) ===== */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.vocab-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  display: flex; flex-direction: column; gap: 2px;
}
.vocab-cell .fr { font-family: var(--font-serif); font-size: 17px; }
.vocab-cell .en { font-size: 12px; color: var(--muted); }
.vocab-cell.met-correct { border-color: oklch(0.85 0.07 145); background: var(--success-soft); }
.vocab-cell.met-missed {
  border-color: oklch(0.85 0.07 25);
  background: var(--error-soft);
  position: relative;
}
.vocab-cell.met-missed::after {
  content: "missed";
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--error);
}
.vocab-cell.not-met { opacity: 0.35; }

/* ===== Completion code ===== */
.code-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--bg);
  position: relative;
  overflow: hidden;
}
.code-card::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 0%, oklch(0.5 0.15 40 / 0.4), transparent 60%),
    radial-gradient(circle at 90% 100%, oklch(0.45 0.12 260 / 0.35), transparent 60%);
  pointer-events: none;
}
.code-card > * { position: relative; }
.code-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: oklch(0.75 0.01 80);
}
.code-card .code {
  font-family: var(--font-mono);
  font-size: clamp(40px, 6vw, 56px);
  letter-spacing: 0.05em;
  font-weight: 500;
}
.code-card .sub {
  font-size: 13px;
  color: oklch(0.82 0.01 80);
}
.copy-btn {
  appearance: none; border: 1px solid oklch(0.45 0.02 250); background: oklch(0.3 0.025 250);
  color: var(--bg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.copy-btn:hover { background: oklch(0.36 0.025 250); }

/* Streak stamp */
.streak {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  background: var(--surface);
}
.streak-icon {
  width: 38px; height: 38px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  flex: none;
  font-weight: 600;
}
.streak-num { font-family: var(--font-serif); font-size: 24px; line-height: 1; }
.streak-label { font-size: 12px; color: var(--muted); }

/* Score row */
.score-row {
  display: flex; align-items: baseline; gap: 8px;
}
.score-num {
  font-family: var(--font-serif); font-size: 56px; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1;
}
.score-of {
  font-family: var(--font-serif); font-size: 28px;
  color: var(--muted);
}

/* ===== Reading variant A: classic ===== */
.read-variant-a .reading-body p {
  margin: 0 0 18px;
}

/* ===== Reading variant B: side-by-side ===== */
.read-variant-b .reading-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  align-items: flex-start;
}
.read-variant-b .reading-side {
  position: sticky;
  top: 90px;
}
@media (max-width: 900px) {
  .read-variant-b .reading-grid { grid-template-columns: 1fr; }
  .read-variant-b .reading-side { position: static; }
}

/* ===== Reading variant C: focus ===== */
.read-variant-c .sentence {
  transition: opacity 0.35s ease, filter 0.35s ease;
  cursor: pointer;
}
.read-variant-c .sentence:not(.active) {
  opacity: 0.32;
}
.read-variant-c .sentence.active {
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft));
  background-size: 100% 0.38em;
  background-repeat: no-repeat;
  background-position: 0 88%;
}

/* ===== Chunk gates ===== */
.chunk-gate {
  display: flex; align-items: center; justify-content: space-between;
  margin: 24px 0 0;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 12px;
}
.chunk-gate .status { font-size: 13px; color: var(--muted); }
.chunk-gate .status strong { color: var(--ink); font-weight: 600; }

/* ===== Question card ===== */
.qcard {
  margin-top: 22px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.qcard .qhead {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.qcard .qtype-pill {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.qcard .qprompt {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin: 0 0 12px;
}

/* Chunk header */
.chunk-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.chunk-head .num {
  font-family: var(--font-serif); font-style: italic; font-size: 14px; color: var(--muted);
}
.chunk-head .name {
  font-size: 13px; font-weight: 600; letter-spacing: -0.005em;
}


/* ===== Utility ===== */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.col.gap-lg { gap: 22px; }
.spacer-sm { height: 8px; }
.spacer { height: 18px; }
.spacer-lg { height: 32px; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.serif { font-family: var(--font-serif); }
.center { text-align: center; }
.hide-mobile { }
@media (max-width: 720px) { .hide-mobile { display: none; } }

/* hidden link to mark visited */
.kb-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--muted);
}

/* Tweaks-friendly accent override */
[data-accent="coral"]   { --accent: oklch(0.68 0.17 30); --accent-soft: oklch(0.94 0.06 30); --accent-ink: oklch(0.34 0.13 30); }
[data-accent="saffron"] { --accent: oklch(0.7 0.16 50);  --accent-soft: oklch(0.94 0.06 70); --accent-ink: oklch(0.32 0.12 50); }
[data-accent="indigo"]  { --accent: oklch(0.55 0.16 265); --accent-soft: oklch(0.95 0.05 265); --accent-ink: oklch(0.34 0.13 265); }
[data-accent="forest"]  { --accent: oklch(0.55 0.13 150); --accent-soft: oklch(0.94 0.05 150); --accent-ink: oklch(0.32 0.1 150); }

/* Section label */
.section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.section-pip {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
  flex: none;
}

/* Smooth fade between screens */
.screen-enter {
  animation: screenIn 0.4s ease both;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Mobile find bottom sheet ===== */
.find-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ink);
  color: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -8px 32px rgba(20, 18, 12, 0.22);
  display: flex; flex-direction: column; gap: 12px;
}
.find-sheet-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(0.65 0.01 80);
  display: flex; align-items: center; gap: 8px;
}
.find-sheet-readout {
  font-family: var(--font-serif);
  font-size: 20px;
  min-height: 34px;
  color: var(--bg);
  line-height: 1.35;
}
.find-sheet-readout.empty {
  color: oklch(0.55 0.01 80);
  font-style: italic;
  font-family: var(--font-ui);
  font-size: 14px;
}
.find-sheet .row { gap: 10px; }
.find-sheet .btn.accent { flex: 1; }
.find-sheet .btn.ghost {
  background: oklch(0.28 0.025 250);
  border-color: oklch(0.4 0.02 250);
  color: var(--bg);
}
.find-sheet .btn.ghost:hover { background: oklch(0.34 0.025 250); }
/* push page content above the sheet */
body.find-sheet-open { padding-bottom: 150px; }
@media (max-width: 720px) {
  .findable {
    /* larger touch target */
    padding: 3px 4px;
    margin: 0 -4px;
    line-height: 1.9;
  }
}

/* ===== Text hint (final listen retry) ===== */
.text-hint {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--indigo-soft);
  border: 1px solid oklch(0.86 0.05 260);
}
.text-hint .eyebrow { color: var(--indigo); }
.text-hint-body {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.55;
  margin-top: 8px;
  color: var(--ink);
}
.text-hint-body mark {
  background: oklch(0.88 0.08 260);
  color: oklch(0.3 0.12 260);
  border-radius: 3px;
  padding: 0 2px;
  font-style: normal;
}

/* ===== Teacher dashboard ===== */
.teacher-bar {
  background: var(--ink);
  color: var(--bg);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
}
.teacher-bar .brand { color: var(--bg); }
.teacher-bar .brand-mark { background: var(--accent); }
.teacher-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background: oklch(0.3 0.025 250);
  color: oklch(0.85 0.01 80);
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.06em;
}
.teacher-btn-back {
  appearance: none; border: 1px solid oklch(0.42 0.025 250);
  background: transparent; color: oklch(0.85 0.01 80);
  border-radius: 999px; padding: 7px 14px;
  font-family: var(--font-ui); font-size: 13px; cursor: pointer;
}
.teacher-btn-back:hover { background: oklch(0.28 0.025 250); }

.results-table {
  width: 100%; border-collapse: collapse;
}
.results-table th {
  text-align: left;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.results-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover td { background: var(--surface-2); }

.score-chip {
  display: inline-flex; align-items: center; gap: 6px;
}
.score-mini-bar {
  width: 64px; height: 5px;
  background: var(--line); border-radius: 999px; overflow: hidden;
  display: inline-block; vertical-align: middle;
}
.score-mini-fill {
  height: 100%; border-radius: 999px;
  background: var(--success);
  transition: width 0.4s ease;
}
.score-mini-fill.mid { background: var(--accent); }
.score-mini-fill.low { background: var(--error); }

.status-pill {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase;
}
.status-pill.complete { background: var(--success-soft); color: oklch(0.32 0.1 145); }
.status-pill.progress { background: var(--accent-soft); color: var(--accent-ink); }
.status-pill.pending  { background: var(--bg-2); color: var(--muted); border: 1px solid var(--line); }

.diff-bar-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.diff-bar-label { flex: 1 1 180px; min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-bar-track {
  flex: 0 0 120px;
  height: 6px; background: var(--line); border-radius: 999px; overflow: hidden;
}
.diff-bar-fill { height: 100%; border-radius: 999px; background: var(--success); }
.diff-bar-fill.mid { background: var(--accent); }
.diff-bar-fill.low { background: var(--error); }
.diff-bar-pct { flex: none; width: 32px; text-align: right; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }

@media (max-width: 720px) {
  .teacher-bar { padding: 12px 16px; }
  .results-table th, .results-table td { padding: 9px 10px; }
  .score-mini-bar { width: 44px; }
  .diff-bar-track { flex: 0 0 80px; }
}
