/* =========================================================
   Langwise — sistema de diseño
   Tinta azul de pluma (Königsblau), subrayador amarillo,
   rojo de corrección y líneas de metro para el camino.
   ========================================================= */
:root {
  --paper: #F6F4FC;
  --surface: #FFFFFF;
  --surface-2: #EEEAF8;
  --line: #DED8EE;
  --line-strong: #C6BEDF;
  --ink: #1A1633;
  --ink-2: #4A4566;
  --ink-3: #777291;
  --night: #1B1642;
  --blue: #6A4BFF;
  --blue-press: #4C2FD9;
  --blue-soft: #ECE7FF;
  --on-blue: #FFFFFF;
  --marker: #FFD400;
  --marker-soft: #FFF2A6;
  --on-marker: #1A1633;
  --pink: #FF4D8D;
  --mint: #19C98A;
  --sky: #2FB3F0;
  --red: #E0364F;
  --red-press: #A8203A;
  --red-soft: #FDE4E8;
  --green: #0E946A;
  --green-press: #0A6B4D;
  --green-soft: #D9F5EA;
  --l-a1: #0E946A;
  --l-a2: #1C8FCC;
  --l-b1: #6A4BFF;
  --l-b2: #D6336F;
  --l-c1: #D9730D;
  --grid: rgba(106, 75, 255, .08);
  --shadow-pop: 0 10px 30px -12px rgba(26, 22, 51, .35);
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --nav-h: 68px;
  --side-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #110E26; --surface: #1A1636; --surface-2: #231E47; --line: #322B5E; --line-strong: #443B7A;
    --ink: #F0EEFA; --ink-2: #BDB7DA; --ink-3: #8C86AD; --night: #0B0920;
    --blue: #9A85FF; --blue-press: #7258F5; --blue-soft: #2A2360; --on-blue: #110E26;
    --marker-soft: #4A4210; --red: #FF6B80; --red-press: #D94A5E; --red-soft: #3D1A26;
    --green: #3DDBA3; --green-press: #22B582; --green-soft: #133A2E;
    --l-a1: #3DDBA3; --l-a2: #4CC3F5; --l-b1: #9A85FF; --l-b2: #FF6FA2; --l-c1: #FFA24C;
    --grid: rgba(154, 133, 255, .09); --shadow-pop: 0 10px 30px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #110E26; --surface: #1A1636; --surface-2: #231E47; --line: #322B5E; --line-strong: #443B7A;
  --ink: #F0EEFA; --ink-2: #BDB7DA; --ink-3: #8C86AD; --night: #0B0920;
  --blue: #9A85FF; --blue-press: #7258F5; --blue-soft: #2A2360; --on-blue: #110E26;
  --marker-soft: #4A4210; --red: #FF6B80; --red-press: #D94A5E; --red-soft: #3D1A26;
  --green: #3DDBA3; --green-press: #22B582; --green-soft: #133A2E;
  --l-a1: #3DDBA3; --l-a2: #4CC3F5; --l-b1: #9A85FF; --l-b2: #FF6FA2; --l-c1: #FFA24C;
  --grid: rgba(154, 133, 255, .09); --shadow-pop: 0 10px 30px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--blue); }
button { font: inherit; color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }
.de { font-weight: 700; }
.mark { background: linear-gradient(transparent 52%, var(--marker) 52%, var(--marker) 92%, transparent 92%); padding: 0 .12em; color: inherit; }
:root[data-theme="dark"] .mark, :root:not([data-theme="light"]) .mark { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { background: linear-gradient(transparent 52%, rgba(255,212,0,.35) 52%, rgba(255,212,0,.35) 92%, transparent 92%); } }
:root[data-theme="dark"] .mark { background: linear-gradient(transparent 52%, rgba(255,212,0,.35) 52%, rgba(255,212,0,.35) 92%, transparent 92%); }

/* ---------- Botones ---------- */
.btn {
  --b: var(--surface); --bp: var(--line-strong); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 46px; padding: .6em 1.15em; border-radius: var(--radius-s);
  background: var(--b); color: var(--c); border: 1.5px solid var(--bp);
  box-shadow: 0 3px 0 var(--bp); font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .06s, box-shadow .06s, background .15s; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--bp); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.btn-primary { --b: var(--blue); --bp: var(--blue-press); --c: var(--on-blue); }
