/* ============================================================
   Escalón · sistema de diseño
   Dirección: "instrumento de estudio académico" — editorial,
   sobrio y preciso. Serif (Crimson Pro) para titulares y preguntas;
   sans cálida (Hanken Grotesk) para la interfaz. Paleta pizarra
   con un único acento índigo. Tema claro/oscuro.
   ============================================================ */

:root {
  /* tipografía · Poppins (interfaz y titulares) — StudyCards */
  --font-sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* color · claro (StudyCards: fondos claros, azul primario) */
  --bg:          #f8fafc;
  --bg-2:        #f1f5f9;
  --surface:     #ffffff;
  --surface-2:   #f1f5f9;
  --surface-3:   #e2e8f0;
  --ink:         #1e293b;  /* slate-800 */
  --ink-2:       #475569;  /* slate-600 */
  --ink-3:       #64748b;  /* slate-500 · AA sobre blanco */
  --line:        #e2e8f0;  /* slate-200 */
  --line-2:      #eef2f7;
  --brand:       #2563eb;  /* blue-600 */
  --brand-2:     #3b82f6;  /* blue-500 */
  --accent:      #3b82f6;  /* azul primario */
  --accent-2:    #60a5fa;  /* blue-400 */
  --accent-soft: #dbeafe;  /* blue-100 */
  --accent-ink:  #ffffff;
  --gold:        #d9920a;  --gold-soft: #fef3c7;  /* ámbar (insignias/estrellas) */
  --ok:          #16a34a;  --ok-soft:  #dcfce7;   /* verde éxito */
  --warn:        #d97706;  --warn-soft:#fef3c7;   /* ámbar advertencia */
  --danger:      #ef4444;  --danger-soft:#fee2e2; /* rojo error */
  --flame:       #f97316;  /* naranja (racha) */

  /* textura muy sutil (apenas perceptible, el kit es plano) */
  --grain-opacity: .022;

  --shadow-1: 0 1px 2px rgba(15,23,42,.04), 0 2px 8px rgba(15,23,42,.05);
  --shadow-2: 0 4px 12px rgba(15,23,42,.07), 0 14px 34px rgba(15,23,42,.09);
  --shadow-3: 0 24px 60px rgba(15,23,42,.18);

  --r-lg: 20px; --r-md: 14px; --r-sm: 10px; --r-pill: 999px;
  --topbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --maxw: 900px;
  --ease: cubic-bezier(.22,.68,.28,1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* StudyCards oscuro: slate profundo + azul que brilla */
  --bg:          #0f172a;  /* slate-900 */
  --bg-2:        #131d33;
  --surface:     #1e293b;  /* slate-800 */
  --surface-2:   #273449;
  --surface-3:   #334155;  /* slate-700 */
  --ink:         #f1f5f9;
  --ink-2:       #cbd5e1;  /* slate-300 */
  --ink-3:       #94a3b8;  /* slate-400 */
  --line:        #334155;
  --line-2:      #273449;
  --brand:       #93c5fd;
  --brand-2:     #60a5fa;
  --accent:      #60a5fa;  /* blue-400 */
  --accent-2:    #93c5fd;
  --accent-soft: #1e3a5f;
  --accent-ink:  #0b1324;
  --gold:        #fbbf24;  --gold-soft: #3a2e0a;
  --ok:          #4ade80;  --ok-soft:  #10331f;
  --warn:        #fbbf24;  --warn-soft:#3a2e0a;
  --danger:      #f87171;  --danger-soft:#3b1717;
  --flame:       #fb923c;
  --grain-opacity: .03;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 2px 8px rgba(0,0,0,.45), 0 16px 34px rgba(0,0,0,.45);
  --shadow-3: 0 26px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1000px 440px at 100% -15%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px; line-height: 1.5;
  font-feature-settings: 'kern' 1, 'liga' 1;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
/* grano de papel: capa fija, muy sutil, sobre todo el fondo (no intercepta clics) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: soft-light;
}
:root[data-theme="dark"] body::before { mix-blend-mode: overlay; }
/* el contenido principal vive por encima del grano (las barras/fab/overlays
   ya son fixed con z-index mayor, así que quedan por encima por sí mismas) */
.app-main { position: relative; z-index: 1; }
h1, h2, h3, .serif { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.01em; }
button { font-family: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* foco visible para teclado (accesibilidad) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .icon-btn:focus-visible, .menu-item:focus-visible, .grade-btn:focus-visible,
.search-item:focus-visible, .seg button:focus-visible, .color-swatch:focus-visible, .fab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.deck-card:focus-visible, .folder-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar-h) + var(--safe-top)); padding-top: var(--safe-top);
  display: flex; align-items: center; gap: 6px; padding-inline: 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.3) blur(14px); -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(155deg, var(--brand), var(--accent)); color: #fff; box-shadow: var(--shadow-1); }
.brand-mark svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.brand-text { font-family: var(--font-serif); font-weight: 600; font-size: 1.14rem; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 1px; }

.icon-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: none;
  border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.93); }
.icon-btn.spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.app-main { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px calc(104px + var(--safe-bottom)); }
.view-enter { animation: viewIn .32s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- botón flotante ---------- */
.fab { position: fixed; right: 18px; bottom: calc(20px + var(--safe-bottom)); z-index: 25;
  width: 60px; height: 60px; border-radius: 21px; border: none; cursor: pointer; color: #fff;
  background: linear-gradient(158deg, var(--brand-2), var(--accent)); box-shadow: var(--shadow-3);
  display: grid; place-items: center; transition: transform .16s var(--ease), box-shadow .16s; }
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(.92); }
.fab svg { width: 27px; height: 27px; stroke-width: 2.2; }

/* ---------- botones ---------- */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 12px; padding: 11px 16px; font-size: .94rem; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 16%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-1); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 90%, #000); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: .84rem; border-radius: 10px; }
.btn.lg { padding: 14px 20px; font-size: 1rem; border-radius: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- panel HOY (dashboard) ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 20px; margin-bottom: 22px;
  color: #fff; background: linear-gradient(150deg, var(--brand) 0%, var(--accent) 135%); box-shadow: var(--shadow-2); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 200px at 88% -20%, rgba(255,255,255,.16), transparent 70%); }
.hero .greeting { font-size: .82rem; opacity: .92; letter-spacing: .02em; }
.hero .hero-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero .hero-main { min-width: 0; }
.hero h1 { font-size: 1.9rem; margin: 2px 0 2px; color: #fff; line-height: 1.1; }
.hero .hero-sub { font-size: .9rem; opacity: .96; }
.hero .cta { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .cta .btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); color: #fff;
  backdrop-filter: blur(4px); }
.hero .cta .btn.solid { background: #fff; color: var(--brand); border-color: #fff; font-weight: 600; }
.hero .cta .btn:hover { background: rgba(255,255,255,.24); }
.hero .cta .btn.solid:hover { background: rgba(255,255,255,.9); }

/* anillo de meta diaria */
.ring { position: relative; flex: none; width: 84px; height: 84px; }
.ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255,255,255,.22); }
.ring .fill { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring .ring-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .ring-num b { font-family: var(--font-serif); font-size: 1.35rem; line-height: 1; }
.ring .ring-num span { font-size: .62rem; opacity: .85; }

/* fila de estadísticas bajo el héroe */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 13px 14px; box-shadow: var(--shadow-1); }
.stat .k { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: .74rem; font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.stat .k svg { width: 15px; height: 15px; }
.stat .v { font-family: var(--font-serif); font-size: 1.6rem; margin-top: 3px; display: flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.stat .v small { font-family: var(--font-sans); font-size: .72rem; font-weight: 500; color: var(--ink-3); }
.stat.flame .v { color: var(--flame); }

/* ---------- encabezado de sección ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 2px 2px 14px; }
.section-head h2 { font-size: 1.3rem; margin: 0; }
.section-head .sub { color: var(--ink-3); font-size: .82rem; font-variant-numeric: tabular-nums; }

/* ---------- rejilla de mazos ---------- */
.deck-grid { display: grid; gap: 13px; grid-template-columns: 1fr; }
@media (min-width: 580px) { .deck-grid { grid-template-columns: 1fr 1fr; } }
.deck-card { position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 17px 18px 16px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow-1);
  transition: transform .16s var(--ease), box-shadow .16s, border-color .16s; animation: cardIn .4s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.deck-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line); }
.deck-card:active { transform: translateY(-1px) scale(.995); }
.deck-card .accent-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dc, var(--accent)); }
.deck-card h3 { font-size: 1.12rem; margin: 0 0 3px; padding-left: 8px; line-height: 1.25; }
.deck-card .desc { color: var(--ink-2); font-size: .85rem; padding-left: 8px; min-height: 1.2em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deck-card .progress { margin: 13px 0 10px; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin-left: 8px; }
.deck-card .progress > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--dc, var(--accent)); transition: width .5s var(--ease); }
.deck-card .meta { display: flex; align-items: center; gap: 12px; padding-left: 8px; color: var(--ink-3); font-size: .78rem; font-variant-numeric: tabular-nums; }
.deck-card .meta .pill { display: inline-flex; align-items: center; gap: 5px; }
.deck-card .meta .pill svg { width: 15px; height: 15px; }
.deck-card .meta .grow { flex: 1; }
.deck-card .badge { position: absolute; top: 14px; right: 14px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill);
  background: var(--dc, var(--accent)); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }

/* ---------- tarjeta de curso (carpeta) ---------- */
.folder-card { position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 16px 18px; cursor: pointer; box-shadow: var(--shadow-1); overflow: hidden;
  transition: transform .16s var(--ease), box-shadow .16s, border-color .16s; animation: cardIn .4s var(--ease) both; }
.folder-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--dc, var(--accent)); }
.folder-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line); }
.folder-card:active { transform: translateY(-1px) scale(.995); }
.folder-top { display: flex; align-items: center; gap: 12px; }
.folder-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--dc, var(--accent)) 15%, var(--surface)); color: var(--dc, var(--accent)); }
.folder-ic svg { width: 22px; height: 22px; }
.folder-name { flex: 1; min-width: 0; }
.folder-name h3 { margin: 0; font-size: 1.1rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-meta { color: var(--ink-3); font-size: .8rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.folder-card .badge { position: static; }
.folder-card .progress { margin: 13px 0 8px; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.folder-card .progress > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--dc, var(--accent)); transition: width .5s var(--ease); }
.folder-foot { display: flex; justify-content: space-between; color: var(--ink-3); font-size: .78rem; font-variant-numeric: tabular-nums; }

/* ---------- cabecera de la vista de curso ---------- */
.folder-hero { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 18px;
  box-shadow: var(--shadow-1); margin-bottom: 22px; position: relative; overflow: hidden; }
.folder-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--dc, var(--accent)); }
.fh-head { display: flex; align-items: flex-start; gap: 13px; }
.fh-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--dc, var(--accent)) 16%, var(--surface)); color: var(--dc, var(--accent)); }
.fh-ic svg { width: 26px; height: 26px; }
.fh-head h1 { font-size: 1.4rem; margin: 0; line-height: 1.2; }
.fh-head p { margin: 4px 0 0; color: var(--ink-2); font-size: .88rem; line-height: 1.5; }
.fh-progress { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; }
.fh-bar { flex: 1; height: 9px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.fh-bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--dc, var(--accent)); transition: width .5s var(--ease); }
.fh-progress > span { font-variant-numeric: tabular-nums; font-weight: 600; font-family: var(--font-serif); }
.fh-meta { color: var(--ink-3); font-size: .82rem; font-variant-numeric: tabular-nums; }
.fh-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.fh-cta .btn.solid { background: var(--dc, var(--accent)); border-color: var(--dc, var(--accent)); color: #fff; }

/* ---------- estado vacío ---------- */
.empty { text-align: center; padding: 54px 20px; color: var(--ink-3); }
.empty .glyph { width: 82px; height: 82px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--accent); box-shadow: var(--shadow-1); }
.empty .glyph svg { width: 36px; height: 36px; }
.empty h2 { color: var(--ink); font-size: 1.25rem; margin: 0 0 8px; }
.empty p { margin: 0 auto 20px; max-width: 36ch; line-height: 1.55; }

/* ---------- barra de herramientas + lista de cartas ---------- */
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

.card-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 11px 13px; margin-bottom: 8px; box-shadow: var(--shadow-1);
  transition: border-color .15s, transform .1s; animation: cardIn .35s var(--ease) both; }
.card-row:hover { border-color: var(--line); }
.card-row .num { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-weight: 600; font-size: .82rem; font-variant-numeric: tabular-nums; }
.card-row .body { flex: 1; min-width: 0; cursor: pointer; }
.card-row .q { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row .a { color: var(--ink-3); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row .thumb { flex: none; width: 42px; height: 42px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); }
.card-row .row-actions { display: flex; gap: 1px; }
.card-row .due-chip { flex: none; font-size: .68rem; padding: 3px 8px; border-radius: var(--r-pill); font-weight: 600; letter-spacing: .01em; }
.due-new { background: var(--accent-soft); color: var(--accent); }
.due-now { background: var(--danger-soft); color: var(--danger); }
.due-ok  { background: var(--ok-soft); color: var(--ok); }
.drag-handle { cursor: grab; color: var(--ink-3); touch-action: none; display: grid; place-items: center; }
.card-row.dragging { opacity: .35; }

/* ---------- estudio ---------- */
.study-wrap { display: flex; flex-direction: column; min-height: calc(100dvh - var(--topbar-h) - var(--safe-top) - 36px); }
.study-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.study-top .bar { flex: 1; height: 7px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.study-top .bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--brand-2), var(--accent)); transition: width .35s var(--ease); }
.study-top .count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .84rem; font-weight: 550; }
.study-top .deck-tag { font-size: .78rem; color: var(--ink-3); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fc-stage { flex: 1; perspective: 1800px; display: flex; }
.flashcard { flex: 1; background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px;
  box-shadow: var(--shadow-2); padding: 26px 24px; display: flex; flex-direction: column; min-height: 48vh;
  cursor: pointer; position: relative; overflow: hidden; user-select: none;
  transition: transform .19s var(--ease), opacity .19s var(--ease); transform-style: preserve-3d; }
.flashcard.turning { transform: rotateY(90deg); opacity: 0; }
.flashcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--brand-2), var(--accent)); opacity: .9; }
.flashcard .fc-label { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.flashcard .fc-hint-badge { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-bottom: 12px;
  padding: 5px 11px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2); font-size: .8rem; }
.flashcard .fc-hint-badge svg { width: 15px; height: 15px; }
.flashcard .fc-question { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 500; line-height: 1.34; color: var(--ink); margin: 2px 0; max-width: 60ch; }
.fc-stage .flashcard > .fc-question, .flashcard .fc-scroll { width: 100%; max-width: 62ch; margin-inline: auto; }
.flashcard .fc-image { margin: 16px 0 4px; text-align: center; }
.flashcard .fc-image img { max-width: 100%; max-height: 40vh; border-radius: 14px; border: 1px solid var(--line); }
.flashcard .fc-answer { font-size: 1.12rem; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }
.flashcard .fc-answer.serif-a { font-family: var(--font-serif); font-size: 1.2rem; }
.flashcard .reveal-hint { margin-top: auto; text-align: center; color: var(--ink-3); font-size: .84rem;
  display: flex; align-items: center; justify-content: center; gap: 8px; padding-top: 18px; }
