/* ─────────────────────────────────────────────────────────
   CAM OPOSICIONES — TEMA OSCURO + COMPONENTES COMPARTIDOS
───────────────────────────────────────────────────────── */

/* ── Variables del modo oscuro ── */
:root[data-theme="dark"] {
  --bg: #15090e;
  --bg-2: #1e0d14;
  --surface: #1f111a;
  --surface-2: #29151f;
  --border: #3a1f2b;
  --border-strong: #5a3145;
  --text: #f1e6ec;
  --text-2: #d3c0c9;
  --muted: #b39aa6;
  --muted-light: #8a6f7c;
  --accent: #ff5b8a;
  --accent-mid: #ff7da5;
  --accent-light: #3a1a25;
  --accent-hover: #ff7da5;
  --green: #6dcfa3;
  --green-light: #1d2e26;
  --amber: #e2b269;
  --amber-light: #2a2014;
  --tag-bg: #2a1620;
  --red: #ff7080;
  --red-light: #2a1418;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .7);
}

/* Fondo radial para modo oscuro */
:root[data-theme="dark"] body {
  background:
    radial-gradient(900px 600px at 88% -10%, #2c1018 0%, transparent 60%),
    radial-gradient(750px 500px at -10% 110%, #1f0e16 0%, transparent 60%),
    var(--bg) !important;
}

/* TopNav en modo oscuro */
:root[data-theme="dark"] .topnav {
  background: linear-gradient(180deg, #0a0306 0%, #15090e 100%) !important;
}

/* Sidebar translúcida oscura */
:root[data-theme="dark"] .sidebar {
  background: rgba(31, 17, 26, .88) !important;
}

/* Página de portada (index) en modo oscuro */
:root[data-theme="dark"] .topnav {
  background: rgba(21, 9, 14, .85) !important;
  backdrop-filter: saturate(180%) blur(14px);
}
:root[data-theme="dark"] .brand { color: var(--text); }
:root[data-theme="dark"] .top-link { color: var(--text-2); }

/* Cards en modo oscuro */
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .mode-card,
:root[data-theme="dark"] .tema-card,
:root[data-theme="dark"] .test-card,
:root[data-theme="dark"] .caract-card,
:root[data-theme="dark"] .estructura-box,
:root[data-theme="dark"] .reforma-list,
:root[data-theme="dark"] .article,
:root[data-theme="dark"] .quiz-panel,
:root[data-theme="dark"] .result-card,
:root[data-theme="dark"] .review-item,
:root[data-theme="dark"] .review-toolbar,
:root[data-theme="dark"] .feature {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

:root[data-theme="dark"] .feature {
  border-left-color: var(--accent-mid) !important;
}

/* Boxes con surface-2 */
:root[data-theme="dark"] .info-box,
:root[data-theme="dark"] .preamble,
:root[data-theme="dark"] .art-body,
:root[data-theme="dark"] .explanation,
:root[data-theme="dark"] .review-exp {
  background: var(--surface-2) !important;
}

/* Tarjeta deshabilitada */
:root[data-theme="dark"] .tema-card.disabled {
  background: var(--bg-2) !important;
  opacity: .45;
}

/* Inputs */
:root[data-theme="dark"] .search-wrap input {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .08);
  color: var(--text);
}
:root[data-theme="dark"] .search-wrap input::placeholder {
  color: rgba(255, 255, 255, .3);
}

/* Score circle en modo oscuro: rectángulo interior con surface */
:root[data-theme="dark"] .score-circle::before {
  background: var(--surface) !important;
}

/* Opciones de test - estados ya usan variables, pero aclaramos */
:root[data-theme="dark"] .option {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
:root[data-theme="dark"] .option .letter {
  background: var(--surface) !important;
  color: var(--muted) !important;
}
:root[data-theme="dark"] .option:hover:not(:disabled) {
  background: var(--accent-light) !important;
}

/* Footer */
:root[data-theme="dark"] footer { background: rgba(0, 0, 0, .2); }

/* Brand-mark del index */
:root[data-theme="dark"] .brand-mark {
  box-shadow: 0 4px 14px rgba(255, 91, 138, .35);
}

/* ─────────────────────────────────
   TOGGLE DE TEMA (botón)
───────────────────────────────── */
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .85);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  flex-shrink: 0;
  transition: background .2s, transform .2s, border-color .2s;
  font-size: 1.05rem;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .25);
  transform: rotate(15deg);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* En la portada (index) el toggle va con estilo claro */
.topnav-inner .theme-toggle {
  border-color: var(--border);
  color: var(--muted);
}
.topnav-inner .theme-toggle:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}

/* ─────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────── */
#cam-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.cam-toast {
  background: rgba(43, 26, 34, .96);
  color: #fff;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: .88rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s, transform .3s;
  pointer-events: auto;
  letter-spacing: .01em;
}
.cam-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
:root[data-theme="dark"] .cam-toast {
  background: rgba(255, 91, 138, .95);
  color: #15090e;
  font-weight: 600;
}

