:root {
  --bg: #faf9f6;
  --panel: #ffffff;
  --panel-border: rgba(15, 23, 42, 0.06);
  --ink: #15192c;
  --ink-soft: #2d3656;
  --muted: #6b7280;
  --muted-soft: #9ca3af;
  --accent: #1e3a5f;
  --accent-hover: #2b4d7a;
  --accent-ink: #ffffff;
  --again: #b03a3a;
  --hard:  #c47a2c;
  --good:  #3f7a4a;
  --easy:  #2b4d7a;
  --border: #ebe9e4;
  --border-strong: #d6d3cb;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.08), 0 20px 48px rgba(15, 23, 42, 0.05);
  --accent-ring: rgba(30, 58, 95, 0.16);
  --overlay: rgba(21, 25, 44, 0.78);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "ss01", "cv01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

body { display: flex; flex-direction: column; }

h1, h2, h3 {
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}
h1 { font-size: 32px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }

p { margin: 0; }

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

#topbar .brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

#topbar nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

#topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 120ms var(--ease), background 120ms var(--ease);
}

#topbar nav a:hover { color: var(--ink); }
#topbar nav a.active { color: var(--ink); background: rgba(15, 23, 42, 0.05); }

#app {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  min-height: 44px;
  transition: background 120ms var(--ease), transform 80ms var(--ease);
}
button:hover { background: var(--accent-hover); }
button:active { transform: translateY(1px); }

button.secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
button.secondary:hover { background: rgba(15, 23, 42, 0.03); }

a.link, a.link:visited { color: var(--accent); }

a.btn,
a.btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background 120ms var(--ease), transform 80ms var(--ease), border-color 120ms var(--ease);
}
a.btn:hover { background: rgba(15, 23, 42, 0.03); border-color: var(--border-strong); }
a.btn:active { transform: translateY(1px); }
a.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
a.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.muted { color: var(--muted); }
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.small { font-size: 14px; }

/* Login */
.login-card {
  margin-top: 64px;
  text-align: center;
  padding: 48px 32px;
}
.login-card h1 { margin-bottom: 12px; }
.login-card .tagline {
  color: var(--muted);
  margin-bottom: 32px;
  font-size: 16px;
  max-width: 32ch;
  margin-left: auto;
  margin-right: auto;
}

/* Home tiles */
.welcome {
  margin-bottom: 28px;
}
.welcome .greeting {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.welcome h1 { margin-top: 4px; }

.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 540px) {
  .tiles { grid-template-columns: 1fr 1fr; }
}

.tile {
  display: block;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms var(--ease), box-shadow 140ms var(--ease), border-color 140ms var(--ease);
}
.tile:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.tile h3 { margin-bottom: 6px; }
.tile p { color: var(--muted); font-size: 14px; }

/* Flashcard */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.session-header strong { color: var(--ink); font-weight: 600; }

.flashcard {
  perspective: 1400px;
  margin: 8px 0 20px;
}
.flashcard .inner {
  position: relative;
  width: 100%;
  min-height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.flashcard.flipped .inner { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute;
  inset: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
}
.flashcard .face.back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
}
.flashcard .word {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.flashcard .hint {
  color: var(--muted-soft);
  margin-top: 16px;
  font-size: 13px;
  font-weight: 500;
}
.flashcard .definition {
  font-size: 19px;
  line-height: 1.5;
  margin-top: 4px;
  color: var(--ink-soft);
}
.flashcard .example {
  font-style: italic;
  color: var(--muted);
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.5;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
}
.flashcard .pos {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.rate-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 20px;
}
.rate-row button {
  padding: 12px 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.rate-row .key {
  display: inline-block;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.rate-row .again { background: var(--again); }
.rate-row .hard  { background: var(--hard); }
.rate-row .good  { background: var(--good); }
.rate-row .easy  { background: var(--easy); }
.rate-row button:hover { filter: brightness(1.05); }

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.35s var(--ease);
}

/* Dashboard / Progress */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 540px) {
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
}
.metric {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.metric .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.metric .value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 6px;
  color: var(--ink);
}

.minutes-chart {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 3px;
  align-items: end;
  height: 64px;
  margin: 12px 0 4px;
}
.minutes-chart .bar {
  background: var(--accent);
  min-height: 2px;
  border-radius: 2px;
  opacity: 0.9;
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), opacity 120ms var(--ease);
}
.minutes-chart .bar.empty {
  background: var(--border);
  height: 3px !important;
  opacity: 1;
}