.flashcard .reveal-hint svg { width: 17px; height: 17px; }
.flashcard .fc-scroll { overflow-y: auto; margin-top: auto; }

.grade-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; padding-bottom: var(--safe-bottom); }
.grade-btn { border: 1px solid var(--line); border-radius: 15px; padding: 11px 4px 9px; background: var(--surface); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink); transition: transform .1s, border-color .15s, background .15s; }
.grade-btn:hover { background: var(--surface-2); }
.grade-btn:active { transform: translateY(2px); }
.grade-btn .g-key { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; }
.grade-btn .g-lbl { font-size: .74rem; color: var(--ink-2); font-weight: 550; }
.grade-btn .g-eta { font-size: .64rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.grade-btn[data-g="again"] { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.grade-btn[data-g="again"] .g-key { color: var(--danger); }
.grade-btn[data-g="hard"] .g-key { color: var(--warn); }
.grade-btn[data-g="good"] .g-key { color: var(--accent); }
.grade-btn[data-g="easy"] .g-key { color: var(--ok); }
.reveal-btn { margin-top: 14px; }

.study-done { text-align: center; padding: 40px 16px; }
.study-done .glyph { width: 90px; height: 90px; border-radius: 28px; margin: 0 auto 18px; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); animation: pop .45s var(--ease) both; }
.study-done .glyph.info { background: var(--accent-soft); color: var(--accent); }
.study-done .glyph svg { width: 42px; height: 42px; }
.study-done h2 { font-size: 1.5rem; margin: 0 0 8px; }
.study-done .stats-line { display: flex; justify-content: center; gap: 26px; margin: 20px 0 26px; }
.study-done .stats-line .s b { font-family: var(--font-serif); display: block; font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.study-done .stats-line .s span { color: var(--ink-3); font-size: .78rem; }

/* ---------- hojas modales ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(8,12,20,.5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; animation: fadeBg .2s ease; }
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 640px) { .overlay { align-items: center; padding: 20px; } }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 26px 26px 0 0; box-shadow: var(--shadow-3); max-height: 92dvh; overflow-y: auto;
  padding: 6px 20px calc(22px + var(--safe-bottom)); animation: sheetUp .28s var(--ease) both; }
@media (min-width: 640px) { .sheet { border-radius: 24px; animation: pop .22s var(--ease) both; } }
@keyframes sheetUp { from { transform: translateY(40px); } to { transform: none; } }
@keyframes pop { from { transform: scale(.96); opacity: .3; } to { transform: none; opacity: 1; } }
.sheet .grabber { width: 42px; height: 4px; border-radius: var(--r-pill); background: var(--line); margin: 10px auto 4px; }
@media (min-width: 640px) { .sheet .grabber { display: none; } }
.sheet h2 { font-size: 1.3rem; margin: 10px 2px 16px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 12px;
  padding: 12px 13px; font-size: 1rem; font-family: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: .77rem; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }

.color-picker { display: flex; gap: 9px; flex-wrap: wrap; }
.color-swatch { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .12s; }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }

.img-drop { border: 1.5px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; color: var(--ink-3);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: border-color .15s, background .15s, color .15s; }
.img-drop:hover { border-color: var(--accent); background: var(--bg-2); color: var(--accent); }
.img-drop svg { width: 20px; height: 20px; }
.img-preview { position: relative; margin-top: 10px; }
.img-preview img { max-width: 100%; max-height: 210px; border-radius: 13px; border: 1px solid var(--line); display: block; margin: 0 auto; }
.img-preview .rm { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.62); color: #fff; border: none; border-radius: 9px;
  width: 32px; height: 32px; cursor: pointer; display: grid; place-items: center; }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn.grow0 { flex: none; }

/* menú de opciones en hoja */
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; margin-bottom: 8px;
  border: 1px solid var(--line-2); border-radius: 13px; background: var(--surface-2); color: var(--ink); cursor: pointer;
  font-size: .95rem; font-weight: 550; transition: background .15s, border-color .15s; }
.menu-item:hover { background: var(--surface-3); border-color: var(--line); }
.menu-item svg { width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.menu-item.danger { color: var(--danger); } .menu-item.danger svg { color: var(--danger); }
.menu-item .mi-sub { display: block; font-size: .78rem; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.menu-item .grow { flex: 1; }

/* ---------- cuenta / sync ---------- */
.acc-status { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line-2); margin-bottom: 16px; }
.acc-status .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.acc-status .dot.on { color: var(--ok); background: var(--ok); }
.acc-status .dot.off { color: var(--ink-3); background: var(--ink-3); }
.acc-status .dot.err { color: var(--danger); background: var(--danger); }
.acc-status .txt { flex: 1; min-width: 0; } .acc-status .txt b { display: block; }
.acc-status .txt span { font-size: .8rem; color: var(--ink-3); }
.seg { display: flex; background: var(--surface-3); border-radius: 13px; padding: 4px; margin-bottom: 18px; }
.seg button { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 10px; cursor: pointer;
  color: var(--ink-2); font-weight: 600; font-size: .9rem; font-family: inherit; transition: background .15s, color .15s; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- onboarding ---------- */
.onb { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 20px) 22px calc(var(--safe-bottom) + 22px); }
.onb .slides { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 460px; margin: 0 auto; width: 100%; }
.onb-slide { text-align: center; animation: viewIn .4s var(--ease) both; }
.onb-art { width: 132px; height: 132px; margin: 0 auto 26px; border-radius: 34px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(155deg, var(--brand), var(--accent)); box-shadow: var(--shadow-3); }
.onb-art svg { width: 62px; height: 62px; stroke-width: 1.7; }
.onb-slide h2 { font-size: 1.7rem; margin: 0 0 12px; }
.onb-slide p { color: var(--ink-2); font-size: 1.02rem; line-height: 1.6; margin: 0 auto; max-width: 34ch; }
.onb-dots { display: flex; gap: 8px; justify-content: center; margin: 30px 0 22px; }
.onb-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: width .25s, background .25s; }
.onb-dots i.on { width: 24px; border-radius: var(--r-pill); background: var(--accent); }
.onb .actions { max-width: 460px; margin: 0 auto; width: 100%; display: flex; gap: 12px; }

/* ---------- toasts ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--safe-bottom)); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 11px 17px; border-radius: 13px; font-size: .88rem; font-weight: 500;
  box-shadow: var(--shadow-3); animation: toastIn .22s var(--ease) both; max-width: 90vw; display: flex; align-items: center; gap: 8px; }
.toast.ok { background: var(--ok); color: #fff; } .toast.err { background: var(--danger); color: #fff; }
.toast svg { width: 17px; height: 17px; }
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- celebración ---------- */
.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .9;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: 1; } }

/* ---------- utilidades ---------- */
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.spin-inline { display: inline-block; animation: spin 1s linear infinite; }
kbd { font-family: var(--font-sans); font-size: .76rem; background: var(--surface-3); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }

/* ---------- texto enriquecido (preguntas/respuestas) ---------- */
.rt-p { margin: 0 0 2px; }
.rt-gap { height: .55em; }
.rt-list { margin: 4px 0 4px; padding-left: 1.35em; }
.rt-list li { margin: 2px 0; }
.fc-answer strong, .fc-question strong, .rt-pv-a strong, .rt-pv-q strong { font-weight: 700; }
.fc-answer code, .fc-question code, .rt-pv-a code, .rt-pv-q code, .card-row code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .9em;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .82em; line-height: 1.05; margin: 0 .12em; }
.frac .num { border-bottom: 1.4px solid currentColor; padding: 0 .3em; }
.frac .den { padding: 0 .3em; }
.radic { border-top: 1.4px solid currentColor; padding: 0 .18em; margin-left: 1px; }
sup, sub { font-size: .72em; line-height: 0; }
.cloze-blank { display: inline-block; min-width: 2.4em; text-align: center; color: var(--accent); font-weight: 700;
  border-bottom: 2px solid var(--accent); border-radius: 2px; background: var(--accent-soft); padding: 0 4px; }
.cloze-fill { color: var(--accent); font-weight: 700; background: var(--accent-soft); border-radius: 4px; padding: 0 4px; }
.fc-recall { font-family: var(--font-serif); font-size: 1.12rem; color: var(--ink-2); margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px dashed var(--line); }

/* vista previa en el editor */
.rt-preview { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 13px; min-height: 48px; line-height: 1.55; }
.rt-pv-label { font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.rt-pv-q { font-family: var(--font-serif); font-size: 1.05rem; }
.rt-pv-a { font-size: .98rem; white-space: pre-wrap; }

/* consejos de tarjetas */
.tips-list { margin: 0 0 16px; padding-left: 1.2em; }
.tips-list li { margin: 8px 0; line-height: 1.5; color: var(--ink); }
.tips-list code { font-family: ui-monospace, monospace; font-size: .88em; background: var(--surface-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.rt-help { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; }
.rt-help-title { font-weight: 600; margin-bottom: 10px; font-size: .9rem; }
.rt-help-grid { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: center; }
.rt-help-grid code { font-family: ui-monospace, monospace; font-size: .82rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; color: var(--accent); }
.rt-help-grid span { font-size: .84rem; color: var(--ink-2); }

/* segmento pequeño (posición de imagen) */
.seg.seg-sm { margin-bottom: 0; padding: 3px; }
.seg.seg-sm button { padding: 7px; font-size: .82rem; }

/* buscador */
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 12px; margin-bottom: 12px; }
.search-box svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.search-box input { flex: 1; border: none; background: transparent; padding: 11px 0; font-size: .95rem; color: var(--ink); outline: none; font-family: inherit; }

/* ---------- asa de reordenar ---------- */
.grip { color: var(--ink-3); cursor: grab; touch-action: none; display: grid; place-items: center;
  opacity: .45; transition: opacity .15s, background .15s; border-radius: 9px; width: 40px; height: 40px; }
.grip:hover, .grip:focus-visible { opacity: 1; background: var(--surface-3); }
.grip svg { width: 18px; height: 18px; }
.deck-card > .grip { position: absolute; top: 8px; right: 8px; z-index: 2; }
.folder-top .grip { flex: none; margin: -6px -6px -6px 0; }
.deck-card.dragging, .folder-card.dragging { opacity: .4; box-shadow: var(--shadow-3); }

/* ---------- búsqueda global ---------- */
.search-box.search-lg { padding: 2px 12px; margin-bottom: 16px; }
.search-box.search-lg input { padding: 13px 0; font-size: 1rem; }
.search-clear { border: none; background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px; transform: rotate(45deg); flex: none; }
.search-clear:hover { background: var(--surface-3); color: var(--ink); }
.search-clear svg { width: 18px; height: 18px; }
.search-hint { padding: 40px 20px; }
.search-group { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
  font-weight: 700; margin: 16px 2px 8px; }
.search-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 7px;
  border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-1); transition: border-color .15s, transform .1s; font-family: inherit; }
.search-item:hover { border-color: var(--line); }
.search-item:active { transform: translateY(1px); }
.search-item > svg { width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.search-item .grow { min-width: 0; }
.search-item b { font-weight: 600; }
.search-item.card { align-items: flex-start; }
.si-q { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-crumb { display: block; font-size: .78rem; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- paneles (progreso) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1); }
.panel-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-family: var(--font-serif); font-size: 1.08rem; margin-bottom: 14px; }
.panel-head svg { width: 19px; height: 19px; color: var(--accent); }

/* mapa de calor */
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat-months { display: grid; grid-auto-flow: column; grid-template-columns: repeat(18, 1fr); gap: 3px; margin-bottom: 4px; min-width: 340px; }
.heat-m { font-size: .66rem; color: var(--ink-3); }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; min-width: 340px; }
.heat-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heat-cell { width: 100%; aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }
.heat-cell.heat-empty { background: transparent; }
.heat-cell.h0 { background: var(--surface-3); }
.heat-cell.h1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-3)); }
.heat-cell.h2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-3)); }
.heat-cell.h3 { background: color-mix(in srgb, var(--accent) 78%, var(--surface-3)); }
.heat-cell.h4 { background: var(--accent); }
.heat-legend { display: flex; align-items: center; gap: 5px; justify-content: flex-end; margin-top: 10px; font-size: .72rem; color: var(--ink-3); }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; }
.heat-legend i.h0 { background: var(--surface-3); } .heat-legend i.h1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-3)); }
.heat-legend i.h2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-3)); } .heat-legend i.h3 { background: color-mix(in srgb, var(--accent) 78%, var(--surface-3)); }
.heat-legend i.h4 { background: var(--accent); }

/* ---------- logros ---------- */
.panel-head .ach-count { margin-left: auto; font-family: var(--font-sans); font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .ach-grid { grid-template-columns: repeat(3, 1fr); } }
.ach { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 14px 8px;
  border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-2); transition: transform .12s; }
.ach.on { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.ach.off { opacity: .6; }
.ach-badge { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 4px;
  background: var(--surface-3); color: var(--ink-3); }
.ach.on .ach-badge { background: linear-gradient(150deg, var(--brand-2), var(--accent)); color: #fff; box-shadow: var(--shadow-1); }
.ach-badge svg { width: 24px; height: 24px; }
.ach b { font-size: .84rem; line-height: 1.2; }
.ach-desc { font-size: .72rem; color: var(--ink-3); line-height: 1.25; }

.ach-burst { width: 92px; height: 92px; margin: 8px auto 0; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-2), var(--accent)); color: #fff; box-shadow: var(--shadow-3);
  animation: pop .5s var(--ease) both; }
.ach-burst svg { width: 44px; height: 44px; }
.ach-unlock-list { display: flex; flex-direction: column; gap: 9px; margin: 12px 0 4px; }
.ach-unlock { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 13px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.ach-unlock .ach-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-2), var(--accent)); color: #fff; }
.ach-unlock .ach-ic svg { width: 21px; height: 21px; }
.ach-unlock b { display: block; } .ach-unlock span { font-size: .8rem; color: var(--ink-2); }

.fh-meta svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 1px; }

/* dominio por mazo */
.mastery { margin-bottom: 15px; }
.mastery:last-child { margin-bottom: 0; }
.mastery-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.mastery-name { font-weight: 550; }
.mastery-pct { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .9rem; }
.mastery-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.mastery-bar > i { display: block; height: 100%; border-radius: var(--r-pill); transition: width .5s var(--ease); }
.mastery-sub { font-size: .76rem; color: var(--ink-3); margin-top: 4px; }
.mastery-name { display: inline-flex; align-items: center; gap: 7px; }
.mastery-name svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.mastery-course .mastery-name { font-family: var(--font-serif); font-size: 1.02rem; }
.mastery-course { margin-bottom: 8px; }
.mastery-indent { margin-left: 16px; padding-left: 12px; border-left: 2px solid var(--line); }
.mastery-divider { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
  font-weight: 700; margin: 18px 0 10px; }
.menu-item.sel-cur { border-color: var(--accent); background: var(--accent-soft); }
.menu-item.sel-cur svg:last-child { color: var(--accent); margin-left: auto; }

/* ---------- calificación simple (2 botones) ---------- */
.grade-bar.grade-simple { grid-template-columns: 1fr 1fr; }
.grade-simple .grade-btn { padding: 15px 6px; gap: 4px; }
.grade-simple .g-lbl.big { font-size: 1.05rem; font-weight: 700; }
.grade-simple [data-g="again"] .g-lbl { color: var(--warn); }
.grade-simple [data-g="good"] .g-lbl { color: var(--ok); }