.btn-success { --b: var(--green); --bp: var(--green-press); --c: #fff; }
.btn-danger { --b: var(--red); --bp: var(--red-press); --c: #fff; }
.btn-marker { --b: var(--marker); --bp: #C9A600; --c: var(--on-marker); }
.btn-ghost { --b: transparent; --bp: transparent; box-shadow: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-sm { min-height: 36px; padding: .35em .8em; font-size: .9rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: .92rem; }
.input, .textarea, .select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); padding: .7em .85em; min-height: 48px;
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.form-error { color: var(--red); font-weight: 700; min-height: 1.4em; margin: 0 0 12px; }

/* ---------- Auth: noche con bocadillos ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth-hero { background: var(--night); color: #fff; padding: 22px 20px 30px; position: relative; overflow: hidden; isolation: isolate; }
.auth-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1.5px); background-size: 22px 22px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-hero .brand { color: #fff; }
.ui-langs { display: inline-flex; gap: 4px; background: rgba(255,255,255,.08); padding: 4px; border-radius: 999px; }
.ui-langs button { border: 0; background: transparent; color: rgba(255,255,255,.75); padding: 6px 10px; border-radius: 999px; font-weight: 700; cursor: pointer; font-size: .85rem; display: inline-flex; gap: 6px; align-items: center; }
.ui-langs button .flag { width: 18px; height: 18px; border-width: 1px; }
.ui-langs button[aria-pressed="true"] { background: #fff; color: var(--night); }
.bubbles { position: relative; height: 200px; margin: 16px -4px 12px; }
.bubble-say { position: absolute; padding: 9px 15px; border-radius: 20px; font: 800 1rem var(--f-display); color: var(--night); white-space: nowrap;
  transform: rotate(var(--r, 0deg)); animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; animation-delay: var(--d, 0s); box-shadow: 0 6px 0 rgba(0,0,0,.22); }
.bubble-say small { display: block; font: 700 .66rem var(--f-body); opacity: .72; }
.bubble-say::after { content: ""; position: absolute; bottom: -8px; left: 22px; border: 9px solid transparent; border-top-color: var(--bc); border-bottom: 0; }
.bubble-say.right::after { left: auto; right: 22px; }
.b-sun { background: var(--marker); --bc: var(--marker); }
.b-pink { background: var(--pink); --bc: var(--pink); color: #fff; }
.b-mint { background: var(--mint); --bc: var(--mint); }
.b-sky { background: var(--sky); --bc: var(--sky); }
.b-lilac { background: #B9A8FF; --bc: #B9A8FF; }
.b-white { background: #fff; --bc: #fff; }
@keyframes pop { from { opacity: 0; transform: rotate(var(--r, 0deg)) scale(.4) translateY(14px); } }
.auth-hero h1 { color: #fff; font-size: clamp(1.7rem, 6.3vw, 3.1rem); max-width: 16ch; margin: 0 0 10px; }
.auth-hero p { color: rgba(255,255,255,.78); max-width: 46ch; margin: 0; }
.auth-panel { padding: 26px 20px 40px; display: grid; align-content: start; justify-items: center; }
.auth-card { width: 100%; max-width: 420px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.auth-tabs button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--line-strong); }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.15fr 1fr; }
  .auth-hero { padding: 34px 52px 44px; display: flex; flex-direction: column; }
  .bubbles { flex: 1; height: auto; min-height: 330px; margin: 24px 0; }
  .bubble-say { font-size: 1.3rem; padding: 12px 20px; }
  .auth-panel { align-content: center; padding: 48px; }
}

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 1.25rem var(--f-display); color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 32px; height: 32px; }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: none; }
.course-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; font-size: .95rem;
}
.course-pill .muted { white-space: nowrap; }
@media (max-width: 480px) { .course-pill .muted { display: none; } }
.flag-pair { display: inline-flex; }
.flag { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; border: 2px solid var(--surface); flex: none; }
.flag + .flag { margin-left: -9px; }
.flag svg { width: 100%; height: 100%; }
.top-stats { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.stat-pill { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; padding: 6px 10px; border-radius: 999px; font-size: .95rem; }
.stat-pill svg { width: 20px; height: 20px; }
.stat-pill.streak { color: #D9480F; }
.stat-pill.streak.off { color: var(--ink-3); }
.stat-pill.xp { color: var(--blue); }

.main { padding: 20px 16px 32px; max-width: 820px; margin: 0 auto; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1.5px solid var(--line); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  display: grid; justify-items: center; align-content: center; gap: 3px; text-decoration: none;
  color: var(--ink-3); font-size: .74rem; font-weight: 700; position: relative;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item[aria-current="page"] { color: var(--blue); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
.side-nav { display: none; }

@media (min-width: 960px) {
  .shell { padding-bottom: 0; padding-left: var(--side-w); }
  .bottom-nav { display: none; }
  .side-nav {
    display: flex; flex-direction: column; gap: 4px; position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w);
    padding: 22px 14px; background: var(--surface); border-right: 1.5px solid var(--line); overflow-y: auto;
  }
  .side-nav .brand { margin: 0 10px 22px; }
  .side-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    text-decoration: none; color: var(--ink-2); font-weight: 700;
  }
  .side-link svg { width: 22px; height: 22px; }
  .side-link:hover { background: var(--surface-2); }
  .side-link[aria-current="page"] { background: var(--blue-soft); color: var(--blue); }
  .side-sub { display: grid; gap: 2px; margin: 0 0 6px 34px; }
  .side-sub a { text-decoration: none; color: var(--ink-3); padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: .92rem; }
  .side-sub a:hover { color: var(--ink); background: var(--surface-2); }
  .side-sub a[aria-current="page"] { color: var(--blue); }
  .side-foot { margin-top: auto; display: grid; gap: 4px; }
  .main { padding: 32px 40px 48px; }
}

/* ---------- Encabezados de página ---------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--ink-2); margin: 0; max-width: 60ch; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; }

/* ---------- Tarjetas y bloques ---------- */
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 18px; }
.card + .card { margin-top: 12px; }
.grid-2 > .card, .stack > .card { margin-top: 0; }
.card-link { display: block; text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s; }
.card-link:hover { border-color: var(--line-strong); }
.card-link > svg { width: 22px; height: 22px; flex: none; color: var(--ink-3); }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Seg control / chips */
.seg { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px 18px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-weight: 700; text-decoration: none; cursor: pointer; font-size: .93rem; white-space: nowrap;
}
.seg [aria-current="page"], .seg [aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (min-width: 960px) { .seg { margin: 0 0 18px; padding-left: 2px; padding-right: 2px; flex-wrap: wrap; } }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.lvl { color: #fff; background: var(--lc, var(--l-a1)); }
.lvl-A1 { --lc: var(--l-a1); } .lvl-A2 { --lc: var(--l-a2); } .lvl-B1 { --lc: var(--l-b1); } .lvl-B2 { --lc: var(--l-b2); } .lvl-C1 { --lc: var(--l-c1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lvl { color: var(--paper); } }
:root[data-theme="dark"] .lvl { color: var(--paper); }

/* ---------- Inicio ---------- */
.hello { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.ring { width: 92px; height: 92px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring .ring-label b { font: 800 1.35rem var(--f-display); }
.ring .ring-label span { font-size: .72rem; color: var(--ink-3); font-weight: 700; }
.continue {
  background: var(--night); color: #fff; border-radius: var(--radius-l); padding: 22px; position: relative; overflow: hidden;
  display: grid; gap: 6px;
}
.continue h2 { color: inherit; margin: 0; font-size: 1.6rem; }
.continue .muted { color: inherit; opacity: .78; }
.continue .btn { justify-self: start; margin-top: 10px; }
.continue .line-badge { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.continue .line-badge i { width: 28px; height: 28px; border-radius: 7px; display: grid; place-content: center; background: var(--marker); color: var(--on-marker); font-style: normal; font: 800 .8rem var(--f-display); }
.progress-bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; margin-top: 8px; }
.progress-bar > i { display: block; height: 100%; background: var(--marker); border-radius: inherit; }
.progress-bar.on-paper { background: var(--surface-2); }
.progress-bar.on-paper > i { background: var(--blue); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a { display: grid; gap: 8px; padding: 14px; border-radius: var(--radius-m); background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: inherit; }
.quick a:hover { border-color: var(--line-strong); }
.quick a svg { width: 26px; height: 26px; color: var(--blue); }
.quick b { font-family: var(--f-display); font-size: 1.05rem; }
.quick span { color: var(--ink-3); font-size: .85rem; }
.quick .count { display: inline-block; min-width: 24px; text-align: center; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-weight: 700; font-size: .78rem; }
.daily-word { display: grid; gap: 4px; }
.daily-word .big { font: 800 1.7rem var(--f-display); }

/* ---------- Camino: líneas de metro ---------- */
.metro-line { --lc: var(--l-a1); margin: 8px 0 28px; }
.metro-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.metro-head .line-sign {
  width: 46px; height: 46px; border-radius: 12px; background: var(--lc); color: #fff; display: grid; place-content: center;
  font: 800 1.1rem var(--f-display); flex: none;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .metro-head .line-sign { color: var(--paper); } }
:root[data-theme="dark"] .metro-head .line-sign { color: var(--paper); }
.metro-head h2 { margin: 0; }
.metro-head p { margin: 0; color: var(--ink-3); font-size: .9rem; }
.stations { list-style: none; margin: 0; padding: 0; position: relative; }
.station { position: relative; padding-left: 52px; }
.station::before { /* tramo de vía */
  content: ""; position: absolute; left: 20px; top: 0; bottom: 0; width: 8px; background: var(--lc); opacity: .28;
}
.station.done::before, .station.done + .station::before { opacity: 1; }
.station:first-child::before { top: 28px; }
.station:last-child::before { bottom: calc(100% - 28px); }
.station .stop {
  position: absolute; left: 10px; top: 14px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 5px solid var(--lc); display: grid; place-content: center; z-index: 1;
}
.station.done .stop { background: var(--lc); }
.station.done .stop svg { width: 14px; height: 14px; color: #fff; }
.station.current .stop { width: 34px; height: 34px; left: 7px; top: 11px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--lc) 25%, transparent); }
.station-card {
  display: block; text-decoration: none; color: inherit; padding: 12px 14px; margin: 6px 0; border-radius: 14px;
  border: 1.5px solid transparent;
}
.station-card:hover { background: var(--surface); border-color: var(--line); }
.station.current .station-card { background: var(--surface); border-color: var(--lc); }
.station-card .st-name { font: 700 1.1rem var(--f-display); display: block; }
.station-card .st-es { color: var(--ink-2); font-size: .95rem; }
.station-card .st-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Detalle de lección ---------- */
.lesson-hero { border-radius: var(--radius-l); padding: 22px; background: var(--surface); border: 1.5px solid var(--line); border-top: 8px solid var(--lc, var(--l-a1)); }
.lesson-hero h1 { margin: 8px 0 4px; }
.goal-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.goal-list li { display: flex; gap: 10px; align-items: flex-start; }
.goal-list li svg { width: 20px; height: 20px; color: var(--green); flex: none; margin-top: 3px; }
.parts-list { counter-reset: part; list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.parts-list li { counter-increment: part; display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; }
.parts-list li::before { content: counter(part); width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-content: center; background: var(--surface-2); font-weight: 800; font-family: var(--f-display); }
.parts-list li.done::before { content: "✓"; background: var(--green); color: #fff; }

/* ---------- Reproductor de lección ---------- */
.player { position: fixed; inset: 0; z-index: 50; background: var(--paper); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.player-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); max-width: 820px; width: 100%; margin: 0 auto; }
.seg-progress { flex: 1; display: flex; gap: 4px; }
.seg-progress .sp { flex: var(--w, 1); height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.seg-progress .sp > i { display: block; height: 100%; width: var(--p, 0%); background: var(--green); border-radius: 99px; transition: width .35s ease; }
.player-part { text-align: center; font-weight: 700; color: var(--ink-3); font-size: .85rem; padding: 0 16px; }
.player-body { overflow-y: auto; padding: 8px 16px 24px; }
.player-inner { max-width: 680px; margin: 0 auto; }
.player-foot { border-top: 1.5px solid var(--line); background: var(--surface); padding: 14px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.player-foot .inner { max-width: 680px; margin: 0 auto; display: grid; gap: 10px; }
.player-foot.is-ok { background: var(--green-soft); border-color: transparent; }
.player-foot.is-bad { background: var(--red-soft); border-color: transparent; }
.feedback { display: flex; gap: 12px; align-items: flex-start; }
.feedback .fb-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-content: center; flex: none; color: #fff; }
.feedback .fb-icon svg { width: 22px; height: 22px; }
.is-ok .fb-icon { background: var(--green); } .is-bad .fb-icon { background: var(--red); }
.feedback h3 { margin: 0 0 2px; }
.is-ok .feedback h3 { color: var(--green); } .is-bad .feedback h3 { color: var(--red); }
.feedback p { margin: 0; }
@media (min-width: 640px) { .player-foot .inner { grid-template-columns: 1fr auto; align-items: center; } .player-foot .inner > .btn { min-width: 180px; } }

.ex-kicker { font-weight: 700; color: var(--ink-3); font-size: .92rem; margin: 10px 0 6px; display: flex; align-items: center; gap: 8px; }
.ex-kicker svg { width: 18px; height: 18px; }
.ex-title { font: 700 1.45rem/1.25 var(--f-display); margin: 0 0 18px; }
.prompt-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; margin-bottom: 18px; }
.prompt-box .pb-text { font-size: 1.2rem; font-weight: 700; }
.speak-btn { width: 52px; height: 52px; border-radius: 14px; border: 0; background: var(--blue); color: var(--on-blue); display: grid; place-content: center; cursor: pointer; flex: none; box-shadow: 0 3px 0 var(--blue-press); }
.speak-btn:active { transform: translateY(3px); box-shadow: none; }
.speak-btn svg { width: 26px; height: 26px; }
.speak-btn.sm { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 2px 0 var(--blue-press); }
.speak-btn.sm svg { width: 20px; height: 20px; }
.speak-btn.slow { background: var(--surface); color: var(--blue); border: 1.5px solid var(--line-strong); box-shadow: 0 3px 0 var(--line-strong); }
.listen-stage { display: flex; justify-content: center; gap: 16px; margin: 10px 0 26px; }
.listen-stage .speak-btn { width: 96px; height: 96px; border-radius: 26px; }
.listen-stage .speak-btn svg { width: 44px; height: 44px; }
.listen-stage .speak-btn.slow { width: 64px; height: 64px; align-self: end; border-radius: 18px; }
.listen-stage .speak-btn.slow svg { width: 28px; height: 28px; }

.options { display: grid; gap: 10px; }
@media (min-width: 560px) { .options.two { grid-template-columns: 1fr 1fr; } }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 56px; padding: 12px 14px;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 14px; box-shadow: 0 3px 0 var(--line-strong);
  cursor: pointer; font-size: 1.05rem; font-weight: 500;
}
.opt .k { width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--line-strong); display: grid; place-content: center; font-size: .8rem; font-weight: 700; color: var(--ink-3); flex: none; }
.opt[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 3px 0 var(--blue); }
.opt[aria-pressed="true"] .k { border-color: var(--blue); color: var(--blue); }
.opt.right { border-color: var(--green); background: var(--green-soft); box-shadow: 0 3px 0 var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); box-shadow: 0 3px 0 var(--red); }
.opt:disabled { cursor: default; }
.opt.big { justify-content: center; font: 700 1.4rem var(--f-display); min-height: 72px; }

.answer-line { min-height: 64px; border-bottom: 2px solid var(--line-strong); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; margin-bottom: 22px; align-content: flex-start; }
.answer-line + .answer-line { margin-top: -14px; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.token {
  padding: 9px 14px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface);
  box-shadow: 0 3px 0 var(--line-strong); font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.token.used { visibility: hidden; }
.token-slot { background: var(--surface-2); border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--line); color: transparent; padding: 9px 14px; font-weight: 700; }

.type-input { font-size: 1.2rem; min-height: 56px; }
.type-hint { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.type-hint button { min-width: 42px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; font-size: 1.05rem; }

.gap-sentence { font-size: 1.35rem; line-height: 1.8; font-weight: 500; margin-bottom: 22px; }
.gap-sentence .gap { display: inline-block; min-width: 90px; border-bottom: 3px solid var(--blue); text-align: center; color: var(--blue); font-weight: 700; padding: 0 6px; }

.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pairs .col { display: grid; gap: 10px; align-content: start; }
.pair { min-height: 54px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); box-shadow: 0 3px 0 var(--line-strong); font-weight: 700; cursor: pointer; font-size: 1rem; }
.pair[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 3px 0 var(--blue); }
.pair.matched { opacity: .35; border-style: dashed; box-shadow: none; cursor: default; }
.pair.miss { animation: shake .35s; border-color: var(--red); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.mic-stage { display: grid; justify-items: center; gap: 14px; margin: 10px 0 20px; }
.mic-btn { width: 104px; height: 104px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: grid; place-content: center; cursor: pointer; box-shadow: 0 4px 0 var(--red-press); }
.mic-btn svg { width: 46px; height: 46px; }
.mic-btn.listening { animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 55%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.heard { text-align: center; font-size: 1.15rem; min-height: 1.6em; }
.heard .w-ok { color: var(--green); font-weight: 700; } .heard .w-bad { color: var(--red); text-decoration: line-through; } .heard .w-miss { color: var(--ink-3); border-bottom: 2px dotted var(--red); }

/* Tarjetas de enseñanza */
.teach { display: grid; gap: 14px; }
.teach .t-label { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; color: var(--blue); }
.teach .t-label svg { width: 20px; height: 20px; }
.word-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 22px; display: grid; gap: 10px; }
.word-card .wc-de { font: 800 2rem/1.1 var(--f-display); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.word-card .wc-es { font-size: 1.15rem; color: var(--ink-2); }
.word-card .wc-ex { border-top: 1.5px dashed var(--line); padding-top: 12px; display: grid; gap: 2px; }
.art { font-weight: 800; padding: 0 .3em; border-radius: 6px; }
.art-m { color: #1D5FD1; } .art-f { color: #C2185B; } .art-n { color: #2E7D32; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .art-m { color: #82AAFF; } :root:not([data-theme="light"]) .art-f { color: #FF7BAC; } :root:not([data-theme="light"]) .art-n { color: #7CD992; } }
:root[data-theme="dark"] .art-m { color: #82AAFF; } :root[data-theme="dark"] .art-f { color: #FF7BAC; } :root[data-theme="dark"] .art-n { color: #7CD992; }
.mini-words { display: grid; gap: 8px; }
.mini-word { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; }
.mini-word .mw-de { font-weight: 700; font-size: 1.08rem; }
.mini-word .mw-es { color: var(--ink-3); font-size: .95rem; }

.theory { background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 20px; }
.theory h3 { margin-top: 0; }
.theory p:last-child { margin-bottom: 0; }
.theory ul { padding-left: 1.2em; margin: 0 0 1em; }
.theory li { margin-bottom: .35em; }
.tip { border-left: 5px solid var(--marker); background: var(--marker-soft); padding: 12px 14px; border-radius: 0 12px 12px 0; margin: 12px 0; }
.warn { border-left: 5px solid var(--red); background: var(--red-soft); padding: 12px 14px; border-radius: 0 12px 12px 0; margin: 12px 0; }
.gtable-wrap { overflow-x: auto; margin: 12px 0; border-radius: 12px; border: 1.5px solid var(--line); }
.gtable { width: 100%; border-collapse: collapse; font-size: .98rem; }
.gtable th, .gtable td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.gtable th { background: var(--surface-2); font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.gtable tr:last-child td { border-bottom: 0; }
.gtable td b { color: var(--blue); }
.ex-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.ex-list li { display: grid; gap: 1px; padding-left: 14px; border-left: 3px solid var(--line-strong); }
.ex-list li .es { color: var(--ink-3); font-size: .93rem; }

.say-inline { width: 26px; height: 26px; border-radius: 7px; border: 0; background: var(--blue-soft); color: var(--blue); font-size: .7rem; cursor: pointer; vertical-align: 1px; margin-right: 4px; }
.say-inline:hover { background: var(--blue); color: var(--on-blue); }
.dialog-lines { display: grid; gap: 10px; }
.dline { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.dline .who { width: 38px; height: 38px; border-radius: 50%; display: grid; place-content: center; font-weight: 800; color: #fff; font-family: var(--f-display); }
.dline .bubble { background: var(--surface); border: 1.5px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 10px 14px; }
.dline .bubble .es { color: var(--ink-3); font-size: .92rem; display: block; margin-top: 2px; }
.dline.right { grid-template-columns: auto 1fr auto; }
.dline .bubble.hide-es .es { filter: blur(5px); cursor: pointer; }

.summary { text-align: center; display: grid; gap: 14px; justify-items: center; padding-top: 20px; }
.summary .medal { width: 120px; height: 120px; border-radius: 50%; background: var(--marker); display: grid; place-content: center; color: var(--on-marker); }
.summary .medal svg { width: 60px; height: 60px; }
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 460px; }
.summary-stats div { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 8px; }
.summary-stats b { display: block; font: 800 1.5rem var(--f-display); }
.summary-stats span { font-size: .8rem; color: var(--ink-3); font-weight: 700; }

/* ---------- Vocabulario / Flashcards ---------- */
.deck-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.deck-stats div { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; }
.deck-stats b { display: block; font: 800 1.6rem var(--f-display); }
.deck-stats span { font-size: .82rem; color: var(--ink-3); font-weight: 700; }
.deck-stats .due b { color: var(--red); } .deck-stats .new b { color: var(--blue); } .deck-stats .known b { color: var(--green); }
.flash {
  perspective: 1200px; margin: 8px 0 18px; min-height: 280px; cursor: pointer;
}
.flash-inner { position: relative; display: grid; min-height: 280px; transition: transform .45s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: relative; grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--surface); border: 1.5px solid var(--line); border-radius: 24px; padding: 22px; display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center; }
.flash-face.back { transform: rotateY(180deg); }
.flash-face .f-main { font: 800 2rem/1.15 var(--f-display); }
.flash-face .f-sub { color: var(--ink-2); font-size: 1.1rem; }
@media (prefers-reduced-motion: reduce) { .flash-inner { transition: none; } }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate .btn { flex-direction: column; gap: 0; padding: .5em .3em; font-size: .92rem; }
.rate .btn small { font-weight: 500; opacity: .8; font-size: .75rem; }
.word-table { display: grid; gap: 6px; }
.word-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; }
.word-row .wr-text { display: grid; }
.word-row .wr-de { font-weight: 700; }
.word-row .wr-es { color: var(--ink-3); font-size: .93rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.dot.learning { background: var(--marker); } .dot.known { background: var(--green); } .dot.due { background: var(--red); }

/* ---------- Gramática ---------- */
.topic-list { display: grid; gap: 8px; }
.topic { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; }
.topic:hover { border-color: var(--line-strong); }
.topic .tp-main { flex: 1; display: grid; }
.topic .tp-title { font-weight: 700; font-size: 1.05rem; }
.topic .tp-sub { color: var(--ink-3); font-size: .9rem; }
.topic > svg { width: 20px; height: 20px; color: var(--ink-3); }

/* ---------- Frases ---------- */
.situations { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .situations { grid-template-columns: repeat(3, 1fr); } }
.situation { display: grid; gap: 6px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: inherit; }
.situation:hover { border-color: var(--line-strong); }
.situation .emoji { font-size: 1.8rem; line-height: 1; }
.situation b { font-family: var(--f-display); font-size: 1.05rem; }
.situation span { color: var(--ink-3); font-size: .85rem; }
.phrase { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; }
.phrase .ph-de { font-weight: 700; font-size: 1.05rem; }
.phrase .ph-es { color: var(--ink-2); font-size: .95rem; }
.phrase .ph-note { color: var(--ink-3); font-size: .84rem; font-style: italic; margin-top: 2px; }
.star { color: var(--ink-3); }
.star[aria-pressed="true"] { color: #E0A800; }
.star[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- Cuaderno (papel cuadriculado) ---------- */
.notebook-paper {
  background-color: var(--surface);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px; background-position: -1px -1px;
}
.notes-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .notes-grid { grid-template-columns: 1fr 1fr; } }
.note-card { position: relative; display: grid; gap: 6px; padding: 16px 16px 14px 22px; border-radius: 6px 16px 16px 6px; border: 1.5px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; min-height: 130px; text-align: left; font: inherit; width: 100%; }
.note-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; border-radius: 6px 0 0 6px; background: var(--nc, var(--blue)); }
.note-card h3 { margin: 0; font-size: 1.1rem; }
.note-card .nc-body { color: var(--ink-2); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.note-card .nc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; align-items: center; }
.note-editor { border-radius: 6px 20px 20px 6px; border: 1.5px solid var(--line); overflow: hidden; position: relative; }
.note-editor::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--nc, var(--blue)); }
.note-editor .ne-title { width: 100%; border: 0; background: transparent; font: 800 1.5rem var(--f-display); padding: 18px 18px 6px 26px; color: var(--ink); }
.note-editor .ne-title:focus { outline: none; }
.note-editor .ne-body { width: 100%; border: 0; background: transparent; font: 400 1.05rem/22px var(--f-body); padding: 11px 18px 18px 26px; min-height: 55vh; resize: vertical; color: var(--ink); }
.note-editor .ne-body:focus { outline: none; }
.ne-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line-strong); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ink); }
.chars { display: flex; gap: 4px; }
.chars button { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; }
.save-state { font-size: .85rem; color: var(--ink-3); font-weight: 700; }

/* ---------- Objetivos ---------- */
.goal-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .goal-options { grid-template-columns: repeat(4, 1fr); } }
.goal-opt { padding: 14px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; text-align: left; display: grid; gap: 2px; box-shadow: 0 3px 0 var(--line-strong); }
.goal-opt b { font-family: var(--f-display); font-size: 1.1rem; }
.goal-opt span { color: var(--ink-3); font-size: .85rem; }
.goal-opt[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 3px 0 var(--blue); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 150px; margin-top: 6px; }
.week .bar { display: grid; gap: 6px; justify-items: center; height: 100%; align-content: end; }
.week .bar i { width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: var(--surface-2); min-height: 6px; position: relative; }
.week .bar i.met { background: var(--blue); }
.week .bar i.some { background: color-mix(in srgb, var(--blue) 45%, var(--surface-2)); }
.week .bar span { font-size: .78rem; color: var(--ink-3); font-weight: 700; }
.week .bar.today span { color: var(--ink); }
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 4px; }
.cal i { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.cal i.l1 { background: color-mix(in srgb, var(--blue) 35%, var(--surface-2)); }
.cal i.l2 { background: color-mix(in srgb, var(--blue) 65%, var(--surface-2)); }
.cal i.l3 { background: var(--blue); }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.check-row.checked span { color: var(--ink-3); text-decoration: line-through; }
.lvl-progress { display: grid; gap: 10px; }
.lvl-progress .lp { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 12px; }
.lvl-progress .lp .progress-bar.on-paper > i { background: var(--lc); }

/* ---------- Escucha y habla ---------- */
.story { background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 20px; }
.story-text { font-size: 1.12rem; line-height: 1.8; }
.story-text .sw { cursor: pointer; border-radius: 4px; }
.story-text .sw:hover { background: var(--marker-soft); }
.story-text .sw.reading { background: var(--marker); color: var(--on-marker); }
.sound-card { display: grid; gap: 8px; }
.sound-ex { display: flex; flex-wrap: wrap; gap: 8px; }
.sound-ex button { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; }
.sound-ex button svg { width: 16px; height: 16px; color: var(--blue); }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: .93rem; margin-bottom: 16px; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--blue); }

/* ---------- Modal y toasts ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
dialog.modal::backdrop { background: rgba(14, 17, 32, .55); }
.modal-body { padding: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 0 22px 22px; }
@media (max-width: 560px) {
  dialog.modal { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal-actions .btn { flex: 1; }
}
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 960px) { #toasts { bottom: 24px; } }
body:has(.player) #toasts { bottom: auto; top: calc(64px + env(safe-area-inset-top)); }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow-pop); animation: toast-in .2s ease-out; }
.toast.bad { background: var(--red); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.empty { text-align: center; padding: 36px 16px; border: 2px dashed var(--line-strong); border-radius: 18px; color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; }
.loading { display: grid; place-content: center; min-height: 60vh; color: var(--ink-3); font-weight: 700; }
.course-choice { display: grid; gap: 10px; }
.course-opt { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 1.5px solid var(--line-strong); background: var(--surface); text-align: left; cursor: pointer; width: 100%; box-shadow: 0 3px 0 var(--line-strong); }
.course-opt:disabled { opacity: .55; cursor: not-allowed; }
.course-opt .co-main { flex: 1; display: grid; }
.course-opt b { font-family: var(--f-display); font-size: 1.15rem; }
.course-opt .flag { width: 34px; height: 34px; }
.course-opt .flag + .flag { margin-left: -12px; }

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

/* ---------- Nuevos componentes ---------- */
.len-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.len-opt { display: grid; gap: 2px; padding: 10px 6px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; box-shadow: 0 3px 0 var(--line-strong); text-align: center; }
.len-opt b { font-family: var(--f-display); font-size: 1rem; }
.len-opt span { font-size: .74rem; color: var(--ink-3); font-weight: 700; }
.len-opt[aria-checked="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 3px 0 var(--blue); }
.len-opt[aria-checked="true"] span { color: var(--blue); }
.opt.judge-yes { color: var(--green); } .opt.judge-no { color: var(--red); }
.level-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 18px; }
.level-tabs a { display: grid; justify-items: center; gap: 1px; padding: 9px 2px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); text-decoration: none; color: var(--ink-2); font: 800 1.05rem var(--f-display); }
.level-tabs small { font: 700 .66rem var(--f-body); color: var(--ink-3); }
.level-tabs [aria-current="page"] { background: var(--lc); border-color: var(--lc); color: #fff; }
.level-tabs [aria-current="page"] small { color: rgba(255,255,255,.88); }
.topic-check { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; }
.topic-check input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; margin: 0; }
.topic-check .tp-main { flex: 1; display: grid; min-width: 0; text-decoration: none; color: inherit; }
.topic-check .tp-title { font-weight: 700; }
.topic-check .tp-sub { color: var(--ink-3); font-size: .86rem; }
.topic-check > svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.builder-card { position: sticky; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 5; display: grid; gap: 10px; margin-top: 14px; box-shadow: var(--shadow-pop); }
@media (min-width: 960px) { .builder-card { bottom: 16px; } }
.deck-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .deck-grid { grid-template-columns: 1fr 1fr; } }
.deck-card { display: grid; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); border-left: 6px solid var(--lc); text-decoration: none; color: inherit; }
.deck-card:hover { border-color: var(--line-strong); border-left-color: var(--lc); }
.deck-card b { font-family: var(--f-display); font-size: 1.08rem; }
.deck-card .progress-bar.on-paper { height: 6px; }
.deck-card .progress-bar.on-paper > i { background: var(--lc); }
.course-opt .co-main span { display: block; }
.course-opt > svg { width: 22px; height: 22px; flex: none; color: var(--ink-3); }
.teach > .tag, .teach > .t-label { justify-self: start; }
.builder-card { position: static; box-shadow: none; margin: 0 0 16px; border-color: var(--blue); }

