/* ══════════════════════════════════════════════════════════════
   Skip-Test + Diagnostic — Pre-screen + Runner + Result
   Identity-aware: respects --subject-color (set by controller).
   Emil-style: restrained typography, single shadow recipe, single
   border weight, stagger entry, no chrome theater.
   ══════════════════════════════════════════════════════════════ */

/* NOTE: --subject-color, --subject-color-light, --subject-color-dark are set
   on documentElement by the controller (skip_test.js / diagnostic.js) via
   applyAreaTokens(). DO NOT redeclare them here with a self-referential
   `var(--subject-color, fallback)` — that creates a CSS dependency cycle which
   the browser flags as invalid-at-computed-time, killing the inherited value
   from root for THIS element and all descendants. Instead, provide fallbacks
   at each var() usage site below. */
.st-page,
.dg-page {
  --st-radius-card: 20px;
  --st-radius-btn: 14px;
  --st-shadow-card: 0 4px 16px -8px rgba(15, 23, 42, 0.06);
  --st-shadow-btn-primary: 0 8px 24px -8px color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 50%);
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at top, color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 94%), transparent 60%),
    var(--bg-primary, #FAFAFA);
  font-family: var(--font-family, system-ui);
  color: var(--text-primary, #0F172A);
}

/* ── Back button (shared) ─────────────────────────────────── */
.st-back {
  position: fixed;
  top: 20px; left: 20px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--bg-white, #fff);
  border: 1.5px solid var(--border, #E5E7EB);
  color: var(--text-secondary, #64748B);
  text-decoration: none;
  z-index: 10;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease;
}
.st-back:hover {
  transform: translateY(-2px);
  color: var(--subject-color, #6C2BFF);
  border-color: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 60%);
}
.st-back .material-symbols-outlined { font-size: 22px; }

/* ── Stagger entry animation ──────────────────────────────── */
.st-stagger {
  opacity: 0;
  transform: translateY(8px);
  animation: stStaggerIn 360ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
  animation-delay: calc(var(--stagger, 0) * 80ms);
}
@keyframes stStaggerIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   INTRO — 3 stacked cards (hero / rules / start)
   Layout: max-width 720 (más ancho para que rules quepan a 3 cols),
   gap 12 (más cerrado), padding superior 48 (más fit-to-fold).
   ══════════════════════════════════════════════════════════════ */
.st-intro {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card chrome — single recipe for both intro and rules */
.st-intro-card,
.st-rules-card {
  background: var(--bg-white, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: var(--st-radius-card);
  box-shadow: var(--st-shadow-card);
}

.st-intro-card {
  padding: 32px 28px 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.st-intro-card::before {
  /* Premium area-color glow stripe at the top */
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--subject-color, #6C2BFF), transparent);
  opacity: 0.55;
}
.st-intro-card::after {
  /* Subtle ambient glow behind the hero icon — premium feel */
  content: '';
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 88%) 0%,
    transparent 70%
  );
  z-index: -1;
  pointer-events: none;
}

.st-intro-icon {
  width: 60px; height: 60px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 18px;
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 85%);
  color: var(--subject-color, #6C2BFF);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 70%) inset,
    0 8px 18px -8px color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 50%);
}
.st-intro-icon .material-symbols-outlined {
  font-size: 32px;
  font-variation-settings: 'FILL' 1;
}
/* Diagnostic variant: uses subject-color too, plus a subtle indigo wash */
.st-intro-icon--diagnostic {
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 86%);
  color: var(--subject-color, #6C2BFF);
}

.st-intro-kicker {
  font: 800 0.72rem/1 inherit;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--subject-color, #6C2BFF);
  margin: 0 0 8px;
}
.st-intro-kicker--diagnostic { color: var(--subject-color, #6C2BFF); }

.st-intro-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary, #0F172A);
  margin: 0 0 6px;
  line-height: 1.2;
}

.st-intro-sub {
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--text-secondary, #64748B);
  margin: 0;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

/* Stats pills row inside intro card */
.st-stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed color-mix(in srgb, var(--border, #E5E7EB), transparent 30%);
}
.st-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 94%);
  border: 1px solid color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 82%);
  font: 600 0.78rem/1 inherit;
  color: var(--text-primary, #0F172A);
  white-space: nowrap;
}
.st-stat-pill .material-symbols-outlined {
  font-size: 14px;
  color: var(--subject-color, #6C2BFF);
}

/* ── Rules card ──────────────────────────────────────────── */
.st-rules-card {
  padding: 20px 20px 18px;
}
.st-rules-title {
  font: 800 0.72rem/1 inherit;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-secondary, #64748B);
  margin: 0 0 14px;
  text-align: center;
}
.st-rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Desktop: 3-column grid; each rule becomes a vertical mini-card */
@media (min-width: 720px) {
  .st-rules-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .st-rules-list li {
    display: flex !important;
    flex-direction: column;
    gap: 10px !important;
    padding: 14px 12px;
    background: color-mix(in srgb, var(--text-secondary, #64748B), transparent 96%);
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--border, #E5E7EB), transparent 30%);
  }
  .st-rules-list li > div { display: contents; }
  .st-rules-list li strong { font-size: 0.88rem; order: 1; }
  .st-rules-list li p { order: 2; }
  .st-rules-list .st-rule-badge { align-self: flex-start; order: 0; }
}
.st-rules-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: start;
}
.st-rule-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border-radius: 8px;
  font: 800 0.74rem/1 inherit;
  letter-spacing: -0.01em;
}
/* Semantic colors stay (performance feedback, not area identity) */
.st-rule-badge--pass    { background: rgba(16, 185, 129, 0.14); color: #047857; }
.st-rule-badge--partial { background: rgba(245, 158, 11, 0.16); color: #B45309; }
.st-rule-badge--fail    { background: rgba(239, 68, 68, 0.14); color: #B91C1C; }
.st-rules-list strong {
  display: block;
  font-weight: 700;
  color: var(--text-primary, #0F172A);
  margin-bottom: 2px;
  font-size: 0.92rem;
}
.st-rules-list p {
  margin: 0;
  color: var(--text-secondary, #64748B);
  font-size: 0.86rem;
  line-height: 1.45;
}

/* ── Start button ────────────────────────────────────────── */
.st-start-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px 24px;
  border: none;
  border-radius: var(--st-radius-btn);
  background: var(--subject-color, #6C2BFF);
  color: #fff;
  font-size: 1rem; font-weight: 700;
  cursor: pointer;
  box-shadow: var(--st-shadow-btn-primary);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.st-start-btn:hover {
  transform: translateY(-2px);
  background: var(--subject-color-dark, #4F1ABF);
  box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 40%);
}
.st-start-btn:active { transform: translateY(0); }
.st-start-btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.st-start-btn .material-symbols-outlined { font-size: 22px; }

/* Diagnostic variant: same area-color treatment (no longer indigo) */
.st-start-btn--diagnostic { /* identical to base */ }

/* ══════════════════════════════════════════════════════════════
   RUNNER
   ══════════════════════════════════════════════════════════════ */
.st-runner {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-white, #fff);
}
.st-runner-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #E5E7EB);
  position: sticky; top: 0;
  background: var(--bg-white, #fff);
  z-index: 5;
}
.st-runner-quit {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--border, #E5E7EB);
  background: var(--bg-white, #fff);
  color: var(--text-secondary, #64748B);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 160ms ease, border-color 160ms ease;
}
.st-runner-quit:hover { color: #EF4444; border-color: #EF4444; }
.st-runner-progress-wrap { flex: 1; display: flex; align-items: center; gap: 12px; }
.st-runner-progress {
  flex: 1; height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 90%);
  overflow: hidden;
}
.st-runner-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--subject-color-light, #B7A0FF), var(--subject-color, #6C2BFF));
  border-radius: 99px;
  transition: width 280ms cubic-bezier(0.23, 1, 0.32, 1);
}
.st-runner-counter {
  font: 700 0.86rem/1 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-secondary, #64748B);
  flex-shrink: 0;
}

.st-runner-main {
  flex: 1;
  max-width: 720px; width: 100%; margin: 0 auto;
  padding: 40px 24px 80px;
}
.st-stem {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--text-primary, #0F172A);
  margin-bottom: 28px;
}
.st-stem p { margin: 0 0 12px; }
.st-stem img { max-width: 100%; height: auto; border-radius: 8px; cursor: zoom-in; }

.st-options { display: flex; flex-direction: column; gap: 10px; }
.st-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  background: var(--bg-white, #fff);
  border: 1.5px solid var(--border, #E5E7EB);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary, #0F172A);
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}
.st-option:hover { border-color: var(--text-primary, #0F172A); }
.st-option:active { transform: scale(0.99); }
.st-option--selected {
  border-color: var(--subject-color, #6C2BFF);
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 94%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 80%);
}
.st-option-label {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary, #0F172A);
  font: 800 0.92rem/1 inherit;
  flex-shrink: 0;
  transition: background 160ms ease, color 160ms ease;
}
.st-option--selected .st-option-label {
  background: var(--subject-color, #6C2BFF);
  color: #fff;
}
.st-option-content { font-size: 0.96rem; line-height: 1.5; }

.st-runner-footer {
  position: sticky; bottom: 0;
  padding: 16px 20px;
  background: var(--bg-white, #fff);
  border-top: 1px solid var(--border, #E5E7EB);
}
.st-runner-next {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 720px;
  margin: 0 auto;
  padding: 14px 20px;
  border: none;
  border-radius: var(--st-radius-btn);
  background: var(--subject-color, #6C2BFF);
  color: #fff;
  font: 700 0.98rem/1 inherit;
  cursor: pointer;
  transition: opacity 160ms ease, transform 120ms ease, background 160ms ease;
}
.st-runner-next:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--subject-color-dark, #4F1ABF);
}
.st-runner-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--text-secondary, #64748B);
}

/* ══════════════════════════════════════════════════════════════
   RESULT — outcome card (semantic colors for the icon, area for the stripe)
   ══════════════════════════════════════════════════════════════ */
.st-result {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.st-result-card {
  --c: var(--subject-color, #6C2BFF);
  --bg: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 92%);
  max-width: 520px; width: 100%;
  padding: 36px 28px 28px;
  background: var(--bg-white, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--st-shadow-card);
  animation: stResultIn 360ms cubic-bezier(0.23, 1, 0.32, 1);
}
.st-result-card::before {
  /* Area-color stripe at the top — anchors the card to the subject identity */
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 6px;
  background: var(--subject-color, #6C2BFF);
}
/* Semantic icon color stays (verde / ámbar / rojo) — that's outcome feedback */
.st-result-card--pass    { --c: #10B981; --bg: rgba(16, 185, 129, 0.07); }
.st-result-card--partial { --c: #F59E0B; --bg: rgba(245, 158, 11, 0.07); }
.st-result-card--fail    { --c: #EF4444; --bg: rgba(239, 68, 68, 0.07); }

.st-result-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c), transparent 82%);
  color: var(--c);
}
.st-result-icon .material-symbols-outlined { font-size: 40px; font-variation-settings: 'FILL' 1; }
.st-result-kicker {
  font: 800 0.74rem/1 inherit;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--c);
  margin: 0 0 6px;
}
.st-result-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.st-result-score {
  display: flex; align-items: baseline; justify-content: center; gap: 4px;
  margin-bottom: 6px;
}
.st-result-score-num {
  font-size: 3.6rem; font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--c);
  font-feature-settings: 'tnum';
  line-height: 1;
}
.st-result-score-unit { font-size: 1.8rem; font-weight: 700; color: var(--c); }
.st-result-fraction {
  margin: 0 0 16px;
  color: var(--text-secondary, #64748B);
  font-size: 0.96rem;
}
.st-result-message {
  margin: 0 0 24px;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--text-primary, #0F172A);
}
.st-result-actions { display: flex; flex-direction: column; gap: 10px; }
.st-result-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px;
  border-radius: var(--st-radius-btn);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 160ms ease, background 160ms ease;
  font-size: 0.96rem;
}
.st-result-cta--primary {
  /* The primary CTA leads to the next lesson — area identity */
  background: var(--subject-color, #6C2BFF);
  color: #fff;
  box-shadow: var(--st-shadow-btn-primary);
}
.st-result-cta--primary:hover {
  transform: translateY(-1px);
  background: var(--subject-color-dark, #4F1ABF);
}
.st-result-cta--secondary {
  background: var(--bg-white, #fff);
  color: var(--text-primary, #0F172A);
  border: 1.5px solid var(--border, #E5E7EB);
}
.st-result-cta--secondary:hover { border-color: var(--text-primary, #0F172A); }

@keyframes stResultIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

/* ══════════════════════════════════════════════════════════════
   ERROR / not eligible
   ══════════════════════════════════════════════════════════════ */
.st-error {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.st-error-card {
  max-width: 440px; width: 100%;
  padding: 32px 24px;
  background: var(--bg-white, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 18px;
  text-align: center;
  box-shadow: var(--st-shadow-card);
}
.st-error-card .material-symbols-outlined {
  font-size: 48px;
  color: var(--text-secondary, #64748B);
  margin-bottom: 12px;
}
.st-error-card h2 { font-size: 1.3rem; font-weight: 800; margin: 0 0 8px; }
.st-error-card p { color: var(--text-secondary, #64748B); line-height: 1.5; margin: 0 0 20px; font-size: 0.94rem; }
.st-error-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 18px;
  background: var(--subject-color, #6C2BFF);
  color: #fff;
  border-radius: var(--st-radius-btn);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--st-shadow-btn-primary);
}
.st-error-back:hover { background: var(--subject-color-dark, #4F1ABF); }

/* ══════════════════════════════════════════════════════════════
   MOBILE (≤ 600px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .st-intro { padding: 80px 16px 60px; gap: 12px; }
  .st-back { width: 38px; height: 38px; top: 12px; left: 12px; }
  .st-intro-card { padding: 24px 18px 18px; border-radius: 16px; }
  .st-intro-icon { width: 48px; height: 48px; border-radius: 14px; }
  .st-intro-icon .material-symbols-outlined { font-size: 24px; }
  .st-intro-title { font-size: 1.3rem; }
  .st-intro-sub { font-size: 0.9rem; }
  .st-stat-pill { font-size: 0.74rem; padding: 5px 10px; }
  .st-stat-pill .material-symbols-outlined { font-size: 13px; }
  .st-rules-card { padding: 18px 16px; border-radius: 16px; }
  .st-rules-list li { grid-template-columns: 60px 1fr; gap: 10px; }
  .st-rule-badge { padding: 6px 8px; font-size: 0.72rem; }
  .st-rules-list strong { font-size: 0.88rem; }
  .st-rules-list p { font-size: 0.82rem; }
  .st-start-btn { padding: 14px 20px; font-size: 0.94rem; }

  .st-runner-main { padding: 28px 18px 100px; }
  .st-stem { font-size: 1rem; }
  .st-option { padding: 14px 14px; }
  .st-option-label { width: 28px; height: 28px; font-size: 0.84rem; }
  .st-option-content { font-size: 0.9rem; }

  .st-result-card { padding: 28px 20px 22px; }
  .st-result-title { font-size: 1.4rem; }
  .st-result-score-num { font-size: 3rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .st-stagger,
  .st-result-card,
  .st-start-btn,
  .st-runner-next,
  .st-result-cta {
    animation: none !important;
    transition: opacity 120ms ease !important;
    transform: none !important;
    opacity: 1 !important;
  }
  .st-runner-progress-fill { transition: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE — tints adjust automatically via color-mix
   ══════════════════════════════════════════════════════════════ */
[data-theme="dark"] .st-page,
[data-theme="dark"] .dg-page {
  background:
    radial-gradient(ellipse at top, color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 90%), transparent 60%),
    var(--bg-primary);
}
[data-theme="dark"] .st-intro-card,
[data-theme="dark"] .st-rules-card,
[data-theme="dark"] .st-result-card,
[data-theme="dark"] .st-error-card {
  background: var(--bg-white);
  border-color: var(--border);
}
[data-theme="dark"] .st-stat-pill {
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 80%);
}
[data-theme="dark"] .st-option {
  background: var(--bg-white);
  border-color: var(--border);
}
[data-theme="dark"] .st-option--selected {
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 80%);
}

/* ══════════════════════════════════════════════════════════════
   DIAGNOSTIC RESULT (Phase D) — per-module breakdown grid
   The bucket icons keep semantic colors; the cards anchor to area-color.
   ══════════════════════════════════════════════════════════════ */
.dg-result {
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}
.dg-result-header { text-align: center; margin-bottom: 28px; }
.dg-result-icon {
  width: 72px; height: 72px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 84%);
  color: var(--subject-color, #6C2BFF);
  box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 60%);
}
.dg-result-icon .material-symbols-outlined { font-size: 38px; font-variation-settings: 'FILL' 1; }
.dg-result-kicker {
  font: 800 0.72rem/1 inherit;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--subject-color, #6C2BFF);
  margin: 0 0 6px;
}
.dg-result-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.dg-result-sub { color: var(--text-secondary, #64748B); margin: 0; font-size: 0.94rem; }

.dg-result-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.dg-result-tile {
  --c: var(--text-secondary, #64748B);
  text-align: center;
  padding: 18px 12px;
  background: var(--bg-white, #fff);
  border: 1.5px solid var(--border, #E5E7EB);
  border-radius: 14px;
}
.dg-result-tile .material-symbols-outlined {
  font-size: 24px;
  color: var(--c);
  font-variation-settings: 'FILL' 1;
  display: block;
  margin-bottom: 6px;
}
.dg-result-tile strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary, #0F172A);
  line-height: 1;
  margin-bottom: 4px;
}
.dg-result-tile small {
  font-size: 0.74rem;
  color: var(--text-secondary, #64748B);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.dg-result-tile--mastered { --c: #10B981; border-color: rgba(16,185,129,0.32); background: rgba(16,185,129,0.05); }
.dg-result-tile--review   { --c: #F59E0B; border-color: rgba(245,158,11,0.32); background: rgba(245,158,11,0.05); }
.dg-result-tile--start    { --c: var(--subject-color, #6C2BFF); border-color: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 70%); background: color-mix(in srgb, var(--subject-color, #6C2BFF), transparent 95%); }

.dg-result-detail { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.dg-result-bucket {
  --c: var(--text-secondary, #64748B);
  padding: 16px 18px;
  background: var(--bg-white, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-left: 3px solid var(--c);
  border-radius: 12px;
  box-shadow: var(--st-shadow-card);
}
.dg-result-bucket--mastered { --c: #10B981; }
.dg-result-bucket--review   { --c: #F59E0B; }
.dg-result-bucket--start    { --c: var(--subject-color, #6C2BFF); }
.dg-result-bucket-title {
  font: 800 0.84rem/1 inherit;
  margin: 0 0 12px;
  color: var(--c);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dg-result-bucket-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--c), transparent 82%);
  color: var(--c);
  font-size: 0.7rem;
  font-weight: 800;
}
.dg-result-bucket-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.dg-result-bucket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text-primary), transparent 97%);
  font-size: 0.92rem;
  color: var(--text-primary, #0F172A);
}
.dg-result-bucket-pct {
  font: 700 0.82rem/1 'JetBrains Mono', ui-monospace, monospace;
  color: var(--c);
  flex-shrink: 0;
}
.dg-result-actions { display: flex; flex-direction: column; gap: 10px; }

/* Mobile diagnostic */
@media (max-width: 600px) {
  .dg-result { padding: 36px 16px 60px; }
  .dg-result-title { font-size: 1.4rem; }
  .dg-result-summary { gap: 6px; }
  .dg-result-tile { padding: 14px 8px; }
  .dg-result-tile strong { font-size: 1.4rem; }
}

[data-theme="dark"] .dg-result-tile,
[data-theme="dark"] .dg-result-bucket {
  background: var(--bg-white);
  border-color: var(--border);
}
[data-theme="dark"] .dg-result-bucket-item {
  background: color-mix(in srgb, var(--bg-white), white 4%);
}