/* ---------- opción múltiple (estudio) ---------- */
.flashcard.is-choice { cursor: default; }
.fc-options { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.fc-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 15px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  cursor: pointer; font-family: inherit; font-size: 1rem; transition: border-color .15s, background .15s, transform .1s; }
.fc-opt:not(.answered):hover { border-color: var(--accent); background: var(--bg-2); }
.fc-opt:active { transform: translateY(1px); }
.fc-opt .opt-key { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-weight: 700; font-size: .9rem; }
.fc-opt .opt-text { flex: 1; min-width: 0; }
.fc-opt.answered { cursor: default; }
.fc-opt.opt-correct { border-color: var(--ok); background: var(--ok-soft); }
.fc-opt.opt-correct .opt-key { background: var(--ok); color: #fff; }
.fc-opt.opt-wrong { border-color: var(--danger); background: var(--danger-soft); }
.fc-opt.opt-wrong .opt-key { background: var(--danger); color: #fff; }
.fc-opt.answered:not(.opt-correct):not(.opt-wrong) { opacity: .6; }
.choice-hint { text-align: center; color: var(--ink-3); font-size: .85rem; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 0; }
.choice-hint svg { width: 16px; height: 16px; }
.fc-explain { margin-top: 6px; }

/* ---------- opción múltiple (editor) ---------- */
/* Nota: se acota a .opt-edit-row para no chocar con .fc-opt.opt-correct del estudio. */
.opt-edit-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.opt-edit-row .opt-correct { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); cursor: pointer; background: var(--bg-2); }
.opt-edit-row .opt-correct input { width: 18px; height: 18px; accent-color: var(--ok); cursor: pointer; }
.opt-edit-row .opt-input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font-size: .95rem; font-family: inherit; outline: none; }
.opt-edit-row .opt-input:focus { border-color: var(--accent); }
.opt-del { flex: none; width: 34px; height: 34px; border: none; background: transparent; color: var(--ink-3);
  cursor: pointer; border-radius: 9px; display: grid; place-items: center; }
.opt-del:hover { background: var(--danger-soft); color: var(--danger); }
.opt-del svg { width: 17px; height: 17px; }
.pv-opts { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.pv-opt { font-size: .9rem; color: var(--ink-2); padding: 5px 9px; border-radius: 8px; background: var(--surface-2); }
.pv-opt.ok { color: var(--ok); background: var(--ok-soft); font-weight: 600; }
.type-tag { display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .04em; vertical-align: middle;
  background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: 1px 5px; }

/* ============================================================
   Estudio · experiencia con ambiente (teñido por el color del mazo)
   Da ganas de estudiar: fondo con atmósfera, tarjeta viva, letras
   grandes y bonitas. Todo usa --study (color del mazo en curso).
   ============================================================ */
.study-themed { --study: var(--accent); position: relative; }
.study-themed::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(75% 55% at 10% -8%, color-mix(in srgb, var(--study) 24%, transparent), transparent 62%),
    radial-gradient(65% 55% at 108% 112%, color-mix(in srgb, var(--study) 18%, transparent), transparent 62%);
}

/* barra superior */
.study-themed .study-top .bar > i { background: linear-gradient(90deg, var(--study), color-mix(in srgb, var(--study) 55%, #fff)); }
.study-themed .deck-tag { max-width: 46%; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: .76rem;
  background: color-mix(in srgb, var(--study) 15%, var(--surface)); color: color-mix(in srgb, var(--study) 60%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--study) 28%, transparent); }
.study-themed .study-top .count { font-weight: 700; }

/* la tarjeta como objeto bonito */
.study-themed .flashcard {
  border-radius: 28px; padding: 32px 26px;
  border: 1px solid color-mix(in srgb, var(--study) 22%, var(--line-2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--study) 8%, var(--surface)), var(--surface) 42%);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--study) 22%, transparent), 0 2px 8px rgba(16,24,40,.06);
  animation: cardRise .38s var(--ease) both;
}
@keyframes cardRise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.study-themed .flashcard::before { height: 5px; background: linear-gradient(90deg, var(--study), color-mix(in srgb, var(--study) 45%, var(--accent-2))); opacity: 1; }

/* etiquetas y letras */
.study-themed .fc-label { color: var(--study); letter-spacing: .18em; font-weight: 700; opacity: .95; }
.study-themed .fc-question { font-size: clamp(1.55rem, 5.2vw, 2.1rem); line-height: 1.32; font-weight: 500; letter-spacing: -.01em; }
.study-themed .fc-answer { font-size: 1.16rem; line-height: 1.62; }
.study-themed .fc-recall { border-bottom-color: color-mix(in srgb, var(--study) 30%, var(--line)); }
.study-themed .fc-image img { border-color: color-mix(in srgb, var(--study) 25%, var(--line)); box-shadow: 0 6px 18px color-mix(in srgb, var(--study) 16%, transparent); }
.study-themed .fc-divider { background: color-mix(in srgb, var(--study) 22%, var(--line)); }

/* pista de revelar, más cálida */
.study-themed .reveal-hint { color: color-mix(in srgb, var(--study) 55%, var(--ink-3)); font-weight: 500; }
.study-themed .reveal-hint svg { color: var(--study); }

/* botones principales del estudio con el color del mazo */
.study-themed .btn.primary, .study-themed .reveal-btn {
  background: var(--study); border-color: var(--study); color: #fff;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--study) 38%, transparent);
}
.study-themed .btn.primary:hover, .study-themed .reveal-btn:hover { background: color-mix(in srgb, var(--study) 88%, #000); }

/* calificación */
.study-themed .grade-btn[data-g="good"] .g-key,
.study-themed .grade-simple [data-g="good"] .g-lbl { color: var(--study); }
.study-themed .grade-btn:hover { border-color: color-mix(in srgb, var(--study) 40%, var(--line)); }

/* opciones (opción múltiple) */
.study-themed .fc-opt:not(.answered):hover { border-color: var(--study); background: color-mix(in srgb, var(--study) 7%, var(--surface)); }
.study-themed .fc-opt .opt-key { background: color-mix(in srgb, var(--study) 14%, var(--surface-3)); color: color-mix(in srgb, var(--study) 70%, var(--ink)); }

/* fin de sesión con el mismo color */
.study-done.study-themed .glyph:not(.info) { background: transparent;
  background-image: linear-gradient(150deg, color-mix(in srgb, var(--study) 22%, var(--surface)), color-mix(in srgb, var(--study) 12%, var(--surface)));
  color: var(--study); box-shadow: 0 12px 30px color-mix(in srgb, var(--study) 22%, transparent); }
.study-done.study-themed .stats-line .s b { color: var(--study); }
.study-done.study-themed .btn.primary { background: var(--study); border-color: var(--study); box-shadow: 0 8px 22px color-mix(in srgb, var(--study) 34%, transparent); }

/* ============================================================
   Refinamiento v2 — más aire, calidez y calma (invita a estudiar)
   ============================================================ */
.app-main { padding-top: 22px; }
.hero { border-radius: 24px; padding: 24px 22px 20px; }
.hero h1 { font-size: 2.05rem; letter-spacing: -.02em; }
.hero .cta { margin-top: 18px; }
.section-head { margin: 6px 2px 15px; }
.section-head h1 { font-size: 1.5rem; letter-spacing: -.015em; }
.section-head h2 { letter-spacing: -.01em; }
.stat { border-radius: 16px; padding: 15px 16px; }
.deck-grid { gap: 14px; }
.deck-card { border-radius: 22px; padding: 18px 20px 16px; }
.deck-card h3 { font-size: 1.18rem; }
.folder-card { border-radius: 22px; padding: 17px 19px; }
.card-row { border-radius: 15px; padding: 12px 14px; }
.btn { border-radius: 13px; }
.btn.lg { border-radius: 16px; padding: 15px 22px; font-size: 1.02rem; }
.fab { border-radius: 22px; }
/* la tarjeta de estudio, aún más presencia */
.study-themed .flashcard { border-radius: 30px; }
.study-themed .fc-question { font-weight: 500; }

/* ============================================================
   Diseño v2.1 — tarjetas con color y vida (más dinámico)
   ============================================================ */
/* --- tarjeta de mazo --- */
.deck-card { background: color-mix(in srgb, var(--dc) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--dc) 15%, var(--line-2)); overflow: visible; }
.deck-card .accent-bar { display: none; }
.deck-card h3, .deck-card .desc, .deck-card .meta, .deck-card .progress { padding-left: 0; margin-left: 0; }
.deck-card .progress { height: 7px; background: color-mix(in srgb, var(--dc) 14%, var(--surface-3)); }
.deck-card .progress > i { background: linear-gradient(90deg, var(--dc), color-mix(in srgb, var(--dc) 60%, #fff)); }
.dc-top { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 15px; padding-right: 34px; }
.dc-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(150deg, color-mix(in srgb, var(--dc) 88%, #fff), var(--dc));
  color: #fff; font-family: var(--font-serif); font-weight: 600; font-size: 1.4rem; line-height: 1;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--dc) 42%, transparent); transition: transform .18s var(--ease); }
.deck-card:hover .dc-ic { transform: scale(1.06) rotate(-2deg); }
.dc-title { flex: 1; min-width: 0; padding-top: 2px; }
.dc-title h3 { margin: 0 0 3px; }
.deck-card:hover { border-color: color-mix(in srgb, var(--dc) 30%, var(--line));
  box-shadow: 0 12px 32px color-mix(in srgb, var(--dc) 20%, transparent); }
.deck-card .meta .pill:last-child { color: color-mix(in srgb, var(--dc) 70%, var(--ink)); font-weight: 600; }

/* --- tarjeta de curso --- */
.folder-card { background: color-mix(in srgb, var(--dc) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--dc) 15%, var(--line-2)); }
.folder-card::before { width: 5px; }
.folder-ic { background: linear-gradient(150deg, color-mix(in srgb, var(--dc) 88%, #fff), var(--dc)) !important;
  color: #fff !important; box-shadow: 0 5px 14px color-mix(in srgb, var(--dc) 40%, transparent); }
.folder-card .progress { background: color-mix(in srgb, var(--dc) 14%, var(--surface-3)); }
.folder-card .progress > i { background: linear-gradient(90deg, var(--dc), color-mix(in srgb, var(--dc) 60%, #fff)); }
.folder-card:hover { border-color: color-mix(in srgb, var(--dc) 30%, var(--line));
  box-shadow: 0 12px 32px color-mix(in srgb, var(--dc) 20%, transparent); }
.folder-foot span:first-child { color: color-mix(in srgb, var(--dc) 66%, var(--ink)); font-weight: 600; }

/* --- íconos de estadística con color --- */
.stat .k svg { color: var(--accent); }
.stat.flame .k svg { color: var(--flame); }

/* --- entrada escalonada --- */
.deck-grid > *:nth-child(2) { animation-delay: .05s; }
.deck-grid > *:nth-child(3) { animation-delay: .09s; }
.deck-grid > *:nth-child(4) { animation-delay: .13s; }
.deck-grid > *:nth-child(n+5) { animation-delay: .17s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   v3 · "Cuaderno de estudio / Ascenso" — identidad editorial
   Más carácter y menos plantilla: papel con grano, motivo de
   PELDAÑOS (Escalón), tipografía serif con itálicas reales,
   hairlines de libro mayor y profundidad táctil. Sin tocar la
   lógica ni los colores de los mazos.
   ============================================================ */

/* ---- marca (peldaños que ascienden) ---- */
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(155deg, var(--brand-2), var(--accent));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 34%, transparent),
              inset 0 1px 0 rgba(255,255,255,.28);
  position: relative; overflow: hidden;
}
.brand-mark::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(200deg, rgba(255,255,255,.22), transparent 55%); }
.brand-text { font-weight: 600; font-size: 1.18rem; }
.brand-text::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 7px;
  border-radius: 50%; background: var(--gold); vertical-align: middle; opacity: .9; }
.topbar { border-bottom-color: color-mix(in srgb, var(--gold) 14%, var(--line-2)); }

/* ---- encabezados de sección: estilo "libro mayor" ---- */
.section-head { align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.section-head h2 { position: relative; padding-left: 16px; }
.section-head h2::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 5px; height: 1.05em; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--brand-2)); }
.section-head .sub { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 600; color: var(--ink-3); }

/* ---- HÉROE "Hoy": panel de tinta, grid de plano y peldaños ---- */
.hero {
  color: #fdfcf8; border: none; border-radius: 26px; padding: 26px 24px 22px;
  background:
    radial-gradient(130% 120% at 8% -20%, color-mix(in srgb, var(--accent) 60%, var(--brand)), transparent 60%),
    linear-gradient(150deg, #211e46 0%, #2a2658 55%, #37307e 120%);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,.10);
}
:root[data-theme="dark"] .hero {
  background:
    radial-gradient(130% 120% at 8% -20%, color-mix(in srgb, var(--accent) 42%, #231f3f), transparent 60%),
    linear-gradient(150deg, #1a1733 0%, #221d47 60%, #2c2560 120%);
}
/* capa 1: retícula de plano (blueprint) + peldaños ascendentes (marca de agua) */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='130'%3E%3Cg fill='%23ffffff'%3E%3Crect x='6' y='104' width='34' height='26'/%3E%3Crect x='49' y='82' width='34' height='48'/%3E%3Crect x='92' y='60' width='34' height='70'/%3E%3Crect x='135' y='38' width='34' height='92'/%3E%3Crect x='178' y='14' width='34' height='116'/%3E%3C/g%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(255,255,255,.055) 25px 26px),
    repeating-linear-gradient(90deg, transparent 0 25px, rgba(255,255,255,.055) 25px 26px);
  background-repeat: no-repeat, repeat, repeat;
  background-position: right -14px bottom -10px, 0 0, 0 0;
  background-size: 48% auto, auto, auto;
  -webkit-mask-image: linear-gradient(105deg, transparent 30%, #000 100%);
          mask-image: linear-gradient(105deg, transparent 30%, #000 100%);
}
/* capa 2: brillo cálido + hairline dorado superior */
.hero::after {
  background:
    radial-gradient(420px 200px at 90% -30%, rgba(255,255,255,.16), transparent 70%),
    linear-gradient(to bottom, color-mix(in srgb, var(--gold) 55%, transparent), transparent 3px);
}
.hero .hero-head, .hero .cta { position: relative; z-index: 1; }
.hero .greeting { font-family: var(--font-serif); font-style: italic; font-weight: 500;
  font-size: .98rem; letter-spacing: .01em; opacity: .9; color: color-mix(in srgb, var(--gold) 70%, #fff); }
.hero h1 { font-weight: 700; font-size: clamp(1.9rem, 6vw, 2.25rem); letter-spacing: -.025em;
  text-wrap: balance; margin-top: 4px; }
.hero .hero-sub { opacity: .88; font-size: .92rem; }
.hero .cta .btn { border-radius: 13px; font-weight: 600; }
.hero .cta .btn.solid { background: #fdfcf8; color: #2a2658;
  box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.hero .cta .btn:not(.solid) { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.26); color: #fdfcf8; }

/* anillo de meta: pista cálida y relleno con brillo */
.ring .track { stroke: rgba(255,255,255,.18); }
.ring .fill { stroke: #fdfcf8; filter: drop-shadow(0 0 6px rgba(255,255,255,.5)); }
.ring .ring-num b { font-weight: 700; }
.ring .ring-num span { color: color-mix(in srgb, var(--gold) 55%, #fff); opacity: .95; }

/* ---- fila de estadísticas: entradas de libro mayor ---- */
.stat { position: relative; background: var(--surface); border-color: var(--line);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.4); overflow: hidden; }
:root[data-theme="dark"] .stat { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.04); }
.stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); opacity: .85; }
.stat.flame::before { background: var(--flame); }
.stat .k { letter-spacing: .07em; }
.stat .v { font-weight: 600; letter-spacing: -.01em; }

/* ---- tarjetas de mazo / curso: más táctiles, con sello ---- */
.deck-card, .folder-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.5), transparent 42%),
    color-mix(in srgb, var(--dc) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--dc) 18%, var(--line));
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.45);
}
:root[data-theme="dark"] .deck-card, :root[data-theme="dark"] .folder-card {
  background: color-mix(in srgb, var(--dc) 11%, var(--surface));
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.05);
}
/* sello/inicial del mazo: tipo letterpress */
.dc-ic, .folder-ic {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--dc) 42%, transparent),
              inset 0 1px 0 rgba(255,255,255,.4), inset 0 -2px 5px rgba(0,0,0,.14) !important;
  border: 1px solid color-mix(in srgb, var(--dc) 55%, #fff);
}
.dc-ic { position: relative; }
.dc-ic::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(200deg, rgba(255,255,255,.35), transparent 55%); }
.deck-card:hover, .folder-card:hover {
  box-shadow: 0 14px 36px color-mix(in srgb, var(--dc) 22%, transparent), inset 0 1px 0 rgba(255,255,255,.5);
}
/* cifra "en memoria" con numeral serif */
.folder-foot span:first-child, .deck-card .meta .pill:last-child { font-variant-numeric: tabular-nums; }

/* ---- botones: un punto más de calidez y tacto ---- */
.btn { font-weight: 600; }
.btn.primary { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.22); }
.btn.lg { letter-spacing: .005em; }

/* ---- botón flotante: sello con ascenso ---- */
.fab {
  background: linear-gradient(158deg, var(--brand-2), var(--accent));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent),
              inset 0 1px 0 rgba(255,255,255,.3);
}
.fab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(200deg, rgba(255,255,255,.25), transparent 55%); }

/* ============================================================
   v3 · Estudio, Progreso y pantallas secundarias
   ============================================================ */

/* ---- la tarjeta de estudio como una PÁGINA ---- */
.flashcard .fc-label { letter-spacing: .2em; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.flashcard .fc-label::before { content: ""; width: 14px; height: 1.5px; background: currentColor; opacity: .5; }
.study-themed .flashcard .fc-label::before { background: var(--study); opacity: .9; }
/* pregunta recordada en el reverso: itálica serif (editorial) */
.flashcard .fc-recall { font-style: italic; font-weight: 400; }
/* separador */
.fc-divider { height: 1px; margin: 16px 0 14px; background: var(--line); border: 0; }
/* FIX: al revelar, la respuesta se lee desde arriba (sin hueco gigante) */
.flashcard .fc-scroll { margin-top: 0; padding-top: 2px; }
/* número de tarjeta con numeral serif */
.study-top .count { font-family: var(--font-serif); font-weight: 600; font-size: .92rem; }
/* etiqueta del mazo: sello redondeado del color del mazo (ya teñido en base) */
.study-themed .deck-tag { box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }

/* ---- calificación: botones con tacto ---- */
.grade-btn { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.4); }
:root[data-theme="dark"] .grade-btn { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.04); }
.grade-simple .grade-btn { padding: 16px 6px; }
.grade-simple [data-g="good"] { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.grade-simple [data-g="again"] { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.grade-simple .g-lbl.big { font-family: var(--font-serif); font-weight: 600; font-size: 1.1rem; }

/* ---- fin de sesión: celebración on-brand ---- */
.study-done .glyph { border-radius: 30px; box-shadow: var(--shadow-2); }
.study-done h2 { font-weight: 700; letter-spacing: -.02em; }
.study-done .stats-line .s b { font-weight: 700; }

/* ---- Progreso: paneles de libro mayor ---- */
.panel { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.4); }
:root[data-theme="dark"] .panel { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.04); }
.panel-head { font-weight: 600; letter-spacing: -.01em; }
.panel-head svg { color: var(--accent); }