/* ─────────────────────────────────
   BOTÓN COPIAR ENLACE EN ARTÍCULO
───────────────────────────────── */
.article {
  position: relative;
}
.art-copy {
  position: absolute;
  top: 8px;
  right: 50px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: .7rem;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s, transform .18s, color .18s, background .18s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 3;
  letter-spacing: .02em;
}
:root[data-theme="dark"] .art-copy {
  background: rgba(31, 17, 26, .9);
  color: var(--text-2);
}
.article:hover .art-copy,
.art-copy:focus {
  opacity: 1;
  transform: translateY(0);
}
.art-copy:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-color: var(--accent-mid);
}
.art-copy svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Highlight cuando se aterriza en un artículo por enlace */
.article.targeted {
  animation: targetPulse 2.2s ease;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(192, 48, 90, .15), var(--shadow-md) !important;
}
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(192, 48, 90, .15), var(--shadow-md); }
  50% { box-shadow: 0 0 0 8px rgba(192, 48, 90, .25), var(--shadow-lg); }
}

/* ─────────────────────────────────
   ARTÍCULO LEÍDO / MARCADOS
───────────────────────────────── */
.article.read .art-num::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.article .art-num { position: relative; }

/* Flags Dudoso / Importante en barra de art */
.art-flags {
  display: flex;
  gap: 6px;
  padding: 0 14px 0 4px;
}
.art-flag {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .18s;
  color: var(--muted-light);
  flex-shrink: 0;
}
.art-flag:hover { color: var(--accent); border-color: var(--accent-mid); }
.art-flag.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.art-flag.flag-imp.active { background: var(--amber-light); color: var(--amber); border-color: var(--amber); }

/* Bordes diferenciados según marcador */
.article.is-doubt { border-left: 3px solid var(--accent); }
.article.is-important { border-left: 3px solid var(--amber); }
.article.is-doubt.is-important { border-left: 3px solid; border-image: linear-gradient(180deg, var(--amber) 0%, var(--accent) 100%) 1; }

/* ─────────────────────────────────
   PROGRESS BARS EN TARJETAS DE TEMA (index)
───────────────────────────────── */
.tema-progress {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: .72rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tema-progress-bar {
  height: 4px;
  background: var(--accent-light);
  border-radius: 999px;
  overflow: hidden;
}
.tema-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-mid) 100%);
  border-radius: 999px;
  transition: width .8s ease;
}
.tema-progress-row {
  display: flex; justify-content: space-between; align-items: center;
}
.tema-progress-row .best {
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .65rem;
  letter-spacing: .04em;
}

/* ─────────────────────────────────
   CONFETI 🎉
───────────────────────────────── */
.cam-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}
.cam-confetti span {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 3s linear forwards;
  opacity: .9;
}
@keyframes confettiFall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─────────────────────────────────
   BUSCADOR: HIGHLIGHT + CONTADOR