/* ===================== Tarjetas enriquecidas ===================== */
.pos-chip { display: inline-flex; align-items: center; font-size: .74rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; padding: .2em .6em; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.pos-chip.g-der { background: color-mix(in srgb, #1D5FD1 14%, transparent); color: #1D5FD1; }
.pos-chip.g-die { background: color-mix(in srgb, #C2185B 14%, transparent); color: #C2185B; }
.pos-chip.g-das { background: color-mix(in srgb, #2E7D32 14%, transparent); color: #2E7D32; }
.pos-chip.pos-verb { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.pos-chip.pos-adj { background: color-mix(in srgb, #D9730D 16%, transparent); color: #B35C00; }
:root[data-theme="dark"] .pos-chip.g-der { color: #82AAFF; } :root[data-theme="dark"] .pos-chip.g-die { color: #FF7BAC; } :root[data-theme="dark"] .pos-chip.g-das { color: #7CD992; } :root[data-theme="dark"] .pos-chip.pos-adj { color: #FFB066; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pos-chip.g-der { color: #82AAFF; } :root:not([data-theme="light"]) .pos-chip.g-die { color: #FF7BAC; }
  :root:not([data-theme="light"]) .pos-chip.g-das { color: #7CD992; } :root:not([data-theme="light"]) .pos-chip.pos-adj { color: #FFB066; }
}
.flash.rich .flash-inner { min-height: 360px; }
.flash.rich .flash-face { align-content: center; padding: 20px 18px 30px; }
.flash .flip-hint { position: absolute; right: 14px; bottom: 10px; font-size: .78rem; color: var(--ink-3); display: inline-flex; gap: 4px; align-items: center; }
.flash .flip-hint svg { width: 14px; height: 14px; }
.f-ex .speak-btn { vertical-align: middle; margin-left: 4px; }
.flash .f-src { font-size: 1.7rem; }
.forms { display: grid; gap: 4px; margin: 4px 0 0; width: 100%; max-width: 360px; }
.forms > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: .95rem; }
.forms dt { color: var(--ink-3); font-weight: 600; } .forms dd { margin: 0; font-weight: 700; text-align: right; }
.f-ex { border-top: 1.5px dashed var(--line); padding-top: 10px; width: 100%; max-width: 380px; font-size: .95rem; }
.f-tip, .fb-why { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: .9rem; background: var(--marker-soft); border-radius: 12px; padding: 8px 10px; max-width: 380px; }
.f-tip svg, .fb-why svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.fb-why { margin: 8px 0 0; color: var(--ink); max-width: none; }
.nb-save.saved { color: var(--blue); }
.nb-save.saved svg { fill: currentColor; }
.flash-cta { display: grid; gap: 12px; margin-bottom: 4px; }
.seg.seg-sm { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
.seg.seg-sm button { font-size: .85rem; padding: .35em .8em; }
.seg [aria-checked="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.word-row .wr-forms { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.word-row .wr-ex { font-size: .85rem; color: var(--ink-2); font-style: italic; }
.word-row .wr-note { font-size: .82rem; color: var(--ink-3); }
.word-row .wr-de .pos-chip { margin-left: 4px; font-size: .66rem; }

/* ===================== Cuaderno de vocabulario ===================== */
.nb-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.nb-stats div { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; display: grid; }
.nb-stats b { font: 800 1.5rem/1 var(--f-display); } .nb-stats span { color: var(--ink-3); font-size: .85rem; }
.nb-form { display: grid; gap: 10px; margin-bottom: 18px; }
.nb-form .field { margin: 0; }
.art-pick { display: flex; gap: 4px; flex: none; }
.art-pick button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0 .55em; min-height: 44px; cursor: pointer; font: inherit; font-weight: 800; }
.art-pick button[aria-pressed="true"] { border-color: currentColor; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px currentColor; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); overflow: hidden; margin-top: 4px; }
.suggest button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; font: inherit; cursor: pointer; color: inherit; }
.suggest button + button { border-top: 1px solid var(--line); }
.suggest button:hover { background: var(--surface-2); }
.nb-preview { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: inherit; border-radius: 99px; padding: .35em .85em; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ===================== Ejercicios y corrección ===================== */
.hint-row { display: grid; gap: 8px; justify-items: start; margin-top: 10px; }
.hint-box { display: grid; gap: 6px; font-size: .93rem; background: var(--marker-soft); border-radius: 12px; padding: 10px 12px; width: 100%; }
.hint-box svg { width: 16px; height: 16px; vertical-align: -3px; }
.gap-hint { display: flex; gap: 6px; align-items: center; color: var(--ink-2); font-weight: 600; margin: -6px 0 12px; }
.gap-hint svg { width: 18px; height: 18px; }
.wrong-sentence { text-decoration: underline wavy var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 6px; }
.task-chip { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); padding: .35em .8em; border-radius: 99px; margin-bottom: 12px; }
.task-chip svg { width: 16px; height: 16px; }
.feedback .fb-body { min-width: 0; flex: 1; }
.fb-answer { font-size: 1.05rem; }
.fb-yours { margin-top: 4px !important; }
.fb-forms { margin-top: 4px !important; }
.fb-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.d-ok { color: var(--green); font-weight: 700; }
.d-bad { color: var(--red); text-decoration: line-through; font-weight: 700; }
.d-miss { color: var(--green); font-weight: 800; background: var(--green-soft); border-radius: 4px; padding: 0 .2em; }
.player-foot.is-bad .inner, .player-foot.is-ok .inner { max-height: 62vh; overflow-y: auto; }
.rule-summary { display: flex; gap: 10px; align-items: flex-start; background: var(--marker-soft); border-radius: 14px; padding: 12px 14px; margin: 8px 0 14px; }
.rule-summary svg { width: 22px; height: 22px; flex: none; }
.ex-list .why { font-size: .85rem; color: var(--ink-2); }
.ex-list .why svg { width: 14px; height: 14px; vertical-align: -2px; }
.rule-modal { max-height: 60vh; overflow-y: auto; padding: 0; border: 0; background: none; }

/* ===================== Inicio: el mapa de metro ===================== */
.hello { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.hello h1 { margin: 0; font-size: clamp(1.9rem, 5.2vw, 2.7rem); letter-spacing: -.025em; }
.hello p { margin: 4px 0 0; }

/* Tarjeta principal: cartel de línea + vía */
.hero-line {
  --lc: var(--l-a1);
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; gap: 6px; padding: 24px 22px 22px; border-radius: 28px;
  background: #1B1642; color: #fff;
  box-shadow: 0 24px 48px -28px color-mix(in srgb, var(--lc) 70%, #000);
}
.hero-line::before { /* resplandor del color de la línea */
  content: ""; position: absolute; z-index: -1; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--lc) 55%, transparent) 0%, transparent 65%);
}
.hero-line::after { /* trama de puntos, como un plano */
  content: ""; position: absolute; z-index: -1; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1.5px); background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(115deg, transparent 35%, #000 100%); mask-image: linear-gradient(115deg, transparent 35%, #000 100%);
}
.hl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.hl-sign {
  width: 50px; height: 50px; flex: none; border-radius: 13px; display: grid; place-content: center;
  background: var(--lc); color: #fff; font: 800 1.25rem var(--f-display); letter-spacing: -.02em;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.9);
}
.hl-meta { display: grid; line-height: 1.3; }
.hl-meta b { font-size: .98rem; }
.hl-meta span { color: rgba(255,255,255,.7); font-size: .9rem; }
.hl-title { margin: 0; color: #fff; font-size: clamp(2.3rem, 7.5vw, 3.6rem); line-height: 1; letter-spacing: -.035em; text-wrap: balance; }
.hl-sub { margin: 2px 0 0; color: rgba(255,255,255,.78); font-size: 1.05rem; max-width: 48ch; }
.hl-progress { display: grid; gap: 4px; color: rgba(255,255,255,.72); font-size: .85rem; max-width: 420px; }
.hl-progress .progress-bar { margin-top: 0; }
.hl-go { justify-self: start; margin-top: 12px; }

/* Vía de metro (sirve en la tarjeta grande y en el mapa) */
.track { --dot: 16px; --rail: 6px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); align-items: center; min-width: 0; }
.tk { position: relative; display: grid; place-items: center; height: calc(var(--dot) + 14px); }
.tk::before { /* tramo hacia la siguiente parada */
  content: ""; position: absolute; left: 50%; right: -50%; top: 50%; height: var(--rail); transform: translateY(-50%);
  background: color-mix(in srgb, var(--lc) 28%, transparent); border-radius: 99px;
}
.tk:last-child::before { display: none; }
.tk.lit::before { background: var(--lc); }
.tk.now::before { background: color-mix(in srgb, var(--lc) 28%, transparent); }
.tk .dot {
  position: relative; z-index: 1; width: var(--dot); height: var(--dot); border-radius: 50%;
  background: var(--surface); border: 3px solid color-mix(in srgb, var(--lc) 45%, transparent);
  display: grid; place-content: center;
}
.tk.done .dot { background: var(--lc); border-color: var(--lc); }
.tk .dot svg { width: 70%; height: 70%; color: #fff; stroke-width: 3.5; }
.tk.now .dot { width: calc(var(--dot) + 8px); height: calc(var(--dot) + 8px); background: var(--marker); border: 4px solid #fff; box-shadow: 0 0 0 4px var(--lc); }
.track.big { --dot: 18px; --rail: 8px; margin: 14px 0 4px; max-width: 560px; }
.hero-line .tk .dot { background: #1B1642; border-color: color-mix(in srgb, var(--lc) 70%, #1B1642); }
.hero-line .tk.done .dot { background: var(--lc); border-color: var(--lc); }
.hero-line .tk.now .dot { background: var(--marker); border-color: #fff; }
.hero-line .tk::before { background: rgba(255,255,255,.14); }
.hero-line .tk.lit::before { background: var(--lc); }
.hero-line .tk.now::before { background: rgba(255,255,255,.14); }
@media (prefers-reduced-motion: no-preference) {
  .hero-line .tk.now .dot::after {
    content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--marker);
    animation: station 2.4s ease-out infinite;
  }
  @keyframes station { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
}

/* Accesos rápidos con su propio color */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a {
  --qc: var(--blue);
  display: grid; gap: 4px; align-content: start; padding: 16px; border-radius: 20px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1.5px solid var(--line); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.quick a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--qc) 45%, var(--line)); box-shadow: 0 12px 24px -18px var(--qc); }
.quick .q-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-content: center; margin-bottom: 8px;
  background: color-mix(in srgb, var(--qc) 15%, var(--surface)); color: var(--qc); }
.quick .q-ic svg { width: 24px; height: 24px; }
.quick b { font: 700 1.05rem var(--f-display); display: flex; align-items: center; gap: 6px; }
.quick a > span:last-child { color: var(--ink-3); font-size: .85rem; }

/* Palabra del día: una tarjeta de vocabulario con la franja del género */
.today { align-items: stretch; }
.wotd {
  --g: var(--blue);
  position: relative; display: grid; gap: 6px; align-content: start; padding: 18px 18px 18px 26px; border-radius: 20px;
  background: var(--surface); border: 1.5px solid var(--line); overflow: hidden;
}
.wotd::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--g); }
.wotd[data-g="der"] { --g: #1D5FD1; } .wotd[data-g="die"] { --g: #C2185B; } .wotd[data-g="das"] { --g: #2E7D32; }
.wotd[data-g="el"] { --g: #1D5FD1; } .wotd[data-g="la"] { --g: #C2185B; }
.wotd .big { font: 800 clamp(1.6rem, 4vw, 2rem)/1.1 var(--f-display); letter-spacing: -.02em; }
.wotd-mean { font-size: 1.1rem; }
.wotd .row { gap: 8px; }

/* Frase del día: con forma de bocadillo */
.potd {
  position: relative; display: grid; gap: 6px; align-content: start; padding: 18px 20px; margin-bottom: 14px;
  background: var(--blue); color: var(--on-blue); border-radius: 22px 22px 22px 6px;
}
.potd::after { content: ""; position: absolute; left: 0; bottom: -14px; border: 14px solid transparent; border-left-color: var(--blue); border-top-color: var(--blue); border-bottom: 0; border-right-width: 18px; }
.potd .big { font: 800 1.45rem/1.2 var(--f-display); }
.potd .small, .potd .muted { color: inherit; opacity: .8; }
.potd .speak-btn { background: var(--marker); color: var(--on-marker); }

/* Mapa de líneas (progreso por nivel) */
.lines-map { display: grid; gap: 4px; padding: 14px 16px; }
.lm-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; gap: 12px; align-items: center; padding: 6px 4px; border-radius: 12px; text-decoration: none; color: inherit; }
.lm-row:hover { background: var(--surface-2); }
.lm-sign { width: 40px; height: 40px; border-radius: 11px; display: grid; place-content: center; background: var(--lc); color: #fff; font: 800 .95rem var(--f-display); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lm-sign, :root:not([data-theme="light"]) .hl-sign { color: var(--paper); } }
:root[data-theme="dark"] .lm-sign, :root[data-theme="dark"] .hl-sign { color: var(--paper); }
.lm-count { text-align: right; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: .9rem; }
.lm-sum { margin: 8px 4px 0; }
.lines-map .track { --dot: 13px; --rail: 5px; }
@media (max-width: 420px) { .lines-map .track { --dot: 11px; --rail: 4px; } .lm-row { gap: 8px; grid-template-columns: 36px minmax(0, 1fr) 40px; } .lm-sign { width: 36px; height: 36px; } }

/* ===================== Ajustes finos del rediseño ===================== */
/* Frase del día: bocadillo con cola limpia y misma altura que la palabra */
.potd { margin-bottom: 0; }
.potd::after { left: 26px; bottom: -13px; width: 26px; height: 14px; border: 0; background: var(--blue); clip-path: polygon(0 0, 100% 0, 0 100%); }
.today { padding-bottom: 14px; }

/* Paradas hechas en la tarjeta grande, más visibles */
.hero-line .tk.done .dot svg { color: #1B1642; }
.hero-line .tk.done .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc) 35%, transparent); }

/* Menú lateral: opción activa con más presencia */
@media (min-width: 960px) {
  .side-link[aria-current="page"] { background: var(--blue); color: var(--on-blue); box-shadow: 0 10px 20px -14px var(--blue); }
  .side-nav .brand { font-size: 1.35rem; }
}

/* Camino: cada nivel con su cartel de línea */
.metro-head {
  gap: 14px; margin-bottom: 14px; padding: 14px 16px; border-radius: 20px;
  background: color-mix(in srgb, var(--lc) 11%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--lc) 30%, var(--line));
}
.metro-head .line-sign { width: 54px; height: 54px; border-radius: 14px; font-size: 1.25rem; box-shadow: inset 0 0 0 3px rgba(255,255,255,.85); }
.metro-head h2 { font-size: 1.5rem; letter-spacing: -.02em; }
.station.current .station-card {
  background: var(--surface); border-color: var(--marker);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--marker) 30%, transparent), 0 14px 28px -20px rgba(26, 22, 51, .5);
}
.station.current .stop { background: var(--marker); }
.station-card .st-name { font-size: 1.15rem; }

/* ===================== Pantallas grandes: aprovechar el ancho ===================== */
@media (min-width: 1360px) { .main { max-width: 1120px; padding-left: 56px; padding-right: 56px; } }

/* ===================== Vocabulario: tarjeta de repaso ===================== */
.review-hero {
  position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px;
  padding: 26px 22px; border-radius: 28px; background: #1B1642; color: #fff; margin-bottom: 8px;
  box-shadow: 0 24px 48px -30px rgba(106, 75, 255, .9);
}
.review-hero::before {
  content: ""; position: absolute; z-index: -1; inset: auto -10% -60% auto; width: 60%; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(106, 75, 255, .55), transparent 65%);
}
.review-hero::after {
  content: ""; position: absolute; z-index: -1; inset: 0; opacity: .45;
  background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1.5px); background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(100deg, transparent 40%, #000); mask-image: linear-gradient(100deg, transparent 40%, #000);
}
.rh-text { display: grid; gap: 10px; align-content: start; min-width: 0; }
.rh-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--marker); font-weight: 700; }
.rh-kicker svg { width: 20px; height: 20px; }
.review-hero h1 { color: #fff; margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.02; letter-spacing: -.03em; }
.review-hero p { margin: 0; color: rgba(255,255,255,.75); max-width: 46ch; }
.rh-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.rh-stats span { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); font-size: .9rem; }
.rh-stats b { font: 800 1.15rem var(--f-display); color: #fff; }
.rh-stats .due b { color: #FF8FA3; } .rh-stats .new b { color: #B9A8FF; } .rh-stats .known b { color: #5EE6B3; }
.rh-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.rh-ghost { --b: rgba(255,255,255,.08); --bp: rgba(255,255,255,.18); --c: #fff; }
.rh-dir { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: rgba(255,255,255,.7); font-size: .88rem; }
.rh-dir .seg button { background: rgba(255,255,255,.06); color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.18); }
.rh-dir .seg [aria-checked="true"] { background: #fff; color: #1B1642; border-color: #fff; }

/* Abanico de tarjetas con palabras reales */
.fan { position: relative; height: 190px; min-width: 0; }
.fan-card {
  --g: #6A4BFF;
  position: absolute; left: 50%; top: 50%; width: 200px; min-height: 128px; padding: 16px 16px 14px;
  display: grid; gap: 4px; align-content: center; text-align: center;
  background: #fff; color: #1A1633; border-radius: 18px; border-top: 7px solid var(--g);
  box-shadow: 0 18px 30px -16px rgba(0,0,0,.6);
}
.fan-card[data-g="der"], .fan-card[data-g="el"] { --g: #1D5FD1; }
.fan-card[data-g="die"], .fan-card[data-g="la"] { --g: #C2185B; }
.fan-card[data-g="das"] { --g: #2E7D32; }
.fan-card .fc-word { font: 800 1.25rem/1.15 var(--f-display); overflow-wrap: anywhere; }
.fan-card .fc-mean { font-size: .85rem; color: #4A4566; }
.fan-card .art-m { color: #1D5FD1; } .fan-card .art-f { color: #C2185B; } .fan-card .art-n { color: #2E7D32; }
.fan-card.f0 { transform: translate(-50%, -50%) translate(-58px, 6px) rotate(-12deg); }
.fan-card.f1 { transform: translate(-50%, -50%) translate(58px, 6px) rotate(10deg); }
.fan-card.f2 { transform: translate(-50%, -50%) translateY(-8px) rotate(-1deg); z-index: 2; }
@media (min-width: 760px) {
  .review-hero { grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); align-items: center; padding: 32px 34px; }
  .fan { height: 240px; }
  .fan-card { width: 220px; min-height: 140px; }
}

/* Buscador y filtro de niveles */
.deck-tools { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .deck-tools { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
.lvl-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.lvl-filter a {
  --lc: var(--ink); padding: 8px 14px; border-radius: 99px; text-decoration: none; font-weight: 800; font-family: var(--f-display);
  color: var(--lc); background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--lc) 35%, var(--line));
}
.lvl-filter a[aria-current="page"] { background: var(--lc); color: var(--paper); border-color: var(--lc); }

/* Mazos como montones de tarjetas */
.deck-grid { display: grid; gap: 22px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); padding: 8px 6px 6px 0; }
.deck-stack {
  position: relative; display: grid; gap: 6px; align-content: start; padding: 16px 16px 14px; border-radius: 18px;
  text-decoration: none; color: inherit; background: var(--surface); border: 1.5px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.deck-stack::before, .deck-stack::after { /* las tarjetas de debajo */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--lc) 14%, var(--surface)); transition: transform .18s ease;
}
.deck-stack::before { transform: translate(5px, 5px) rotate(1.6deg); }
.deck-stack::after { transform: translate(10px, 10px) rotate(3.2deg); background: color-mix(in srgb, var(--lc) 26%, var(--surface)); }
.deck-grid { isolation: isolate; }
.deck-stack { isolation: isolate; }
.deck-stack:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -22px var(--lc); }
.deck-stack:hover::before { transform: translate(7px, 8px) rotate(2.4deg); }
.deck-stack:hover::after { transform: translate(14px, 15px) rotate(4.6deg); }
.ds-top { display: flex; align-items: center; gap: 8px; }
.ds-sign { width: 34px; height: 34px; border-radius: 10px; display: grid; place-content: center; background: var(--lc); color: #fff; font: 800 .85rem var(--f-display); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ds-sign { color: var(--paper); } }
:root[data-theme="dark"] .ds-sign { color: var(--paper); }
.ds-kind { font-size: .8rem; font-weight: 700; color: var(--ink-3); }
.ds-emoji { margin-left: auto; font-size: 1.5rem; line-height: 1; }
.ds-title { font: 800 1.2rem/1.2 var(--f-display); letter-spacing: -.01em; margin-top: 4px; }
.ds-sub { color: var(--ink-3); font-size: .88rem; }
.ds-sample { justify-self: start; margin-top: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); font-weight: 700; font-size: .95rem; }
.ds-foot { display: grid; gap: 4px; margin-top: 8px; font-size: .8rem; color: var(--ink-3); }
.ds-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.ds-bar i { display: block; height: 100%; background: var(--lc); border-radius: inherit; }

/* ===================== Flashcards: un mazo de verdad ===================== */
.flash.rich { position: relative; max-width: 560px; margin: 12px auto 22px; }
.flash.rich::before, .flash.rich::after { /* tarjetas del mazo, debajo */
  content: ""; position: absolute; inset: 0; border-radius: 28px; background: var(--surface); border: 1.5px solid var(--line);
}
.flash.rich::before { transform: translateY(10px) rotate(-2deg) scale(.98); opacity: .8; }
.flash.rich::after { transform: translateY(18px) rotate(2.5deg) scale(.96); opacity: .55; }
.flash.rich .flash-inner { z-index: 1; min-height: 400px; }
.flash.rich .flash-face {
  border-radius: 28px; border: 1.5px solid var(--line); border-top: 10px solid var(--blue);
  box-shadow: 0 26px 50px -30px rgba(26, 22, 51, .55); padding: 26px 24px 34px;
}
.flash.rich .flash-face:has(.pos-chip.g-der), .flash.rich .flash-face:has(.pos-chip.g-el) { border-top-color: #1D5FD1; }
.flash.rich .flash-face:has(.pos-chip.g-die), .flash.rich .flash-face:has(.pos-chip.g-la) { border-top-color: #C2185B; }
.flash.rich .flash-face:has(.pos-chip.g-das) { border-top-color: #2E7D32; }
.flash.rich .flash-face:has(.pos-chip.pos-adj) { border-top-color: #D9730D; }
.flash.rich .f-main { font-size: clamp(2.2rem, 7vw, 3.2rem); letter-spacing: -.03em; line-height: 1.05; }
.flash.rich .f-src { font-size: clamp(1.8rem, 6vw, 2.5rem); }
.flash.rich .flash-face:not(.back) .speak-btn { width: 56px; height: 56px; }
.flash.rich .f-sub { font-size: 1.25rem; color: var(--ink); font-weight: 600; }
.player:has(.flash.rich) .player-body { background:
  radial-gradient(ellipse 60% 40% at 50% 35%, color-mix(in srgb, var(--blue) 10%, transparent), transparent 70%); }

/* Mazos: las tarjetas de debajo como sombras desplazadas (no tapan la de encima) */
.deck-stack { isolation: auto; box-shadow: 6px 7px 0 -1.5px color-mix(in srgb, var(--lc) 16%, var(--surface)), 6px 7px 0 0 color-mix(in srgb, var(--lc) 30%, var(--line)), 12px 14px 0 -1.5px color-mix(in srgb, var(--lc) 30%, var(--surface)), 12px 14px 0 0 color-mix(in srgb, var(--lc) 40%, var(--line)); }
.deck-stack::before, .deck-stack::after { content: none; }
.deck-stack:hover { box-shadow: 8px 10px 0 -1.5px color-mix(in srgb, var(--lc) 16%, var(--surface)), 8px 10px 0 0 color-mix(in srgb, var(--lc) 30%, var(--line)), 16px 19px 0 -1.5px color-mix(in srgb, var(--lc) 30%, var(--surface)), 16px 19px 0 0 color-mix(in srgb, var(--lc) 40%, var(--line)); }
.deck-grid { padding-right: 14px; padding-bottom: 14px; }
@media (min-width: 1640px) { .main { max-width: 1280px; } }

/* Cabecera de un mazo: el color de su nivel */
.deck-hero::before { background: radial-gradient(circle, color-mix(in srgb, var(--lc) 60%, transparent), transparent 65%); }
.deck-hero { box-shadow: 0 24px 48px -30px var(--lc); margin-bottom: 14px; }
.deck-hero .rh-kicker .ds-sign { width: 30px; height: 30px; font-size: .78rem; }
.flash-cta svg { width: 1.2em; height: 1.2em; display: inline-block; vertical-align: -3px; }