/* ---- FIX heatmap: celdas pequeñas estilo "diario de actividad" ---- */
.heatmap-wrap { overflow-x: auto; padding-bottom: 6px; }
.heat-months { display: grid; grid-auto-flow: column; grid-template-columns: repeat(18, 15px); gap: 3px;
  min-width: max-content; margin-bottom: 5px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 15px);
  grid-auto-columns: 15px; gap: 3px; min-width: max-content; }
.heat-col { display: contents; }
.heat-cell { width: 15px; height: 15px; aspect-ratio: auto; border-radius: 4px; }
.heat-cell.h0 { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 5%, transparent); }

/* ---- dominio por mazo ---- */
.mastery-bar { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 4%, transparent); }

/* ---- logros: insignias con más presencia ---- */
.ach.on { box-shadow: var(--shadow-1); }
.ach.on .ach-badge { box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 38%, transparent),
  inset 0 1px 0 rgba(255,255,255,.35); }
.ach b { font-weight: 600; }

/* ---- onboarding: portada de cuaderno ---- */
.onb { background:
    radial-gradient(900px 480px at 100% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(760px 460px at -10% 110%, color-mix(in srgb, var(--gold) 8%, transparent), transparent 60%),
    var(--bg); }
.onb-art { border-radius: 32px; box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,.25); position: relative; overflow: hidden; }
.onb-art::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(200deg, rgba(255,255,255,.22), transparent 55%); }
.onb-slide h2 { font-weight: 700; letter-spacing: -.02em; }
.onb-slide p { font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.65; }
.onb-dots i.on { background: linear-gradient(90deg, var(--accent), var(--brand-2)); }

/* ---- hojas modales + toasts: un toque más cálido ---- */
.sheet { box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,.4); }
:root[data-theme="dark"] .sheet { box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,.05); }
.sheet h2 { font-weight: 700; letter-spacing: -.015em; }
.toast { border-radius: 14px; box-shadow: var(--shadow-3); }

/* ---- estado vacío: invitación editorial ---- */
.empty .glyph { border-radius: 26px; box-shadow: var(--shadow-2); }
.empty h2 { font-weight: 700; letter-spacing: -.015em; }
.empty p { font-family: var(--font-serif); font-size: 1.04rem; }

/* ---- cabecera de curso: hairline dorado ---- */
.folder-hero { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.4); }
:root[data-theme="dark"] .folder-hero { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.04); }
.fh-head h1 { font-weight: 700; letter-spacing: -.02em; }
.fh-ic { box-shadow: 0 5px 14px color-mix(in srgb, var(--dc) 36%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }

/* ============================================================
   v3.1 · Editor con formato visual + estilo por defecto + color
   ============================================================ */

/* ---- editor WYSIWYG (tipo Word) ---- */
.rt-input { min-height: 96px; max-height: 44vh; overflow-y: auto; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink); border-radius: 12px; padding: 12px 13px; font-size: 1rem;
  line-height: 1.55; outline: none; transition: border-color .15s, box-shadow .15s; }
.rt-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rt-input.is-empty::before { content: attr(data-ph); color: var(--ink-3); pointer-events: none; }
.rt-input ul, .rt-input ol { margin: 4px 0; padding-left: 1.4em; }
.rt-input .cloze-src, .cloze-src { background: var(--accent-soft); color: var(--accent); font-weight: 600;
  border-radius: 3px; padding: 0 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---- barra de herramientas (fija arriba del editor) ---- */
.rt-tools { position: sticky; top: 0; z-index: 6; background: var(--surface); margin: 0 0 12px;
  border-bottom: 1px solid var(--line); }
.fmt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 9px 2px; }
.fmt-grow { flex: 1 1 8px; }
.fmt-btn { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); border-radius: 10px; cursor: pointer; font-size: .92rem; font-family: inherit;
  display: grid; place-items: center; line-height: 1; transition: background .12s, border-color .12s, transform .08s; }
.fmt-btn:hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
.fmt-btn:active { transform: translateY(1px); }
.fmt-btn b { font-weight: 800; }
.fmt-btn.fmt-i i { font-style: italic; font-family: var(--font-serif); font-size: 1.05rem; }
.fmt-btn.fmt-u u { text-underline-offset: 2px; }
.fmt-btn.fmt-mark { background: color-mix(in srgb, var(--gold) 30%, var(--surface-2));
  border-color: color-mix(in srgb, var(--gold) 36%, var(--line)); font-weight: 700; }
.fmt-btn.kpad-toggle { font-size: .82rem; font-weight: 600; gap: 4px; color: var(--accent);
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.fmt-btn.kpad-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fmt-colors { display: inline-flex; gap: 5px; align-items: center; padding: 0 3px; }
.fmt-color { width: 23px; height: 23px; border-radius: 50%; border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1); background: var(--c); cursor: pointer; transition: transform .1s; }
.fmt-color:hover { transform: scale(1.2); }
.fmt-sep { width: 1px; align-self: stretch; min-height: 24px; background: var(--line); margin: 0 3px; }

/* ---- teclado de símbolos / unidades (tipo calculadora) ---- */
.kpad { padding: 4px 2px 10px; }
.kpad-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.kpad-tabs button { flex: 1; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2);
  border-radius: 9px; padding: 7px; font-size: .82rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: background .12s, color .12s; }
.kpad-tabs button.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.kpad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px;
  max-height: 150px; overflow-y: auto; }
.kpad-key { height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 9px; cursor: pointer; font-size: .9rem; font-family: var(--font-serif); font-variant-numeric: tabular-nums;
  display: grid; place-items: center; transition: background .1s, border-color .1s, transform .08s; }
.kpad-key:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--accent); }
.kpad-key:active { transform: translateY(1px); }

/* ---- fila de estilo por defecto ---- */
.style-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.style-grid .seg { margin-bottom: 0; }
@media (max-width: 440px) { .style-grid { grid-template-columns: 1fr; } }