───────────────────────────────── */
mark.cam-highlight {
  background: linear-gradient(180deg, transparent 50%, rgba(255, 220, 50, .55) 50%);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
}
:root[data-theme="dark"] mark.cam-highlight {
  background: linear-gradient(180deg, transparent 50%, rgba(255, 200, 80, .35) 50%);
  color: var(--text);
}
.search-counter {
  position: absolute;
  top: calc(var(--nav-h, 64px) + 8px);
  right: 18px;
  z-index: 150;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .76rem;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  display: none;
  font-family: 'Source Serif 4', Georgia, serif;
}
.search-counter.visible { display: inline-flex; align-items: center; gap: 6px; }
.search-counter b { color: var(--accent); font-weight: 700; }

/* ─────────────────────────────────
   ATAJOS DE TECLADO (overlay info)
───────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: 0 2px 0 var(--border-strong);
  margin: 0 2px;
  min-width: 18px;
}

.kbd-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: .78rem;
  color: var(--muted);
  border: 1px dashed var(--border);
}
.kbd-hints span { display: inline-flex; align-items: center; gap: 4px; }

/* Indicador de tecla pulsada en las opciones del quiz */
.option .letter {
  position: relative;
}
.option:not(:disabled):hover .letter {
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ─────────────────────────────────
   ENLACES EN FOOTER E ICONOS
───────────────────────────────── */
.share-icon {
  width: 12px; height: 12px;
  display: inline-block;
  vertical-align: middle;
}

/* ─────────────────────────────────
   MODAL DE TESTS: opciones avanzadas
───────────────────────────────── */
.test-mode-pick {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.test-mode-pick label {
  flex: 1;
  min-width: 130px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--surface);
  transition: all .18s;
  font-size: .82rem;
  text-align: center;
}
.test-mode-pick label:hover { border-color: var(--accent-mid); }
.test-mode-pick input[type="radio"] { display: none; }
.test-mode-pick input[type="radio"]:checked + label,
.test-mode-pick label.checked {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

/* ─────────────────────────────────
   TIMER DE EXAMEN
───────────────────────────────── */
.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: .04em;
}
.quiz-timer.warning {
  background: var(--amber-light);
  color: var(--amber);
  animation: pulseWarn 1.2s infinite;
}
.quiz-timer.danger {
  background: var(--red-light);
  color: var(--red);
  animation: pulseWarn .8s infinite;
}
@keyframes pulseWarn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ─────────────────────────────────
   PÁGINA "MI PROGRESO"
───────────────────────────────── */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.progress-tema-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.progress-tema-card h4 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}
.progress-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.progress-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  margin-top: 12px;
}
.history-table th,
.history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px dashed var(--border);
}
.history-table th {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.history-table .pct {
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
}
.history-table .pct.good { background: var(--green-light); color: var(--green); }
.history-table .pct.bad { background: var(--red-light); color: var(--red); }
.history-table .pct.mid { background: var(--accent-light); color: var(--accent); }

/* ─────────────────────────────────
   MINI-MAPA DE NAVEGACIÓN (PC)
───────────────────────────────── */
.minimap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 130px;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-md);
  z-index: 90;
  display: none;
  max-height: 60vh;
  overflow-y: auto;
}
:root[data-theme="dark"] .minimap {
  background: rgba(31, 17, 26, .95);
}
@media (min-width: 1280px) {
  .minimap { display: block; }
}
.minimap-title {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  text-align: center;
}
.minimap-bar {
  height: 3px;
  background: var(--accent-light);
  border-radius: 2px;
  margin-bottom: 3px;
  cursor: pointer;
  transition: background .18s, height .18s;
  position: relative;
}
.minimap-bar:hover { background: var(--accent-mid); height: 5px; }
.minimap-bar.active { background: var(--accent); height: 5px; }
.minimap-bar.read::after {
  content: '';
  position: absolute;
  right: -2px; top: -2px;
  width: 5px; height: 5px;
  background: var(--green);
  border-radius: 50%;
}