/* Stacked daily-cards chart: each column is a vertical stack of rating segments */
.minutes-chart .bar-stack {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  border-radius: 2px;
  overflow: hidden;
  min-height: 2px;
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), opacity 120ms var(--ease);
}
.minutes-chart .bar:hover,
.minutes-chart .bar-stack:hover,
.minutes-chart .bar.is-active,
.minutes-chart .bar-stack.is-active {
  transform: translateY(-1px);
  opacity: 1;
}
.minutes-chart .bar.is-active,
.minutes-chart .bar-stack.is-active {
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.minutes-chart .bar-stack .seg.again { background: var(--again); }
.minutes-chart .bar-stack .seg.hard  { background: var(--hard); }
.minutes-chart .bar-stack .seg.good  { background: var(--good); }
.minutes-chart .bar-stack .seg.easy  { background: var(--easy); }
.minutes-chart .bar-stack.empty {
  background: var(--border);
  height: 3px !important;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.chart-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.chart-legend .dot.again { background: var(--again); }
.chart-legend .dot.hard  { background: var(--hard); }
.chart-legend .dot.good  { background: var(--good); }
.chart-legend .dot.easy  { background: var(--easy); }
.chart-legend .dot.correct { background: var(--good); }
.chart-legend .dot.incorrect { background: var(--again); }
.chart-legend .dot.redo-correct { background: var(--easy); }
.chart-legend .dot.redo-incorrect { background: var(--hard); }

.chart-detail-panel {
  min-height: 38px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-soft);
  font-weight: 500;
}


.analytics-panel h3 {
  margin-bottom: 6px;
}
.analytics-values {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px 0 10px;
}
@media (min-width: 540px) {
  .analytics-values { grid-template-columns: repeat(2, 1fr); }
}
.analytics-values > div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.analytics-values strong {
  font-size: 18px;
  letter-spacing: -0.015em;
}
.analytics-chart {
  display: grid;
  grid-template-columns: repeat(90, minmax(2px, 1fr));
  gap: 2px;
  align-items: end;
  height: 76px;
  margin: 12px 0 4px;
}
.analytics-dual-bar {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 1px;
  min-height: 4px;
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), opacity 120ms var(--ease);
}
.analytics-dual-bar:hover,
.analytics-dual-bar.is-active {
  transform: translateY(-1px);
}
.analytics-dual-bar.is-active {
  border-radius: 3px;
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.dual-bar {
  display: block;
  width: 45%;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
}
.dual-bar.count,
.chart-swatch.count,
.chart-legend .dot.count { background: var(--accent); }
.dual-bar.mass,
.chart-swatch.mass,
.chart-legend .dot.mass { background: #8a6d3b; }
.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.rating-analytics-chart {
  grid-template-columns: repeat(90, minmax(2px, 1fr));
}
.empty-state {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
}
.mcq-prof-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 540px) {
  .mcq-prof-grid { grid-template-columns: repeat(2, 1fr); }
}
.mcq-prof-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
}
.mcq-prof-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mcq-prof-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.mcq-prof-head strong {
  font-size: 14px;
  line-height: 1.2;
  text-transform: capitalize;
}
.mcq-prof-score {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.mcq-prof-card.unrated .mcq-prof-score {
  color: var(--muted);
  font-size: 20px;
}
.mcq-prof-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
  margin-bottom: 6px;
}
.mcq-prof-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
}
.mcq-prof-card.unrated .mcq-prof-track span { background: var(--muted-soft); }
.mcq-prof-meta { margin-bottom: 8px; }
.mcq-outcome-legend {
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}
.mcq-outcome-caption {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mcq-mini-chart {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 50px;
  margin-top: 5px;
  padding: 6px 7px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.mcq-outcome-bar {
  display: flex;
  flex: 1 1 3px;
  flex-direction: column-reverse;
  justify-content: flex-end;
  min-width: 2px;
  max-width: 10px;
  min-height: 2px;
  overflow: hidden;
  border-radius: 2px;
}
.mcq-outcome-bar.empty {
  height: 2px;
  background: var(--border);
}
.mcq-outcome-seg { display: block; }
.mcq-outcome-seg.correct { background: var(--good); }
.mcq-outcome-seg.incorrect { background: var(--again); }
.mcq-outcome-seg.redo-correct { background: var(--easy); }
.mcq-outcome-seg.redo-incorrect { background: var(--hard); }
.mcq-prof-empty {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.stream-table-wrap { overflow-x: auto; }
.stream-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.stream-actions button[hidden] { display: none; }
.stream-actions button:disabled {
  cursor: default;
  opacity: 0.7;
}

.struggling {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.struggling .pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}

/* Session summary */
.session-summary {
  text-align: center;
  padding: 40px 24px;
}
.session-summary h2 {
  margin-bottom: 8px;
}
.session-summary .big {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 16px 0 8px;
  color: var(--ink);
}
/* Alerts (auth errors etc) */
.alert {
  background: #fff4e6;
  border: 1px solid #f3c97a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  color: #6e4c14;
}
.alert h3 { margin: 0 0 4px 0; font-size: 16px; color: #5a3a0c; }
.alert p { margin: 0; font-size: 14px; line-height: 1.5; }
.alert strong { color: #5a3a0c; }

.session-summary .actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

/* Family dashboard */
.family-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.family-card { display: block; padding: 22px 24px; }
.family-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.family-head h3 { margin: 0; font-size: 20px; }
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-badge.student { background: #eef3fa; color: var(--accent); }
.role-badge.parent { background: var(--bg); color: var(--muted); }
.family-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}
.fm-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.fm-sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.fm-label {
  margin-top: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Reviews table on the Progress / Dashboard views */
.reviews-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.reviews-table th,
.reviews-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #eee);
  vertical-align: top;
}
.reviews-table thead th {
  border-bottom: 2px solid var(--border, #eee);
  font-weight: 600;
}
.rating-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.rating-pill.r1 { background: var(--again); }
.rating-pill.r2 { background: var(--hard); }
.rating-pill.r3 { background: var(--good); }
.rating-pill.r4 { background: var(--easy); }

/* Practice mode */
.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.practice-question-panel {
  padding: 16px;
  margin-bottom: 16px;
}
.practice-question-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.practice-question-panel h3 { margin-top: 4px; }
.practice-question-open,
.practice-question-open:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 120ms var(--ease), transform 80ms var(--ease);
}
.practice-question-open:hover { background: var(--accent-hover); }
.practice-question-open:active { transform: translateY(1px); }
.practice-question-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
@media (min-width: 540px) {
  .practice-question-form { grid-template-columns: 1.2fr 1fr 0.8fr; }
  .practice-question-stem-field { grid-column: 1 / -1; }
}
.practice-question-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.practice-question-form input,
.practice-question-form select,
.practice-question-form textarea {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
}
.practice-question-form textarea {
  min-height: 64px;
  resize: vertical;
  text-transform: none;
}
.practice-question-form input:focus,
.practice-question-form select:focus,
.practice-question-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  outline: none;
}
.practice-question-status { min-height: 16px; margin: -4px 0 8px; }
.practice-question-help { margin-bottom: 8px; }
.practice-question-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.practice-question-chip,
.practice-question-chip:visited {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), transform 80ms var(--ease);
}
.practice-question-chip:hover {
  background: var(--panel);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.practice-question-chip .sc-name { font-weight: 700; }
.practice-question-chip .sc-counts { color: var(--muted); font-size: 11px; }
.practice-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #eee);
  border-radius: 14px;
  padding: 18px;
  transition: transform .1s ease, box-shadow .1s ease;
}
.practice-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.05); }
.practice-tile-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.practice-tile-head h3 { margin: 0; }
.practice-badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 999px;
}
.practice-badge.needs { background: var(--again); color: #fff; }
.practice-badge.new   { background: var(--good);  color: #fff; }
.practice-tile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}
.pv { font-size: 20px; font-weight: 700; color: var(--ink); }
.pv-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.pl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.practice-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.practice-pip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--accent, #4f6df5); color: #fff; font-size: 12px; font-weight: 600;
}
.practice-pip.source { background: var(--easy); }
.practice-pip.subtype { background: var(--muted); }
.practice-pip.inspect { background: var(--ink-soft); }
.practice-passage {
  background: #fafafa; border: 1px solid var(--border, #eee); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px;
}
.practice-passage summary { cursor: pointer; font-weight: 600; }
.practice-passage .passage-body { margin-top: 10px; line-height: 1.6; white-space: pre-wrap; }
.reading-passage {
  background: #fafbfc;
  border: 1px solid var(--border, #eee);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.reading-passage-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.reading-passage-title {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.reading-passage-body {
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 15px;
  max-height: 360px;
  overflow-y: auto;
}
.reading-passage.intro .reading-passage-body {
  max-height: none;
  overflow-y: visible;
}
.practice-media {
  margin: 0 0 18px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.practice-media-img {
  display: block;
  max-width: 100%;
  max-height: min(60vh, 420px);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.practice-media-zoom {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  cursor: zoom-in;
  transition: box-shadow 120ms var(--ease), transform 80ms var(--ease);
}
.practice-media-zoom:hover {
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.practice-media-zoom:active { transform: translateY(1px); }
.practice-media-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--ink-soft);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}
.practice-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(4px);
}
.practice-media-lightbox-panel {
  position: relative;
  max-width: min(96vw, 1100px);
  max-height: calc(100vh - 48px);
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.practice-media-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.practice-media-lightbox-close:hover { background: var(--bg); }
.practice-media-lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 80px);
  max-height: calc(100vh - 120px);
  border-radius: var(--radius);
  background: var(--bg);
}
@media (max-width: 540px) {
  .practice-media-lightbox { padding: 12px; }
  .practice-media-lightbox-panel {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 8px;
  }
  .practice-media-lightbox-img {
    max-width: calc(100vw - 40px);
    max-height: calc(100dvh - 72px);
  }
}
.practice-stem {
  font-size: 18px; line-height: 1.5; margin-bottom: 18px; white-space: pre-wrap;
}
.practice-choices { display: flex; flex-direction: column; gap: 10px; }
.practice-choice {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--border, #ddd); border-radius: 10px;
  padding: 14px 16px; text-align: left; font-size: 15px;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  width: 100%;
}
.practice-choice .choice-text { flex: 1; color: var(--ink); font-size: 15px; line-height: 1.4; }
.practice-q-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  margin-left: 6px;
}
.practice-q-badge.new   { background: var(--good);  color: #fff; }
.practice-q-badge.retry { background: var(--again); color: #fff; }
.practice-q-badge.review{ background: #777;         color: #fff; }
.practice-q-badge.learned{ background: var(--easy); color: #fff; }
.subtype-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px; margin-top: 10px;
}
.subtype-chip {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border: 1px solid var(--border, #ddd); border-radius: 10px;
  background: #fff; color: inherit; text-decoration: none;
  font-size: 13px;
}
.subtype-chip:hover { background: #f6f7fb; }
.subtype-chip .sc-name { font-weight: 600; }
.subtype-chip .sc-counts { color: var(--muted); font-size: 11px; }
.practice-group-label { margin-top: 14px; }
.source-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.source-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 10px;
}
.source-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  padding: 2px 2px 10px;
}
.source-chip-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.source-chip-action {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.source-chip:hover .source-chip-action { color: var(--accent-hover); }
.source-subtype-grid { margin-top: 0; }
.practice-choice:hover:not(:disabled) { background: #f6f7fb; border-color: #c9d0e6; }
.practice-choice:disabled { cursor: default; opacity: 0.85; }
.practice-choice .choice-letter {
  display: inline-block; width: 26px; height: 26px; line-height: 26px; text-align: center;
  border-radius: 6px; background: #eef0f7; font-weight: 700; font-size: 12px;
}
.practice-choice.picked { border-color: var(--accent, #4f6df5); }
.practice-choice.correct { background: #e8f6ec; border-color: var(--good); }
.practice-choice.correct .choice-letter { background: var(--good); color: #fff; }
.practice-choice.wrong { background: #fdecec; border-color: var(--again); }
.practice-choice.wrong .choice-letter { background: var(--again); color: #fff; }

.practice-feedback {
  margin-top: 14px; padding: 14px 16px; border-radius: 10px;
  background: #f6f7fb; border: 1px solid var(--border, #eee);
}
.practice-feedback.ok { background: #e8f6ec; border-color: var(--good); }
.practice-feedback.miss { background: #fdecec; border-color: var(--again); }
.practice-verdict.correct { color: #1f7a3a; font-weight: 700; }
.practice-verdict.wrong { color: #a93333; font-weight: 700; }

.kind-pip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: #fff;
  white-space: nowrap;
}
.kind-pip.vocab { background: #4f6df5; }
.kind-pip.v     { background: #e07b3f; } /* Verbal */
.kind-pip.q     { background: #7b3fc8; } /* Quantitative */
.kind-pip.r     { background: #3fb24a; } /* Reading */
.kind-pip.m     { background: #3fa3c8; } /* Mathematics */
.kind-pip.l     { background: #c83f7b; } /* Language */
.kind-pip.mcq   { background: #777;    }

/* Section completion grid */
.section-completion-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 540px) {
  .section-completion-grid { grid-template-columns: repeat(2, 1fr); }
}
.section-completion-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
}
.sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.sc-pct {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sc-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}
.sc-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.sc-stats {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 13px;
  color: var(--ink-soft);
}
.section-source-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.section-source-group {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.section-source-chip {
  padding: 0;
}
.section-source-chip .sc-name,
.section-source-group > .source-chip-main .sc-name {
  font-size: 13px;
  font-weight: 700;
}
.section-source-chip .sc-counts,
.section-source-group > .source-chip-main .sc-counts {
  color: var(--muted);
  font-size: 11px;
}
.section-subtype-grid {
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}
.section-subtype-grid .subtype-chip {
  padding: 8px 10px;
  background: var(--bg);
}