/* ---- texto enriquecido: resaltado y color ---- */
.rt-mark, .fc-answer mark, .fc-question mark {
  background: color-mix(in srgb, var(--gold) 34%, transparent);
  border-radius: 4px; padding: 0 .14em; color: inherit;
  box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.rt-c { font-weight: 600; }
:root[data-theme="dark"] .rt-c { filter: brightness(1.22) saturate(1.05); }

/* ---- estilo por defecto de las tarjetas (tipo de letra) ---- */
:root[data-card-font="serif"] .fc-answer,
:root[data-card-font="serif"] .rt-pv-a { font-family: var(--font-serif); }
:root[data-card-font="sans"] .fc-question,
:root[data-card-font="sans"] .fc-recall,
:root[data-card-font="sans"] .rt-pv-q { font-family: var(--font-sans); }

/* ---- estilo por defecto de las tarjetas (tamaño) ---- */
:root[data-card-size="large"] .study-themed .fc-question { font-size: clamp(1.75rem, 5.8vw, 2.4rem); }
:root[data-card-size="large"] .flashcard .fc-answer { font-size: 1.3rem; }
:root[data-card-size="large"] .rt-pv-q { font-size: 1.2rem; }
:root[data-card-size="xl"] .study-themed .fc-question { font-size: clamp(2rem, 6.6vw, 2.8rem); }
:root[data-card-size="xl"] .flashcard .fc-answer { font-size: 1.46rem; line-height: 1.5; }
:root[data-card-size="xl"] .rt-pv-q { font-size: 1.34rem; }

/* ---- estudio dinámico: badge de racha de aciertos ---- */
.combo-pop {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + var(--safe-top) + 16px);
  z-index: 55; pointer-events: none; opacity: 0;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 13px;
  border-radius: var(--r-pill); color: #fff; font-weight: 600;
  background: linear-gradient(135deg, color-mix(in srgb, var(--study) 88%, #000), var(--study));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--study) 46%, transparent), inset 0 1px 0 rgba(255,255,255,.3);
}
.combo-pop.show { animation: comboPop 1.15s var(--ease) both; }
@keyframes comboPop {
  0%   { opacity: 0; transform: translate(-50%, -6px) scale(.7); }
  14%  { opacity: 1; transform: translate(-50%, 0) scale(1.14); }
  30%  { transform: translate(-50%, 0) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(.96); }
}
.combo-pop b { font-family: var(--font-serif); font-size: 1.4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.combo-pop .combo-lbl { font-size: .78rem; opacity: .92; }
.combo-pop .combo-flame { display: inline-grid; place-items: center; }
.combo-pop .combo-flame svg { width: 20px; height: 20px; color: #ffd39a; fill: #ffd39a; stroke: none;
  animation: comboFlame .5s ease-in-out infinite alternate; }
@keyframes comboFlame { from { transform: scale(1) rotate(-3deg); } to { transform: scale(1.2) rotate(3deg); } }

/* ---- mejor racha en la pantalla de fin de sesión ---- */
.done-combo { display: inline-flex; align-items: center; gap: 8px; margin: 2px auto 2px;
  padding: 9px 17px; border-radius: var(--r-pill); font-size: .92rem;
  background: color-mix(in srgb, var(--study) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--study) 30%, var(--line));
  color: color-mix(in srgb, var(--study) 68%, var(--ink)); }
.done-combo svg { width: 17px; height: 17px; color: var(--flame); fill: var(--flame); stroke: none; }
.done-combo b { font-weight: 700; }

/* ---- opción múltiple: el feedback verde/rojo gana sobre el tinte del mazo ---- */
.study-themed .fc-opt.opt-correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, var(--surface)); }
.study-themed .fc-opt.opt-correct .opt-key { background: var(--ok); color: #fff; }
.study-themed .fc-opt.opt-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.study-themed .fc-opt.opt-wrong .opt-key { background: var(--danger); color: #fff; }

/* ============================================================
   v4 · Afinado tipográfico — Hanken Grotesk + Crimson Pro
   Fuentes editoriales/de estudio (no genéricas/IA). Se ajustan
   pesos, tamaños y tracking a las métricas de las nuevas familias:
   Crimson Pro es un serif de libro (más abierto → menos tracking
   negativo y un poco más de cuerpo en titulares).
   ============================================================ */
h1, h2, h3, .serif { font-weight: 600; letter-spacing: -.005em; }

/* marca */
.brand-text { font-weight: 600; letter-spacing: 0; font-size: 1.22rem; }

/* héroe: titular con más presencia */
.hero h1 { font-weight: 700; font-size: clamp(2.05rem, 6.4vw, 2.6rem); letter-spacing: -.018em; line-height: 1.06; }
.hero .greeting { font-size: 1.04rem; }

/* encabezados de sección */
.section-head h1 { letter-spacing: -.012em; }
.section-head h2 { font-weight: 600; font-size: 1.36rem; letter-spacing: -.01em; }

/* estadísticas: cifras serif con cuerpo */
.stat .v { font-weight: 600; }

/* estudio: la pregunta, legible y con carácter */
.flashcard .fc-question { font-weight: 500; }
.study-themed .fc-question { font-weight: 500; letter-spacing: -.004em; }
.flashcard .fc-recall { font-weight: 400; }

/* lectura en serif (respuestas, consejos): interlineado cómodo para Crimson Pro */
.fc-answer.serif-a, :root[data-card-font="serif"] .fc-answer,
:root[data-card-font="serif"] .fc-recall { line-height: 1.62; }
.empty p, .onb-slide p { line-height: 1.66; }

/* numerales de datos: tabulares, rectos */
.stat .v, .ring .ring-num b, .study-top .count,
.study-done .stats-line .s b, .fh-progress > span, .combo-pop b { font-feature-settings: 'tnum' 1; }

/* pestaña de mazo / etiquetas pequeñas en Hanken (más nítidas que serif) */
.study-themed .deck-tag { font-weight: 600; }
kbd { font-weight: 600; }

/* ============================================================
   v5 · Estudio más eficiente y adaptable
   Deshacer · editar en estudio · pista · gestos de deslizar
   ============================================================ */
/* botones de acción en la barra de estudio (deshacer / editar) */
.study-top { gap: 10px; }
.study-act { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s, transform .08s; }
.study-act:hover { background: var(--surface-3); color: var(--ink); }
.study-act:active { transform: scale(.92); }
.study-act[disabled] { opacity: .38; pointer-events: none; }
.study-act svg { width: 18px; height: 18px; }
.study-themed .study-act:hover { border-color: color-mix(in srgb, var(--study) 35%, var(--line)); color: var(--study); }

/* subfila con la etiqueta del mazo */
.study-sub { display: flex; justify-content: center; margin: 2px 0 12px; }

/* fila de "pista + revelar" */
.reveal-row { display: flex; gap: 10px; align-items: stretch; }
.reveal-row .grow { flex: 1; }
.reveal-row .btn.ghost { flex: none; }

/* pista (muestra el principio de la respuesta) */
.fc-hint { margin: 10px 0 2px; padding: 9px 13px; border-radius: 12px; font-size: 1.02rem; line-height: 1.5;
  background: color-mix(in srgb, var(--study, var(--accent)) 10%, var(--surface-2));
  border: 1px dashed color-mix(in srgb, var(--study, var(--accent)) 38%, var(--line)); color: var(--ink-2);
  animation: hintIn .25s var(--ease) both; }
@keyframes hintIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.fc-hint-k { font-family: var(--font-sans); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--study, var(--accent)); margin-right: 8px; }

/* gestos: deslizar la tarjeta para calificar (móvil) */
.flashcard { touch-action: pan-y; }
.flashcard.swipe-good { border-color: var(--ok) !important; }
.flashcard.swipe-again { border-color: var(--warn) !important; }
.flashcard.swipe-good::after, .flashcard.swipe-again::after {
  position: absolute; top: 16px; z-index: 3; padding: 6px 13px; border-radius: var(--r-pill);
  font-family: var(--font-sans); font-weight: 700; font-size: .78rem; letter-spacing: .03em; color: #fff;
  box-shadow: var(--shadow-2); animation: hintIn .12s var(--ease) both; }
.flashcard.swipe-good::after { content: "¡YA LA SÉ! ✓"; right: 16px; background: var(--ok); }
.flashcard.swipe-again::after { content: "TODAVÍA NO ↺"; left: 16px; background: var(--warn); }

/* ============================================================
   v6 · StudyCards — tarjetas de mazo/curso con COLOR SÓLIDO
   Fondo del color del mazo, contenido en blanco (como el kit).
   ============================================================ */
.deck-card, .folder-card {
  background: linear-gradient(145deg, color-mix(in srgb, var(--dc) 92%, #fff), color-mix(in srgb, var(--dc) 86%, #000)) !important;
  border: none !important; color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--dc) 32%, transparent), inset 0 1px 0 rgba(255,255,255,.18) !important;
}
.folder-card::before { display: none; }
.deck-card h3, .folder-card h3, .folder-name h3 { color: #fff; }
.deck-card .desc, .deck-card .meta, .folder-meta, .folder-foot { color: rgba(255,255,255,.88); }
.deck-card .meta .pill:last-child, .folder-foot span:first-child { color: #fff !important; font-weight: 600; }
.deck-card .meta .pill svg, .folder-meta svg { color: rgba(255,255,255,.9); }
/* sello/inicial e ícono de carpeta: cuadro translúcido blanco */
.dc-ic, .folder-ic {
  background: rgba(255,255,255,.22) !important; color: #fff !important;
  border: 1px solid rgba(255,255,255,.28) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3) !important; }
.dc-ic::after { display: none; }
/* barra de progreso: pista blanca translúcida, relleno blanco */
.deck-card .progress, .folder-card .progress { background: rgba(255,255,255,.3) !important; }
.deck-card .progress > i, .folder-card .progress > i { background: #fff !important; }
/* badge pendientes + grip */
.deck-card .badge, .folder-card .badge { background: rgba(255,255,255,.28); color: #fff; }
.deck-card > .grip, .folder-card .grip { color: rgba(255,255,255,.65); }
.deck-card > .grip:hover, .folder-card .grip:hover { background: rgba(255,255,255,.18); color: #fff; }
/* hover: elevación con el color del mazo */
.deck-card:hover, .folder-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px color-mix(in srgb, var(--dc) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.22) !important;
  border: none !important; }
.deck-card:hover .dc-ic { transform: scale(1.05) rotate(-2deg); }

/* ---- barra de navegación inferior ---- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: flex; align-items: center; justify-content: space-around;
  height: calc(64px + var(--safe-bottom)); padding: 0 6px var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.3) blur(16px); -webkit-backdrop-filter: saturate(1.3) blur(16px);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(15,23,42,.05); }
.bn-item { flex: 1; max-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: none; background: none; cursor: pointer; color: var(--ink-3); font-family: inherit;
  font-size: .66rem; font-weight: 600; padding: 6px 2px; transition: color .15s, transform .1s; }
.bn-item svg { width: 23px; height: 23px; stroke-width: 2; }
.bn-item:hover { color: var(--ink-2); }
.bn-item:active { transform: scale(.9); }
.bn-item.active { color: var(--accent); }
.bn-plus { flex: none; width: 54px; height: 54px; margin-top: -20px; border-radius: 18px; border: none; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 48%, transparent), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .14s var(--ease); }
.bn-plus:hover { transform: translateY(-2px); }
.bn-plus:active { transform: scale(.92); }
.bn-plus svg { width: 26px; height: 26px; stroke-width: 2.4; }
/* el FAB flotante se oculta: lo reemplaza el botón central de la barra */
.fab { display: none !important; }
/* aire para que la barra no tape el contenido; toasts por encima de la barra */
.app-main { padding-bottom: calc(94px + var(--safe-bottom)); }
.toast-wrap { bottom: calc(86px + var(--safe-bottom)); }

/* ---- pantalla de Perfil ---- */
.profile-head { text-align: center; padding: 10px 0 18px; }
.profile-av { width: 86px; height: 86px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 36%, transparent), inset 0 1px 0 rgba(255,255,255,.3); }
.profile-av svg { width: 46px; height: 46px; stroke-width: 1.9; }
.profile-head h1 { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.profile-email { color: var(--ink-3); font-size: .9rem; margin-top: 2px; }
.profile-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 20px auto 0; max-width: 440px; }
.profile-stats .ps { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 8px; box-shadow: var(--shadow-1); }
.profile-stats .ps b { display: block; font-size: 1.55rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.profile-stats .ps span { font-size: .72rem; color: var(--ink-3); font-weight: 500; }
.profile-stats .ps.flame b { color: var(--flame); }
.profile-menu { margin: 22px auto 0; max-width: 540px; }
.mi-chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; margin-left: 6px; }

/* ocultar asas de reordenar donde no aplican (p. ej. pestaña Mazos) */
.no-reorder .grip { display: none !important; }

/* ============================================================
   v7 · StudyCards — ilustraciones, botones circulares, hero limpio
   ============================================================ */
/* ---- ilustraciones (onboarding / vacíos / resultados) ---- */
.onb-art.onb-illus { background: none !important; box-shadow: none !important;
  width: auto !important; height: auto !important; border-radius: 0 !important; margin: 0 auto 24px; }
.onb-art.onb-illus::after { display: none !important; }
.onb-illus img { width: 240px; max-width: 76vw; height: auto; display: block; border-radius: 20px; }
.empty-illus { margin: 4px auto 18px; display: flex; justify-content: center; }
.empty-illus img { width: 200px; max-width: 64vw; height: auto; border-radius: 18px; }
.done-illus { margin: 0 auto 14px; display: flex; justify-content: center; }
.done-illus img { width: 170px; max-width: 56vw; height: auto; border-radius: 16px; animation: pop .5s var(--ease) both; }

/* ---- botones de estudio circulares (No sabía / Lo sabía) ---- */
.grade-circles { display: flex; justify-content: center; gap: 46px; margin-top: 16px; padding-bottom: var(--safe-bottom); }
.grade-circle { display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: none; background: none; cursor: pointer; padding: 6px; font-family: inherit; }
.gc-ic { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-1); transition: transform .12s, box-shadow .16s; }
.gc-ic svg { width: 32px; height: 32px; stroke-width: 2.6; }
.grade-circle[data-g="again"] .gc-ic { border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.grade-circle[data-g="good"] .gc-ic { border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.grade-circle:hover .gc-ic { box-shadow: 0 10px 22px color-mix(in srgb, currentColor 22%, transparent); transform: translateY(-2px); }
.grade-circle:active .gc-ic { transform: scale(.92); }
.gc-lbl { font-weight: 600; font-size: .95rem; }
.grade-circle[data-g="again"] .gc-lbl { color: var(--danger); }
.grade-circle[data-g="good"] .gc-lbl { color: var(--ok); }

/* ---- resultados: título con más fuerza ---- */
.study-done h2 { font-size: 1.7rem; }

/* ---- hero: quitar la marca de agua de peldaños (look más limpio) ---- */
.hero::before { background-image: none; -webkit-mask-image: none; mask-image: none; }

/* ============================================================
   v8 · Tarjetas difíciles (leeches)
   ============================================================ */
.due-leech { background: color-mix(in srgb, var(--flame) 16%, var(--surface)); color: var(--flame); }
.hard-list { display: flex; flex-direction: column; gap: 8px; }
.hard-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--flame) 22%, var(--line)); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--flame) 6%, var(--surface)); color: var(--ink); cursor: pointer;
  font-family: inherit; transition: border-color .15s, transform .1s; }