/* ─────────────────────────────────
   GLOSARIO (tooltips)
───────────────────────────────── */
.glossary {
  border-bottom: 1.5px dotted var(--accent-mid);
  cursor: help;
  position: relative;
  color: inherit;
}
.glossary:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-style: normal;
  font-size: .76rem;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  line-height: 1.4;
  font-weight: 400;
  pointer-events: none;
}
:root[data-theme="dark"] .glossary:hover::after {
  background: var(--text);
  color: var(--bg);
}

/* ─────────────────────────────────
   PRINT styles (imprimir bien los temas)
───────────────────────────────── */
@media print {
  .topnav, .sidebar, .sidebar-overlay, .hamburger, .search-wrap,
  .art-copy, .art-flags, .art-toggle, .theme-toggle, .minimap,
  #cam-toast-container, .to-top { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; max-width: 100% !important; }
  .article { page-break-inside: avoid; border: 1px solid #ccc !important; box-shadow: none !important; }
  .art-body { display: block !important; background: white !important; }
  body { background: white !important; color: #000 !important; }
}

/* ─────────────────────────────────
   STREAK BADGE 🔥
───────────────────────────────── */
.streak-card {
  background: linear-gradient(135deg, #ff9800 0%, #c0305a 100%);
  color: #fff;
  border-radius: 18px;
  padding: 22px 26px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 10px 28px rgba(192, 48, 90, .25);
  position: relative;
  overflow: hidden;
}
.streak-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
  pointer-events: none;
}
.streak-flame {
  font-size: 2.5rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.2));
  animation: flicker 2.5s infinite;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.08) rotate(2deg); }
}
.streak-info { flex: 1; position: relative; z-index: 1; }
.streak-num {
  font-family: 'Playfair Display', serif;
  font-size: 2.6rem; font-weight: 700; line-height: 1;
}
.streak-num small { font-size: 1rem; font-weight: 400; opacity: .85; margin-left: 6px; }
.streak-label {
  font-size: .8rem; letter-spacing: .08em;
  text-transform: uppercase; opacity: .9;
  margin-top: 6px;
}
.streak-best {
  font-size: .76rem; opacity: .82; margin-top: 4px;
}
.streak-card.cold {
  background: linear-gradient(135deg, #5b3a48 0%, #8a6070 100%);
}
.streak-card.cold .streak-flame { animation: none; opacity: .4; }

/* Calendar mini ─ últimos 30 días */
.streak-calendar {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.streak-day {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255, 255, 255, .14);
}
.streak-day.active { background: rgba(255, 255, 255, .85); }

/* ─────────────────────────────────
   LOGROS 🏆
───────────────────────────────── */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.achievement {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
}
.achievement.locked {
  opacity: .35;
  filter: grayscale(.7);
}
.achievement.unlocked {
  border-color: var(--accent-mid);
  box-shadow: var(--shadow-sm);
}
.achievement.unlocked:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.achievement-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
  line-height: 1;
}
.achievement-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: .88rem;
  color: var(--text);
  margin-bottom: 4px;
}
.achievement-desc {
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.4;
}
.achievement.unlocked::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  width: 18px; height: 18px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─────────────────────────────────
   GRÁFICO DE EVOLUCIÓN (SVG)
───────────────────────────────── */
.evolution-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.evolution-chart h4 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  margin-bottom: 14px;
  color: var(--text);
}
.evolution-chart svg {
  width: 100%;
  height: 180px;
  display: block;
}
.evo-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.evo-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.evo-area { fill: var(--accent-light); opacity: .6; }
.evo-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
  cursor: pointer;
  transition: r .15s;
}
.evo-dot:hover { r: 6; fill: var(--accent); }
.evo-label {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: .68rem;
  fill: var(--muted);
}