.hard-item:hover { border-color: color-mix(in srgb, var(--flame) 42%, var(--line)); }
.hard-item:active { transform: translateY(1px); }
.hard-item .hi-ic { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: color-mix(in srgb, var(--flame) 16%, var(--surface)); color: var(--flame); }
.hard-item .hi-ic svg { width: 17px; height: 17px; fill: var(--flame); stroke: none; }
.hard-item .grow { min-width: 0; }
.hi-q { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-crumb { display: block; font-size: .76rem; color: var(--ink-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-count { flex: none; font-weight: 700; color: var(--flame); font-variant-numeric: tabular-nums; }

/* ============================================================
   v9 · Pulido móvil — ilustraciones vectoriales, cabecera de
   mazo, lista compacta de mazos, estudio centrado, contraste
   ============================================================ */

/* ---- ilustraciones SVG (nítidas; fondo/sombra según el tema) ---- */
.illus { display: block; width: 100%; height: auto; stroke: none; fill: none; overflow: visible; }
.illus .il-bg { fill: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
.illus .il-shadow { fill: color-mix(in srgb, var(--ink) 9%, transparent); }
:root[data-theme="dark"] .illus .il-bg { fill: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
:root[data-theme="dark"] .illus .il-shadow { fill: rgba(0,0,0,.35); }
.onb-illus .illus { width: 270px; max-width: 78vw; height: auto; margin: 0 auto; stroke-width: 0; }
.empty-illus .illus { width: 230px; max-width: 70vw; height: auto; }
.done-illus .illus { width: 210px; max-width: 62vw; height: auto; animation: pop .5s var(--ease) both; }
.study-done { padding-top: 22px; }

/* ---- contraste: degradado más profundo abajo (texto blanco legible) ---- */
.deck-card, .folder-card, .deck-line, .deck-hero {
  --dc-grad: linear-gradient(140deg, color-mix(in srgb, var(--dc) 90%, #fff) 0%, var(--dc) 42%, color-mix(in srgb, var(--dc) 72%, #000) 100%);
}
.deck-card, .folder-card { background: var(--dc-grad) !important; }
.deck-card h3, .folder-card h3, .deck-card .meta, .folder-foot, .folder-meta, .deck-card .desc,
.deck-line, .deck-hero { text-shadow: 0 1px 2px rgba(0,0,0,.16); }

/* ---- barra superior: menos botones en el móvil (están en Perfil) ---- */
@media (max-width: 640px) {
  #btnTheme, #btnAccount { display: none; }
}
/* el punto dorado tras "StudyCards" se confundía con un aviso sin leer */
.brand-text::after { display: none; }
/* modo enfoque al estudiar: sólo "volver" y el título */
body.is-studying .topbar-actions { display: none; }

/* ---- cabecera del mazo ---- */
.deck-hero { position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 20px 18px 18px; margin-bottom: 22px;
  background: var(--dc-grad);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--dc) 32%, transparent), inset 0 1px 0 rgba(255,255,255,.2);
  animation: cardIn .35s var(--ease) both; }
.deck-hero::after { content: ""; position: absolute; right: -46px; top: -58px; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.10); pointer-events: none; }
.deck-hero > * { position: relative; z-index: 1; }
.dh-top { display: flex; align-items: flex-start; gap: 13px; }
.deck-hero .dc-ic { width: 50px; height: 50px; font-size: 1.35rem; font-weight: 700; border-radius: 15px; }
.dh-title { flex: 1; min-width: 0; }
.dh-crumb { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; opacity: .9; margin-bottom: 2px; }
.dh-crumb svg { width: 13px; height: 13px; }
.deck-hero h1 { margin: 0; font-size: 1.42rem; line-height: 1.22; font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.deck-hero p { margin: 4px 0 0; font-size: .88rem; line-height: 1.45; opacity: .92; }
.dh-menu { flex: none; width: 40px; height: 40px; margin: -4px -4px 0 0; border: none; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.16); transition: background .15s; }
.dh-menu:hover { background: rgba(255,255,255,.28); }
.dh-progress { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; }
.dh-bar { flex: 1; height: 8px; border-radius: var(--r-pill); background: rgba(255,255,255,.28); overflow: hidden; }
.dh-bar > i { display: block; height: 100%; border-radius: inherit; background: #fff; transition: width .5s var(--ease); }
.dh-progress > span { font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.dh-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; opacity: .94; }
.dh-meta span { display: inline-flex; align-items: center; gap: 5px; }
.dh-meta svg { width: 15px; height: 15px; }
.dh-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.dh-cta .btn { flex: 1 1 130px; border-radius: 14px; padding: 12px 10px; color: #fff; text-shadow: none; white-space: nowrap;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.32); }
.dh-cta .btn:hover { background: rgba(255,255,255,.25); }
.dh-cta .btn.solid { background: #fff; border-color: #fff; color: color-mix(in srgb, var(--dc) 78%, #000);
  box-shadow: 0 6px 16px rgba(0,0,0,.16); }
.dh-cta .btn.solid:hover { background: rgba(255,255,255,.92); }
.dh-cta .btn[disabled] { opacity: .8; }

/* ---- filas de tarjetas: el texto respira (antes se cortaba a ~10 letras) ---- */
.card-row { align-items: flex-start; gap: 11px; padding: 12px 14px 12px 6px; cursor: pointer; }
.card-row:hover { border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
.card-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-row .drag-handle { align-self: stretch; width: 24px; flex: none; }
.card-row .drag-handle svg { width: 18px; height: 18px; }
.card-row .num { margin-top: 1px; }
.card-row .q { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.38; font-weight: 600; }
.card-row .a { margin-top: 2px; }
.card-row .thumb { width: 54px; height: 54px; border-radius: 12px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.row-tags .due-chip { font-size: .68rem; padding: 2px 9px; border-radius: var(--r-pill); font-weight: 600; }
.row-tags .type-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .66rem; font-weight: 600; letter-spacing: 0;
  padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); }
.row-tags .type-tag svg { width: 12px; height: 12px; }

/* ---- pestaña Mazos: lista compacta de colores, agrupada por curso ---- */
.dl-group { margin-bottom: 18px; }
.dl-head { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; cursor: pointer;
  padding: 2px 4px 10px; color: var(--ink-2); font-family: inherit; font-size: .9rem; font-weight: 600; text-align: left; }
.dl-head[disabled] { cursor: default; color: var(--ink-3); }
.dl-head > svg { width: 18px; height: 18px; color: var(--accent); }
.dl-head .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-n { font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); }
.deck-line { display: flex; align-items: center; gap: 13px; width: 100%; margin-bottom: 10px; padding: 13px 14px;
  border: none; border-radius: 18px; cursor: pointer; text-align: left; color: #fff; font-family: inherit;
  background: var(--dc-grad);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--dc) 24%, transparent), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .14s var(--ease), box-shadow .14s; animation: cardIn .35s var(--ease) both; }
.deck-line:hover { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--dc) 36%, transparent), inset 0 1px 0 rgba(255,255,255,.2); }
.deck-line:active { transform: scale(.99); }
.deck-line:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.deck-line[hidden], .dl-group[hidden] { display: none !important; }
.dl-ic { flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-weight: 700; font-size: 1.1rem; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.3); }
.dl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-body b { font-weight: 600; font-size: 1rem; line-height: 1.25; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.dl-body span { font-size: .76rem; opacity: .92; margin-top: 2px; }
.dl-pct { flex: none; width: 56px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dl-pct em { font-style: normal; font-weight: 700; font-size: .86rem; font-variant-numeric: tabular-nums; }
.dl-bar { width: 100%; height: 5px; border-radius: var(--r-pill); background: rgba(255,255,255,.3); overflow: hidden; }
.dl-bar > i { display: block; height: 100%; border-radius: inherit; background: #fff; }

/* ---- perfil: nombre editable + inicial en el avatar ---- */
.profile-name { display: inline-flex; align-items: center; gap: 8px; border: none; background: none; cursor: pointer;
  color: var(--ink); font-family: inherit; padding: 4px 10px; border-radius: 12px; transition: background .15s; }
.profile-name:hover { background: var(--surface-2); }
.pn-edit svg { width: 16px; height: 16px; color: var(--ink-3); }
.profile-hint { font-size: .78rem; font-weight: 500; color: var(--accent); margin-top: -2px; }
.av-initial { font-size: 2.3rem; font-weight: 700; line-height: 1; }

/* ---- estudio: la pregunta centrada, con bombilla (como el kit) ---- */
.flashcard .fc-center { display: flex; flex-direction: column; align-items: center; text-align: center;
  width: 100%; margin-block: auto; padding: 6px 0; }
.flashcard .fc-center .fc-question { margin-inline: auto; }
.flashcard.is-front .fc-label { align-self: center; }
.flashcard.is-front .reveal-hint { margin-top: 0; }
.fc-bulb { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center;
  color: var(--study, var(--accent)); background: color-mix(in srgb, var(--study, var(--accent)) 12%, var(--surface));
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--study, var(--accent)) 6%, transparent);
  animation: bulbIn .5s var(--ease) .08s both; }
.fc-bulb svg { width: 28px; height: 28px; stroke-width: 1.8; }
@keyframes bulbIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.flashcard .fc-center .fc-hint { text-align: left; }
.reveal-hint { flex-wrap: wrap; }
.reveal-hint kbd { font-family: inherit; font-size: .7rem; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
@media (hover: none) { .kbd-only { display: none !important; } }
/* la racha flotante ya no tapa la barra de progreso */
.combo-pop { top: calc(var(--topbar-h) + var(--safe-top) + 64px); }

/* ---- insignia "Powered by Netlify" (plan gratuito) ----
   Netlify la inyecta fija abajo a la derecha, encima de todo (iframe #nl-badge-frame),
   y tapaba "Progreso" y "Perfil". En el plan gratis no se puede ocultar: se mantiene
   visible pero se REUBICA sobre la barra inferior y se le reserva espacio donde haya
   botones abajo (estudio, tutorial, hojas). Sólo aplica si la insignia existe. */
body:has(#nl-badge-frame) { --nl-badge-space: 56px; }
body:has(#nl-badge-frame) #nl-badge-frame { bottom: calc(64px + var(--safe-bottom) + 2px) !important; }
body:has(#nl-badge-frame) .app-main { padding-bottom: calc(94px + var(--nl-badge-space) + var(--safe-bottom)); }
body:has(#nl-badge-frame) .toast-wrap { bottom: calc(86px + var(--nl-badge-space) + var(--safe-bottom)); }
/* al estudiar, con una hoja abierta o en el tutorial no se ve la barra inferior:
   la insignia baja al borde y los botones de abajo suben (espacio reservado) */
body.is-studying:has(#nl-badge-frame) #nl-badge-frame,
body:has(#overlay:not([hidden])):has(#nl-badge-frame) #nl-badge-frame,
body:has(> .onb):has(#nl-badge-frame) #nl-badge-frame { bottom: var(--safe-bottom) !important; }
body.is-studying:has(#nl-badge-frame) .study-wrap { padding-bottom: var(--nl-badge-space); }
body.is-studying:has(#nl-badge-frame) .app-main { padding-bottom: 12px; }
/* tutorial y hojas inferiores: sus botones quedan por encima de la insignia */
body:has(#nl-badge-frame) .onb { padding-bottom: calc(24px + var(--nl-badge-space) + var(--safe-bottom)); }
body:has(#nl-badge-frame) .sheet { padding-bottom: calc(22px + var(--nl-badge-space) + var(--safe-bottom)); }

/* ---- tutorial: "¿Ya tienes una cuenta?" (como el kit) ---- */
.onb-login { display: block; margin: 14px auto 0; border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: .88rem; color: var(--ink-2); padding: 8px 12px; border-radius: 10px; }
.onb-login b { color: var(--accent); font-weight: 600; }
.onb-login:hover { background: var(--surface-2); }

/* ---- inicio: saludo y estadísticas al estilo del kit ---- */
.hero .greeting { font-style: normal; font-weight: 500; font-size: 1rem; letter-spacing: 0; color: rgba(255,255,255,.86); }
.stat::before { display: none; }
.stat .k { gap: 8px; letter-spacing: .035em; }
.stat .k svg { width: 28px; height: 28px; padding: 6px; border-radius: 9px; flex: none;
  background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
.stat.flame .k svg { background: color-mix(in srgb, var(--flame) 15%, var(--surface)); }

/* ---- menús: ícono en chip de color (Crear, elegir mazo) ---- */
.mi-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.menu-item .mi-ic svg { width: 20px; height: 20px; color: var(--c); }
.mi-ic.dk { color: #fff; font-weight: 700; font-size: 1rem;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 88%, #fff), color-mix(in srgb, var(--c) 78%, #000)); }
.pick-list { max-height: min(60vh, 520px); overflow-y: auto; margin: 0 -4px; padding: 0 4px; }

/* ---- cuenta: botón de Google (pautas de marca: fondo blanco, borde gris, logo a color) ---- */
.google-btn { background: #fff !important; color: #1f1f1f !important; border: 1px solid #dadce0 !important;
  font-weight: 600; gap: 10px; box-shadow: 0 1px 2px rgba(60,64,67,.12); }
.google-btn:hover { background: #f8f9fa !important; box-shadow: 0 2px 6px rgba(60,64,67,.18); }
:root[data-theme="dark"] .google-btn { background: #131314 !important; color: #e3e3e3 !important; border-color: #8e918f !important; }
:root[data-theme="dark"] .google-btn:hover { background: #1f1f20 !important; }
.g-logo { width: 20px !important; height: 20px !important; flex: none; stroke: none !important; }
.google-btn .g-logo { width: 20px; height: 20px; }
.profile-email .g-logo, .acc-id .g-logo { width: 14px !important; height: 14px !important; vertical-align: -2px; margin-right: 4px; }

.auth-head { text-align: center; margin: 2px 0 16px; }
.auth-logo { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 17px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 34%, transparent); }
.auth-logo svg { width: 28px; height: 28px; }
.auth-head h2 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 700; }
.auth-head p { margin: 0 auto; max-width: 34ch; color: var(--ink-2); font-size: .9rem; line-height: 1.5; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; color: var(--ink-3); font-size: .78rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sheet .hint svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }

.acc-card { display: flex; align-items: center; gap: 13px; padding: 14px; margin-bottom: 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line-2); }
.acc-id { min-width: 0; display: flex; flex-direction: column; }
.acc-id b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-id span { font-size: .8rem; color: var(--ink-3); overflow-wrap: anywhere; line-height: 1.4; }
.av { flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  font-weight: 700; color: #fff; background: linear-gradient(145deg, var(--brand-2), var(--brand)); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.av-lg { width: 52px; height: 52px; font-size: 1.3rem; }
.av.av-fill { width: 100%; height: 100%; font-size: 2.3rem; background: none; }

/* invitación a sincronizar en Perfil */
.sync-cta { margin: 18px auto 0; max-width: 540px; padding: 16px; border-radius: 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); box-shadow: var(--shadow-1); }
.sc-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.sc-ic { flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.sc-top b { display: block; font-size: .98rem; }
.sc-top div span { display: block; font-size: .82rem; color: var(--ink-2); line-height: 1.45; margin-top: 2px; }
.sc-ic svg { width: 24px; height: 24px; }
.sync-cta .btn.ghost { margin-top: 6px; }

/* botón de sincronizar: estado de un vistazo */
#btnSync[data-state="idle"] { color: var(--ok); }
#btnSync[data-state="error"] { color: var(--warn); }
#btnSync[data-state="offline"] { color: var(--ink-3); }
#btnSync[data-state="error"]::after { content: ""; position: absolute; top: 10px; right: 10px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--bg); }

/* ---- estilo de letra de las tarjetas: "Moderna" (Poppins) o "Libro" (Crimson Pro) ----
   Antes Mixto/Serif/Sans no cambiaban nada: con el rediseño todas eran Poppins. */
:root { --font-read: 'Crimson Pro', Georgia, 'Times New Roman', serif; }
/* font-size-adjust iguala la altura de las minúsculas a la de Poppins: el serif se lee
   del mismo tamaño y se respeta el ajuste A / A+ / A++ */
.flashcard .fc-answer.serif-a { font-family: var(--font-read); font-size-adjust: .52; line-height: 1.55; }
:root[data-card-font="serif"] .fc-question,
:root[data-card-font="serif"] .fc-recall,
:root[data-card-font="serif"] .fc-answer,
:root[data-card-font="serif"] .fc-opt .opt-text,
:root[data-card-font="serif"] .rt-pv-q,
:root[data-card-font="serif"] .rt-pv-a { font-family: var(--font-read); font-size-adjust: .52; letter-spacing: 0; }

/* ================================================================
   v10 · "CUADERNO DE ESTUDIO" (claro) / "PIZARRA" (oscuro)
   Estilo de estudio elegante: papel marfil con cuadrícula, tinta
   azul noche, títulos en serif de libro (Crimson Pro), interfaz en
   Hanken Grotesk, fichas con renglones y margen rojo, resaltador
   pastel y cinta adhesiva (washi). En oscuro: pizarra verde con tiza.
   Los colores de cada mazo se suavizan solos (pastel) con color-mix.
   ================================================================ */
:root {
  --font-sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;

  --bg: #f7f4ec;  --bg-2: #f1ede2;
  --surface: #fffdf8; --surface-2: #f6f2e8; --surface-3: #ebe5d6;
  --ink: #1f2a44; --ink-2: #4a5468; --ink-3: #69717f;
  --line: #e2d9c6; --line-2: #ece5d6;
  --brand: #2f4a6d; --brand-2: #4a6a94;
  --accent: #3d5a80; --accent-2: #7d9cc0; --accent-soft: #e4eaf2; --accent-ink: #ffffff;
  --gold: #a8853d; --gold-soft: #f3ead3;
  --ok: #4c8459; --ok-soft: #e3efe2;
  --warn: #a37b2f; --warn-soft: #f4ecd6;
  --danger: #b14f5a; --danger-soft: #f6e2e2;
  --flame: #bf6a7d;
  --grain-opacity: .03;
  --grid: rgba(61, 90, 128, .055);
  --rule: rgba(61, 90, 128, .095);
  --margin: rgba(196, 92, 92, .42);
  --tape: rgba(226, 162, 179, .55);
  --hl: rgba(125, 156, 192, .34);
  --shadow-1: 0 1px 0 rgba(255,255,255,.6) inset, 0 1px 2px rgba(70,55,30,.06), 0 3px 10px rgba(70,55,30,.05);
  --shadow-2: 0 2px 6px rgba(70,55,30,.07), 0 12px 28px rgba(70,55,30,.08);
  --shadow-3: 0 18px 48px rgba(40,32,18,.16);
}
:root[data-theme="dark"] {
  --bg: #1c2624; --bg-2: #1f2b28;
  --surface: #24312e; --surface-2: #2a3835; --surface-3: #33433f;
  --ink: #eef1ea; --ink-2: #c7cfc6; --ink-3: #9aa59c;
  --line: #3b4b47; --line-2: #2f3e3a;
  --brand: #a9c7e2; --brand-2: #8fb3d6;
  --accent: #a3c4e3; --accent-2: #cfe0ef; --accent-soft: #2d3f46; --accent-ink: #13201d;
  --gold: #e3cd92; --gold-soft: #3a3622;
  --ok: #a9d4ae; --ok-soft: #26392c;
  --warn: #e4cf92; --warn-soft: #3a3622;
  --danger: #eba7ad; --danger-soft: #402a2c;
  --flame: #eaa9b8;
  --grid: rgba(255, 255, 255, .028);
  --rule: rgba(238, 241, 234, .07);
  --margin: rgba(235, 167, 173, .35);
  --tape: rgba(226, 162, 179, .28);
  --hl: rgba(163, 196, 227, .22);
  --shadow-1: 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 2px 8px rgba(0,0,0,.35), 0 14px 30px rgba(0,0,0,.3);
  --shadow-3: 0 24px 56px rgba(0,0,0,.5);
}

/* ---- papel cuadriculado (o pizarra con polvo de tiza) ---- */
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  font-family: var(--font-sans);
}
:root[data-theme="dark"] body {
  background-image:
    radial-gradient(1200px 600px at 20% -10%, rgba(255,255,255,.035), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
}
h1, h2, h3, .serif { font-family: var(--font-serif); font-weight: 600; letter-spacing: 0; }

/* ---- barra superior: tapa del cuaderno ---- */
.topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent); }
.brand-mark { background: var(--ink); color: var(--bg); border-radius: 9px; box-shadow: none; }
:root[data-theme="dark"] .brand-mark { background: var(--accent); color: var(--accent-ink); }
.brand-text { font-family: var(--font-serif); font-weight: 700; font-size: 1.42rem; letter-spacing: .005em; }

/* ---- botones: tinta, bordes definidos ---- */
.btn { border-radius: 11px; font-weight: 600; border-color: var(--line); background: var(--surface); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 4px 12px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { background: transparent; }
.btn.lg { border-radius: 13px; }

/* ---- títulos de sección: subrayado con resaltador ---- */
.section-head { border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.section-head h1, .section-head h2 { padding-left: 2px; font-weight: 700; color: var(--ink);
  /* resaltador: subrayado grueso pastel detrás de la mitad baja de las letras */
  text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: .38em;
  text-underline-offset: -.22em; text-decoration-skip-ink: none; }
.section-head h2 { font-size: 1.55rem; }
.section-head h1 { font-size: 1.85rem; }
.section-head h2::before { display: none; }
.section-head .sub { font-family: var(--font-sans); letter-spacing: .1em; font-size: .68rem; color: var(--ink-3); }

/* ---- HÉROE "Hoy": hoja de cuaderno con margen rojo y cinta ---- */
.hero {
  color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: 16px !important;
  overflow: visible; padding: 24px 22px 20px 40px !important;
  background:
    linear-gradient(90deg, transparent 27px, var(--margin) 27px, var(--margin) 28.5px, transparent 28.5px),
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px),
    var(--surface) !important;
  background-position: 0 0, 0 20px, 0 0 !important;
  box-shadow: var(--shadow-1), 0 8px 0 -4px var(--surface-2), 0 8px 0 -3px var(--line), var(--shadow-2) !important;
}
.hero::before { content: ""; position: absolute; inset: auto; top: -10px; right: 34px; width: 92px; height: 24px; opacity: 1;
  background: repeating-linear-gradient(45deg, var(--tape) 0 7px, color-mix(in srgb, var(--tape) 70%, transparent) 7px 14px) !important;
  -webkit-mask-image: none !important; mask-image: none !important; transform: rotate(3deg); border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.hero::after { display: none !important; }
.hero .greeting { font-family: var(--font-serif) !important; font-style: italic !important; font-weight: 500 !important;
  font-size: 1.12rem !important; color: var(--ink-2) !important; opacity: 1; }
.hero h1 { color: var(--ink) !important; font-family: var(--font-serif); font-weight: 700 !important;
  font-size: clamp(2.2rem, 7vw, 2.8rem) !important; line-height: 1.02 !important; letter-spacing: -.005em !important; margin: 4px 0 6px !important; }
.hero .hero-sub { color: var(--ink-2); opacity: 1; font-size: .93rem; }
.hero .cta .btn { border-radius: 11px; }
.hero .cta .btn.solid { background: var(--ink) !important; color: var(--bg) !important; border-color: var(--ink) !important; box-shadow: 0 4px 12px rgba(31,42,68,.18) !important; }
.hero .cta .btn:not(.solid) { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
:root[data-theme="dark"] .hero .cta .btn.solid { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; }
.ring .track { stroke: var(--surface-3); }
.ring .fill { stroke: var(--accent); filter: none; }
.ring .ring-num b { color: var(--ink); font-family: var(--font-serif); font-size: 1.5rem; }
.ring .ring-num span { color: var(--ink-3); }

/* ---- estadísticas: fichas ---- */
.stat { background: var(--surface) !important; border: 1px solid var(--line) !important; border-radius: 12px !important; box-shadow: var(--shadow-1) !important; }
.stat .k { color: var(--ink-3); font-size: .68rem; letter-spacing: .09em; font-weight: 700; }
.stat .k svg { background: var(--accent-soft) !important; color: var(--accent) !important; border-radius: 7px; }
.stat.flame .k svg { background: color-mix(in srgb, var(--flame) 16%, var(--surface)) !important; color: var(--flame) !important; }
.stat .v { font-family: var(--font-serif); font-weight: 700; font-size: 1.9rem; color: var(--ink); }
.stat.flame .v { color: var(--flame); }

/* ---- tarjetas de mazo: fichas de estudio con pestaña de color ---- */
.deck-card, .folder-card {
  --dc-soft: color-mix(in srgb, var(--dc) 22%, var(--surface));
  --dc-ink: color-mix(in srgb, var(--dc) 60%, var(--ink));
  background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important;
  border-radius: 14px !important; text-shadow: none !important;
  box-shadow: var(--shadow-1), 0 6px 16px rgba(70,55,30,.05) !important;
}
:root[data-theme="dark"] .deck-card, :root[data-theme="dark"] .folder-card { --dc-ink: color-mix(in srgb, var(--dc) 55%, #fff); --dc-soft: color-mix(in srgb, var(--dc) 26%, var(--surface)); }
.deck-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px; border-radius: 14px 14px 0 0;
  background: color-mix(in srgb, var(--dc) 55%, var(--surface)); }
.deck-card h3, .folder-card h3, .folder-name h3 { color: var(--ink) !important; font-family: var(--font-serif); font-weight: 700; font-size: 1.32rem; line-height: 1.15; text-shadow: none !important; }
.deck-line *, .deck-hero *, .deck-card *, .folder-card * { text-shadow: none !important; }
.deck-card .desc, .deck-card .meta, .folder-meta, .folder-foot { color: var(--ink-2) !important; text-shadow: none !important; }
.deck-card .meta .pill:last-child, .folder-foot span:first-child { color: var(--dc-ink) !important; }
.deck-card .meta .pill svg, .folder-meta svg { color: var(--ink-3) !important; }
.dc-ic, .folder-ic { background: var(--dc-soft) !important; color: var(--dc-ink) !important;
  border: 1px solid color-mix(in srgb, var(--dc) 35%, var(--surface)) !important; box-shadow: none !important;
  font-family: var(--font-serif); font-weight: 700; border-radius: 11px !important; }
.deck-card .progress, .folder-card .progress { background: var(--surface-3) !important; height: 6px; }
.deck-card .progress > i, .folder-card .progress > i { background: var(--dc-ink) !important; }
.deck-card > .grip, .folder-card .grip { color: var(--ink-3) !important; }
.deck-card > .grip:hover, .folder-card .grip:hover { background: var(--surface-2) !important; color: var(--ink) !important; }
.deck-card:hover, .folder-card:hover { transform: translateY(-2px) rotate(-.25deg);
  box-shadow: var(--shadow-1), 0 14px 30px rgba(70,55,30,.10) !important; border-color: color-mix(in srgb, var(--dc) 35%, var(--line)) !important; }
/* curso = carpeta: pestaña superior tipo archivador + papel teñido */
.folder-card { background: linear-gradient(180deg, var(--dc-soft), var(--surface) 70%) !important; padding-top: 22px !important; }
.folder-card::before { display: block !important; content: ""; position: absolute; top: 0; left: 18px; width: 84px; height: 8px;
  border-radius: 0 0 7px 7px; background: color-mix(in srgb, var(--dc) 60%, var(--surface)); }

/* ---- pestaña Mazos: renglones con lomo de color ---- */
.deck-line { background: var(--surface) !important; color: var(--ink) !important; text-shadow: none !important;
  border: 1px solid var(--line) !important; border-left: 6px solid color-mix(in srgb, var(--dc) 60%, var(--surface)) !important;
  border-radius: 12px !important; box-shadow: var(--shadow-1) !important; }
.deck-line:hover { box-shadow: var(--shadow-2) !important; }
.dl-ic { background: color-mix(in srgb, var(--dc) 20%, var(--surface)) !important; color: color-mix(in srgb, var(--dc) 60%, var(--ink)) !important;
  border: 1px solid color-mix(in srgb, var(--dc) 32%, var(--surface)) !important; font-family: var(--font-serif); border-radius: 10px !important; }
.dl-body b { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; }
.dl-body span { color: var(--ink-3); opacity: 1; }
.dl-pct em { color: color-mix(in srgb, var(--dc) 60%, var(--ink)); }
.dl-bar { background: var(--surface-3) !important; }
.dl-bar > i { background: color-mix(in srgb, var(--dc) 60%, var(--ink)) !important; }
:root[data-theme="dark"] .dl-ic, :root[data-theme="dark"] .dl-pct em { color: color-mix(in srgb, var(--dc) 55%, #fff) !important; }
:root[data-theme="dark"] .dl-bar > i { background: color-mix(in srgb, var(--dc) 55%, #fff) !important; }
.dl-head { color: var(--ink-2); font-family: var(--font-serif); font-size: 1.12rem; font-weight: 700; }

/* ---- cabecera del mazo: portada de cuaderno con cinta ---- */
.deck-hero {
  --dc-ink: color-mix(in srgb, var(--dc) 60%, var(--ink));
  color: var(--ink) !important; text-shadow: none !important; border: 1px solid var(--line); border-radius: 16px; overflow: visible;
  background:
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px) 0 96px / 100% calc(100% - 96px) no-repeat,
    linear-gradient(180deg, color-mix(in srgb, var(--dc) 20%, var(--surface)) 0, var(--surface) 92px) !important;
  box-shadow: var(--shadow-1), 0 8px 0 -4px var(--surface-2), 0 8px 0 -3px var(--line), var(--shadow-2) !important;
}
:root[data-theme="dark"] .deck-hero { --dc-ink: color-mix(in srgb, var(--dc) 55%, #fff); }
.deck-hero::after { top: -10px; right: 30px; left: auto; width: 86px; height: 22px; border-radius: 2px; transform: rotate(-3deg);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--dc) 38%, transparent) 0 7px, color-mix(in srgb, var(--dc) 24%, transparent) 7px 14px); }
.deck-hero h1 { color: var(--ink) !important; font-size: 1.75rem; font-weight: 700; line-height: 1.12; }
.deck-hero p, .dh-meta { color: var(--ink-2); opacity: 1; }
.dh-crumb { color: var(--dc-ink); opacity: 1; }
.deck-hero .dc-ic { width: 52px; height: 52px; font-size: 1.5rem; }
.dh-menu { background: var(--surface) !important; color: var(--ink-2) !important; border: 1px solid var(--line) !important; margin: 0 !important; }
.dh-bar { background: var(--surface-3) !important; }
.dh-bar > i { background: var(--dc-ink) !important; }
.dh-progress > span { color: var(--dc-ink); font-family: var(--font-serif); font-size: 1.15rem; }
.dh-cta .btn { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
.dh-cta .btn.solid { background: var(--dc-ink) !important; color: #fff !important; border-color: var(--dc-ink) !important; box-shadow: 0 4px 12px rgba(31,42,68,.16) !important; }
:root[data-theme="dark"] .dh-cta .btn.solid { color: #14201d !important; }

/* ---- lista de tarjetas: renglones de libreta ---- */
.card-row { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.card-row .num { background: transparent; border: 1px solid var(--line); color: var(--ink-3); font-family: var(--font-serif); font-size: .95rem; font-weight: 700; border-radius: 50%; }
.card-row .q { font-family: var(--font-serif); font-size: 1.08rem; font-weight: 600; color: var(--ink); }

/* ---- barra inferior ---- */
.bottomnav { background: color-mix(in srgb, var(--surface) 94%, transparent) !important; border-top: 1px solid var(--line) !important; box-shadow: 0 -6px 18px rgba(70,55,30,.05) !important; }
.bn-item { font-weight: 600; }
.bn-item.active { color: var(--ink); }
.bn-item.active svg { color: var(--accent); }
.bn-plus { background: var(--ink) !important; color: var(--bg) !important; border-radius: 16px !important;
  box-shadow: 0 8px 18px rgba(31,42,68,.24), 0 0 0 4px var(--bg) !important; }
:root[data-theme="dark"] .bn-plus { background: var(--accent) !important; color: var(--accent-ink) !important; }

/* ---- hojas, campos, menús ---- */
.sheet { background: var(--surface); border-color: var(--line); }
.sheet h2 { font-family: var(--font-serif); font-size: 1.55rem; font-weight: 700; }
.menu-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.menu-item:hover { background: var(--surface-2); }
.field input, .field textarea, .field select, .rt-input, .search-box { background: var(--surface) !important; border-color: var(--line) !important; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.panel-head { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; }

/* ---- perfil / ilustraciones / tutorial ---- */
.profile-av { background: var(--ink) !important; color: var(--bg) !important; box-shadow: 0 0 0 5px var(--surface), 0 0 0 6px var(--line), var(--shadow-2) !important; }
:root[data-theme="dark"] .profile-av { background: var(--accent) !important; color: var(--accent-ink) !important; }
.profile-head h1 { font-family: var(--font-serif); font-size: 1.9rem; }
.profile-stats .ps { background: var(--surface); border-color: var(--line); border-radius: 12px; }
.profile-stats .ps b { font-family: var(--font-serif); font-size: 1.8rem; }
.illus .il-bg { fill: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.onb { background: var(--bg) !important; }
.onb-slide h2 { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; }
.onb-slide p { font-family: var(--font-sans); }
.auth-logo { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); }
:root[data-theme="dark"] .auth-logo { background: var(--accent); color: var(--accent-ink); }

/* ---- ESTUDIO: ficha de estudio con renglones y margen ---- */
.study-themed { --study-ink: color-mix(in srgb, var(--study) 60%, var(--ink)); --study-soft: color-mix(in srgb, var(--study) 18%, var(--surface)); }
:root[data-theme="dark"] .study-themed { --study-ink: color-mix(in srgb, var(--study) 55%, #fff); }
.study-themed::before { background: none !important; }
.study-themed .flashcard {
  border: 1px solid var(--line) !important; border-radius: 14px !important;
  background:
    linear-gradient(var(--margin), var(--margin)) 0 58px / 100% 1.5px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 33px, var(--rule) 33px 34px) 0 58px / 100% calc(100% - 58px) no-repeat,
    var(--surface) !important;
  box-shadow: var(--shadow-1), 0 9px 0 -5px var(--surface-2), 0 9px 0 -4px var(--line), 0 17px 0 -9px var(--surface-2), 0 17px 0 -8px var(--line), var(--shadow-2) !important;
}
.study-themed .flashcard::before { display: none !important; }
.study-themed .fc-label { color: var(--study-ink) !important; font-family: var(--font-sans); }
.flashcard .fc-question { font-family: var(--font-serif); color: var(--ink); }
.study-themed .fc-question { font-size: clamp(1.75rem, 6vw, 2.35rem); font-weight: 600; line-height: 1.25; }
.fc-bulb { color: var(--study-ink, var(--accent)) !important; background: var(--study-soft, var(--accent-soft)) !important;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--study, var(--accent)) 7%, transparent) !important; }
.study-themed .reveal-hint, .study-themed .reveal-hint svg { color: var(--ink-3) !important; }
.study-themed .btn.primary, .study-themed .reveal-btn { background: var(--study-ink) !important; border-color: var(--study-ink) !important;
  color: #fff !important; box-shadow: 0 4px 12px rgba(31,42,68,.16) !important; }
:root[data-theme="dark"] .study-themed .btn.primary, :root[data-theme="dark"] .study-themed .reveal-btn { color: #13201d !important; }
.study-themed .study-top .bar { background: var(--surface-3); }
.study-themed .study-top .bar > i { background: var(--study-ink) !important; }
.study-top .count { font-family: var(--font-serif); font-size: 1.05rem; }
.study-themed .deck-tag { background: var(--study-soft) !important; color: var(--study-ink) !important; border-color: color-mix(in srgb, var(--study) 30%, var(--line)) !important; }
.study-themed .fc-opt { background: var(--surface); border-color: var(--line); border-radius: 12px; }
.study-themed .fc-opt .opt-key { background: var(--study-soft) !important; color: var(--study-ink) !important; font-family: var(--font-serif); }
.study-themed .fc-opt:not(.answered):hover { border-color: var(--study-ink) !important; background: var(--study-soft) !important; }
.gc-ic { box-shadow: var(--shadow-1); }
.grade-circle[data-g="again"] .gc-ic { background: var(--danger-soft) !important; }
.grade-circle[data-g="good"] .gc-ic { background: var(--ok-soft) !important; }
.study-done.study-themed .stats-line .s b { color: var(--study-ink) !important; font-family: var(--font-serif); font-size: 2.2rem; }
.study-done h2 { font-family: var(--font-serif); font-size: 2.1rem; }
.study-done.study-themed .btn.primary { background: var(--study-ink) !important; border-color: var(--study-ink) !important; }
.combo-pop { background: var(--ink) !important; color: var(--bg) !important; box-shadow: var(--shadow-2) !important; }
.combo-pop .combo-flame svg { color: #eaa9b8; fill: #eaa9b8; }
.done-combo { background: var(--surface) !important; border-color: var(--line) !important; color: var(--ink-2) !important; }

/* ---- progreso / logros ---- */
.ach { background: var(--surface); border-color: var(--line); }
.ach.on .ach-badge { background: var(--accent-soft) !important; color: var(--accent) !important; }
.mastery-name { font-family: var(--font-serif); font-size: 1.05rem; }

/* ---- v10b · letras "Cuaderno anotado" (elegidas por el usuario: opción A) ----
   Literata (títulos y preguntas, letra de libro), Source Sans 3 (texto),
   Caveat (notas a mano: saludo, etiquetas de la ficha, avisos suaves). */
:root {
  --font-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Literata', Georgia, 'Times New Roman', serif;
  --font-read: 'Literata', Georgia, serif;
  --font-hand: 'Caveat', 'Segoe Print', cursive;
  --hand-ink: #6d5a8f;
}
:root[data-theme="dark"] { --hand-ink: #cdbde8; }
body { font-size: 16.5px; }
.brand-text { font-size: 1.3rem; font-weight: 700; letter-spacing: -.005em; }
.section-head h2 { font-size: 1.38rem; letter-spacing: -.01em; }
.section-head h1 { font-size: 1.65rem; letter-spacing: -.01em; }
.hero h1 { font-size: clamp(2rem, 6.4vw, 2.5rem) !important; letter-spacing: -.015em !important; line-height: 1.08 !important; }
.deck-card h3, .folder-card h3, .folder-name h3 { font-size: 1.16rem; letter-spacing: -.005em; }
.dl-body b { font-size: 1.02rem; }
.dl-head { font-size: 1rem; }
.deck-hero h1 { font-size: 1.5rem; letter-spacing: -.01em; }
.card-row .q { font-size: 1rem; }
.stat .v { font-size: 1.65rem; }
.profile-head h1 { font-size: 1.6rem; }
.profile-stats .ps b { font-size: 1.55rem; }
.sheet h2, .panel-head { letter-spacing: -.01em; }
.sheet h2 { font-size: 1.35rem; }
.panel-head { font-size: 1.14rem; }
.onb-slide h2 { font-size: 1.75rem; }
.study-done h2 { font-size: 1.8rem; }
.study-done.study-themed .stats-line .s b { font-size: 1.9rem; }
.study-themed .fc-question { font-size: clamp(1.45rem, 5.2vw, 1.95rem); font-weight: 600; letter-spacing: -.01em; line-height: 1.32; }
.ring .ring-num b { font-size: 1.35rem; }

/* notas a mano: el saludo, las etiquetas de la ficha y avisos suaves */
.hero .greeting { font-family: var(--font-hand) !important; font-style: normal !important; font-weight: 600 !important;
  font-size: 1.55rem !important; color: var(--hand-ink) !important; line-height: 1; }
.flashcard .fc-label { font-family: var(--font-hand) !important; text-transform: none; letter-spacing: 0 !important;
  font-size: 1.45rem; font-weight: 600; line-height: 1; }
.flashcard .fc-label::before { display: none; }
.flashcard.is-front .fc-label { margin-top: -2px; }
.profile-hint, .onb-login { font-family: var(--font-hand); font-size: 1.25rem; font-weight: 600; color: var(--hand-ink); }
.onb-login b { color: var(--hand-ink); }
.fc-hint-k { font-family: var(--font-hand); font-size: 1.15rem; letter-spacing: 0; text-transform: none; }

/* ---- v10c · proporciones compactas (pedido: "todo está muy grande") ----
   Escala más contenida y profesional: letra base 15px, títulos moderados,
   menos relleno, íconos y botones más pequeños, barra inferior más baja. */
body { font-size: 15px; line-height: 1.5; }
.app-main { padding: 14px 14px calc(84px + var(--safe-bottom)); }
body:has(#nl-badge-frame) .app-main { padding-bottom: calc(84px + var(--nl-badge-space) + var(--safe-bottom)); }

/* barra superior */
:root { --topbar-h: 52px; }
.topbar { padding-inline: 8px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.brand-mark svg { width: 16px; height: 16px; }
.brand-text { font-size: 1.12rem; }
.icon-btn { width: 40px; height: 40px; }
.icon-btn svg { width: 20px; height: 20px; }

/* botones */
.btn { padding: 8px 13px; font-size: .88rem; gap: 7px; border-radius: 10px; }
.btn svg { width: 16px; height: 16px; }
.btn.sm { padding: 6px 10px; font-size: .8rem; }
.btn.lg { padding: 11px 16px; font-size: .93rem; border-radius: 11px; }

/* encabezados de sección */
.section-head { margin: 4px 2px 12px; padding-bottom: 6px; }
.section-head h2 { font-size: 1.12rem; }
.section-head h1 { font-size: 1.32rem; }
.section-head .sub { font-size: .62rem; }

/* héroe "Hoy" */
.hero { padding: 16px 14px 14px 34px !important; margin-bottom: 18px; border-radius: 14px !important;
  background-position: 0 0, 0 14px, 0 0 !important; }
.hero::before { width: 74px; height: 19px; top: -8px; right: 26px; }
.hero .hero-head { gap: 10px; }
.hero .greeting { font-size: 1.22rem !important; }
.hero h1 { font-size: clamp(1.45rem, 5vw, 1.8rem) !important; margin: 2px 0 4px !important; }
.hero .hero-sub { font-size: .84rem; }
.hero .cta { margin-top: 12px !important; gap: 8px; }
.ring { width: 64px; height: 64px; }
.ring svg { width: 64px; height: 64px; }
.ring .ring-num b { font-size: 1.05rem; }
.ring .ring-num span { font-size: .56rem; }

/* estadísticas */
.stat-row { gap: 8px; margin-bottom: 18px; }
.stat { padding: 10px 11px !important; border-radius: 10px !important; }
.stat .k { font-size: .6rem; gap: 6px; }
.stat .k svg { width: 22px; height: 22px; padding: 4px; border-radius: 6px; }
.stat .v { font-size: 1.3rem; margin-top: 4px; }
.stat .v small { font-size: .66rem; }

/* tarjetas de mazo y curso */
.deck-grid { gap: 12px; }
.deck-card { padding: 15px 14px 11px !important; border-radius: 12px !important; }
.deck-card::before { height: 5px; border-radius: 12px 12px 0 0; }
.folder-card { padding: 18px 14px 12px !important; border-radius: 12px !important; }
.folder-card::before { height: 6px; width: 70px; left: 14px; }
.deck-card h3, .folder-card h3, .folder-name h3 { font-size: 1rem; margin-bottom: 1px; }
.deck-card .desc, .folder-meta { font-size: .78rem; }
.deck-card .meta, .folder-foot { font-size: .72rem; }
.dc-top { gap: 11px; }
.dc-ic, .folder-ic { width: 36px !important; height: 36px !important; font-size: .95rem !important; border-radius: 9px !important; }
.folder-ic svg { width: 18px; height: 18px; }
.deck-card .progress, .folder-card .progress { height: 5px; margin: 10px 0 7px; }
.deck-card > .grip { top: 6px; right: 6px; }

/* pestaña Mazos */
.deck-line { padding: 9px 11px; gap: 11px; margin-bottom: 8px; border-radius: 10px !important; border-left-width: 5px !important; }
.dl-ic { width: 34px; height: 34px; font-size: .95rem; border-radius: 9px !important; }
.dl-body b { font-size: .95rem; }
.dl-body span { font-size: .72rem; }
.dl-pct { width: 50px; gap: 5px; }
.dl-pct em { font-size: .78rem; }
.dl-head { font-size: .92rem; padding-bottom: 8px; }
.dl-group { margin-bottom: 14px; }

/* cabecera del mazo */
.deck-hero { padding: 15px 14px 14px; margin-bottom: 18px; border-radius: 14px; }
.deck-hero::after { width: 70px; height: 18px; top: -8px; }
.deck-hero h1 { font-size: 1.22rem; }
.deck-hero p { font-size: .82rem; }
.deck-hero .dc-ic { width: 42px !important; height: 42px !important; font-size: 1.15rem !important; }
.dh-top { gap: 11px; }
.dh-menu { width: 34px; height: 34px; border-radius: 10px; }
.dh-progress { margin: 12px 0 6px; }
.dh-bar { height: 6px; }
.dh-progress > span { font-size: .95rem; }
.dh-meta { font-size: .74rem; }
.dh-cta { margin-top: 12px; gap: 8px; }
.dh-cta .btn { padding: 9px 10px; border-radius: 10px; font-size: .86rem; }

/* lista de tarjetas */
.card-row { padding: 10px 12px 10px 4px; gap: 9px; border-radius: 10px; margin-bottom: 7px; }
.card-row .num { width: 26px; height: 26px; font-size: .8rem; }
.card-row .q { font-size: .92rem; }
.card-row .a { font-size: .78rem; }
.row-tags { margin-top: 6px; gap: 5px; }
.row-tags .due-chip, .row-tags .type-tag { font-size: .62rem; padding: 1px 8px; }
.card-row .thumb { width: 44px; height: 44px; }
.search-box input { padding: 9px 0; font-size: .9rem; }

/* barra inferior */
.bottomnav { height: calc(56px + var(--safe-bottom)); }
.bn-item { font-size: .6rem; gap: 2px; padding: 4px 2px; }
.bn-item svg { width: 20px; height: 20px; }
.bn-plus { width: 46px; height: 46px; margin-top: -16px; border-radius: 14px !important; }
.bn-plus svg { width: 22px; height: 22px; }
body:has(#nl-badge-frame) #nl-badge-frame { bottom: calc(56px + var(--safe-bottom) + 2px) !important; }
.toast-wrap { bottom: calc(74px + var(--safe-bottom)); }
.toast { font-size: .82rem; padding: 9px 14px; }

/* estudio */
.study-wrap { min-height: calc(100dvh - var(--topbar-h) - var(--safe-top) - 30px); }
.study-top { margin-bottom: 12px; }
.study-act { width: 34px; height: 34px; border-radius: 10px; }
.study-act svg { width: 16px; height: 16px; }
.study-themed .flashcard { padding: 22px 18px !important; min-height: 44vh; }
.study-themed .flashcard { background-position: 0 50px, 0 50px, 0 0 !important; }
.flashcard .fc-label { font-size: 1.25rem; }
.study-themed .fc-question { font-size: clamp(1.2rem, 4.6vw, 1.55rem); line-height: 1.35; }
.study-themed .fc-answer, .flashcard .fc-answer { font-size: 1rem; line-height: 1.6; }
.fc-bulb { width: 46px; height: 46px; margin-bottom: 12px; }
.fc-bulb svg { width: 22px; height: 22px; }
.reveal-hint { font-size: .78rem; }
.fc-opt { padding: 11px 12px; gap: 10px; font-size: .92rem; }
.fc-opt .opt-key { width: 26px; height: 26px; font-size: .8rem; }
.grade-circles { gap: 40px; margin-top: 12px; }
.gc-ic { width: 60px; height: 60px; }
.gc-ic svg { width: 26px; height: 26px; }
.gc-lbl { font-size: .85rem; }
.combo-pop { top: calc(var(--topbar-h) + var(--safe-top) + 56px); padding: 6px 13px 6px 11px; }
.combo-pop b { font-size: 1.1rem; }
.study-done h2 { font-size: 1.45rem; }
.study-done .stats-line { gap: 22px; margin: 16px 0 20px; }
.study-done.study-themed .stats-line .s b { font-size: 1.5rem; }
.done-illus .illus { width: 170px; }

/* hojas, menús y campos */
.sheet { padding-left: 16px; padding-right: 16px; }
.sheet h2 { font-size: 1.15rem; margin-bottom: 10px; }
.menu-item { padding: 11px 12px; gap: 10px; font-size: .9rem; margin-bottom: 7px; }
.menu-item svg { width: 18px; height: 18px; }
.menu-item .mi-sub { font-size: .74rem; }
.mi-ic { width: 32px; height: 32px; border-radius: 9px; }
.menu-item .mi-ic svg { width: 17px; height: 17px; }
.field label { font-size: .8rem; }
.field input, .field textarea, .field select { font-size: .92rem; padding: 9px 11px; }

/* progreso, perfil, tutorial, vacíos */
.panel { padding: 14px; }
.panel-head { font-size: 1rem; margin-bottom: 11px; }
.profile-head { padding: 4px 0 12px; }
.profile-av { width: 70px; height: 70px; margin-bottom: 10px; }
.profile-av svg { width: 36px; height: 36px; }
.av-initial, .av.av-fill { font-size: 1.8rem; }
.profile-head h1 { font-size: 1.3rem; }
.profile-email { font-size: .82rem; }
.profile-stats { gap: 8px; margin-top: 14px; }
.profile-stats .ps { padding: 10px 6px; }
.profile-stats .ps b { font-size: 1.25rem; }
.profile-stats .ps span { font-size: .66rem; }
.profile-hint { font-size: 1.1rem; }
.sync-cta { padding: 13px; margin-top: 14px; }
.sc-ic { width: 36px; height: 36px; }
.onb-slide h2 { font-size: 1.45rem; }
.onb-slide p { font-size: .94rem; }
.onb-illus .illus { width: 220px; }
.empty-illus .illus { width: 190px; }
.empty h2 { font-size: 1.15rem; }
.empty p { font-size: .9rem; }

/* ---- reverso de la ficha: el texto se escribe SOBRE los renglones ----
   Los renglones van en el área de texto (se desplazan con él) y todo usa
   una altura de línea de 28px, así cada línea cae justo sobre un renglón. */
.study-themed .flashcard:not(.is-front):not(.is-choice) {
  background: linear-gradient(var(--margin), var(--margin)) 0 50px / 100% 1.5px no-repeat, var(--surface) !important; }
.study-themed .flashcard:not(.is-front):not(.is-choice) .fc-scroll {
  flex: 1; padding-top: 4px;
  background: repeating-linear-gradient(to bottom, transparent 0 27px, var(--rule) 27px 28px);
  background-attachment: local; }
.flashcard .fc-scroll .fc-recall { font-size: 1.02rem; line-height: 28px; margin: 0 0 28px; padding: 0; border: 0; }
.flashcard .fc-scroll .fc-answer, :root[data-card-font] .flashcard .fc-scroll .fc-answer { line-height: 28px !important; margin: 0; }
.flashcard .fc-scroll .fc-image { margin: 0 0 28px; }