/* ─────────────────────────────────
   NOTAS POR ARTÍCULO 📝
───────────────────────────────── */
.art-note-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: .75rem;
  color: var(--muted);
  cursor: pointer;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .18s;
}
.art-note-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}
.art-note-btn.has-note {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
  font-weight: 600;
}
.art-note-panel {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 4px solid var(--amber);
  border-radius: 0 10px 10px 0;
  display: none;
}
.art-note-panel.open { display: block; }
.art-note-panel textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: .88rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
}
.art-note-panel textarea:focus {
  outline: none;
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px rgba(192, 48, 90, .12);
}
.art-note-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.art-note-actions .note-save {
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .03em;
}
.art-note-actions .note-cancel {
  background: transparent;
  color: var(--muted);
  border: none;
  font-family: inherit;
  font-size: .76rem;
  cursor: pointer;
}
.art-note-actions .note-meta {
  font-size: .7rem;
  color: var(--muted);
  font-style: italic;
}

/* ─────────────────────────────────
   BOTÓN "SIGUIENTE ARTÍCULO"
───────────────────────────────── */
.next-art-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  color: var(--accent);
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: .82rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s;
}
.next-art-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  transform: translateX(4px);
}

/* ─────────────────────────────────
   BANNER TEST INACABADO
───────────────────────────────── */
.resume-banner {
  background: linear-gradient(135deg, #fdf3e3 0%, #fce8ef 100%);
  border: 1px solid var(--amber);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
:root[data-theme="dark"] .resume-banner {
  background: linear-gradient(135deg, #2a2014 0%, #3a1a25 100%);
}
.resume-banner .ic {
  font-size: 1.8rem;
}
.resume-banner .resume-info {
  flex: 1;
  min-width: 180px;
}
.resume-banner .resume-info b {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: .98rem;
  color: var(--text);
  margin-bottom: 2px;
}
.resume-banner .resume-info span {
  font-size: .8rem;
  color: var(--muted);
}
.resume-banner button {
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}
.resume-banner .resume-continue {
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  color: #fff;
  box-shadow: 0 6px 14px rgba(192,48,90,.25);
}
.resume-banner .resume-discard {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ─────────────────────────────────
   FLASHCARDS
───────────────────────────────── */
.flashcard-stage {
  perspective: 1400px;
  margin: 30px auto;
  max-width: 640px;
  min-height: 340px;
}
.flashcard {
  position: relative;
  width: 100%;
  min-height: 340px;
  cursor: pointer;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,.2,.2,1);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 12px 30px rgba(192, 48, 90, .14);
}
.flashcard-face.back {
  transform: rotateY(180deg);
  overflow-y: auto;
  text-align: left;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: 30px;
}
.flashcard-tag {
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 18px;
  background: var(--accent-light);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid #f3c1d2;
  align-self: center;
}
.flashcard-face.back .flashcard-tag {
  background: var(--green-light);
  color: var(--green);
  border-color: #9ecdb5;
}
.flashcard-q {
  font-family: 'Playfair Display', serif !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  line-height: 1.4 !important;
  max-width: 480px;
  margin: 0 auto;
}
.flashcard-face.back .flashcard-q {
  font-size: 1.08rem !important;
  font-weight: 600 !important;
  line-height: 1.55 !important;
  max-width: 100%;
  color: var(--green) !important;
}
.flashcard-hint {
  margin-top: 28px !important;
  font-size: .78rem !important;
  color: var(--muted) !important;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.flashcard-hint::before {
  content: '👆';
  font-size: 1rem;
  font-style: normal;
}
.flashcard-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 12px !important;
  margin-top: 28px !important;
  flex-wrap: wrap !important;
}
.flashcard-actions button {
  padding: 11px 22px !important;
  border-radius: 999px !important;
  border: 1.5px solid var(--border) !important;
  background: var(--surface) !important;
  cursor: pointer !important;
  font-family: 'Source Serif 4', Georgia, serif !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  transition: all .2s !important;
  letter-spacing: .01em;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.flashcard-actions button:hover {
  border-color: var(--accent-mid) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 18px rgba(192,48,90,.18) !important;
}
.flashcard-actions .fc-known {
  color: #fff !important;
  background: linear-gradient(135deg, var(--green), #4d9d77) !important;
  border-color: var(--green) !important;
  box-shadow: 0 6px 14px rgba(45, 106, 79, .35) !important;
}
.flashcard-actions .fc-known:hover {
  box-shadow: 0 10px 20px rgba(45, 106, 79, .45) !important;
}
.flashcard-actions .fc-doubt {
  color: #fff !important;
  background: linear-gradient(135deg, var(--amber), #c87a2a) !important;
  border-color: var(--amber) !important;
  box-shadow: 0 6px 14px rgba(154, 92, 26, .3) !important;
}
.flashcard-actions .fc-doubt:hover {
  box-shadow: 0 10px 20px rgba(154, 92, 26, .4) !important;
}
.flashcard-progress {
  text-align: center !important;
  font-size: .82rem !important;
  color: var(--muted) !important;
  margin-bottom: 18px !important;
  letter-spacing: .04em;
  font-family: 'Source Serif 4', Georgia, serif !important;
}
.flashcard-progress::before {
  content: '🎴 ';
  margin-right: 4px;
}

/* ─────────────────────────────────
   WELCOME OVERLAY (primera visita)
───────────────────────────────── */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 26, 34, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .35s ease;
}
.welcome-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  animation: slideUp .4s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.welcome-card .emoji {
  font-size: 3.2rem;
  display: block;
  margin-bottom: 12px;
}
.welcome-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  color: var(--text);
  margin-bottom: 8px;
}
.welcome-card p {
  color: var(--muted);
  line-height: 1.65;
  font-size: .94rem;
  margin-bottom: 22px;
}
.welcome-steps {
  text-align: left;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.welcome-steps li {
  padding: 8px 0;
  font-size: .88rem;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.welcome-steps li::before {
  content: '✓';
  background: var(--accent);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.welcome-card .btn-start {
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  color: #fff;
  border: none;
  padding: 13px 30px;
  border-radius: 999px;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(192,48,90,.32);
}

/* ─────────────────────────────────
   PREGUNTAS SIN CONTESTAR (mini-mapa quiz)
───────────────────────────────── */
.quiz-minimap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.qm-dot {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: .7rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  color: var(--muted);
  transition: all .15s;
}
.qm-dot:hover { transform: scale(1.15); }
.qm-dot.answered { background: var(--accent); color: #fff; border-color: var(--accent); }
.qm-dot.current { box-shadow: 0 0 0 2.5px var(--accent-mid); transform: scale(1.1); }
.qm-dot.skipped { background: var(--red-light); border-color: var(--red); color: var(--red); }
.qm-dot.flagged::after {
  content: '🔖';
  position: absolute;
  font-size: .5rem;
  margin-left: 15px;
  margin-top: -10px;
}

/* ─────────────────────────────────
   FIXES VISUALES (mejora #6)
───────────────────────────────── */
/* Toast: que cierre antes si llegan más */
#cam-toast-container .cam-toast + .cam-toast { margin-top: -20px; }

/* Opciones dim en modo oscuro */
:root[data-theme="dark"] .option.dim {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  opacity: .55;
}

/* Mini-mapa: hover más visible */
.minimap-bar { position: relative; }
.minimap-bar:hover::before {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: .68rem;
  white-space: nowrap;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  pointer-events: none;
}

/* ─────────────────────────────────
   PÁGINA 404
───────────────────────────────── */
.error-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.error-404 .big {
  font-family: 'Playfair Display', serif;
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-mid) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 14px;
}
.error-404 h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  margin-bottom: 10px;
  color: var(--text);
}
.error-404 p { color: var(--muted); margin-bottom: 30px; max-width: 460px; line-height: 1.65; }
