/* =====================================================================================================
   HOJA DE ESTILOS DE LA APP · una sola hoja ordenada por capas (docs/PLANTILLAS.md)

   El orden de las capas decide quién gana, no la especificidad del selector: una regla de una capa
   posterior gana siempre a una de una capa anterior (salvo !important, que funciona al revés).
     tokens       colores, tipografía, espaciado, radios, alturas táctiles y barras (variables)
     base         reinicio y elementos HTML sin clase
     legado       reglas anteriores a las plantillas, por pantalla; se migran poco a poco a las capas
                  de abajo. Nunca se añade nada nuevo aquí.
     componentes  piezas comunes: opciones, botones, avisos, hoja inferior, fichas, estados táctiles
     regiones     cabecera de foco y barra de acción
     plantillas   flujo (lectura, pregunta, paso guiado, portada, resultado), índice, herramienta
     paginas      lo que es de una sola pantalla (simulador de challenge, prefijo cs-)

   Regla: una regla nueva vive en una sola capa y nunca se duplica. Si cambias este archivo, sube su
   ?v= en app/head.html y en public/sw.js, y sube VERSION en public/sw.js.
   ===================================================================================================== */
@layer tokens, base, legado, componentes, regiones, plantillas, paginas;

/* Tipografía de la marca (Poppins, servida desde /fonts) */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap; src: url(/fonts/poppins-latin-300-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/poppins-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap; src: url(/fonts/poppins-latin-ext-300-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/poppins-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@layer tokens {
/* Paleta: oscuro de marca por defecto; el claro es opcional (data-theme="light") */
:root,
:root:not([data-theme="light"]),
:root[data-theme="dark"] {
  --bg: #2d2f35; --panel: #363940; --panel2: #2a2c31; --card: #363940;
  --ink: #ffffff; --muted: #b4b8c1; --rule: #464951;
  --chartbg: #26282d; --grid: #34373d;
  --bull: #11d6b6; --bear: #f2466f; --accent: #ff8a4c; --onaccent: #1f2126;
  --liq: #4aa3ff; --fvg: #c471ed; --good: #11d6b6; --bad: #f2466f;
  --display: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg-top: #3c3f46; --bg-bottom: #232529;
  --g-violet: linear-gradient(160deg, #c471ed 0%, #7b2ff7 62%, #6a11f5 100%);
  --g-pink: linear-gradient(160deg, #ff6b8b 0%, #e6246e 100%);
  --g-orange: linear-gradient(100deg, #ff7043 0%, #ffd48a 100%);
  --g-blue: linear-gradient(160deg, #1d3fd1 0%, #139fe0 55%, #00e3b5 100%);
  --g-teal: linear-gradient(90deg, #139fe0, #11d6b6);
  --g-brand: linear-gradient(100deg, #c471ed 0%, #f2466f 38%, #ff8a4c 70%, #ffd48a 100%);
  --soft: 0 12px 30px -12px rgba(0, 0, 0, .45);
  --violet-glow: 0 14px 34px -12px rgba(123, 47, 247, .75);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef0f4; --panel: #ffffff; --panel2: #e4e7ee; --card: #ffffff;
  --ink: #1f2126; --muted: #5d616b; --rule: #d7dbe3;
  --chartbg: #f8f9fb; --grid: #e6e9ef;
  --bull: #0e9f88; --bear: #df2f5a; --accent: #ea6a2a; --onaccent: #ffffff;
  --liq: #1673d1; --fvg: #8b3cf7; --good: #0e9f88; --bad: #df2f5a;
  --bg-top: #f5f6f9; --bg-bottom: #e6e9ef;
  --soft: 0 10px 26px -14px rgba(31, 33, 38, .25);
  --violet-glow: 0 12px 28px -12px rgba(123, 47, 247, .5);
  color-scheme: light;
}

/* Espaciado y radios (los mismos que la web pública, src/styles/tokens.css)
   Escala de 4 pt: s-1 4 · s-2 8 · s-3 12 · s-4 16 · s-5 24 · s-6 32 · s-7 48 · s-8 64
   Ritmo:   título de sección → subtítulo s-2 · subtítulo → ayuda s-3 · ayuda → contenido s-5
            entre bloques de una sección s-7 · relleno de tarjeta s-5 · filas internas s-3/s-4
            huecos de rejilla s-4 (s-5 en escritorio) · listas s-3
   Radios:  tarjetas 24 · filas y controles 16 · chips 12 · píldoras para etiquetas */
:root {
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-card: 24px; --r-row: 16px; --r-chip: 12px;
  --tabbar-h: 68px; --wrap: 1080px;
  --g-white: linear-gradient(135deg, #ffffff, #b9bec8); --g-tealx: linear-gradient(135deg, #139fe0, #00e3b5);
  --surface-card: linear-gradient(180deg, color-mix(in srgb, var(--panel) 100%, #ffffff 3%), var(--panel));
}

/* Alturas táctiles y barras fijas */
:root { --bar-bottom: 76px; --h-touch: 44px; --h-control: 48px; }

/* Escala tipográfica: nada por debajo de 12 px en el móvil; el texto de lectura, desde 14 px */
:root { --t-xs: 12px; --t-sm: 13.5px; --t-md: 15px; --t-read: 17px; }

/* Color de cada cinturón */
[data-k="white"], [data-belt="white"] { --bg-belt: var(--g-white); }
[data-k="orange"], [data-belt="orange"] { --bg-belt: var(--g-orange); }
[data-k="teal"], [data-belt="teal"] { --bg-belt: var(--g-tealx); }
[data-k="blue"], [data-belt="blue"] { --bg-belt: var(--g-blue); }
[data-k="pink"], [data-belt="pink"] { --bg-belt: var(--g-pink); }
[data-k="violet"], [data-belt="violet"] { --bg-belt: var(--g-violet); }
}

@layer base {
:root{box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);}
html{scroll-padding-top:env(safe-area-inset-top,0px);}
*,*::before,*::after{box-sizing:inherit}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh}
button{font:inherit;color:inherit;-webkit-tap-highlight-color:transparent}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
body {
  background: var(--bg-bottom) linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 35%, var(--bg-bottom) 100%) fixed;
  font-weight: 400;
  letter-spacing: -.003em;
}
:focus-visible { outline: 2px solid #c471ed; outline-offset: 3px; }
::selection { background: rgba(196, 113, 237, .35); }
}

@layer legado {
/* ---------- Originales (antes en app/head.html) ---------- */
.brand svg{width:18px;height:24px;flex:none}
.brand span{white-space:nowrap}
@media(max-width:560px){body.playing .brand span{display:none}}
.spacer{flex:1}
.pill{display:inline-flex;align-items:center;gap:5px;padding:6px 11px;border-radius:999px;background:var(--panel);border:1px solid var(--rule);font-weight:700;font-size:14px;font-variant-numeric:tabular-nums;white-space:nowrap}
.pill.hot{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
main{max-width:1080px;margin:0 auto;padding:18px 16px 48px}

/* Inicio */
.rank{display:grid;grid-template-columns:auto 1fr;gap:20px;align-items:center;padding:18px 20px;background:var(--panel);border:1px solid var(--rule);border-radius:20px}
.meter{position:relative;width:38px;height:116px}
.meter .wick{position:absolute;left:50%;top:0;bottom:0;width:2px;margin-left:-1px;background:var(--muted);border-radius:2px}
.meter .fill{position:absolute;left:0;right:0;bottom:0;height:0;background:var(--bull);transition:height .7s cubic-bezier(.2,.8,.2,1)}
.rank h2{font-family:var(--display);font-weight:800;font-size:23px;line-height:1.1;margin:0}
.rank .sub{color:var(--muted);font-size:14px;margin:4px 0 12px}
.stats{display:flex;flex-wrap:wrap;gap:8px 22px;font-size:13px;color:var(--muted)}
.stats b{font-family:var(--display);font-weight:800;font-size:21px;display:block;line-height:1.1;color:var(--ink);font-variant-numeric:tabular-nums}
.modes{display:grid;grid-template-columns:1fr;gap:10px;margin:16px 0 34px}
@media(min-width:640px){.modes{grid-template-columns:1.35fr 1fr}}
.mode{text-align:left;padding:18px 20px;border-radius:20px;border:1px solid var(--rule);background:var(--panel);cursor:pointer;display:grid;gap:3px}
.mode b{font-family:var(--display);font-weight:800;font-size:21px;line-height:1.15}
.mode span{color:var(--muted);font-size:14px}
.mode.primary{background:var(--accent);color:var(--onaccent);border-color:transparent}
.secsub{color:var(--muted);margin:2px 0 8px;font-size:15px}
.modules{list-style:none;margin:0;padding:0}
.mod{padding:18px 0 20px;border-top:1px solid var(--rule)}
.modhead{display:grid;grid-template-columns:auto 1fr auto;gap:14px;align-items:start}
.num{font-family:var(--display);font-weight:800;font-size:30px;line-height:1;color:var(--muted);min-width:22px;padding-top:2px}
.mod h3{font-family:var(--display);font-weight:800;font-size:20px;margin:0;line-height:1.2}
.mod p{margin:3px 0 0;color:var(--muted);font-size:14px;max-width:48ch}
.go{padding:9px 16px;border-radius:999px;border:1.5px solid var(--ink);background:transparent;font-weight:700;font-size:14px;cursor:pointer;white-space:nowrap}
.cpts{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 0 36px}
.cpt{position:relative;padding:8px 12px 11px;border-radius:12px;border:1px solid var(--rule);background:var(--panel);cursor:pointer;font-size:14px;display:flex;gap:8px;align-items:baseline;text-align:left}
.cpt em{font-style:normal;color:var(--muted);font-variant-numeric:tabular-nums;font-size:12.5px}
.cpt i{position:absolute;left:12px;right:12px;bottom:5px;height:2px;background:var(--panel2);border-radius:2px;overflow:hidden}
.cpt i::after{content:'';position:absolute;left:0;top:0;bottom:0;width:var(--p,0%);background:var(--bull)}
.foot{display:flex;gap:18px;flex-wrap:wrap;margin-top:30px;padding-top:16px;border-top:1px solid var(--rule)}

/* Juego */
.timer .track{flex:1;height:8px;border-radius:8px;background:var(--panel2);overflow:hidden}
.timer .track i{display:block;height:100%;background:var(--accent);transform-origin:left center}
.timer span{font-weight:700;font-variant-numeric:tabular-nums;min-width:40px;text-align:right}
@media(min-width:920px){.side{position:sticky;top:84px}}
.concept{font-family:var(--display);font-weight:600;font-size:15px;color:var(--muted)}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{font-size:12.5px;padding:3px 8px;border-radius:7px;background:var(--panel2);font-weight:700;font-variant-numeric:tabular-nums}
.chip.up{background:color-mix(in srgb,var(--bull) 20%,transparent);color:var(--bull)}
.chip.down{background:color-mix(in srgb,var(--bear) 20%,transparent);color:var(--bear)}
.prompt{font-family:var(--display);font-weight:800;font-size:clamp(20px,4.8vw,25px);line-height:1.18;margin:8px 0 12px;letter-spacing:-.012em;max-width:44ch}
.chartwrap{position:relative;border-radius:20px;overflow:hidden;background:var(--chartbg);border:1px solid var(--rule)}
#cv{display:block;width:100%;height:clamp(260px,50svh,500px);cursor:crosshair;touch-action:pan-y}
.card table{border-collapse:collapse;width:100%;max-width:420px}
.card th{text-align:left;font-weight:400;color:var(--muted);padding:10px 0;border-bottom:1px solid var(--rule);font-size:15px}
.card td{text-align:right;font-family:var(--display);font-weight:800;font-size:22px;padding:10px 0;border-bottom:1px solid var(--rule);font-variant-numeric:tabular-nums}
.opt{width:100%;text-align:left;padding:13px 16px;border-radius:14px;border:1.5px solid var(--rule);background:var(--panel);cursor:pointer;font-weight:700;display:flex;gap:12px;align-items:center;min-height:54px;line-height:1.3}
.opt.right{border-color:var(--good);background:color-mix(in srgb,var(--good) 15%,var(--panel))}
.opt.wrong{border-color:var(--bad);background:color-mix(in srgb,var(--bad) 15%,var(--panel))}
.opt:disabled{cursor:default}
.opt:disabled:not(.right):not(.wrong){opacity:.55}
.hint{font-size:14.5px;color:var(--muted);margin:0}
.hint b{color:var(--ink);font-variant-numeric:tabular-nums}
.nb{min-height:54px;border-radius:14px;border:1.5px solid var(--rule);background:var(--panel);font-size:18px;cursor:pointer}
.confirm{min-height:54px;border-radius:14px;border:0;background:var(--accent);color:var(--onaccent);font-weight:700;font-size:16px;cursor:pointer;padding:0 16px}
.confirm:disabled{opacity:.4;cursor:default}
.skip{justify-self:start}
.fb{border-radius:20px;padding:16px 18px 18px;border:2px solid;background:var(--panel)}
.fb.ok{border-color:var(--good)}.fb.bad{border-color:var(--bad)}
.verdict{font-family:var(--display);font-weight:800;font-size:23px;margin:0 0 8px;display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}
.fb.ok .verdict{color:var(--good)}.fb.bad .verdict{color:var(--bad)}
.verdict small{font-family:var(--body);font-size:14px;color:var(--ink);font-weight:700}
.why{font-size:15.5px}
.why p{margin:0 0 8px}
.why .ans{padding:8px 10px;border-radius:10px;background:var(--panel2)}
.crit{margin:8px 0 4px;padding-left:18px}.crit li{margin:2px 0}
.note{margin:4px 0 12px;font-size:14.5px;color:var(--muted);padding-left:11px;border-left:3px solid var(--accent)}
.next{width:100%;min-height:54px;margin-top:6px;border-radius:14px;border:0;background:var(--ink);color:var(--bg);font-weight:700;font-size:16px;cursor:pointer}

/* Resultado */
.result .big{font-family:var(--display);font-size:clamp(88px,26vw,150px);font-weight:800;line-height:.85;letter-spacing:-.05em;margin:6px 0 10px;font-variant-numeric:tabular-nums}
.result p{margin:0 0 6px;font-size:17px}
.rbtns{display:grid;gap:10px;margin-top:22px}
.rbtns .go{padding:14px 18px;font-size:15px}

/* Casos y avanzado */
.adv{font-family:var(--body);font-size: var(--t-xs);font-weight:700;padding:2px 7px;border-radius:6px;background:color-mix(in srgb,var(--accent) 28%,transparent);margin-left:8px;vertical-align:middle;white-space:nowrap}
#stepTxt{font-weight:700;font-variant-numeric:tabular-nums}
.tfs[hidden]{display:none!important}
.tfs{display:inline-flex;background:var(--panel2);border-radius:12px;padding:3px;gap:3px}
.tf{border:0;background:transparent;padding:7px 14px;border-radius:9px;font-weight:700;font-size:14px;cursor:pointer;min-width:58px;min-height:36px}
.tf.on{background:var(--panel);box-shadow:0 1px 3px rgba(0,0,0,.18)}
.tf:disabled{opacity:.38;cursor:default}
.stepper .track{height:6px;border-radius:6px;background:var(--panel2);overflow:hidden}
.stepper .track i{display:block;height:100%;background:var(--accent);transform-origin:left center;transition:transform .4s}
.legend{font-size:13px;color:var(--muted);margin:8px 0 0}
.dl{display:inline-block;border-radius:50%;vertical-align:middle;margin:0 4px 0 8px}
.dl.d1{width:6px;height:6px;background:var(--muted)}.dl.d2{width:9px;height:9px;background:var(--liq)}.dl.d3{width:12px;height:12px;background:var(--accent);box-shadow:0 0 0 1.5px var(--ink)}
.rule{margin:10px 0 0;font-size:14px;padding:9px 11px;border-radius:10px;background:var(--panel2)}
.ticket{margin:18px 0;padding:14px 18px;border-radius:18px;background:var(--panel);border:1px solid var(--rule)}
.ticket table{width:100%;border-collapse:collapse}
.ticket th{text-align:left;font-weight:400;color:var(--muted);padding:8px 0;border-bottom:1px solid var(--rule);font-size:14.5px}
.ticket td{text-align:right;font-weight:700;padding:8px 0;border-bottom:1px solid var(--rule);font-variant-numeric:tabular-nums}
.ticket tr:last-child th,.ticket tr:last-child td{border-bottom:0}
.csteps li{display:flex;gap:10px;align-items:center;font-size:15px}
.csteps li b{width:24px;height:24px;border-radius:7px;display:grid;place-items:center;font-size:13px;flex:none}
.csteps li.ok b{background:color-mix(in srgb,var(--good) 20%,transparent);color:var(--good)}
.csteps li.no b{background:color-mix(in srgb,var(--bad) 20%,transparent);color:var(--bad)}
.win{color:var(--good)}.loss{color:var(--bad)}
.sub2{font-family:var(--display);font-weight:800;font-size:19px;margin:22px 0 8px}

/* Evaluación y dificultad */
.diffrow{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:16px 0 4px}
.diffrow>span{font-weight:700}
.diffnote{color:var(--muted);font-size:14px;margin:4px 0 0;max-width:60ch}
.evalcard{width:100%;margin:10px 0 34px}
.tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.tool{text-align:left;padding:9px 11px;border-radius:12px;border:1.5px solid var(--rule);background:var(--panel);cursor:pointer;display:grid;gap:1px;min-height:52px}
.tool b{font-size:14.5px;line-height:1.2}
.tool em{font-style:normal;font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.tool.on{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.tool.set em{color:var(--good);font-weight:700}
.gradebtns{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.gb{min-height:54px;border-radius:12px;border:1.5px solid var(--rule);background:var(--panel);font-family:var(--display);font-weight:800;font-size:21px;cursor:pointer}
.gb.sel{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 22%,var(--panel))}
.nonebtn{min-height:46px;border-radius:12px;border:1.5px dashed var(--muted);background:transparent;font-weight:700;cursor:pointer}
.nonebtn.sel{border-style:solid;border-color:var(--accent);background:color-mix(in srgb,var(--accent) 15%,transparent)}
.evalbtn:disabled{opacity:.4;cursor:default}
.elist li{display:grid;grid-template-columns:24px 1fr;gap:9px;align-items:start;font-size:14.5px;line-height:1.38}
.elist li b.k{width:24px;height:24px;border-radius:7px;display:grid;place-items:center;font-size:13px}
.elist li.ok b.k{background:color-mix(in srgb,var(--good) 20%,transparent);color:var(--good)}
.elist li.no b.k{background:color-mix(in srgb,var(--bad) 20%,transparent);color:var(--bad)}
.elist li.na b.k{background:var(--panel2);color:var(--muted)}
.why h4{font-family:var(--display);font-weight:800;font-size:16px;margin:14px 0 4px}
.maj{font-size: var(--t-xs);font-weight:700;padding:1px 6px;border-radius:5px;background:var(--panel2);margin-left:6px;white-space:nowrap}
.gradebig{font-family:var(--display);font-weight:800;font-size:40px;line-height:1;margin:2px 0 4px}

/* Lecciones */
.mbtns{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.lesson{max-width:760px;margin:0 auto}
.lhead{display:flex;justify-content:space-between;gap:10px;align-items:baseline;margin-bottom:8px}
#lUnit{font-family:var(--display);font-weight:800;font-size:14px;color:var(--muted)}
#lCount{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.ltrack{height:6px;border-radius:6px;background:var(--panel2);overflow:hidden;margin-bottom:18px}
.ltrack i{display:block;height:100%;background:var(--accent);transform-origin:left center;transition:transform .4s}
.lbody{padding-bottom:110px}
.lbody p{font-size:17px;line-height:1.62;margin:0 0 14px;max-width:64ch}
.lx{padding-left:22px;margin:0 0 14px;max-width:64ch}.lx li{margin:7px 0;font-size:16.5px;line-height:1.55}
.box{border-radius:16px;padding:14px 16px;margin:14px 0;background:var(--panel);border:1px solid var(--rule);border-left-width:5px}
.box h4{margin:0 0 6px;font-family:var(--display);font-weight:800;font-size:15.5px}
.box p{font-size:16px;margin:0 0 8px}.box p:last-child,.box .lx:last-child{margin-bottom:0}
.box.look{border-left-color:var(--liq)}.box.read{border-left-color:var(--accent)}.box.why{border-left-color:var(--good)}.box.not{border-left-color:var(--bad)}.box.act{border-left-color:var(--fvg)}
.box.ana{background:var(--panel2);border:0;border-left:5px solid var(--muted)}
.anat{display:flex;gap:6px;justify-content:center;flex-wrap:wrap;margin:8px 0 12px;padding:10px;border-radius:16px;background:var(--chartbg);border:1px solid var(--rule)}
.anat svg{width:min(48%,240px);height:auto}
.anat text{font-family:var(--body)}
.gloss div{display:grid;grid-template-columns:52px 1fr;gap:10px;align-items:baseline;padding:10px 12px;border-radius:12px;background:var(--panel);border:1px solid var(--rule)}
.gloss b{font-family:var(--display);font-weight:800;font-size:20px}
.lwrap{margin:6px 0 4px}
.lcv{display:block;width:100%;height:clamp(250px,44svh,440px)}
.lcv.sm{height:210px}
.stepn{font-size:13px;font-weight:700;color:var(--muted);margin:0 0 6px}
.stept{font-size:16.5px;line-height:1.58;min-height:3.2em}
@media(min-width:760px){.cmp.two{grid-template-columns:1fr 1fr}.cmp.three{grid-template-columns:repeat(3,1fr)}}
.cmpi{background:var(--panel);border:1px solid var(--rule);border-radius:16px;padding:12px 14px;display:grid;gap:8px;align-content:start}
.cmpi h4{margin:0;font-family:var(--display);font-weight:800;font-size:17px}
.cmpi p{font-size:15.5px;margin:0 0 6px}
.lq{font-family:var(--display);font-weight:800;font-size:clamp(19px,4.8vw,23px)!important;line-height:1.25!important;margin:4px 0 12px!important}
.qopts{display:grid;gap:10px;margin-top:6px}
.tfbtns{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:6px}
.tfb{min-height:64px;border-radius:14px;border:1.5px solid var(--rule);background:var(--panel);font-family:var(--display);font-weight:800;font-size:19px;cursor:pointer}
.tfb.right{border-color:var(--good);background:color-mix(in srgb,var(--good) 15%,var(--panel))}
.tfb.wrong{border-color:var(--bad);background:color-mix(in srgb,var(--bad) 15%,var(--panel))}
.lfb{margin-top:12px;border-radius:16px;padding:14px 16px;border:2px solid;background:var(--panel)}
.lfb.ok{border-color:var(--good)}.lfb.bad{border-color:var(--bad)}
.lfb b.v{font-family:var(--display);font-weight:800;font-size:19px;display:block;margin-bottom:4px}
.lfb.ok b.v{color:var(--good)}.lfb.bad b.v{color:var(--bad)}
.lfb p{font-size:16px!important}
.lfb .ans{padding:8px 10px;border-radius:10px;background:var(--panel2)}
.pdone{margin:10px 0 0!important;font-weight:700}
.toc li button{width:100%;text-align:left;display:grid;grid-template-columns:30px 1fr auto;gap:12px;align-items:center;padding:12px 14px;border-radius:14px;border:1px solid var(--rule);background:var(--panel);cursor:pointer}
.toc li button b{display:block;font-size:16px}
.toc .n{font-family:var(--display);font-weight:800;font-size:19px;color:var(--muted)}
.toc .st{font-size:13px;color:var(--muted)}.toc .okt{font-size:13px;color:var(--good);font-weight:700}
@media(min-width:760px){.sumt{grid-template-columns:1fr 1fr}.sumt .keyrule{grid-column:1/-1}}
.srow{background:var(--panel);border:1px solid var(--rule);border-radius:16px;padding:12px 14px}
.srow h4{margin:0 0 6px;font-family:var(--display);font-weight:800;font-size:17px}
.srow dl{margin:0;display:grid;grid-template-columns:auto 1fr;gap:4px 10px;font-size:14.5px;line-height:1.4}
.srow dt{color:var(--muted);font-weight:700}.srow dd{margin:0}
.qres .big{font-family:var(--display);font-size:clamp(80px,24vw,130px);font-weight:800;line-height:.85;letter-spacing:-.05em;margin:6px 0 10px}
.lnav .go{min-height:52px;border-radius:14px}
.lnav .confirm:disabled{opacity:.4}

.paths{display:grid;gap:10px;margin:10px 0 28px}
.box.inst{border-left-color:var(--ink)}
@media(min-width:620px){.rvi{grid-template-columns:1fr 1fr}}
.rvi>div{border-radius:12px;padding:10px 12px}
.rvi b{display:block;font-size:13px;margin-bottom:4px}
.rvi p{margin:0!important;font-size:15.5px!important;line-height:1.5!important}
.rv{background:color-mix(in srgb,var(--bad) 10%,transparent)}.rv b{color:var(--bad)}
.iv{background:color-mix(in srgb,var(--good) 12%,transparent)}.iv b{color:var(--good)}
.lfb .note{margin-top:8px!important}
.calcrow{display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid var(--rule);border-radius:12px;margin-bottom:8px;background:var(--card)}
.calcrow span{flex:1;font-size:15.5px}
.calcrow .suf{color:var(--muted);font-size:14px;width:22px}
.calcout table{width:100%;border-collapse:collapse}
.calcout td{padding:5px 0;font-size:15.5px;vertical-align:top}
.calcout td:last-child{text-align:right;font-weight:700;white-space:nowrap;padding-left:10px}
.calcout .note{margin-top:8px;font-size:14.5px;color:var(--muted)}
.report h3{font-size:13px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:18px 0 8px}
.report .rc{border:1px solid var(--rule);border-radius:14px;padding:12px 14px;background:var(--card)}
.report .rc+.rc{margin-top:8px}
.report .rc h4{font-size:16px;margin:0 0 8px}
.report .rc p.sub{font-size:13px;font-weight:700;color:var(--muted);margin:10px 0 4px;text-transform:uppercase;letter-spacing:.03em}
.report ul{margin:0;padding-left:18px}
.report li{font-size:15.5px;line-height:1.5;margin:4px 0}
.report .alert li b{font-variant-numeric:tabular-nums}
.report .plan{border-left:3px solid var(--good)}
.report .planb{border-left:3px solid var(--bad)}
.report .state{font-size:15.5px;line-height:1.55;margin:0 0 10px}
@media (prefers-reduced-motion: reduce){*{transition:none!important;animation:none!important;scroll-behavior:auto!important}}

/* ---------- Capa de marca (antes app-brand.css) ---------- */
/* Cabecera translúcida */
.brand { font-family: var(--display); letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 2px; cursor: pointer; font-weight: 500; font-size: 17px; }
.brand svg { width: 26px; height: 26px; }
.iconbtn { width: 40px; height: 40px; border: 1px solid var(--rule); cursor: pointer; display: grid; place-items: center; font-size: 18px; flex: none; border-radius: 14px; border-color: var(--rule); background: color-mix(in srgb, var(--panel) 80%, transparent); }
.pill { font-weight: 500; background: color-mix(in srgb, var(--panel) 85%, transparent); border-color: var(--rule); }
.pill.hot { border-color: transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--g-orange) border-box; box-shadow: 0 6px 18px -8px rgba(255, 112, 67, .7); }

/* ---------- Tipografía: finos en grande, medios en títulos pequeños ---------- */
.result .big, .qres .big, .gradebig, .num, .toc .n { font-weight: 300; letter-spacing: -.03em; }
.result .big, .qres .big { background: var(--g-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sec { font-family: var(--display); margin: 0; font-weight: 400; font-size: 26px; letter-spacing: -.02em; margin-top: 8px; }
.lh { font-family: var(--display); font-size: clamp(25px,6.4vw,34px); margin: 0 0 14px; font-weight: 400; letter-spacing: -.025em; line-height: 1.15; }
.prompt, .lq { font-weight: 500 !important; letter-spacing: -.015em; }
.mode b, .mod h3, .rank h2 { font-weight: 500; letter-spacing: -.015em; }
.stats b { font-weight: 400; }
.card td, .tfb, .gb { font-weight: 500; }
.verdict, .lfb b.v { font-weight: 600; }
.box h4, .cmpi h4, .srow h4, .why h4, .sub2, #lUnit, .concept { font-weight: 600; }
.go, .confirm, .next, .opt, .tf, .tool b, .chip, #stepTxt, .pdone, .diffrow > span { font-weight: 500; }
.lbody p, .lx li, .stept, .why, .box p { font-weight: 300; }
.lbody p b, .lx li b, .stept b, .why b, .box p b, .lbody strong { font-weight: 600; }

/* ---------- Superficies ---------- */
.rank, .mode, .fb, .ticket, .cmpi, .srow, .box, .gloss div, .toc li button, .report .rc, .calcrow, .opt, .tool, .tfb, .gb, .nb, .cpt, .lfb {
  border-color: var(--rule);
}
.rank, .mode, .ticket, .cmpi, .srow, .report .rc {
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 100%, #ffffff 3%), var(--panel));
  box-shadow: var(--soft);
}
.rank, .mode { border-radius: 24px; }
.chartwrap, .anat { border-radius: 22px; border-color: var(--rule); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .28); }

/* ---------- Botones ---------- */
.confirm {
  background: var(--g-violet); color: #fff; border-radius: 16px; font-weight: 500;
  box-shadow: var(--violet-glow); transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, opacity .2s;
}
.confirm:hover:not(:disabled) { transform: translateY(-1px); }
.confirm:disabled { box-shadow: none; }
.go { border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); transition: background-color .2s; }
.go:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.next { border-radius: 16px; background: var(--ink); color: var(--bg-bottom); font-weight: 500; transition: transform .2s; }
.next:hover { transform: translateY(-1px); }
.mode { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
.mode:hover { transform: translateY(-2px); }
.mode.primary { background: var(--g-violet); color: #fff; box-shadow: var(--violet-glow); }
.mode.primary span { color: inherit; opacity: .85; }
.opt { border-width: 1px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 92%, transparent); transition: background-color .2s, border-color .2s, transform .2s; }
.opt:hover:not(:disabled) { transform: translateY(-1px); background: color-mix(in srgb, var(--panel) 100%, #ffffff 5%); }
.opt kbd { font-family: var(--display); font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; flex: none; font-weight: 600; background: var(--panel2); color: var(--muted); }
.tfb, .gb, .nb, .tool { border-width: 1px; }
.tf.on { background: var(--panel); box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .4); }
.tool.on, .gb.sel, .nonebtn.sel { border-color: #c471ed; box-shadow: inset 0 0 0 1px #c471ed; background: color-mix(in srgb, #8b3cf7 14%, var(--panel)); }
.link { background: none; border: 0; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; color: var(--muted); }

/* ---------- Progreso con degradado ---------- */
.ltrack, .stepper .track, .timer .track { background: var(--panel2); box-shadow: inset 0 1px 4px rgba(0, 0, 0, .3); height: 8px; }
.ltrack i, .stepper .track i { background: var(--g-brand); }
.timer .track i { background: var(--g-orange); }
.meter .body { position: absolute; left: 5px; right: 5px; top: 14px; bottom: 14px; border: 2px solid var(--bull); border-radius: 4px; overflow: hidden; border-color: transparent; background: var(--panel2); box-shadow: inset 0 1px 6px rgba(0, 0, 0, .35); }
.meter .fill { background: var(--g-blue); }
.cpt i::after { background: var(--g-teal); }

/* ---------- Tarjetas del recorrido ---------- */

/* ---------- Refuerzo positivo ---------- */
.fb, .lfb { border-width: 1px; animation: fbIn .45s cubic-bezier(.2,.8,.2,1); }
.fb.ok, .lfb.ok { background: linear-gradient(160deg, color-mix(in srgb, var(--good) 14%, var(--panel)), var(--panel) 70%); box-shadow: 0 16px 40px -18px color-mix(in srgb, var(--good) 70%, transparent); }
.fb.bad, .lfb.bad { background: linear-gradient(160deg, color-mix(in srgb, var(--bad) 10%, var(--panel)), var(--panel) 70%); }
.fb.ok .verdict, .lfb.ok b.v { background: var(--g-teal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.opt.right, .tfb.right { animation: rightPop .5s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 0 1px var(--good), 0 10px 26px -12px color-mix(in srgb, var(--good) 80%, transparent); }
@keyframes fbIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rightPop { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: scale(1); } }

/* Píldora de XP que «late» al sumar y cifra flotante +N XP */
.pill.bump { animation: bump .6s cubic-bezier(.2,.8,.2,1); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.14); box-shadow: 0 0 0 4px rgba(196, 113, 237, .35); } 100% { transform: scale(1); } }
.xpfloat {
  position: fixed; z-index: 50; transform: translateX(-50%); pointer-events: none;
  padding: 5px 11px; border-radius: 999px; background: var(--g-violet); color: #fff;
  font: 600 13px/1.2 var(--body); box-shadow: var(--violet-glow);
  animation: xpUp 1.3s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes xpUp { 0% { opacity: 0; margin-top: 8px; } 18% { opacity: 1; margin-top: 0; } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -16px; } }
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 14px 20px; border-radius: 18px; text-align: center;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--g-brand) border-box; border: 1.5px solid transparent;
  color: var(--ink); font: 500 15px/1.35 var(--body); box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .6);
  animation: toastIn 3.2s cubic-bezier(.2,.8,.2,1) forwards;
}
.toast b { background: var(--g-brand); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }
@keyframes toastIn { 0% { opacity: 0; transform: translate(-50%, 16px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Lecciones ---------- */
.box { border-radius: 18px; background: color-mix(in srgb, var(--panel) 92%, transparent); }
.box.read { border-left-color: var(--accent); }
.box.inst { border-left-color: #c471ed; }
.box.ana { background: var(--panel2); }
.lnav .go, .lnav .confirm { border-radius: 16px; }
.toc li button { border-radius: 16px; transition: transform .2s, background-color .2s; }
.toc li button:hover { transform: translateY(-1px); }
.calcrow input { width: 96px; font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); border: 1px solid var(--rule); border-radius: 9px; padding: 7px 9px; text-align: right; background: var(--panel2); border-color: var(--rule); }
.chip { background: var(--panel2); }
.zoombtn { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--rule); font-size: 13px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12); background: color-mix(in srgb, var(--panel) 88%, transparent); border-color: var(--rule); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .xpfloat, .toast, .fb, .lfb, .opt.right, .tfb.right, .pill.bump { animation-duration: .01ms !important; }
  .toast { animation: none !important; }
}

/* Encabezados de pregunta dentro de lecciones, exámenes y prueba de nivel: etiqueta, no texto de lectura */
.lbody p.stepn { font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }

/* ---------- Pautas de interfaz (accesibilidad, tacto, cifras) ---------- */
.d-skip {
  position: absolute; left: 16px; top: -100px; z-index: 100; padding: 12px 18px; border-radius: 12px;
  background: #ffffff; color: #1f2126; font-weight: 500; text-decoration: none; transition: top .2s;
}
.d-skip:focus { top: 12px; }
main:focus { outline: none; } /* destino del salto: el foco pasa al primer control del contenido */
a, button, summary, label, .opt, .cpt { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pill, .chip, .d-ringc b, .d-perf-kpis b, .d-goal, #lCount, #stepTxt, .timer span { font-variant-numeric: tabular-nums; }
.tool:hover:not(:disabled), .gb:hover:not(:disabled), .tfb:hover:not(:disabled), .nb:hover:not(:disabled),
.cpt:hover:not(:disabled), .nonebtn:hover:not(:disabled) { background: color-mix(in srgb, var(--panel) 100%, #ffffff 6%); border-color: color-mix(in srgb, var(--rule) 60%, var(--ink)); }
.tf:hover:not(.on):not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.tool, .gb, .tfb, .nb, .cpt, .nonebtn, .tf { transition: background-color .2s, border-color .2s, transform .2s; }


/* ---------- Estructura de la app (antes app-shell.css) ---------- */
/* Iconos Phosphor: siempre del tamaño del texto que acompañan, salvo donde se indique */
.ph { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -0.2em; }

/* ---------- Marco: cabecera alineada con el contenido y ritmo de la página ---------- */
.bar { position: sticky; top: env(safe-area-inset-top,0px); z-index: 10; display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--bg-top) 72%, transparent); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom-color: color-mix(in srgb, var(--ink) 8%, transparent); padding-inline: max(var(--s-4), calc((100% - var(--wrap)) / 2 + var(--s-4))); gap: var(--s-3); }
main { padding-top: var(--s-6); }
#stPill { display: inline-flex; align-items: center; gap: var(--s-1); }
#stPill .ph { color: #ff8a4c; width: 1.1em; height: 1.1em; }

/* ---------- Navegación ---------- */
.d-tabs { display: none; }
.d-tabbtn { font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: none; }
.d-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: var(--s-2) var(--s-1) calc(var(--s-2) + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg-bottom) 86%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
.d-tabbar .d-tabbtn { display: grid; justify-items: center; gap: var(--s-1); padding: var(--s-1) 2px; border-radius: var(--r-chip); font-size: var(--t-xs); font-weight: 500; letter-spacing: -.01em; }
.d-tabbar .d-tabbtn .ph { width: 24px; height: 24px; }
.d-tabbtn.on { color: var(--ink); }
.d-tabbar .d-tabbtn.on .ph { color: #c471ed; filter: drop-shadow(0 4px 10px rgba(196, 113, 237, .55)); }
body:not(.playing) main { padding-bottom: calc(var(--tabbar-h) + var(--s-7) + env(safe-area-inset-bottom, 0px)); }
body.playing .d-tabbar, body.playing .d-tabs { display: none !important; }

@media (min-width: 900px) {
  .d-tabbar { display: none; }
  body:not(.playing) main { padding-bottom: var(--s-8); }
  .d-tabs { display: flex; gap: var(--s-1); margin-left: var(--s-5); }
  .d-tabs .d-tabbtn { display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-radius: 999px; font-size: 14px; font-weight: 500; transition: background-color .2s, color .2s; }
  .d-tabs .d-tabbtn .ph { width: 18px; height: 18px; }
  .d-tabs .d-tabbtn:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
  .d-tabs .d-tabbtn.on { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); }
  .d-tabs .d-tabbtn.on .ph { color: #c471ed; }
}

/* ---------- Comunes ---------- */
.d-tab { animation: dIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes dIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.d-head .sec { margin: 0; font-size: clamp(28px, 6vw, 36px); font-weight: 300; }
.d-head .secsub { margin: var(--s-2) 0 0; max-width: 64ch; }
.d-sec2 + .secsub { margin: var(--s-2) 0 var(--s-4); }
.d-h { font-size: 12.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.d-h2 { font-size: 19px; font-weight: 500; margin: 0; letter-spacing: -.01em; }
.d-panel { border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--surface-card); box-shadow: var(--soft); padding: var(--s-5); }
.d-soon { font-size: var(--t-xs); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--rule); border-radius: 999px; padding: var(--s-1) var(--s-3); white-space: nowrap; }
.d-lock { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-4) 0 0; font-size: 13.5px; color: var(--muted); }
.d-help { margin: 0 0 var(--s-5); max-width: 64ch; color: var(--muted); font-size: 14px; line-height: 1.55; }
.d-empty { margin: var(--s-3) 0 0; padding: var(--s-4); border-radius: var(--r-row); border: 1px dashed var(--rule); color: var(--muted); font-size: 14px; line-height: 1.5; }
.dot { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50% 50% 50% 0 / 50% 50% 50% 0; transform: rotate(-45deg); }
.dot.violet { background: var(--g-violet); } .dot.pink { background: var(--g-pink); } .dot.orange { background: var(--g-orange); } .dot.blue { background: var(--g-blue); }
#hActions li > div, .d-place > div { min-width: 0; overflow-wrap: break-word; }

/* ---------- HOY ---------- */
.d-ring { order: 2; margin-top: var(--s-5); }
.d-trade { order: 7; margin-top: var(--s-4); }
.d-date { margin: 0; color: var(--muted); font-weight: 300; }
#hHello { margin: var(--s-1) 0 0; font-size: clamp(30px, 7vw, 38px); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
.d-rankline { margin: var(--s-2) 0 0; font-size: 14px; color: var(--muted); }
.d-ringbox { position: relative; width: min(100%, 320px); margin: 0 auto; }
.d-ringbox svg { display: block; width: 100%; height: auto; overflow: visible; }
.rtrack { fill: #3a3d44; stroke: #2d2f35; stroke-width: 1; }
.rgroove { fill: url(#rgroove); } .rgA { stop-color: #2a2c31; } .rgB { stop-color: #34373e; } .rcore { fill: #30333a; }
:root[data-theme="light"] .rtrack { fill: #e2e5ec; stroke: #f5f6f9; }
:root[data-theme="light"] .rgA { stop-color: #e9ecf1; } :root[data-theme="light"] .rgB { stop-color: #f5f6f9; } :root[data-theme="light"] .rcore { fill: #ffffff; }
.rcur { transform-origin: 160px 160px; animation: dPop .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes dPop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.d-ringc { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.d-ringc b { font-size: 46px; font-weight: 300; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.d-ringc small { font-size: 18px; color: var(--muted); margin-left: 2px; }
.d-ringc span { font-size: 12.5px; color: var(--muted); margin-top: var(--s-1); }
.d-belt-legend { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2) var(--s-4); font-size: 12.5px; color: var(--muted); }
.d-belt-legend li { display: inline-flex; align-items: center; gap: var(--s-2); opacity: .6; }
.d-belt-legend li.done { opacity: .9; } .d-belt-legend li.cur { opacity: 1; color: var(--ink); font-weight: 500; }
.d-belt-legend i { width: 8px; height: 8px; border-radius: 50%; }
.d-goal { display: flex; align-items: center; gap: var(--s-2); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-goalbar { width: 88px; height: 6px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.d-goalbar i { display: block; height: 100%; border-radius: inherit; background: var(--g-orange); transition: width .6s; }
#hActions { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-3); }
#hActions li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-radius: var(--r-row); background: color-mix(in srgb, var(--ink) 3%, transparent); border: 1px solid var(--rule); }
.d-abtn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-width: 48px; height: 48px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-row); color: #fff; font: 500 14px/1 var(--body); cursor: pointer; transition: transform .2s; }
.d-abtn .ph { width: 20px; height: 20px; }
.d-abtn span { display: none; }
.d-abtn:hover { transform: translateY(-2px); }
.d-abtn:active { transform: translateY(0) scale(.98); }
.d-abtn.continue { background: var(--g-violet); box-shadow: 0 10px 24px -10px rgba(123,47,247,.8); }
.d-abtn.practice { background: var(--g-pink); box-shadow: 0 10px 24px -10px rgba(230,36,110,.7); }
.d-abtn.sim { background: var(--g-blue); box-shadow: 0 10px 24px -10px rgba(19,159,224,.7); }
@media (min-width: 480px) { .d-abtn span { display: inline; } .d-abtn { padding: 0 var(--s-4); } }
.d-trade-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.d-trade-in p { margin: var(--s-2) 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.d-trade-ghost { display: flex; align-items: flex-end; gap: var(--s-2); height: 64px; margin-top: var(--s-4); padding: var(--s-3); border-radius: var(--r-row); background: var(--panel2); }
.d-trade-ghost i { flex: 1; height: var(--h); border-radius: 4px; background: var(--g-blue); opacity: .28; }
.d-sheet { display: block; width: calc(100% + 2 * var(--s-4)); margin: var(--s-6) calc(-1 * var(--s-4)) 0; padding: var(--s-5); border: 0; border-radius: var(--s-6) var(--s-6) 0 0; background: #ffffff; color: #1f2126; cursor: pointer; text-align: left; font: inherit; }
.d-sheet .wrapin { display: flex; align-items: center; gap: var(--s-3); max-width: var(--wrap); margin: 0 auto; }
.d-s-l { color: #6b6f78; font-weight: 300; font-size: 16px; }
.d-sheet b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.d-s-a { margin-left: auto; font-size: 22px; color: #6b6f78; }
:root[data-theme="light"] .d-sheet { background: #1f2126; color: #fff; } :root[data-theme="light"] .d-s-l, :root[data-theme="light"] .d-s-a { color: #b4b8c1; }

@media (min-width: 900px) {
  .d-trade { margin-top: 0; }
  .d-ring { margin-top: var(--s-6); }
  .d-trade { padding: var(--s-6); }
  .d-sheet { width: 100%; margin: var(--s-6) 0 0; border-radius: var(--r-card); padding: var(--s-5) var(--s-6); }
}

/* ---------- RECORRIDO ---------- */
.d-place p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 52ch; }
.d-place .d-place-t { color: var(--ink); font-weight: 600; font-size: 16px; margin-bottom: var(--s-1); }
.d-belts { display: grid; gap: var(--s-4); }
@media (min-width: 900px) { .d-belts { grid-template-columns: 1fr 1fr; gap: var(--s-5); align-items: start; } .d-final, .d-after { grid-column: 1 / -1; } }
.d-bbar { height: 6px; margin-top: var(--s-4); border-radius: 99px; background: var(--panel2); overflow: hidden; }
.d-bbar i { display: block; height: 100%; border-radius: inherit; background: var(--bg-belt); }
.d-lring { position: relative; z-index: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums;
  background: conic-gradient(var(--good) calc(var(--p) * 360deg), var(--panel2) 0); }
.d-lring::before { content: ''; position: absolute; inset: 4px; z-index: -1; border-radius: 50%; background: var(--panel); }
.d-lring .ph { color: var(--good); width: 18px; height: 18px; }
.d-lk { margin: 0; font-size: var(--t-xs); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-final { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-5); border-radius: var(--r-card); background: linear-gradient(120deg, rgba(123,47,247,.22), rgba(242,70,111,.1) 60%, rgba(255,138,76,.06)); border: 1px solid rgba(196,113,237,.32); }
.d-final h3 { margin: 2px 0 0; font-size: 18px; font-weight: 500; }
.d-final p:last-child { margin: var(--s-1) 0 0; color: var(--muted); font-size: 14px; }
.d-final-ring { flex: none; width: 48px; height: 48px; border-radius: 50%; background: conic-gradient(from 200deg, #c471ed, #6a11f5, #e6246e, #ff7043, #ffd48a, #00e3b5, #1d3fd1, #c471ed); -webkit-mask: radial-gradient(circle, transparent 52%, #000 54%); mask: radial-gradient(circle, transparent 52%, #000 54%); }
.d-after { margin: 0 !important; }

/* ---------- PRÁCTICA ---------- */
.d-weak-list { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.d-mods { display: grid; gap: var(--s-4); align-items: start; margin: 0 !important; }
@media (min-width: 760px) { .d-mods { grid-template-columns: 1fr 1fr; gap: var(--s-5); } }
.d-mods .mod { position: relative; overflow: hidden; padding: var(--s-5); border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--surface-card); box-shadow: var(--soft); }
.d-mods .mod::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--bg-belt, var(--g-brand)); }
.d-mods .modhead { grid-template-columns: auto 1fr; gap: var(--s-4); }
.d-mods .mbtns { grid-column: 1 / -1; justify-content: flex-start; gap: var(--s-2); margin-top: var(--s-1); }
.d-mods .num { background: var(--bg-belt, var(--g-brand)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.d-mods .cpts { margin: var(--s-4) 0 0; gap: var(--s-2); }
.d-mods .mod.locked { background: transparent; box-shadow: none; border-style: dashed; }
.d-mods .mod.locked > *:not(.d-lock) { opacity: .5; }
.d-mods .mod.locked button { cursor: not-allowed; }

/* ---------- SIMULADORES ---------- */

/* ---------- RENDIMIENTO ---------- */
.d-bars { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-4); }
@media (min-width: 760px) { .d-bars { grid-template-columns: 1fr 1fr; gap: var(--s-4) var(--s-6); } }
.d-bar-top { display: flex; justify-content: space-between; gap: var(--s-3); font-size: 14.5px; }
.d-bar-top b { font-weight: 500; font-variant-numeric: tabular-nums; }
.d-bar { height: 8px; margin-top: var(--s-2); border-radius: 99px; background: var(--panel2); overflow: hidden; }
.d-bar i { display: block; height: 100%; border-radius: inherit; background: var(--bg-belt, var(--g-brand)); }
.d-bars p { margin: var(--s-1) 0 0; font-size: 12.5px; color: var(--muted); }
.d-perf-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-5) var(--s-4); margin: var(--s-6) 0 0; padding: var(--s-5) 0 0; border-top: 1px solid var(--rule); }
@media (min-width: 760px) { .d-perf-kpis { grid-template-columns: repeat(4, 1fr); } }
.d-perf-kpis div { display: grid; gap: var(--s-1); }
.d-perf-kpis b { font-size: 30px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.d-perf-kpis span { font-size: 13px; color: var(--muted); }

/* ---------- ONBOARDING Y PRUEBA DE NIVEL ---------- */
.d-onb { min-height: calc(100dvh - 140px); display: grid; place-items: center; }
.d-onb-card { width: min(100%, 520px); padding: var(--s-2) 0 var(--s-7); }
.d-onb-dots { display: flex; gap: var(--s-2); margin-bottom: var(--s-6); }
.d-onb-dots i { height: 4px; flex: 1; border-radius: 99px; background: var(--panel2); }
.d-onb-dots i.on { background: var(--g-brand); }
.d-onb-k { margin: 0; font-size: 12.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.d-onb-q { margin: var(--s-2) 0 var(--s-3); font-size: clamp(28px, 7vw, 38px); font-weight: 300; line-height: 1.12; letter-spacing: -.02em; }
.d-onb-h { margin: 0 0 var(--s-5); color: var(--muted); font-size: 16px; line-height: 1.55; }
.d-onb .qopts { gap: var(--s-3); }
.d-onb .opt { min-height: 64px; font-size: 16.5px; }
.d-onb .rbtns { gap: var(--s-3); }
.d-onb-ring { width: 80px; height: 80px; margin-bottom: var(--s-5); border-radius: 50%; background: conic-gradient(from 200deg, #c471ed, #6a11f5, #e6246e, #ff7043, #ffd48a, #00e3b5, #1d3fd1, #c471ed); -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%); mask: radial-gradient(circle, transparent 54%, #000 56%); animation: dSpin 8s linear infinite; }
@keyframes dSpin { to { transform: rotate(360deg); } }
.d-steps { list-style: none; margin: 0 0 var(--s-6); padding: 0; display: grid; gap: var(--s-3); }
.d-steps li { position: relative; padding-left: var(--s-5); color: var(--muted); font-size: 16px; line-height: 1.5; }
.d-steps li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--g-brand); }
.d-steps b { color: var(--ink); font-weight: 600; }
#place .lbody { padding-bottom: var(--s-8); }
#place .box-q { margin-top: var(--s-2); }

/* ---------- Ritmo de los componentes originales dentro de las secciones ---------- */
#home .mode, #home .rank { padding: var(--s-5); }
#home .mode, #home .rank, #home .evalcard { border-radius: var(--r-card); }
#home .diffnote { margin: 0; }
#home .evalcard { margin: 0; }
#home .rank { gap: var(--s-5); }

@media (prefers-reduced-motion: reduce) { .d-tab, .rcur, .d-onb-ring { animation: none !important; } }

/* =====================================================================================
   RITMO DE LAS PÁGINAS (inicio de la app y páginas del curso)
   Principio de proximidad: poco espacio dentro de un grupo (etiqueta + título: s-2/s-3) y
   mucho entre grupos distintos (s-6/s-7). Todo sale de la escala de 4 pt.
   ===================================================================================== */

/* ---------- Secciones de inicio: más aire alrededor de cada bloque ---------- */
main { padding-top: var(--s-7); }
.d-head { margin: 0 0 var(--s-3); margin-bottom: var(--s-4); }
.d-head .secsub { margin-top: var(--s-3); }
.d-help { margin-bottom: var(--s-7); }
.d-sec2 { margin-top: var(--s-8) !important; }
.d-sec2 + .secsub { margin: var(--s-3) 0 var(--s-6); }
#home .modes { margin: 0 0 var(--s-5); gap: var(--s-4); margin-bottom: var(--s-4); }
#home .modes + .d-help { margin-top: var(--s-4); }
#home .diffrow { margin: var(--s-6) 0 var(--s-2); margin-top: var(--s-7); }
.d-weak { margin: var(--s-6) 0 0; margin-top: var(--s-7); }
.d-belts { gap: var(--s-5); }
.d-place { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); margin: 0 0 var(--s-5); padding: var(--s-5); border-radius: var(--r-card); background: linear-gradient(120deg, rgba(123,47,247,.2), rgba(242,70,111,.07)); border: 1px solid rgba(196,113,237,.32); margin-bottom: var(--s-7); }
#perfMods { margin-top: var(--s-2); }
#perfTrade { margin-top: var(--s-7); }
.d-perf-kpis { margin-top: var(--s-7); padding-top: var(--s-6); }
.d-trade { margin-top: var(--s-5); }
@media (min-width: 900px) {
  main { padding-top: var(--s-8); }
  .d-belts { gap: var(--s-6); }
  .d-mods { gap: var(--s-6); }
  .d-trade { margin-top: 0; }
  .d-mods .mod, #home .mode, #home .rank { padding: var(--s-6); }
}

/* ---------- Lecciones ---------- */
.lesson .lhead { margin-bottom: var(--s-3); }
.lesson .ltrack { margin-bottom: var(--s-7); }
.lbody p { margin: 0 0 var(--s-4); line-height: 1.7; }
.lbody > div + div, .lbody > div + .lwrap, .lbody > .lwrap + div { margin-top: var(--s-6); }
.lx { margin: var(--s-2) 0 var(--s-5); padding-left: var(--s-5); }
.lx li { margin: var(--s-2) 0; line-height: 1.6; }
.box { margin: var(--s-6) 0; padding: var(--s-5); }
.box h4 { margin-bottom: var(--s-2); }
.keyrule { border-radius: 14px; font-size: 16.5px; line-height: 1.55; max-width: 64ch; background: linear-gradient(160deg, color-mix(in srgb, #8b3cf7 16%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, #c471ed 45%, transparent); font-weight: 400; margin: var(--s-6) 0; padding: var(--s-5); }
.anat { margin: var(--s-5) 0 var(--s-6); padding: var(--s-4); gap: var(--s-3); }
.gloss { display: grid; gap: var(--s-3); margin: var(--s-5) 0 var(--s-6); }
.gloss div { padding: var(--s-4); }
.lwrap { margin: var(--s-5) 0; }
.stepn { margin-bottom: var(--s-2); }
.stepctl { display: grid; grid-template-columns: 58px 1fr; margin-top: var(--s-5); gap: var(--s-3); }
.other { margin-top: var(--s-4); }
.cmp { display: grid; gap: var(--s-5); margin: var(--s-6) 0; }
.cmpi { padding: var(--s-5); gap: var(--s-3); }
.lbody .lq { margin: var(--s-2) 0 var(--s-5) !important; }
.qopts, .tfbtns { gap: var(--s-3); margin-top: var(--s-4); }
.lfb { margin-top: var(--s-5); padding: var(--s-5); }
.lfb b.v { margin-bottom: var(--s-2); }
.lfb .next, .fbq .next { margin-top: var(--s-5); }
.qtrack { margin: 0 0 var(--s-6); }
.toc { list-style: none; padding: 0; display: grid; gap: var(--s-3); margin: var(--s-5) 0; }
.toc li button { padding: var(--s-4) var(--s-5); gap: var(--s-4); }
.sumt { display: grid; gap: var(--s-4); }
.srow { padding: var(--s-5); }
.srow h4 { margin-bottom: var(--s-3); }
.calc { margin: var(--s-5) 0; }
.calcrow { padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3); gap: var(--s-3); }
.calcout { margin-top: var(--s-5); }
.rvi { display: grid; gap: var(--s-3); margin-top: var(--s-4); }
.rvi > div { padding: var(--s-4); }
.pdone { margin-top: var(--s-4) !important; }
.lcont { width: 100%; margin: var(--s-4) 0 var(--s-6); }
.lbody { padding-bottom: 160px; }
.lnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; border-top: 1px solid var(--rule); background: color-mix(in srgb, var(--bg-bottom) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top-color: color-mix(in srgb, var(--ink) 8%, transparent); padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); }
.lnav .in { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 2fr; gap: var(--s-3); }
.lhint { position: fixed; left: 0; right: 0; text-align: center; margin: 0; z-index: 9; pointer-events: none; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
.qres .big { margin: var(--s-3) 0 var(--s-4); }
.qres p { margin-bottom: var(--s-3); }
.qres + .sub2, .lbody .sub2 { margin: var(--s-7) 0 var(--s-3); }

/* ---------- Ejercicios y casos ---------- */
.timer { display: flex; align-items: center; margin-bottom: var(--s-6); gap: var(--s-3); }
.stepper { margin-bottom: var(--s-6); }
.steprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: var(--s-3); }
.prompt { margin: var(--s-3) 0 var(--s-5); }
.shint { font-size: 14.5px; color: var(--muted); border-left: 3px solid var(--liq); max-width: 60ch; margin: 0 0 var(--s-5); padding-left: var(--s-3); }
.side { display: grid; align-content: start; gap: var(--s-4); }
.controls { display: grid; gap: var(--s-3); }
.card { min-height: 230px; display: grid; align-content: center; padding: var(--s-6) var(--s-5); }
.fb { padding: var(--s-5); }
.verdict { margin: 0 0 var(--s-3); }
.why p { margin: 0 0 var(--s-3); }
.why h4 { margin: var(--s-5) 0 var(--s-2); }
.note { margin: var(--s-3) 0 var(--s-4); }
.next { margin-top: var(--s-4); }
.tools, .gradebtns { gap: var(--s-3); }
.nudge { display: grid; grid-template-columns: 58px 1fr 58px; gap: var(--s-3); }
.elist { list-style: none; padding: 0; display: grid; gap: var(--s-3); margin: var(--s-2) 0 var(--s-4); }
@media (min-width: 920px) { .side { top: 96px; } }

/* ---------- Resultados y resumen de casos ---------- */
.result { max-width: 560px; padding-top: var(--s-7); }
.result .big { margin: var(--s-3) 0 var(--s-5); }
.result p { margin-bottom: var(--s-3); }
.rbtns { gap: var(--s-3); margin-top: var(--s-7); }
.ticket { margin: 0 0 var(--s-6); padding: var(--s-4) var(--s-5); }
.ticket th, .ticket td { padding: var(--s-3) 0; }
.csteps { list-style: none; padding: 0; display: grid; gap: var(--s-3); margin: 0 0 var(--s-6); }
.sub2 { margin: var(--s-7) 0 var(--s-3); }
.report { margin-top: var(--s-6); }
.report h3 { margin: var(--s-7) 0 var(--s-3); }
.report .rc { padding: var(--s-5); }
.report .rc + .rc { margin-top: var(--s-3); }
.report .rc p.sub { margin: var(--s-4) 0 var(--s-2); }

/* ---------- Simuladores estrella (Hoy y Simuladores) ---------- */ .d-simblock { order: 6; margin-top: var(--s-6); } .d-trade { order: 9; }
.d-simblock .d-help { margin: var(--s-2) 0 var(--s-4); }
.d-sims { display: grid; gap: var(--s-4); }
@media (min-width: 600px) { .d-sims { grid-template-columns: 1fr 1fr; } }
.d-sim {
  --t: 139 60 247; --g: var(--g-violet);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-5); border-radius: var(--r-card); border: 1px solid rgb(var(--t) / .32);
  background: radial-gradient(120% 80% at 100% 0%, rgb(var(--t) / .24), transparent 60%), var(--surface-card);
  box-shadow: 0 18px 40px -22px rgb(var(--t) / .6);
}
.d-sim.rutina { --t: 19 159 224; --g: var(--g-blue); }
/* El simulador de challenge ocupa toda la fila: es la prueba final de todo lo demás */
.d-sim-top { display: flex; align-items: center; gap: var(--s-3); }
.d-sim-ic { flex: none; width: 44px; height: 44px; border-radius: var(--r-chip); display: grid; place-items: center; color: #fff; background: var(--g); }
.d-sim-ic .ph { width: 24px; height: 24px; }
.d-sim-k { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.d-sim-n { margin: var(--s-1) 0 0; font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.d-sim-x { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.d-sim-s { display: flex; align-items: center; gap: var(--s-2); margin: auto 0 0; padding-top: var(--s-2); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-sim-s.ok { color: var(--good); }
.d-sim-s .ph { width: 18px; height: 18px; }
.d-sim-b {
  display: inline-flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 52px; padding: 0 var(--s-5);
  border: 0; border-radius: var(--r-row); color: #fff; font: 500 15px/1 var(--body); cursor: pointer; background: var(--g);
  box-shadow: 0 12px 28px -12px rgb(var(--t) / .8); transition: transform .2s;
}
.d-sim-b:hover { transform: translateY(-2px); }
.d-sim-b:active { transform: translateY(0) scale(.98); }
.d-sim-b .ph { width: 20px; height: 20px; }
/* Versión ampliada: pasos reales del simulador */
.d-sim.big { padding: var(--s-6); gap: var(--s-4); }
.d-sim.big .d-sim-n { font-size: 26px; font-weight: 400; }
.d-sim.big .d-sim-x { font-size: 15.5px; max-width: 52ch; }
.d-sim-steps { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-4); counter-reset: st; }
.d-sim-steps li { counter-increment: st; display: flex; align-items: baseline; gap: var(--s-2); font-size: 13.5px; color: var(--ink); }
.d-sim-steps li::before { content: counter(st); min-width: 22px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-sim-flow { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-sim-flow li { display: inline-flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-3); border-radius: 999px; font-size: 13.5px; background: rgb(var(--t) / .14); border: 1px solid rgb(var(--t) / .3); }
@media (min-width: 900px) {
  .d-simblock { margin-top: 0; }
  .d-sims.big { gap: var(--s-6); }
}

/* Pie de la app: origen de la plataforma */
#home .foot { padding-top: var(--s-5); gap: var(--s-5); margin-top: var(--s-8); align-items: center; }
.d-origin { flex-basis: 100%; margin: 0 0 var(--s-2); display: flex; align-items: center; gap: var(--s-2); color: var(--ink); font-weight: 500; font-size: 14px; }
.d-flag { width: 21px; height: 14px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }

/* ---------- Plantilla de ejercicio ----------
   Una sola estructura para todo lo que se responde sobre un gráfico: práctica libre, contrarreloj,
   setup paso a paso, rutina, evaluación de setup y las prácticas y pasos guiados de las lecciones.
   El marcado vive en head.html (#play) y en exFrame() de lesson.js; cualquier cambio aquí llega a todos.

   .d-ex            rejilla: cabecera arriba; debajo, escenario y panel
   .d-ex-head       qué se pregunta: meta (concepto y marcador), enunciado y pista
   .d-ex-stage      el gráfico, con su barra (activo, temporalidad, herramientas)
   .d-ex-panel      la respuesta: etiqueta, controles y corrección, en una única tarjeta
   Escritorio: la cabecera ocupa todo el ancho y el gráfico y el panel empiezan a la misma altura. */
.d-ex { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "stage" "panel"; }
.d-ex-head { grid-area: head; min-width: 0; }
.d-ex-stage { grid-area: stage; min-width: 0; }
.d-ex-steps { grid-template-areas: "stage" "panel"; }

.d-ex-head .stepper { margin-bottom: var(--s-5); }
.d-ex-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4); margin: 0 0 var(--s-2); }
.d-ex-meta .concept { font-size: 14px; color: var(--muted); }
.d-ex-score { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-ex-head .prompt { margin: 0; max-width: 38ch; font-size: clamp(21px, 2.6vw, 28px); line-height: 1.2; }
.lbody .d-ex-head .prompt { font-size: clamp(19px, 2.2vw, 23px); }
.d-ex-head .shint { margin: var(--s-4) 0 0; }

.d-ex-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 36px; margin-bottom: var(--s-3); }
.d-ex-bar .chips:empty { display: none; }
.d-ex-tools { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.d-ex-bar .zoombtn { position: static; box-shadow: none; padding: 7px var(--s-4); min-height: 36px; }
.d-ex-stage .chartwrap, .d-ex-stage .lwrap { margin: 0; }

.d-ex-panel { grid-area: panel; min-width: 0; display: grid; gap: var(--s-4); align-content: start; padding: var(--s-5); border-radius: var(--r-card); background: var(--surface-card); border: 1px solid var(--rule); transition: border-color .3s, box-shadow .3s; }
.d-ex-label { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted); }
.lbody .d-ex-panel p.stepn, .lbody p.d-ex-label { margin: 0; font-size: 14px; line-height: 1.4; letter-spacing: 0; }
.lbody p.d-ex-meta { margin: 0 0 var(--s-2); }
.d-ex-panel .controls, .d-ex-panel .qopts { gap: var(--s-3); margin: 0; }
.d-ex-panel .opt, .d-ex-panel .nb { background: color-mix(in srgb, var(--panel2) 55%, transparent); }
.d-ex-panel .opt:not(:disabled):hover, .d-ex-panel .nb:not(:disabled):hover { background: var(--panel2); }
.d-ex-panel .skip { margin-top: var(--s-1); }
.d-ex-panel .stepctl { margin-top: 0; }
.d-ex-panel .other { margin-top: 0; justify-self: start; }
/* La corrección vive dentro del panel: sin tarjeta propia, separada por una línea. El panel se tiñe. */
.d-ex-panel .fb, .d-ex-panel .lfb { margin: 0; padding: var(--s-5) 0 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; box-shadow: none; }
.d-ex-panel .lfb:empty { display: none; }
.d-ex-panel:has(.fb.ok:not([hidden])), .d-ex-panel:has(.lfb.ok) {
  border-color: color-mix(in srgb, var(--good) 50%, var(--rule));
  box-shadow: 0 22px 48px -28px color-mix(in srgb, var(--good) 75%, transparent);
}
.d-ex-panel:has(.fb.bad:not([hidden])), .d-ex-panel:has(.lfb.bad) { border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.d-ex-panel .fb .next, .d-ex-panel .lfb .next { width: 100%; }

@media (min-width: 920px) {
  .d-ex { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "head head" "stage panel"; column-gap: var(--s-7); row-gap: var(--s-6); align-items: start; }
  .d-ex-steps { grid-template-areas: "stage panel"; }
  .d-ex-panel { position: sticky; top: 96px; }
  /* El panel empieza a la altura del gráfico, no de su barra */
  .d-ex-stage:has(.d-ex-bar:not([hidden])) + .d-ex-panel { margin-top: calc(36px + var(--s-3)); }
  /* En las lecciones el texto va en una columna de lectura; el gráfico y el panel se abren al ancho de la app
     y la cabecera del ejercicio sigue alineada con el título de la lección. */
  .lbody .d-ex {
    --exw: min(calc(var(--wrap) - 2 * var(--s-4)), calc(100vw - 2 * var(--s-7)));
    width: var(--exw); margin-left: calc((100% - var(--exw)) / 2);
  }
  .lbody .d-ex-head { padding-inline: calc((var(--exw) - 760px) / 2); }
}

/* ---------- Lecciones: el texto cuenta, las tarjetas destacan ----------
   Solo dos piezas son tarjeta: la regla clave (.keyrule) y «Por qué funciona así» (.box.why).
   El resto de bloques son texto con subtítulo y un punto de color que conserva el código de siempre:
   reconocer (azul), interpretar (violeta), aplicar (ámbar), analogía (gris), confusiones (rojo). */
.lbody .box.look, .lbody .box.read, .lbody .box.act, .lbody .box.ana, .lbody .box.not, .lbody .box.inst {
  margin: var(--s-7) 0 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; max-width: 64ch;
}
.lbody .box h4 { display: flex; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-3); font-size: 19px; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.lbody .box h4::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dot, var(--muted)); }
.lbody .box.look { --dot: var(--liq); }
.lbody .box.read { --dot: #c471ed; }
.lbody .box.act { --dot: var(--fvg); }
.lbody .box.not { --dot: var(--bad); }
.lbody .box.inst { --dot: var(--ink); }
.lbody .box p, .lbody .box .lx li { font-size: 17px; line-height: 1.7; }
.lbody .box.not .lx li::marker { color: var(--bad); }
.lbody .box.ana p { color: color-mix(in srgb, var(--ink) 82%, var(--muted)); }
.lbody > div > .box:first-child, .lbody > div > .keyrule:first-child { margin-top: 0; }
.lbody .keyrule { margin: var(--s-7) 0; max-width: 64ch; }
.lbody .lh { margin: 0 0 var(--s-5); margin-bottom: var(--s-6); }
/* «Por qué funciona así»: el destacado del razonamiento */
.lbody .box.why {
  margin: var(--s-7) 0; padding: var(--s-5); max-width: 64ch; font-size: inherit;
  border-radius: var(--r-card); border: 1px solid color-mix(in srgb, var(--good) 38%, var(--rule));
  background: linear-gradient(160deg, color-mix(in srgb, var(--good) 11%, var(--panel)), var(--panel) 70%);
  box-shadow: 0 22px 48px -30px color-mix(in srgb, var(--good) 70%, transparent);
}
.lbody .box.why h4::before { display: none; }
.lbody .box.why h4 { margin: 0 0 var(--s-3); background: var(--g-teal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lbody .box.why > :last-child, .lbody .box > :last-child { margin-bottom: 0; }
@media (min-width: 620px) { .lbody .box.why { padding: var(--s-6); } }

/* ---------- Simuladores: Entrenador de Setups y Rutina diaria a la mitad, el challenge a todo el ancho ---------- */
.d-sim.challenge { --t: 242 70 111; --g: linear-gradient(135deg, #ff7043 0%, #f2466f 55%, #c471ed 100%); grid-column: 1 / -1; }
.d-sim-main { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; flex: 1; }
.d-sim.big .d-sim-main { gap: var(--s-4); }
.d-sim-learn { list-style: none; margin: var(--s-1) 0 0; padding: 0; display: grid; gap: var(--s-2); }
.d-sim-learn li { display: flex; align-items: flex-start; gap: var(--s-2); font-size: 14.5px; }
.d-sim-learn .ph { width: 18px; height: 18px; margin-top: 2px; color: var(--good); }
.d-sim-more { border-radius: var(--r-row); background: rgb(var(--t) / .08); border: 1px solid rgb(var(--t) / .22); }
.d-sim-more summary { cursor: pointer; padding: var(--s-3) var(--s-4); font-size: 14px; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.d-sim-more .d-sim-steps { margin: 0; padding: 0 var(--s-4) var(--s-4); grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) {
  .d-sim.big { padding: var(--s-7); }
  .d-sim.big .d-sim-n { font-size: 30px; }
  .d-sim.challenge.big .d-sim-x { max-width: 72ch; }
}

/* ---------- Rutas de aprendizaje ---------- */
.d-cats { display: grid; gap: var(--s-8); margin-top: var(--s-6); }
.d-cat .d-help { margin: var(--s-2) 0 var(--s-5); max-width: 70ch; }
.d-cgrid { display: grid; gap: var(--s-4); }
@media (min-width: 640px) { .d-cgrid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .d-cgrid { gap: var(--s-5); } .d-cgrid.c3 { grid-template-columns: repeat(3, 1fr); } }
.d-course { --t: 139 60 247; --g: var(--g-violet); position: relative; display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-5);
  border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--surface-card); color: inherit; text-decoration: none; min-width: 0; }
.d-course-b { display: grid; gap: var(--s-2); min-width: 0; flex: 1; }
.d-course h3 { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.d-course-k { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-course-m { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-course-x { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.d-course .d-bbar { margin-top: var(--s-1); }
.d-course .d-bbar i { background: var(--g-brand); }
.d-mono { flex: none; width: 52px; height: 52px; border-radius: var(--r-chip); display: grid; place-items: center; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: #fff; background: var(--g); }
.d-course.soon { background: transparent; border-style: dashed; }
.d-course.soon .d-mono { background: var(--panel2); color: var(--muted); }
.d-course.soon h3 { color: var(--muted); }
.d-course.live { border-color: rgb(var(--t) / .35); background: radial-gradient(120% 90% at 100% 0%, rgb(var(--t) / .18), transparent 60%), var(--surface-card); box-shadow: 0 18px 40px -24px rgb(var(--t) / .6); }
/* La ruta activa del catálogo ocupa toda la fila y tiene su botón a la derecha */
.d-course.feat { grid-column: 1 / -1; flex-wrap: wrap; padding: var(--s-6); }
.d-course.feat h3 { font-size: 22px; font-weight: 400; }
.d-course.feat .d-sim-b { align-self: flex-end; }
@media (min-width: 760px) { .d-course.feat { flex-wrap: nowrap; align-items: center; } .d-course.feat .d-sim-b { align-self: center; flex: none; } .d-course.feat .d-course-b { max-width: 62ch; } }
.d-wiki { margin: var(--s-7) 0 0; padding: var(--s-4) var(--s-5); border-radius: var(--r-row); border: 1px dashed var(--rule); }
.d-crumb { display: inline-flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); font-size: 14px; color: var(--muted); text-decoration: none; }
.d-crumb::before { content: ""; width: 7px; height: 7px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.d-crumb:hover { color: var(--ink); }
#rutaIct .d-head .d-course-k { margin-bottom: var(--s-2); }

/* Cursos activos en Inicio */

/* Práctica: la ruta que se practica y los módulos agrupados por cinturón */
.d-routebar { display: flex; align-items: center; gap: var(--s-4); margin: 0 0 var(--s-6); padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--surface-card); --g: var(--g-violet); }
.d-routebar .d-mono { width: 44px; height: 44px; }
.d-routebar > div { display: grid; gap: 2px; flex: 1; min-width: 0; }
.d-routebar b { font-weight: 500; }
.d-routebar span { font-size: 13.5px; color: var(--muted); }
.d-routebar .link { font-size: 14px; white-space: nowrap; }
.d-mgroups { display: grid; gap: var(--s-7); margin-top: var(--s-5); }
.d-mgroup > header { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.d-mgroup > header h3 { margin: 0; font-size: 18px; font-weight: 500; }
.d-mgroup.locked .d-mods { opacity: .6; }

/* ---------- Cuenta: botón de la barra y páginas de registro, entrar y tu cuenta ---------- */
/* Sin sesión (body.d-guest) solo se ve la página de cuenta: nada de pestañas, XP ni botón de volver. */
.d-guest #back, .d-guest #xpPill, .d-guest #stPill, .d-guest #acctBtn, .d-guest .d-tabs, .d-guest .d-tabbar { display: none !important; }
.d-acct { display: inline-flex; align-items: center; gap: var(--s-2); border: 1px solid var(--rule); font: inherit; font-weight: 500; font-size: 13.5px; color: var(--ink); cursor: pointer; max-width: 180px; }
.d-acct .ph { width: 18px; height: 18px; color: #c471ed; }
.d-acct.on .ph { color: var(--good); }
.d-acct span { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 760px) { .d-acct span { display: inline; } }

.d-auth { width: min(100%, var(--wrap)); margin: 0 auto; padding: 0 var(--s-4) var(--s-8); }
.d-auth-grid { display: grid; gap: var(--s-6); align-items: start; }
.d-auth-one { display: grid; justify-items: center; padding-top: var(--s-5); }
.d-auth-one .d-auth-card { width: min(100%, 480px); }
.d-auth-pitch { display: grid; gap: var(--s-4); align-content: start; }
.d-auth-h { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 300; line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; text-wrap: balance; }
.d-auth-list { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: var(--s-4); }
.d-auth-list li { display: flex; gap: var(--s-3); align-items: flex-start; color: var(--muted); line-height: 1.55; font-size: 15px; }
.d-auth-list li b { color: var(--ink); font-weight: 500; }
.d-auth-list .ph { width: 22px; height: 22px; margin-top: 1px; color: #c471ed; }
.d-auth-pitch .d-fine { color: var(--muted); margin: 0; }
.d-auth-card { display: grid; gap: var(--s-4); padding: var(--s-5); }
.d-auth-t { margin: 0; font-size: 24px; font-weight: 400; letter-spacing: -.02em; }
.d-auth-p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 15px; }
.d-auth-p b { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.d-auth-alt { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: var(--s-1) var(--s-2); color: var(--muted); font-size: 14px; }
.d-auth-alt .link { color: var(--ink); font-weight: 500; }
.d-auth-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-row); background: var(--g-violet); color: #fff; }
.d-auth-icon .ph { width: 28px; height: 28px; }
@media (min-width: 900px) {
  .d-auth { padding-top: var(--s-5); }
  .d-auth-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: var(--s-8); }
  .d-auth-pitch { position: sticky; top: 96px; padding-top: var(--s-5); }
  .d-auth-card { padding: var(--s-6); }
}
@media (max-width: 899px) { .d-auth-pitch .d-auth-list, .d-auth-pitch .d-fine { display: none; } .d-auth-h { font-size: 28px; } }

.d-form { display: grid; gap: var(--s-4); }
.d-field { display: grid; gap: var(--s-2); }
.d-field label { font-size: 13.5px; color: var(--muted); }
.d-opt { color: var(--muted); opacity: .8; }
.d-form input, .d-form select { width: 100%; height: 50px; padding: 0 var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; }
.d-form select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 22px, calc(100% - 16px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: var(--s-7); }
.d-form input[readonly] { color: var(--muted); }
.d-form input:focus-visible, .d-form select:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.d-pass { position: relative; }
.d-pass input { padding-right: 56px; }
.d-eye { position: absolute; top: 3px; right: 3px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--r-chip); background: none; color: var(--muted); cursor: pointer; }
.d-eye:hover { color: var(--ink); }
.d-eye .ph { width: 20px; height: 20px; }
.d-forgot { justify-self: start; margin-top: calc(var(--s-2) * -1); }
.d-form .d-cta { margin-top: var(--s-1); }
.d-msg { margin: 0; }
.d-msg.ok { padding: var(--s-3) var(--s-4); border-radius: var(--r-row); background: color-mix(in srgb, var(--good) 12%, transparent); border: 1px solid color-mix(in srgb, var(--good) 40%, var(--rule)); color: var(--ink); font-size: 14px; line-height: 1.5; }
.d-vh { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden; clip: rect(0 0 0 0); border: 0 !important; }

.d-me { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-6); }
.d-me > div { min-width: 0; }
.d-avatar { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--g-violet); color: #fff; font-size: 26px; font-weight: 500; box-shadow: 0 12px 28px -12px rgba(123, 47, 247, .8); }
.d-me-mail { margin: var(--s-1) 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.d-me-grid { display: grid; gap: var(--s-4); }
.d-me-card { display: grid; gap: var(--s-3); align-content: start; }
.d-me-card .d-help { margin: 0 0 var(--s-2); }
.d-me-card .d-danger { justify-self: start; }
.d-me-card .d-acts { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .d-me-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
  .d-me-grid > :first-child { grid-row: span 2; }
  .d-me-card { padding: var(--s-6); }
}

.d-cta, .d-btn2 { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 52px; padding: 0 var(--s-5); border-radius: var(--r-row); font: inherit; font-weight: 600; cursor: pointer; }
.d-cta { border: 0; color: #fff; background: var(--g-violet); box-shadow: 0 12px 28px -12px rgba(123, 47, 247, .8); }
.d-cta:disabled, .d-btn2:disabled { opacity: .55; cursor: default; }
.d-cta.danger { background: var(--g-pink); box-shadow: 0 12px 28px -12px rgba(230, 36, 110, .7); }
.d-btn2 { border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font-weight: 500; }
.d-cta .ph, .d-btn2 .ph { width: 20px; height: 20px; }
.d-or { display: flex; align-items: center; gap: var(--s-3); margin: 0; color: var(--muted); font-size: 13px; }
.d-or::before, .d-or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.d-fine { font-size: 13px !important; line-height: 1.55 !important; }
.d-err { padding: var(--s-3) var(--s-4); border-radius: var(--r-row); background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--rule)); color: var(--ink) !important; font-size: 14px !important; line-height: 1.5; }
.d-sync { display: flex; align-items: center; gap: var(--s-2); margin: 0; color: var(--good) !important; font-size: 14px !important; }
.d-sync .ph { width: 18px; height: 18px; }
.d-acts { display: grid; gap: var(--s-2); }
@media (min-width: 460px) { .d-acts { grid-template-columns: 1fr 1fr; } }
.d-danger { color: var(--bad) !important; }

/* ---------- Cinturón marrón: tablas, veredictos, fichas de datos y constructor del plan ---------- */
.d-tw { overflow-x: auto; margin: var(--s-4) 0 var(--s-5); -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.d-lt { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.d-lt th { text-align: left; font-weight: 600; font-size: 13px; line-height: 1.35; color: var(--muted); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--rule); vertical-align: bottom; }
.d-lt td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 1.45; }
.d-lt td:first-child, .d-lt th:first-child { padding-left: 0; }
.d-lt.wide { min-width: 640px; }
@media (max-width: 640px) { .d-lt { font-size: 14px; } .d-lt th, .d-lt td { padding: 6px 8px; } }
.lbody p.note { font-size: 14px; color: var(--muted); }
.cmpi.v-ok { border-color: color-mix(in srgb, var(--good) 50%, var(--rule)); }
.cmpi.v-bad { border-color: color-mix(in srgb, var(--bad) 50%, var(--rule)); }
.d-verd { justify-self: start; font-size: var(--t-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); }
.v-ok .d-verd { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.v-bad .d-verd { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.d-seq { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 var(--s-2) !important; }
.d-seq i { font-style: normal; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; font-size: var(--t-xs); font-weight: 700; }
.d-seq i.w { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.d-seq i.l { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.d-pbar { display: flex; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-2) !important; }
.d-pbar span { flex: 1; height: 8px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.d-pbar i { display: block; height: 100%; border-radius: 999px; background: var(--g-violet); }
.d-pbar b { font-variant-numeric: tabular-nums; }
/* Fichas de datos de los ejercicios (práctica y lecciones) */
.card.d-dcard { align-content: start; gap: var(--s-3); min-height: 0; }
/* Ficha de datos debajo de un gráfico (ejercicios con gráfico y datos del diario) */
.card.d-dcard2, .lwrap + .d-dcard { margin-top: var(--s-4); padding: var(--s-5); }
.d-dcard .dc-t { margin: 0; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-dcard table { max-width: none; }
.d-dcard th { font-size: 14px; padding-right: var(--s-3); vertical-align: top; }
.d-dcard td { font-size: 16px; font-weight: 600; font-family: inherit; line-height: 1.4; }
.dc-quote { margin: 0; font-size: 19px; line-height: 1.5; font-weight: 500; }
.dc-note { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.dc-checks { list-style: none; padding: 0; margin: var(--s-2) 0; display: grid; gap: 6px; }
.dc-checks li { position: relative; padding-left: 18px; font-size: 14.5px; line-height: 1.5; }
.dc-checks li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.dc-checks li.no::before { background: var(--bad); }
.dc-checks li.no { color: var(--ink); font-weight: 500; }
.dc-days { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--s-2); }
.dc-days li { display: flex; justify-content: space-between; gap: var(--s-2); padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-chip); font-size: 14px; font-variant-numeric: tabular-nums; }
.dc-days li span { color: var(--muted); }
.dc-days li.neg b { color: var(--bad); }
.dc-days li.best { border-color: var(--accent); }
/* Constructor del plan (lección 11) */
.d-plan { display: grid; gap: var(--s-3); margin-top: var(--s-4); }
.d-plan-v { margin: 0; font-size: 13.5px; color: var(--muted); }
.d-plan-sec { border: 1px solid var(--rule); border-radius: var(--r-row); background: var(--panel); padding: 0 var(--s-4); }
.d-plan-sec summary { cursor: pointer; padding: var(--s-4) 0; font-weight: 600; }
.d-plan-f { display: grid; gap: var(--s-4); padding-bottom: var(--s-5); }
@media (min-width: 760px) { .d-plan-f { grid-template-columns: 1fr 1fr; } .d-plan-f .wide { grid-column: 1 / -1; } }
.d-plan .d-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.d-plan .d-field > label, .d-flab { margin: 0; font-size: 13.5px; color: var(--muted); }
.d-plan input[type=text], .d-plan input[type=time], .d-plan select, .d-plan textarea { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; }
.d-plan textarea { line-height: 1.5; resize: vertical; }
.d-plan input:focus-visible, .d-plan select:focus-visible, .d-plan textarea:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-plan-crit { padding-left: 22px; margin: 0; display: grid; gap: var(--s-2); }
.d-plan-crit li { display: grid; grid-template-columns: 1fr 150px; gap: var(--s-2); }
@media (max-width: 520px) { .d-plan-crit li { grid-template-columns: 1fr; } }
.d-plan-checks { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.d-plan-checks label { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; cursor: pointer; }
.d-plan-checks input { width: 18px; height: 18px; accent-color: #7b2ff7; }
.d-plan-warn { padding: var(--s-4); border-radius: var(--r-row); border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--rule)); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.d-plan-warn p { margin: 0; }
.d-plan-out, .d-plan-quote { padding: var(--s-5); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--panel); margin: var(--s-4) 0; }
.d-plan-out h3 { margin: 0 0 var(--s-3); font-size: 19px; }
.d-plan-out p, .d-plan-quote p { margin: 0 0 var(--s-2); font-size: 15.5px; line-height: 1.6; }
.d-plan-out p.sub { padding-left: var(--s-4); font-size: 14.5px; color: var(--muted); }
.d-plan-new { display: grid; gap: var(--s-2); }
.d-plan-new label { font-size: 13.5px; color: var(--muted); }
.d-plan-new input { box-sizing: border-box; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; }
.d-plan-msg { margin: 0; font-size: 14px; color: var(--muted); }
@media print {
  body.d-printing * { visibility: hidden !important; }
  body.d-printing #planOut, body.d-printing #planOut * { visibility: visible !important; color: #000 !important; }
  body.d-printing #planOut { position: absolute; inset: 0 auto auto 0; width: 100%; margin: 0; border: 0; background: #fff; }
}

/* ---------- Entrenador de Setups: niveles, origen de los gráficos, diario y resumen ---------- */
.d-cssrc { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin: 0 0 var(--s-4); }
.d-cssrc > span { font-size: 13.5px; color: var(--muted); }
.d-cssrc p { flex-basis: 100%; margin: 0; font-size: 13.5px; color: var(--muted); }
.d-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--rule); background: var(--panel); }
.d-seg button { min-height: 36px; padding: 0 var(--s-4); border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.d-seg button.on { background: color-mix(in srgb, #8b3cf7 22%, var(--panel2)); color: var(--ink); }
.d-seg button:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-cs-diary { margin: var(--s-5) 0 var(--s-6); }
.d-cs-diary .d-h { margin-top: 0; }
.d-cs-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); margin: var(--s-3) 0 var(--s-4); }
@media (min-width: 720px) { .d-cs-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.d-cs-kpis > div { display: grid; gap: 2px; padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); }
.d-cs-kpis b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.d-cs-kpis span { font-size: 13px; color: var(--muted); }
.pos { color: var(--good); } .neg { color: var(--bad); }
.d-cs-h { margin: var(--s-4) 0 var(--s-2); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-cs-last { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-cs-last li { display: grid; gap: 1px; min-width: 64px; padding: 6px 10px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel); font-size: 12.5px; text-align: center; }
.d-cs-last li b { font-size: 15px; font-weight: 600; }
.d-cs-last li.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); }
.d-cs-last li.no { border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.d-cs-weak { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.d-cs-weak li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); }
.d-cs-weak li > div:first-child { display: grid; gap: 2px; }
.d-cs-weak li span { font-size: 13.5px; color: var(--muted); }
.d-cs-wb { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.d-cs-wb .go { min-height: 40px; }
.d-cs-note { margin: var(--s-3) 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.d-cs-kpis3 { display: grid; gap: var(--s-3); margin: var(--s-4) 0 var(--s-5); }
@media (min-width: 560px) { .d-cs-kpis3 { grid-template-columns: 1fr 1fr; } .d-cs-kpis3 .d-cs-quad { grid-column: 1 / -1; } }
.d-cs-kpi { display: grid; gap: 2px; padding: var(--s-4) var(--s-5); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); }
.d-cs-kpi span { font-size: 13px; color: var(--muted); }
.d-cs-kpi b { font-size: 40px; font-weight: 300; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.d-cs-kpi em { font-style: normal; font-size: 13.5px; color: var(--muted); }
.d-cs-quad { padding: var(--s-4) var(--s-5); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); }
.d-cs-quad b { font-size: 17px; font-weight: 600; }
.d-cs-quad p { margin: var(--s-1) 0 0; font-size: 14.5px; line-height: 1.5; }
.d-cs-quad p.sub { color: var(--muted); font-size: 13.5px; }
.d-cs-quad.ok { border-color: color-mix(in srgb, var(--good) 50%, var(--rule)); } .d-cs-quad.ok b { color: var(--good); }
.d-cs-quad.warn { border-color: color-mix(in srgb, #f7a14a 55%, var(--rule)); } .d-cs-quad.warn b { color: #f7a14a; }
.d-cs-quad.bad { border-color: color-mix(in srgb, var(--bad) 50%, var(--rule)); } .d-cs-quad.bad b { color: var(--bad); }
.d-cs-check { margin: 0 0 var(--s-5); }
.d-cscrit { list-style: none; padding: 0; margin: var(--s-2) 0 var(--s-4); display: grid; gap: 6px; }
.d-cscrit li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; }
.d-cscrit li b { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12.5px; flex: none; }
.d-cscrit li.ok b { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.d-cscrit li.no b { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.d-cscrit li.na b { background: var(--panel2); color: var(--muted); }
.d-cscrit li em { font-style: normal; font-size: var(--t-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-left: 6px; }
.fb .d-cscrit { margin: var(--s-2) 0; }
.d-free-opts { display: grid; gap: var(--s-2); margin: var(--s-2) 0; }
.d-free-opts .opt.sel { border-color: #c471ed; box-shadow: inset 0 0 0 1px #c471ed; }

/* Rutina diaria: semana de preparación y diario */
.d-rt-week { margin-top: var(--s-4); padding: var(--s-4); border: 1px dashed var(--rule); border-radius: var(--r-row); display: grid; gap: var(--s-3); }
.d-rt-week p { margin: 0; font-size: 14px; line-height: 1.5; }
.d-rt-week button { justify-self: start; }
.d-cs-kpis3 .d-cs-kpi:nth-child(3):last-child { grid-column: 1 / -1; }

/* Figuras fijas de las lecciones (diagramas SVG con los colores del tema): fig() en app/gen23.js */
.d-fig { margin: var(--s-4) 0 var(--s-5); padding: var(--s-4); border-radius: 22px; background: var(--chartbg); border: 1px solid var(--rule); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .28); }
.d-fig svg { display: block; width: 100%; max-width: 620px; height: auto; margin: 0 auto; overflow: visible; }
.d-fig text { font-family: var(--body); }
.d-fig figcaption { margin-top: var(--s-3); font-size: 13px; color: var(--muted); text-align: center; line-height: 1.45; }
@media (max-width: 520px) { .d-fig { padding: var(--s-2); margin-left: calc(-1 * var(--s-2)); margin-right: calc(-1 * var(--s-2)); } }

/* ---------- Ruta MACD: página de la ruta, laboratorio y probador de reglas (app/macdlab.js) ---------- */
.d-course.mk { --t: 19 159 224; --g: var(--g-blue); }
.d-sim.mklab { --t: 19 159 224; --g: var(--g-blue); }
.d-sim.mktest { --t: 196 113 237; --g: var(--g-violet); }
.d-mk-find { margin: 0 0 var(--s-6); }
.d-mk-find .d-help { margin-bottom: var(--s-4); }
#mkRoute .d-belts { margin-top: var(--s-6); }
.d-mk-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.d-mk-t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.d-mk-t th, .d-mk-t td { padding: 10px 0 10px var(--s-4); text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.d-mk-t th:first-child { padding-left: 0; text-align: left; white-space: normal; min-width: 140px; font-weight: 500; }
.d-mk-t thead th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.d-mk-t tr.grp th { padding-top: var(--s-5); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.d-mk-t td.up { color: var(--good); font-weight: 600; }
.d-mk-t td.dn { color: var(--bad); font-weight: 600; }
.d-mk-notes { margin: var(--s-5) 0 0; padding-left: 1.1em; display: grid; gap: var(--s-2); font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.d-mk-notes b { color: var(--ink); font-weight: 500; }
.d-mk-fine { margin: var(--s-4) 0 0; max-width: 72ch; font-size: 13px; line-height: 1.5; color: var(--muted); }
.d-mk { max-width: 980px; margin: 0 auto; padding-bottom: 110px; }
.d-mk .d-crumb { padding: 0; border: 0; background: none; font: inherit; font-size: 14px; cursor: pointer; }
.d-mk .d-seg { flex-wrap: wrap; border-radius: 18px; }
.d-mk-warn { margin: var(--s-3) 0 0; max-width: 72ch; padding: var(--s-3) var(--s-4); border-radius: var(--r-row); font-size: 14px; line-height: 1.5;
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.d-mk-ctr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-4); margin: var(--s-5) 0 var(--s-4); }
.d-mk-ctr.col { flex-direction: column; align-items: stretch; max-width: 720px; }
.d-mk-field { display: grid; gap: var(--s-2); min-width: 0; justify-items: start; }
.d-mk-lab { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.d-mk-sel { width: 100%; max-width: 480px; height: 48px; padding: 0 var(--s-7) 0 var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); color: var(--ink); font: inherit; font-size: 16px; appearance: none;
  background: var(--panel2) no-repeat; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 21px, calc(100% - 16px) 21px; background-size: 6px 6px; }
.d-mk-sel:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-mk-rule { margin: 0; max-width: 64ch; padding: var(--s-3) var(--s-4); border-left: 3px solid #8b3cf7; border-radius: 0 var(--r-row) var(--r-row) 0; background: color-mix(in srgb, #8b3cf7 8%, transparent); font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.d-mk-sl { display: grid; gap: var(--s-3); margin: 0 0 var(--s-3); }
@media (min-width: 700px) { .d-mk-sl { grid-template-columns: repeat(3, 1fr); gap: var(--s-4); } }
.d-mk-range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s-1) var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--surface-card); }
.d-mk-range span { font-size: 14px; color: var(--muted); }
.d-mk-range output { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.d-mk-range input { grid-column: 1 / -1; width: 100%; min-height: 28px; accent-color: #8b3cf7; }
.d-mk-reset { margin-bottom: var(--s-4); }
.d-mk-stage { min-height: 200px; overflow: hidden; border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--chartbg); }
.d-mk-cv { display: block; width: 100%; height: clamp(380px, 64svh, 620px); }
.d-mk-wait { margin: 0; padding: var(--s-6) var(--s-5); font-size: 15px; color: var(--muted); }
.d-mk-res > .d-mk-wait { padding-left: 0; }
.d-mk-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3); margin: var(--s-4) 0; }
.d-mk-kpis > div { display: grid; align-content: start; gap: var(--s-1); padding: var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--surface-card); }
.d-mk-kpis b { font-size: 22px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.d-mk-kpis.big b { font-size: 26px; }
.d-mk-kpis span { font-size: 13px; line-height: 1.4; color: var(--muted); }
.d-mk-why { grid-column: 1 / -1; margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.d-mk-verdict { margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); font-size: 15px; line-height: 1.5; }
.d-mk-verdict.ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.d-mk-verdict.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.d-mk-verdict.mid { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.d-mk-res .d-h { margin: var(--s-6) 0 var(--s-2); }
.d-mk-res .d-help { margin-bottom: var(--s-3); }
.d-mk-curve { display: block; width: 100%; height: 190px; border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--chartbg); }
.d-mk-curve polyline { fill: none; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.d-mk-curve polyline.up { stroke: var(--good); }
.d-mk-curve polyline.dn { stroke: var(--bad); }
.d-mk-curve .z { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .6; vector-effect: non-scaling-stroke; }
.d-mk-axis { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); justify-content: space-between; margin-top: var(--s-1); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-mk-two { display: grid; gap: 0 var(--s-6); }
@media (min-width: 860px) { .d-mk-two { grid-template-columns: 1fr 1fr; } }
.d-mk-ex { margin-top: var(--s-6); }
.d-mk-ex .d-h { margin-top: 0; }
.d-mk-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-3) 0; }
.d-mk-btns button.on { outline: 2px solid #8b3cf7; outline-offset: 1px; }
.d-mk-exout p { max-width: 72ch; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.d-mk-exout p b { color: var(--ink); font-weight: 500; }
@media (max-width: 600px) {
  .d-mk-t { font-size: 12.5px; }
  .d-mk-t thead th { font-size: var(--t-xs); letter-spacing: .02em; white-space: normal; vertical-align: bottom; }
  .d-mk-t th:first-child { min-width: 92px; }
  .d-mk-sel { font-size: 15px; }
}
.d-mk-t th small { display: none; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
@media (max-width: 600px) {
  .d-mk-t .tfc { display: none; }
  .d-mk-t th small { display: block; }
  .d-mk-ex .d-mk-t th:first-child { min-width: 78px; }
}
@media (max-width: 600px) { .d-mk-t th:first-child, .d-mk-ex .d-mk-t th:first-child { min-width: 70px; } .d-mk-t th, .d-mk-t td { padding-left: 8px; } }
@media (max-width: 600px) { .d-mk-t .pm { display: block; font-size: var(--t-xs); font-weight: 500; opacity: .8; } }
/* Gráficos con panel de oscilador (ruta MACD): más altos, para que el precio no quede aplastado */
#cv.osc, .lcv.osc { height: clamp(360px, 62svh, 580px); }
.lcv.sm.osc { height: 320px; }
/* Herramientas de la ruta MACD dentro de las lecciones y simulador de reglas */
.d-mk-embed { display: grid; gap: var(--s-4); margin: var(--s-5) 0; }
.d-mk-embed > .d-mk-ctr { margin: 0; }
.d-mk-sub { margin: var(--s-4) 0 var(--s-2); font-size: 15px; font-weight: 500; }
.d-mk-num, .d-mk-in { box-sizing: border-box; width: 100%; max-width: 480px; min-height: 44px; padding: 8px 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; }
.d-mk-num { max-width: 140px; }
.d-mk-num:focus-visible, .d-mk-in:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-mk-plan .d-mk-field { justify-items: stretch; }
.d-mk-simside { display: grid; gap: var(--s-3); }
.d-mk-simside .d-mk-lab { margin: 0; }
.d-mk-note { margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-row); background: color-mix(in srgb, var(--liq) 12%, transparent); font-size: 14px; }
.d-mk-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.d-mk-checks li { display: flex; align-items: flex-start; gap: var(--s-2); font-size: 14.5px; color: var(--muted); }
.d-mk-checks li .ph { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.d-mk-checks li.ok { color: var(--ink); }
.d-mk-checks li.ok .ph { color: var(--good); }
.d-mk-pract { margin: var(--s-6) 0; }
.d-mk-pract .d-mods { margin: var(--s-4) 0; }
#rutaMacd .d-head .d-course-k { margin-bottom: var(--s-2); }

/* ---------- Índice de secciones de la página de una ruta (routeToc en app/shell.js) ----------
   Móvil y tableta: fila de secciones deslizable, fija bajo la cabecera. Escritorio: columna fija a la izquierda. */
.d-rtoc { position: sticky; top: var(--barh, 61px); z-index: 5; margin: 0 calc(-1 * var(--s-4)) var(--s-5); padding: var(--s-2) var(--s-4);
  background: var(--bg); border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.d-rtoc::-webkit-scrollbar { display: none; }
.d-rtoc-t { display: none; }
.d-rtoc ol { display: flex; gap: var(--s-2); list-style: none; margin: 0; padding: 0; }
.d-rtoc ol ol { display: none; }
.d-rtoc button { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: 0 var(--s-4); border-radius: 999px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.d-rtoc button.on { color: var(--ink); border-color: transparent; background: color-mix(in srgb, #8b3cf7 24%, var(--panel2)); }
.d-rtoc button:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-rtoc em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; display: inline-flex; }
.d-rtoc em .ph { width: 14px; height: 14px; }
.d-toc-target { scroll-margin-top: calc(var(--barh, 61px) + 72px); }
.d-toc-target:focus { outline: none; }
@media (min-width: 1024px) {
  .d-rlayout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: var(--s-7); align-items: start; }
  .d-rtoc { top: calc(var(--barh, 64px) + var(--s-5)); margin: 0; padding: 0 0 0 var(--s-1); background: none; border: 0; overflow: visible; max-height: calc(100dvh - var(--barh, 64px) - 48px); overflow-y: auto; }
  .d-rtoc-t { display: block; margin: 0 0 var(--s-3); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .d-rtoc ol { display: grid; gap: 2px; border-left: 1px solid var(--rule); }
  .d-rtoc ol ol { display: grid; border-left: 0; margin: 0 0 var(--s-2) var(--s-3); }
  .d-rtoc button { width: 100%; justify-content: space-between; min-height: 34px; margin-left: -1px; padding: 0 var(--s-2) 0 var(--s-3); border: 0; border-left: 2px solid transparent;
    border-radius: 0 var(--r-chip) var(--r-chip) 0; background: none; font-size: 14px; text-align: left; white-space: normal; }
  .d-rtoc ol ol button { font-size: 13px; font-weight: 400; min-height: 30px; }
  .d-rtoc button:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, transparent); }
  .d-rtoc button.on { border-left-color: #c471ed; background: color-mix(in srgb, #8b3cf7 12%, transparent); }
  .d-toc-target { scroll-margin-top: calc(var(--barh, 64px) + 24px); }
  .d-rmain .d-belts { grid-template-columns: 1fr 1fr; }
}
}

@layer componentes {
/* ---------- Lista de opciones: variante automática (tOptKind) y sin atajos de teclado en pantallas táctiles ---------- */
.d-opts { display: grid; gap: var(--s-2); }
.d-ex-panel .d-opts.qopts, .d-onb .d-opts.qopts { gap: var(--s-3); }
.d-opts .opt { min-height: 52px; }
.d-opts.seg { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.d-opts.grid { grid-template-columns: 1fr 1fr; }
.d-opts.seg .opt, .d-opts.grid .opt { justify-content: center; text-align: center; padding: 10px 8px; }
.d-opts.seg .opt kbd, .d-opts.grid .opt kbd { display: none; }
@media (hover: none), (pointer: coarse) { .opt kbd { display: none; } }

/* ---------- Táctil: respuesta visible al tocar y sin efectos que dependen del ratón ---------- */
.opt:active:not(:disabled), .go:active:not(:disabled), .confirm:active:not(:disabled), .nb:active:not(:disabled), .next:active, .tfb:active:not(:disabled) { transform: scale(.98); }
@media (hover: none) { .opt:hover:not(:disabled) { transform: none; } }
.nb.d-nudge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.nb.d-nudge span { font-size: 13.5px; font-weight: 500; }

/* ---------- Señales de acierto y fallo (tSignal en app/ui.js): un pulso breve del veredicto ---------- */
@keyframes d-pop { 0% { transform: scale(.92); } 60% { transform: scale(1.05); } 100% { transform: none; } }
@keyframes d-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.d-pulse-ok { transform-origin: left center; animation: d-pop .32s ease-out; }
.d-pulse-bad { animation: d-shake .3s ease-in-out; }
.opt.wrong { animation: d-shake .3s ease-in-out; }
@media (prefers-reduced-motion: reduce) { .d-pulse-ok, .d-pulse-bad, .opt.wrong { animation: none; } }

/* ---------- Avisos arriba, bajo la cabecera, sin tapar las respuestas ---------- */
.toast { top: calc(72px + env(safe-area-inset-top, 0px)); bottom: auto; pointer-events: none; }
/* ---------- Componentes de las páginas índice (tContinue, tRow, tAcc, tStats en app/ui.js) ---------- */
/* «Continuar»: la próxima acción, siempre la primera tarjeta de la página */
.d-tcont { display: grid; gap: var(--s-2); padding: var(--s-5); border-radius: var(--r-card); border: 1px solid rgb(139 60 247 / .35);
  background: radial-gradient(120% 90% at 100% 0%, rgb(139 60 247 / .22), transparent 60%), var(--surface-card); box-shadow: 0 18px 40px -24px rgb(139 60 247 / .7); }
.d-tcont-k { margin: 0; font-size: var(--t-xs); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-tcont-t { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.25; letter-spacing: -.01em; }
.d-tcont-m { margin: 0; color: var(--muted); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.d-tcont .d-bbar { margin-top: var(--s-1); }
.d-tcont .d-bbar i { background: var(--g-brand); }
.d-tcont-b { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-3); min-height: var(--h-control); padding: 0 var(--s-5); }
.d-tcont-b .ph { width: 20px; height: 20px; }
/* Fila: icono, título, detalle de una línea, dato y chevron; toda la fila se toca */
.d-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
.d-trow { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 60px; padding: var(--s-3) var(--s-4); border: 1px solid var(--rule);
  border-radius: var(--r-row); background: var(--surface-card); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: border-color .2s, transform .15s; }
.d-trow:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 28%, var(--rule)); }
.d-trow:active:not(:disabled) { transform: scale(.99); }
.d-trow:disabled { cursor: default; opacity: .55; }
.d-trow-i { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-chip); background: var(--panel2); color: var(--ink); }
.d-trow-i .ph { width: 20px; height: 20px; }
.d-trow-i:empty { display: none; }
.d-trow-b { flex: 1; min-width: 0; display: grid; gap: 2px; }
.d-trow-t { font-weight: 500; line-height: 1.3; }
.d-trow-m { color: var(--muted); font-size: var(--t-sm); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-trow-e { flex: none; color: var(--muted); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.d-trow-c { flex: none; display: grid; color: var(--muted); }
.d-trow-c .ph { width: 18px; height: 18px; }
.d-mono.sm { --g: var(--g-violet); width: 46px; height: 36px; font-size: var(--t-xs); }
.d-mono.sm.mk { --g: var(--g-blue); }
.d-trow-i:has(.d-mono) { width: auto; background: none; }
/* Acordeón: abierto solo el que importa ahora */
.d-tacc { border: 1px solid var(--rule); border-radius: var(--r-row); background: var(--surface-card); }
.d-tacc > summary { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: var(--s-3) var(--s-4); cursor: pointer; list-style: none; border-radius: inherit; }
.d-tacc > summary::-webkit-details-marker { display: none; }
.d-tacc-h { flex: 1; min-width: 0; display: grid; gap: 2px; }
.d-tacc-t { font-weight: 500; }
.d-tacc-m { color: var(--muted); font-size: var(--t-sm); }
.d-tacc-c { flex: none; display: grid; color: var(--muted); transition: transform .2s; }
.d-tacc-c .ph { width: 18px; height: 18px; }
.d-tacc[open] > summary .d-tacc-c { transform: rotate(180deg); }
.d-tacc-b { padding: 0 var(--s-4) var(--s-4); }
/* El contenido de <details> cuelga de un slot interno que no hereda box-sizing: se fija aquí */
.d-tacc > summary, .d-tacc-b, details > :not(summary) { box-sizing: border-box; }
/* Cifras: número grande y rótulo, 3 por fila como mucho */
.d-tstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.d-tstats div { display: grid; gap: var(--s-1); }
.d-tstats b { font-size: 26px; font-weight: 300; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.d-tstats span { color: var(--muted); font-size: var(--t-xs); }
/* Estado vacío: una línea y la acción que lo llena. El panel que lo contiene deja de ser tarjeta (d-isempty). */
.d-panel.d-isempty { padding: 0; border: 0; background: none; box-shadow: none; }
.d-panel.d-isempty > .d-h { margin-bottom: var(--s-2); }
.d-empty .link { padding: 0; margin-left: var(--s-1); color: var(--ink); font-size: inherit; }
}

@layer regiones {
/* ---------- Cabecera de foco: en una tarea sobran marca, pestañas, XP, racha y cuenta ---------- */
.d-fbar { display: flex; align-items: center; flex: 1; min-width: 0; }
.d-fbar[hidden] { display: none; }
.d-fbar-l { font-size: 14.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.d-fbar-p { position: absolute; left: 0; right: 0; bottom: -1px; height: 4px; display: flex; gap: 3px; padding-inline: max(var(--s-4), calc((100% - var(--wrap)) / 2 + var(--s-4))); }
.d-fbar-p[hidden] { display: none; }
.d-fbar-p i { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.d-fbar-p b { display: block; height: 100%; background: var(--g-brand); transform-origin: left; transition: transform .35s ease; }
#back .d-ic-x { display: none; }
body.d-focusing #back .d-ic-back { display: none; }
body.d-focusing #back .d-ic-x { display: block; }
body.d-focusing .bar .brand, body.d-focusing .bar .spacer, body.d-focusing #xpPill, body.d-focusing #stPill, body.d-focusing #acctBtn { display: none !important; }
body.d-focusing .bar { position: sticky; }
body.d-focusing #back { width: var(--h-touch); height: var(--h-touch); }
body.d-focusing main { padding-top: var(--s-5); }
/* El progreso ya está en la cabecera: fuera las barras y contadores de cada pantalla */
body.d-focusing .lesson .ltrack, body.d-focusing #lCount, body.d-focusing #stepper, body.d-focusing .d-onb-dots, body.d-focusing .d-onb-k, body.d-focusing #place .qtrack { display: none !important; }
body.d-focusing .lesson .lhead { margin-bottom: var(--s-2); }
body.d-focusing #lUnit { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- Barra de acción: «Anterior» como icono y la acción principal ocupando el resto ---------- */
.lnav.d-action .in { display: flex; align-items: center; gap: var(--s-3); }
.lnav .d-action-prev { flex: none; width: 56px; min-height: var(--h-control); padding: 0; display: grid; place-items: center; }
.lnav .d-action-prev svg { width: 20px; height: 20px; }
.lnav.d-action .confirm { flex: 1; min-height: var(--h-control); }
.lnav .confirm[hidden] { display: none; }
.d-action-lock { flex: 1; margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.d-action-lock[hidden] { display: none; }
/* La lección es una pantalla de app: fija entre la cabecera y el borde inferior, con su propio scroll, y la barra de
   navegación es la última pieza de esa pantalla (sticky dentro de ella). La página no se desplaza, así que el navegador
   del móvil no esconde ni recoloca su barra de direcciones y no puede dejar la barra desfasada (con «fixed» y con
   «sticky» sobre la página sí pasaba). --lesson-top es el borde inferior de la cabecera (lesson.js, lessonTop). */
#lesson:not([hidden]) { --lpad: max(var(--s-4), calc((100vw - 760px) / 2));
  position: fixed; top: var(--lesson-top, 64px); left: 0; right: 0; bottom: 0; z-index: 5; max-width: none; margin: 0;
  padding: var(--s-5) var(--lpad) 0; display: flex; flex-direction: column;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
#lesson:focus { outline: none; }
#lesson .lbody { flex: 1 0 auto; padding-bottom: var(--s-8); }
#lesson .lhint { position: sticky; bottom: calc(var(--bar-bottom) + var(--s-3) + env(safe-area-inset-bottom, 0px)); margin-top: auto; }
#lesson .lnav { position: sticky; bottom: 0; left: auto; right: auto; margin: auto calc(-1 * var(--lpad)) 0; }
#lesson .lhint:not([hidden]) + .lnav { margin-top: 0; }
/* Dentro de la lección, lo «sticky» se mide desde su borde superior (ya está bajo la cabecera). */
#lesson .d-ex-panel { top: var(--s-4); }
html:has(#lesson:not([hidden])), html:has(#lesson:not([hidden])) body { overflow: hidden; overscroll-behavior: none; }
}

@layer plantillas {
/* ---------- Replay a ciegas y laboratorio (app/replay.js) ---------- */
.d-rp { max-width: 960px; margin: 0 auto; }
.d-rp-head { margin-bottom: var(--s-4); }
.d-rp-k { margin: 0 0 var(--s-1); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-rp-t { margin: 0; font-size: clamp(20px, 3vw, 26px); line-height: 1.25; }
.d-rp-x { margin: var(--s-2) 0 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.5; }
.d-rp-chart { margin: 0 0 var(--s-4); }
.d-rp-cv { height: min(56svh, 460px); touch-action: none; cursor: crosshair; }
.d-rp-panel { display: grid; gap: var(--s-3); }
.d-rp-q { margin: 0; font-weight: 600; }
.d-rp-h, .d-rp-m, .d-rp-sum, .d-rp-note { margin: 0; font-size: var(--t-sm); color: var(--muted); line-height: 1.5; }
.d-rp-h b { color: var(--ink); }
.d-rp-err { color: var(--bad); }
.d-seg.d-rp-side, .d-seg.d-rp-mkt, .d-rp-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-rp-side button, .d-rp-mkt button, .d-rp-tags button { flex: 1 1 auto; min-height: var(--h-touch); padding: 0 var(--s-4); border-radius: var(--r-pill, 999px); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; }
.d-rp-side button[aria-pressed="true"], .d-rp-mkt button[aria-pressed="true"], .d-rp-tags button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--panel)); }
.d-rp-lv { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--s-2); }
.d-rp-lv button { display: grid; gap: 2px; padding: var(--s-2) var(--s-3); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.d-rp-lv button[aria-pressed="true"] { border-color: var(--accent); }
.d-rp-lv small { font-size: var(--t-xs); color: var(--muted); }
.d-rp-lv b { font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.d-rp-help { display: flex; gap: var(--s-2); align-items: center; font-size: var(--t-sm); color: var(--muted); }
.d-rp-cta { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-rp-cta > button { flex: 1 1 160px; min-height: var(--h-control); }
.d-rp-res { padding: var(--s-4) var(--s-5); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--panel); }
.d-rp-res.ok { border-color: color-mix(in srgb, var(--good) 50%, var(--rule)); }
.d-rp-res.bad { border-color: color-mix(in srgb, var(--bad) 50%, var(--rule)); }
.d-rp-res p { margin: 0 0 var(--s-2); line-height: 1.55; }
.d-rp-rk { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.d-rp-when { font-size: var(--t-sm); color: var(--muted); }
.d-rp-stats summary { cursor: pointer; font-weight: 600; min-height: var(--h-touch); display: flex; align-items: center; }
.d-rp-tbl { width: 100%; border-collapse: collapse; margin-top: var(--s-3); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.d-rp-tbl th, .d-rp-tbl td { padding: var(--s-2); border-bottom: 1px solid var(--rule); text-align: left; }
/* ---------- Misiones de la semana (Inicio) ---------- */
.d-mis { margin-top: var(--s-5); padding: var(--s-4) var(--s-5); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--panel); }
.d-mis-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.d-mis-top .d-h3 { margin: 0; font-size: 17px; }
.d-mis-n { font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.d-mis-l { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: var(--s-3); }
.d-mis-l li { display: flex; align-items: center; gap: var(--s-3); }
.d-mis-l li > div { flex: 1; min-width: 0; }
.d-mis-l p { margin: 0 0 var(--s-1); display: flex; gap: var(--s-2); align-items: center; font-size: var(--t-sm); }
.d-mis-l li.ok p { color: var(--good); }
.d-mis-l small { font-size: var(--t-xs); color: var(--muted); }
.d-mis-go { flex: none; min-height: var(--h-touch); padding: 0 var(--s-3); font-size: var(--t-sm); }
.d-mis-note { margin: var(--s-3) 0 0; font-size: var(--t-xs); color: var(--muted); }

/* ---------- Reto del día, tablas de posiciones, grupos y patrocinio (app/social.js) ---------- */
.d-reto-row { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-2); }
.d-reto-row p { flex: 1; min-width: 0; margin: 0; font-size: var(--t-sm); color: var(--muted); line-height: 1.5; }
.d-retotab, .d-grp { margin-top: var(--s-5); padding: var(--s-4) var(--s-5); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--panel); display: grid; gap: var(--s-3); }
.d-retotab .d-idx-sechead, .d-grp .d-idx-sechead { margin: 0; }
.d-lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.d-lb li { display: flex; align-items: center; gap: var(--s-3); min-height: 40px; padding: 0 var(--s-2); border-radius: var(--r-chip); font-size: var(--t-sm); }
.d-lb li:nth-child(odd) { background: var(--panel2); }
.d-lb li.yo { outline: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.d-lb-p { width: 2.2em; flex: none; color: var(--muted); text-align: right; }
.d-lb-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-lb-d { flex: none; font-size: var(--t-xs); color: var(--muted); }
.d-lb b { flex: none; min-width: 5.5em; text-align: right; }
.d-grp-row { display: flex; gap: var(--s-2); }
.d-grp-in { flex: 1; min-width: 0; box-sizing: border-box; min-height: var(--h-touch); padding: 8px 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; }
.d-grp-row .go { flex: none; min-height: var(--h-touch); padding: 0 var(--s-4); }
.d-grp-l { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.d-grp-l li { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); }
.d-grp-l li > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.d-grp-l small { font-size: var(--t-xs); color: var(--muted); }
.d-grp-l code { font-size: var(--t-sm); letter-spacing: .08em; color: var(--ink); }
.d-grp-l .go { min-height: var(--h-touch); padding: 0 var(--s-3); }
.d-retotab > *, .d-grp > *, .d-grp-v > * { min-width: 0; }
.d-grp-v .d-retotab { margin-top: var(--s-4); padding: 0; border: 0; background: none; }
.d-grp-v .d-rp-tbl th { white-space: nowrap; }
.d-grp-v .link { margin-top: var(--s-3); }
.d-grp-v h4 { margin: var(--s-3) 0 0; font-size: 17px; }
.d-grp-v tr.yo td { color: var(--ink); font-weight: 600; }
.d-patro { margin-top: var(--s-5); padding: var(--s-3) var(--s-4); border-radius: var(--r-card); border: 1px dashed var(--rule); background: var(--panel); display: grid; gap: var(--s-1); }
.d-patro p { margin: 0; }
.d-patro-k { font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.d-patro-t { font-weight: 600; }
.d-patro-x { font-size: var(--t-sm); color: var(--muted); }
.d-patro-a { justify-self: start; font-size: var(--t-sm); }
@media (max-width: 520px) { .d-grp-row { flex-direction: column; } .d-lb-d, .d-grp-opt { display: none; } }

/* ---------- Glosario (app/glosario.js): términos enlazados en la teoría, ventanita y pantalla ---------- */
.d-term { display: inline; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.d-term:hover { color: var(--ink); text-decoration-style: solid; }
.d-gpop { position: fixed; z-index: 60; width: min(360px, calc(100vw - 24px)); padding: var(--s-4); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--panel); box-shadow: 0 12px 40px rgba(0, 0, 0, .45); }
.d-gpop p { margin: 0 0 var(--s-2); line-height: 1.5; }
.d-gpop-k { font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-gpop-t { font-weight: 600; font-size: 17px; }
.d-gpop-d { font-size: var(--t-sm); }
.d-gpop-l { font-size: var(--t-xs); color: var(--muted); }
.d-gpop-b { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-2); }
.d-gpop-b .go { min-height: var(--h-touch); padding: 0 var(--s-4); }
@media (max-width: 639px) { .d-gpop { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; } }
.d-glos { max-width: 820px; margin: 0 auto; }
.d-glos-head { margin-bottom: var(--s-4); }
.d-glos-n { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.d-glos-l { display: grid; gap: var(--s-3); }
.d-glos-i { padding: var(--s-4) var(--s-5); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--panel); scroll-margin-top: 96px; }
.d-glos-i.on { border-color: var(--accent); }
.d-glos-i h3 { margin: 0 0 var(--s-1); font-size: 17px; }
.d-glos-i p { margin: 0 0 var(--s-2); line-height: 1.55; }
.d-glos-a { font-size: var(--t-xs); color: var(--muted); }
.d-glos-d { font-size: var(--t-sm); }
.d-glos-b .link { font-size: var(--t-sm); }
/* Portada de la lección: repaso de 5 minutos y resumen para imprimir; pasos: reproducir */
.d-pre-tools { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-3) 0; }
.d-pre-tools .go { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--h-touch); padding: 0 var(--s-4); }
.d-steps-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-2); }
.d-steps-play { display: inline-flex; align-items: center; gap: var(--s-1); }
.d-rep-kr li { margin: var(--s-2) 0; }

/* ---------- Lecciones: «¿Algo no está claro?», «Márcalo tú» y «¿Qué esperas?», refuerzo en Inicio ---------- */
.d-duda { margin-top: var(--s-6); padding-top: var(--s-3); border-top: 1px solid var(--rule); }
.d-duda-b { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); }
.d-duda-ok { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.d-duda-l { display: grid; gap: var(--s-2); font-size: var(--t-sm); color: var(--muted); }
.d-duda-l textarea { box-sizing: border-box; width: 100%; min-height: 84px; padding: 10px 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; resize: vertical; }
.d-duda-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-2); }
.d-duda-row .go { min-height: var(--h-touch); padding: 0 var(--s-5); }
.d-stepq-k { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-1); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.d-stepq .qopts { margin-top: var(--s-2); }
.d-stepq .next { margin-top: var(--s-3); }
.d-ref .d-rows { margin-top: var(--s-3); }
.d-adm-q { margin: var(--s-1) 0 0; padding-left: 18px; font-size: var(--t-xs); color: var(--muted); }

/* ---------- Práctica: dificultad de cuatro niveles, detective, mapa de habilidades y celebraciones (app/practica.js) ---------- */
.d-tfs4 { flex-wrap: wrap; }
.chip.exp { color: var(--ink); background: color-mix(in srgb, var(--bad) 22%, var(--panel2)); }
.d-det-why { margin: var(--s-2) 0; padding-left: 18px; font-size: var(--t-sm); color: var(--muted); }
.d-det-why li { margin: var(--s-1) 0; }
.d-skmap { display: grid; gap: var(--s-4); }
.d-skmap > .d-help, .d-skmap > .d-sk-leg { margin: 0; }
.d-skm-h { margin: 0 0 var(--s-2); font-size: var(--t-sm); font-weight: 600; }
.d-skm-l { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-sk { display: grid; gap: 2px; min-height: var(--h-touch); padding: 6px 10px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.d-sk span { font-size: var(--t-sm); }
.d-sk small { font-size: var(--t-xs); color: var(--muted); }
.d-sk-new { opacity: .7; }
.d-sk-learn { border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.d-sk-solid { border-color: color-mix(in srgb, #ffd48a 60%, var(--rule)); }
.d-sk-master { border-color: color-mix(in srgb, var(--good) 65%, var(--rule)); background: color-mix(in srgb, var(--good) 10%, var(--panel2)); }
.d-sk-expert { border-color: #c471ed; background: color-mix(in srgb, #c471ed 16%, var(--panel2)); }
.d-sk-leg { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: 0; font-size: var(--t-xs); color: var(--muted); }
.d-sk-leg span { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; opacity: 1; }
.d-sk-leg i { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--rule); }
.d-sk-leg .d-sk-learn i { border-color: var(--bad); } .d-sk-leg .d-sk-solid i { border-color: #ffd48a; } .d-sk-leg .d-sk-master i { border-color: var(--good); } .d-sk-leg .d-sk-expert i { border-color: #c471ed; background: #c471ed; }
.d-burst { position: fixed; left: 50%; top: 42%; width: 0; height: 0; pointer-events: none; z-index: 80; }
.d-burst i { position: absolute; left: 0; top: 0; width: 7px; height: 7px; border-radius: 2px; animation: dburst .95s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes dburst { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(200deg) scale(.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .d-burst { display: none; } }

/* ---------- Ejemplo real (tarjeta real de las lecciones): velas reales, primero sin marcas ---------- */
.d-real { margin: var(--s-5) 0; }
.d-real-when { margin: 0 0 var(--s-2) !important; font-size: var(--t-sm) !important; color: var(--muted); line-height: 1.45 !important; }
.d-real-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-3); }
.d-real-bar .d-real-tog { min-height: var(--h-touch); padding: 0 var(--s-4); }
.d-real-note { margin: var(--s-3) 0 0 !important; font-size: var(--t-xs) !important; color: var(--muted); line-height: 1.5 !important; }

/* ---------- Pasos guiados: un solo botón de avance (el de la barra) y el texto del paso antes del gráfico ---------- */
.lbody .d-ex-steps .stepctl { display: none; }
@media (max-width: 919px) {
  .d-ex-steps { grid-template-areas: "panel" "stage"; gap: var(--s-4); }
  .d-ex-steps .d-ex-panel .stept { min-height: 4.4em; }
}

/* ---------- Gráfico en el móvil: pregunta, gráfico y respuestas caben en una pantalla ---------- */
@media (max-width: 919px) {
  #cv:not(.osc) { height: clamp(220px, 40svh, 400px); }
  .lcv:not(.sm):not(.osc) { height: clamp(210px, 38svh, 380px); }
  .d-ex { gap: var(--s-4); }
  .d-ex-head .prompt { font-size: 20px; }
  .lbody .d-ex-head .prompt { font-size: 19px; }
  /* Sin tarjeta alrededor de las respuestas: las opciones van directamente sobre el fondo */
  .d-ex-panel { padding: 0; background: none; border: 0; box-shadow: none !important; }
  .d-ex-panel .opt, .d-ex-panel .nb { background: var(--panel); }
}

/* ---------- Hoja inferior: la corrección sube desde abajo y el gráfico sigue a la vista ---------- */
@keyframes d-sheet-in { from { transform: translateY(28px); opacity: .5; } }
@media (max-width: 919px) {
  #play .d-ex-panel .fb:not([hidden]) {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    max-height: 58dvh; overflow: auto; overscroll-behavior: contain;
    padding: var(--s-5) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
    background: var(--surface-card, var(--panel)); border: 1px solid var(--rule); border-bottom: 0; border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 44px -14px rgba(0, 0, 0, .6); animation: d-sheet-in .25s ease-out;
  }
  #play .d-ex-panel .fb.ok:not([hidden]) { border-top: 3px solid var(--good); }
  #play .d-ex-panel .fb.bad:not([hidden]) { border-top: 3px solid var(--bad); }
  #play .d-ex-panel .fb .next { position: sticky; bottom: 0; margin-top: var(--s-3); }
  /* Espacio para poder desplazar el contenido por encima de la hoja */
  #play:has(.fb:not([hidden])) { padding-bottom: 58dvh; }
}
/* ---------- Índice: cabecera de página, Continuar primero y como mucho 3 o 4 secciones ---------- */
.d-idx-sechead { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.d-idx-sechead .d-h { margin: 0; }
.d-idx-more { color: var(--muted); font-size: var(--t-sm); text-decoration: underline; text-underline-offset: 3px; }
/* Inicio: en el móvil, una columna (Continuar, hoy, simuladores, progreso); en escritorio, el progreso a la izquierda */
.d-home { display: grid; gap: var(--s-6); grid-template-areas: "head" "next" "reto" "today" "sims" "prog"; }
.d-home-head { grid-area: head; }
.d-home-head h1 { margin: var(--s-1) 0 0; }
.d-home-next { grid-area: next; }
.d-home-today { grid-area: today; }
.d-home-sims { grid-area: sims; }
.d-home-prog { grid-area: prog; }
.d-home-cheer { margin: 0 0 var(--s-3); color: var(--muted); font-size: var(--t-sm); }
.d-home-cheer b { color: var(--ink); font-weight: 500; }
.d-sims.compact .d-sim { padding: var(--s-4); gap: var(--s-2); }
.d-sims.compact .d-sim-n { font-size: 18px; margin: 0; }
.d-sims.compact .d-sim-s { padding-top: 0; }
.d-sims.compact .d-sim-b { min-height: var(--h-control); margin-top: var(--s-1); }
.d-home-prog .d-ringbox { display: none; }
.d-beltline { display: flex; gap: 3px; height: 8px; }
.d-beltline i { flex: 1; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.d-beltline b { display: block; height: 100%; background: var(--g); }
.d-home-prog .d-belt-legend { justify-content: flex-start; margin: var(--s-3) 0 var(--s-5); }
.d-home-left { margin: var(--s-4) 0 var(--s-5); color: var(--muted); font-size: var(--t-sm); }
.d-home-left b { color: var(--ink); font-weight: 500; }
/* Avisos automáticos de Inicio, mapa de constancia, recordatorio y Memoria (app/memoria.js) */
.d-hnote { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: var(--s-4); border-radius: var(--r-row); border: 1px solid color-mix(in srgb, var(--fvg) 40%, var(--rule)); background: linear-gradient(160deg, color-mix(in srgb, var(--fvg) 12%, var(--panel)), var(--panel)); }
.d-hnote-i { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--fvg) 20%, transparent); color: var(--ink); }
.d-hnote b { display: block; font-weight: 500; }
.d-hnote p { margin: var(--s-1) 0 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.5; }
.d-hnote .go, .d-hnote .link { margin: var(--s-3) var(--s-3) 0 0; }
.d-heat { margin: var(--s-4) 0 0; }
.d-heat-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 260px; }
.d-heat-g i { aspect-ratio: 1; border-radius: 4px; background: var(--panel2); border: 1px solid var(--rule); }
.d-heat-g i.l1 { background: color-mix(in srgb, var(--good) 30%, var(--panel2)); border-color: transparent; }
.d-heat-g i.l2 { background: color-mix(in srgb, var(--good) 60%, var(--panel2)); border-color: transparent; }
.d-heat-g i.l3 { background: var(--good); border-color: transparent; }
.d-heat-g i.lf { background: none; border-style: dashed; opacity: .4; }
.d-heat-g i.t { outline: 2px solid var(--ink); outline-offset: 1px; }
.d-heat-l { display: flex; justify-content: space-between; gap: var(--s-3); max-width: 260px; margin: var(--s-2) 0 0; color: var(--muted); font-size: var(--t-xs); }
.d-heat-l b { color: var(--ink); font-weight: 500; }
.d-remind { padding: var(--s-3) var(--s-4) var(--s-4); }
.d-remind .d-help { margin: 0 0 var(--s-3); }
.d-remind-b { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-mem-from { margin: var(--s-3) 0 0; color: var(--muted); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; }
.d-mem-next { margin-top: var(--s-2); color: var(--muted); font-size: var(--t-sm); }
/* Enlace de una clase a su tema de Aprende (app/lesson.js, learnLink): abre en una ventana nueva */
.d-learnlink { display: flex; align-items: center; gap: var(--s-3); max-width: 64ch; margin: var(--s-6) 0 0; padding: var(--s-3) var(--s-4); min-height: var(--h-touch);
  border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); text-decoration: none; transition: border-color .15s, background-color .15s; }
.d-learnlink:hover { border-color: color-mix(in srgb, var(--fvg) 50%, var(--rule)); background: color-mix(in srgb, var(--fvg) 8%, var(--panel)); }
.d-learnlink > span { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.d-learnlink small { color: var(--muted); font-size: var(--t-xs); }
.d-learnlink b { font-weight: 500; font-size: var(--t-md); }
.d-learnlink .ph { flex: none; color: var(--fvg); }
.d-uend .d-learnlink { margin: var(--s-5) 0; }
.d-learnname { display: inline-flex; align-items: center; gap: var(--s-1); color: inherit; text-decoration-color: color-mix(in srgb, var(--fvg) 60%, transparent); text-underline-offset: 3px; }
.d-learnname .ph { width: 14px; height: 14px; color: var(--fvg); }
/* Consentimiento para los emails automáticos (registro y «Tu cuenta») */
.d-consent { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-3); align-items: start; margin: var(--s-2) 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.5; cursor: pointer; }
.d-consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--fvg); }
.d-adm-form .d-consent { grid-template-columns: 22px minmax(0, 1fr); align-items: center; color: var(--ink); font-size: var(--t-md); }
.d-adm-form .d-consent input { width: 20px; height: 20px; min-height: 0; padding: 0; }
@media (min-width: 900px) {
  .d-home { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); grid-template-areas: "head head" "prog next" "prog reto" "prog today" "prog sims"; align-items: start; column-gap: var(--s-6); }
  .d-home-prog { grid-row: 2 / span 4; position: sticky; top: 88px; padding: var(--s-6); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--surface-card); box-shadow: var(--soft); }
  .d-home-prog .d-ringbox { display: block; width: min(100%, 280px); margin: 0 auto; }
  .d-home-prog .d-beltline { display: none; }
  .d-home-prog .d-belt-legend { justify-content: center; }
  .d-home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-home-stats div:first-child { display: none; }   /* el anillo ya lo dice */
}
/* Página de una ruta (ICT y MACD): cinturones en acordeón, lecciones como filas y botón fijo «Continuar: lección N» */
.d-belts { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
.d-beltacc { position: relative; overflow: hidden; }
.d-beltacc::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--bg-belt); }
.d-beltacc.cur { border-color: color-mix(in srgb, var(--ink) 30%, var(--rule)); box-shadow: var(--soft); }
.d-beltacc.done .d-tacc-m { color: var(--good); }
.d-beltacc.locked, .d-beltacc.soon { background: transparent; border-style: dashed; }
.d-beltacc.locked::before, .d-beltacc.soon::before { opacity: .45; }
.d-beltacc .d-tacc-b { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
.d-beltacc .d-tacc-b > .d-help, .d-beltacc .d-bbar, .d-beltacc .d-lock { margin: 0; }
.d-trow-i:has(.d-lring) { width: 40px; height: 40px; background: none; }
.d-trow .d-lring { width: 40px; height: 40px; font-size: 14px; }
.d-lrow.done .d-lring::before { background: color-mix(in srgb, var(--good) 16%, var(--panel)); }
.d-lrow.d-next { border-color: rgb(139 60 247 / .55); background: color-mix(in srgb, #8b3cf7 10%, var(--panel)); }
.d-rsec { margin-top: var(--s-5); }
.d-rsec > .d-help { margin: var(--s-2) 0 var(--s-4); }
.d-idx-cta { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--s-3)); z-index: 5; margin-top: var(--s-5); }
.d-idx-cta .confirm { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 52px; padding: 0 var(--s-5); box-shadow: 0 14px 34px -12px rgba(123, 47, 247, .8); }
.d-idx-cta .confirm .ph { width: 20px; height: 20px; }
@media (min-width: 900px) { .d-idx-cta { bottom: var(--s-4); max-width: 440px; margin-left: auto; } }
/* Práctica: accesos rápidos en una fila, filtro y un acordeón por cinturón */
.d-pquick { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-3); margin: 0 0 var(--s-4); }
.d-pquick .mode { padding: var(--s-4); border-radius: var(--r-row); }
.d-pquick .mode b { font-size: 17px; }
.d-pquick .mode span { font-size: var(--t-sm); line-height: 1.4; max-height: calc(3 * 1.4em); overflow: hidden; }
.d-filter { display: flex; align-items: center; gap: var(--s-2); min-height: var(--h-control); padding: 0 var(--s-4); margin: var(--s-4) 0; border: 1px solid var(--rule); border-radius: var(--r-row); background: var(--surface-card); }
.d-filter:focus-within { border-color: color-mix(in srgb, var(--ink) 40%, var(--rule)); outline: 2px solid #c471ed; outline-offset: 3px; }   /* el mismo foco que :focus-visible */
.d-filter-i { display: grid; color: var(--muted); }
.d-filter input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; outline: none; }
.d-filter input::placeholder { color: var(--muted); }
#mods { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
.d-mgroup .d-mods { grid-template-columns: minmax(0, 1fr); gap: 0; }
/* Dentro del acordeón, los módulos son filas separadas por una línea: nunca una tarjeta dentro de otra */
.d-mgroup .d-mods .mod { padding: var(--s-4) 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; box-shadow: none; overflow: visible; }
.d-mgroup .d-mods .mod::before { display: none; }
.d-mgroup .d-mods .mod:first-child { border-top: 0; padding-top: var(--s-1); }
.d-mgroup .cpt { font-size: var(--t-sm); padding: 6px 10px 9px; }
@media (min-width: 760px) { .d-mgroup .d-mods { grid-template-columns: 1fr 1fr; column-gap: var(--s-6); } .d-mgroup .d-mods .mod:nth-child(2) { border-top: 0; padding-top: var(--s-1); } }
.cpt.d-hit { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Flujo · lectura: en las comparaciones, un solo nivel de tarjeta; el gráfico va sin marco propio */
.cmpi .chartwrap { border: 0; box-shadow: none; border-radius: var(--r-row); }
/* Flujo · fin de unidad (lUnitEnd): lo que se vio y la unidad siguiente */
.d-uend { display: grid; gap: var(--s-3); max-width: 68ch; }
.d-uend .lh { margin: 0 0 var(--s-2); }
.d-uend .d-h { margin: var(--s-2) 0 0; font-size: var(--t-xs); }
.d-uend-l { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.d-uend-l li { display: flex; align-items: flex-start; gap: var(--s-2); }
.d-uend-l .ph { flex: none; width: 18px; height: 18px; margin-top: 3px; color: var(--good); }
.d-uend-n { margin: var(--s-3) 0 0; padding-top: var(--s-4); border-top: 1px solid var(--rule); color: var(--muted); }
.d-uend-n b { color: var(--ink); font-weight: 500; }
/* Flujo · resultado del examen: cifra, tres cifras y revisión de fallos */
.d-qstats { margin: var(--s-4) 0 var(--s-5); }
.d-qn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--bad) 16%, var(--panel)); color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.d-trow-i:has(.d-qn) { background: none; }
.d-qmiss { margin-top: var(--s-3); }
.d-qmiss-l { margin: 0; padding-left: var(--s-5); display: grid; gap: var(--s-4); }
.d-qmiss-l p { margin: 0; }
.d-qmiss-a { margin-top: var(--s-1) !important; font-size: var(--t-sm); }
.d-qmiss-u { margin-top: var(--s-1) !important; color: var(--muted); font-size: var(--t-xs); }
/* Flujo · resultado de casos, rutina y evaluación: cifras arriba, detalle plegado y la acción fija abajo */
.d-sumfold { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); margin: var(--s-5) 0 0; text-align: left; }
.d-sumfold .ticket { margin: 0; }
.d-sumfold .d-cs-diary > .d-cs-kpis:first-child { margin-top: 0; }
.d-sumsec { margin-top: var(--s-5); }
.d-sumbar { position: sticky; bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); z-index: 5; display: grid; margin-top: var(--s-4); padding: var(--s-2); border-radius: var(--r-card);
  background: color-mix(in srgb, var(--bg-bottom) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.d-sumbar .confirm { width: 100%; }
/* Panel (Rendimiento y Simuladores): cifras arriba y el detalle plegado, con su resumen en la cabecera */
.d-panelacc { margin: var(--s-5) 0; }
#perfKpis { margin-bottom: var(--s-4); }
.d-levels { margin: var(--s-4) 0 0; }
.d-lvrow .d-trow-m { white-space: normal; }
.d-lvpips { display: flex; gap: 3px; }
.d-lvpips i { width: 6px; height: 16px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.d-lvpips i.f { background: var(--g-violet); }
#perfKpis .d-perf-kpis { margin: var(--s-4) 0 0; }
.d-panelacc .d-cs-diary > .d-cs-kpis:first-child, .d-panelacc .d-bars { margin-top: 0; }
.d-panelacc .d-tacc-b > div > .d-empty:first-child { margin-top: 0; }
/* Flujo · portada de la lección (rToc): la pregunta, lo que aprenderás, por qué importa y tres datos */
.d-pre { display: grid; gap: var(--s-3); max-width: 68ch; margin: 0 0 var(--s-5); }
.d-pre-q { margin: 0 0 var(--s-2); font-size: 20px; line-height: 1.4; font-weight: 400; color: var(--ink); }
.d-pre .d-h { margin: var(--s-3) 0 0; font-size: var(--t-xs); }
.d-pre-l { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.d-pre-l li { display: flex; align-items: flex-start; gap: var(--s-3); line-height: 1.5; }
.d-pre-l .ph { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--good); }
.d-pre-why { margin-top: var(--s-3); padding: var(--s-4) var(--s-5); border-radius: var(--r-row); border-left: 3px solid transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--g-brand) border-box; }
.d-pre-why .d-h { margin: 0 0 var(--s-2); }
.d-pre-why p { margin: 0; line-height: 1.6; }
.d-pre-stats { margin-top: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.d-pre-note { margin: var(--s-4) 0 0; color: var(--muted); font-size: var(--t-sm); max-width: 68ch; }
.d-pre-toc, .d-pre-more { margin-top: var(--s-4); }
.d-pre-more .d-tacc-b p { max-width: 68ch; line-height: 1.6; }
.d-pre-toc .toc { margin: 0; }
/* ---------- Panel de administración (/admin/, public/admin/admin.js) ---------- */
.d-adm-bar { display: flex; align-items: center; gap: var(--s-4); }
.d-adm-brand { font-weight: 500; }
.d-adm-who { color: var(--muted); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .d-adm-who { display: none; } .d-adm-brand { font-size: 15px; } }
.d-adm-stats b.d-adm-txt { font-size: 18px; line-height: 1.2; }
.d-adm-main { max-width: 1180px; }
.d-adm-tabs { display: flex; gap: var(--s-2); overflow-x: auto; margin: 0 0 var(--s-5); }
.d-adm-tabs button { flex: none; min-height: var(--h-touch); padding: 0 var(--s-4); border-radius: 999px; border: 1px solid var(--rule); background: none; color: var(--muted); font: inherit; cursor: pointer; }
.d-adm-tabs button.on { color: var(--ink); background: var(--panel); border-color: color-mix(in srgb, var(--ink) 30%, var(--rule)); }
.d-adm-h { margin: 0 0 var(--s-4); font-size: 28px; font-weight: 400; }
.d-adm-sub { margin: 0 0 var(--s-5); color: var(--muted); font-size: var(--t-sm); }
.d-adm-stats { margin: 0 0 var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--surface-card); }
.d-adm-sec { margin-top: var(--s-6); }
.d-adm-sec .d-h { margin-bottom: var(--s-3); }
.d-adm-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.d-adm-bars li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 3.5em; align-items: center; gap: var(--s-3); font-size: var(--t-sm); }
.d-adm-bars i { display: block; height: 10px; min-width: 2px; border-radius: 99px; background: var(--g-brand); }
.d-adm-bars b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.d-adm-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-row); }
.d-adm-t { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.d-adm-t th, .d-adm-t td { padding: var(--s-3); text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; white-space: nowrap; }
.d-adm-t th { color: var(--muted); font-weight: 500; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .05em; background: var(--panel); }
.d-adm-t tr:last-child td { border-bottom: 0; }
.d-adm-list tbody tr { cursor: pointer; }
.d-adm-list tbody tr:hover, .d-adm-list tbody tr:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.d-adm-list td:first-child { white-space: normal; min-width: 14em; }
.d-adm-list td:first-child b { display: block; font-weight: 500; }
.d-adm-list td:first-child span { color: var(--muted); font-size: var(--t-xs); }
.d-adm-tag { font-style: normal; font-size: var(--t-xs); padding: 1px 6px; border-radius: 99px; border: 1px solid var(--rule); color: var(--muted); }
.d-adm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-4); }
.d-adm-tools .d-filter { flex: 1 1 260px; margin: 0; }
.d-adm-sel { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-size: var(--t-sm); }
.d-adm-sel select { min-height: var(--h-touch); padding: 0 var(--s-3); border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: inherit; }
.d-adm-count { margin: 0 0 var(--s-3); color: var(--muted); font-size: var(--t-sm); }
.d-adm-pager { display: flex; gap: var(--s-3); margin-top: var(--s-4); }
.d-adm-raw { margin-top: var(--s-6); }
.d-adm-raw pre { margin: 0; max-height: 60vh; overflow: auto; font-size: var(--t-xs); white-space: pre-wrap; word-break: break-word; }
.d-adm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.d-adm-steps { margin: 0 0 var(--s-4); padding-left: var(--s-5); display: grid; gap: var(--s-2); }
.d-adm-steps code { word-break: break-all; }
.d-adm-qr { display: block; width: 200px; height: 200px; margin: 0 0 var(--s-4); padding: var(--s-2); border-radius: var(--r-row); background: #fff; }
.d-adm-code { display: grid; gap: var(--s-3); max-width: 320px; }
.d-adm-code label { display: grid; gap: var(--s-2); color: var(--muted); font-size: var(--t-sm); }
.d-adm-code input { min-height: var(--h-control); padding: 0 var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: inherit; font-size: 22px; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
/* Sección SEO del panel: estado de publicación, tabla de páginas, vista previa en Google y formulario */
.d-adm-ok { margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid color-mix(in srgb, var(--good) 40%, var(--rule)); background: color-mix(in srgb, var(--good) 10%, transparent); font-size: var(--t-sm); }
.d-adm-seo-state { display: grid; gap: var(--s-1); margin: 0 0 var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--surface-card); font-size: var(--t-sm); }
.d-adm-seo-state b { font-weight: 500; }
.d-adm-seo-state span { color: var(--muted); }
.d-adm-seo-state.wait { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.d-adm-seo-t td.d-adm-seo-wrap { white-space: normal; min-width: 16em; max-width: 26em; }
.d-adm-seo-t td span { display: block; color: var(--muted); font-size: var(--t-xs); }
.d-adm-tag.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); }
.d-adm-tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.d-adm-serp { max-width: 640px; margin: 0 0 var(--s-5); padding: var(--s-4) var(--s-5); border-radius: var(--r-row); background: #fff; color: #202124; font-family: Arial, sans-serif; }
.d-adm-serp-u { display: block; font-size: 13px; color: #4d5156; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-adm-serp b { display: block; margin-top: 4px; font-weight: 400; font-size: 20px; line-height: 1.3; color: #1a0dab; }
.d-adm-serp p { margin: 4px 0 0; font-size: 14px; line-height: 1.58; color: #4d5156; }
.d-adm-form { display: grid; gap: var(--s-2); max-width: 720px; }
.d-adm-form label { display: grid; gap: var(--s-2); margin-top: var(--s-3); color: var(--muted); font-size: var(--t-sm); }
.d-adm-form input, .d-adm-form textarea { width: 100%; min-height: var(--h-touch); padding: var(--s-2) var(--s-3); border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: inherit; font-size: var(--t-md); }
.d-adm-form textarea { resize: vertical; line-height: 1.5; }
.d-adm-form .d-help { margin: 0; font-size: var(--t-xs); }
.d-adm-slug { display: flex; align-items: center; min-width: 0; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--panel); }
.d-adm-slug > span { flex: none; padding: 0 var(--s-2); color: var(--muted); font-size: var(--t-xs); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-adm-slug input { flex: 1 1 auto; min-width: 0; border: 0; border-radius: 0; padding-inline: 0; }
.d-adm-fixed { margin-top: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-chip); border: 1px dashed var(--rule); font-size: var(--t-sm); }
.d-adm-fixed > span { color: var(--muted); }
.d-adm-fixed p { margin: var(--s-1) 0 0; }
.d-adm-checks { list-style: none; margin: var(--s-4) 0 0; padding: var(--s-4); display: grid; gap: var(--s-2); border-radius: var(--r-row); border: 1px solid var(--rule); font-size: var(--t-sm); }
.d-adm-checks li { position: relative; padding-left: var(--s-5); }
.d-adm-checks li::before { content: ''; position: absolute; left: 0; top: .45em; width: 10px; height: 10px; border-radius: 50%; background: var(--good); }
.d-adm-checks li.no { color: var(--ink); }
.d-adm-checks li.no::before { background: var(--bad); }
.d-adm-kinds { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); max-width: 420px; }
.d-adm-kinds li { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.d-adm-kinds b { font-weight: 500; font-variant-numeric: tabular-nums; }
}

@layer paginas {
/* ---------- Simulador de challenge (antes app-challenge.css) ---------- */
/* Simulador de challenge. Pantalla de operación: el gráfico ocupa todo el ancho y la franja del
   challenge, la barra de reproducción y el ticket quedan siempre a la vista.
   Todas las clases llevan el prefijo cs- para no chocar con las de la app. Usa los tokens de
   la capa tokens (colores, espaciado --s-*, radios --r-*). */

.cs { --warn: #ffb74a; --cs-bar: 64px; }
body.chal-on main { max-width: none; padding: var(--s-3) var(--s-4) var(--s-7); }
body.chal-on .bar { padding-inline: var(--s-4); }
.cs-num { font-variant-numeric: tabular-nums; }
.cs-up { color: var(--good); } .cs-down { color: var(--bad); } .cs-muted { color: var(--muted); }
.cs button { font-family: inherit; color: inherit; letter-spacing: inherit; }

/* ---------- Pantalla de operación: exactamente el alto de la ventana en escritorio ---------- */
.cs-screen { display: flex; flex-direction: column; gap: var(--s-3); }
@media (min-width: 1000px) { .cs-screen { height: calc(100dvh - var(--cs-bar) - var(--s-3) * 2); min-height: 640px; } }

/* Franja del challenge */
.cs-strip {
  flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-5); align-items: center;
  padding: var(--s-4) var(--s-5); border-radius: 20px; background: var(--surface-card); border: 1px solid var(--rule);
}
.cs-day { display: grid; gap: var(--s-2); min-width: 290px; padding-right: var(--s-5); border-right: 1px solid var(--rule); }
.cs-day-h { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.cs-day-h h2 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.cs-day-h span { font-size: 13px; color: var(--muted); }
.cs-days { display: grid; grid-template-columns: repeat(30, 7px); gap: 2.5px; }
.cs-days i { height: 18px; border-radius: 3px; background: var(--panel2); border: 1px dashed color-mix(in srgb, var(--rule) 80%, transparent); }
.cs-days i.w { background: var(--good); border: 0; } .cs-days i.l { background: var(--bad); border: 0; } .cs-days i.f { background: #6a6e78; border: 0; }
.cs-days i.now { border: 0; background: var(--ink); animation: csPulse 2s infinite; }
@keyframes csPulse { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, #fff 18%, transparent); } }
.cs-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.cs-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-5); }
.cs-kpi { display: grid; gap: 6px; min-width: 0; }
.cs-kpi > span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-kpi > b { font-size: 19px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; }
.cs-kpi small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-bar { height: 6px; border-radius: 6px; background: var(--panel2); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3); }
.cs-bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--g-teal); transition: width .35s ease, background .35s; }
.cs-bar.risk i { background: var(--good); }
.cs-bar.risk.mid i { background: var(--warn); } .cs-bar.risk.hot i { background: var(--bad); }
.cs-dots { display: flex; gap: 5px; height: 6px; align-items: center; }
.cs-dots i { width: 22px; height: 6px; border-radius: 6px; background: var(--panel2); }
.cs-dots i.on { background: var(--g-teal); }

/* Terminal: herramientas + gráfico */
.cs-term { flex: 1; min-height: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); border-radius: 20px; overflow: hidden; border: 1px solid var(--rule); background: var(--chartbg); }
.cs-tools { display: flex; flex-direction: column; gap: 2px; padding: var(--s-2) 6px; background: var(--panel2); border-right: 1px solid var(--rule); overflow-y: auto; scrollbar-width: none; }
.cs-tools hr { width: 32px; margin: 4px auto; border: 0; border-top: 1px solid var(--rule); }
.cs-tool {
  display: grid; justify-items: center; gap: 3px; padding: 5px 2px 4px; border-radius: 12px; border: 1px solid transparent;
  background: none; color: var(--muted); font-size: 10.5px; font-weight: 500; line-height: 1; cursor: pointer; transition: background .15s, color .15s;
}
.cs-tool:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--ink); }
.cs-tool[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, #7b2ff7 26%, var(--panel)); border-color: color-mix(in srgb, #c471ed 55%, transparent); }
.cs-tool .ph { width: 21px; height: 21px; }

.cs-chart { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cs-chead { flex: none; height: 46px; display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-3) 0 var(--s-4); border-bottom: 1px solid var(--rule); }
.cs-sym { font-weight: 600; font-size: 14.5px; }
/* Selector de instrumento (BTC, ETH, XRP); el punto marca el activo con la operación en curso */
.cs-assets button { font-weight: 600; position: relative; }
.cs-assets button.cs-open::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cs-sp { flex: 1; }
.cs-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--panel2); flex: none; }
.cs-seg button { border: 0; background: none; border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 500; color: var(--muted); min-height: 28px; cursor: pointer; white-space: nowrap; }
.cs-seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.cs-seg button:disabled { opacity: .45; cursor: default; }
.cs-ibtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.cs-ibtn:hover { background: var(--panel2); color: var(--ink); }
.cs-ibtn[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, #7b2ff7 26%, var(--panel)); }
.cs-ibtn:disabled { opacity: .4; cursor: default; }
.cs-vsep { width: 1px; height: 22px; background: var(--rule); flex: none; }
.cs-coach { display: inline-flex; align-items: center; gap: var(--s-2); font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; white-space: nowrap; }
.cs-coach i { width: 34px; height: 20px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--rule); position: relative; transition: background .2s; flex: none; }
.cs-coach i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.cs-coach[aria-pressed="true"] { color: var(--ink); }
.cs-coach[aria-pressed="true"] i { background: color-mix(in srgb, var(--good) 30%, var(--panel2)); border-color: color-mix(in srgb, var(--good) 60%, var(--rule)); }
.cs-coach[aria-pressed="true"] i::after { transform: translateX(14px); background: var(--good); }

.cs-plot { position: relative; flex: 1; min-height: 0; }
#csCv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: none; touch-action: none; }
.cs-legend { position: absolute; left: var(--s-4); top: var(--s-3); display: flex; gap: var(--s-3); font-size: 12.5px; color: var(--muted); pointer-events: none; }
.cs-legend b { font-weight: 500; }
.cs-hint {
  position: absolute; left: var(--s-4); top: 40px; display: flex; align-items: center; gap: var(--s-3); max-width: min(720px, calc(100% - 120px));
  padding: 6px 6px 6px var(--s-3); border-radius: 12px; background: color-mix(in srgb, var(--panel) 90%, transparent); border: 1px solid var(--rule);
  backdrop-filter: blur(8px); font-size: 13px; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .6);
}
.cs-hint[hidden], .cs-live[hidden] { display: none; }
.cs-hint b { font-weight: 600; white-space: nowrap; }
.cs-hint span { color: var(--muted); }
.cs-live { position: absolute; right: 96px; bottom: 40px; height: 34px; padding: 0 var(--s-3); border-radius: 10px; border: 1px solid var(--rule); background: var(--panel); font-size: 13px; font-weight: 500; cursor: pointer; }

/* Barra de reproducción y ticket */
.cs-dock { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); border-radius: 18px; background: var(--panel); border: 1px solid var(--rule); }
.cs-replay { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.cs-play { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 0; display: grid; place-items: center; background: var(--g-violet); color: #fff; box-shadow: 0 10px 24px -12px rgba(123, 47, 247, .9); cursor: pointer; }
.cs-btn { height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); padding: 0 var(--s-3); border-radius: 12px; border: 1px solid var(--rule); background: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.cs-btn:hover { background: var(--panel2); }
.cs-btn.cs-icon { width: 44px; padding: 0; flex: none; }
.cs-clock { display: grid; gap: 1px; padding: 0 var(--s-2); white-space: nowrap; }
.cs-clock b { font-size: 15px; font-weight: 500; }
.cs-clock span { font-size: 12px; color: var(--muted); }
.cs-ticket { display: flex; align-items: center; gap: 10px; padding-left: var(--s-4); border-left: 1px solid var(--rule); }
.cs-fld { display: grid; gap: 2px; }
.cs-fld span { font-size: var(--t-xs); color: var(--muted); }
.cs-fld label { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 var(--s-2); border-radius: 10px; background: var(--panel2); border: 1px solid var(--rule); }
.cs-fld input { width: 40px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.cs-fld input::-webkit-inner-spin-button, .cs-fld input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cs-fld em { font-style: normal; font-size: 12px; color: var(--muted); }
.cs-lots { display: grid; gap: 2px; min-width: 76px; font-size: 12px; color: var(--muted); }
.cs-lots b { color: var(--ink); font-weight: 500; font-size: 14px; }
.cs-buy, .cs-sell { height: 46px; min-width: 96px; padding: 0 var(--s-4); border: 0; border-radius: 14px; font-weight: 600; font-size: 15px; color: #fff; display: grid; line-height: 1.1; cursor: pointer; }
.cs-buy small, .cs-sell small { font-weight: 400; font-size: var(--t-xs); opacity: .85; }
.cs-buy { background: var(--g-teal); box-shadow: 0 10px 24px -14px rgba(17, 214, 182, .9); }
.cs-sell { background: var(--g-pink); box-shadow: 0 10px 24px -14px rgba(230, 36, 110, .9); }

/* ---------- Debajo: posición, operaciones del día y rendimiento ---------- */
.cs-below { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.5fr); gap: var(--s-4); margin-top: var(--s-4); }
.cs-card { padding: var(--s-5); border-radius: var(--r-card); background: var(--surface-card); border: 1px solid var(--rule); min-width: 0; }
.cs-card h3 { margin: 0 0 var(--s-2); font-size: 17px; font-weight: 500; }
.cs-help { margin: 0 0 var(--s-4); font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.cs-empty { padding: var(--s-5); border-radius: var(--r-row); border: 1px dashed var(--rule); color: var(--muted); font-size: 14px; line-height: 1.55; }
.cs-pos { display: grid; gap: var(--s-3); }
.cs-pos-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.cs-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 500; }
.cs-tag.b { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.cs-tag.s { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.cs-tag.p { background: var(--panel2); color: var(--muted); }
.cs-pnl { font-size: 30px; font-weight: 400; letter-spacing: -.02em; }
.cs-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-4); font-size: 13.5px; }
.cs-grid2 span { color: var(--muted); }
.cs-grid2 b { font-weight: 500; text-align: right; }
.cs-rowbtns { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.cs-trades { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); max-height: 260px; overflow-y: auto; }
.cs-trades li { display: grid; grid-template-columns: 52px 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); border-radius: var(--r-row); background: var(--panel2); font-size: 13.5px; }
.cs-trades li b { font-weight: 500; }
.cs-perf { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: var(--s-5); align-items: start; }
.cs-curve { width: 100%; height: 120px; display: block; }
.cs-stats { display: grid; gap: var(--s-3); font-size: 13.5px; }
.cs-stats div { display: flex; justify-content: space-between; gap: var(--s-3); }
.cs-stats span { color: var(--muted); }
.cs-stats b { font-weight: 500; }
.cs-pace { margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-row); background: var(--panel2); font-size: 13.5px; line-height: 1.55; }
.cs-pace b { font-weight: 500; }
.cs-reset { margin: var(--s-5) 0 0; font-size: 13.5px; }

/* Aviso flotante y hojas (inicio, cierre del día, resultado del challenge) */
.cs-toast {
  position: fixed; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 40;
  padding: 10px 18px; border-radius: 99px; background: var(--panel); border: 1px solid var(--rule); box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .7);
  font-size: 14px; max-width: 90vw; transition: opacity .25s, transform .25s;
}
.cs-toast.on { opacity: 1; transform: translate(-50%, 0); }
.cs-toast.good { border-color: color-mix(in srgb, var(--good) 60%, var(--rule)); }
.cs-toast.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--rule)); }
.cs-modal { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--s-4); background: rgba(20, 21, 24, .6); backdrop-filter: blur(6px); z-index: 50; }
.cs-modal[hidden] { display: none; }
.cs-sheet { width: min(480px, 100%); padding: var(--s-6); border-radius: var(--r-card); background: var(--panel); border: 1px solid var(--rule); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8); display: grid; gap: var(--s-4); }
.cs-sheet h3 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.cs-sheet p { margin: 0; color: var(--muted); line-height: 1.6; }
.cs-sheet .cs-kick { font-size: 13.5px; }
.cs-big { font-size: 40px; font-weight: 400; letter-spacing: -.02em; color: var(--ink); }
.cs-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.cs-rules li { padding: var(--s-3); border-radius: var(--r-row); background: var(--panel2); font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.cs-rules li b { color: var(--ink); font-size: 16px; font-weight: 500; }
/* Hoja inicial: lo esencial a la vista, el detalle plegado y los atajos solo con teclado y ratón */
.cs-lead { margin: 0; }
.cs-more { margin: var(--s-3) 0 0; }
.cs-more summary { cursor: pointer; color: var(--muted); font-size: var(--t-sm); text-decoration: underline; text-underline-offset: 3px; }
.cs-more[open] summary { margin-bottom: var(--s-2); }
@media (hover: none), (pointer: coarse) { .cs-keys { display: none; } }
@media (max-width: 420px) { .cs-rules li { padding: var(--s-2); } .cs-rules li b { font-size: 15px; } }
.cs-cta { height: 52px; border: 0; border-radius: var(--r-row); background: var(--g-violet); color: #fff; font-weight: 600; cursor: pointer; box-shadow: 0 12px 28px -12px rgba(123, 47, 247, .8); }
.cs-cta.win { background: var(--g-teal); box-shadow: 0 12px 28px -12px rgba(17, 214, 182, .8); }
/* Elegir el activo del challenge nuevo (BTC, ETH, XRP) */
.cs-sheet .cs-pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: 13.5px; }
.cs-pick .cs-btn { height: 36px; min-width: 56px; color: var(--ink); }

/* ---------- Pantallas medianas y móvil ---------- */
@media (max-width: 1240px) {
  .cs-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3) var(--s-5); }
  .cs-below { grid-template-columns: 1fr 1fr; } .cs-below .cs-card:last-child { grid-column: 1 / -1; }
  .cs-clock { display: none; }
}
/* ---------- Tableta y móvil ----------
   Prioridad: el gráfico y los botones de operar. La franja muestra lo imprescindible (resultado de hoy,
   límite diario y objetivo) y se despliega con «Ver todo». Las herramientas van bajo el gráfico, al
   alcance del pulgar, y la barra de reproducción y el ticket quedan fijos abajo. */
.cs-more, .cs-zoom, .cs-tsum, .cs-s, .cs-spd { display: none; }
.cs-tf { display: flex; align-items: center; gap: 10px; }
@media (max-width: 999px) {
  body.chal-on main { padding: var(--s-2) var(--s-3) var(--s-6); }
  .cs-screen { gap: var(--s-2); }
  .cs-strip { grid-template-columns: 1fr; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: 18px; }
  .cs-day { border-right: 0; padding-right: 0; min-width: 0; gap: 6px; }
  .cs-day-h { flex-wrap: nowrap; }
  .cs-day-h h2 { font-size: 19px; white-space: nowrap; }
  .cs-day-h span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .cs-more { display: inline; margin-left: auto; font-size: 13px; white-space: nowrap; min-height: 32px; }
  .cs-days { grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px; }
  .cs-days i { height: 12px; }
  .cs-strip:not(.open) .cs-days, .cs-strip:not(.open) .cs-note, .cs-strip:not(.open) .cs-x { display: none; }
  .cs-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
  .cs-kpi { gap: 4px; }
  .cs-kpi > span { font-size: var(--t-xs); }
  .cs-kpi > b { font-size: 15.5px; }
  .cs-kpi small { font-size: var(--t-xs); }

  .cs-term { display: flex; flex-direction: column; border-radius: 18px; }
  .cs-chart { order: 1; }
  .cs-tools { order: 2; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--rule); padding: 6px; gap: 2px; -webkit-overflow-scrolling: touch; }
  .cs-tools hr { flex: none; width: 1px; height: 34px; margin: auto 3px; border-top: 0; border-left: 1px solid var(--rule); }
  .cs-tool { flex: none; min-width: 56px; min-height: 48px; }
  .cs-chead { height: 44px; gap: var(--s-2); padding: 0 var(--s-2) 0 var(--s-3); overflow-x: auto; scrollbar-width: none; }
  .cs-chead .cs-soon { display: none; }
  .cs-coach span { display: none; }
  .cs-ibtn { width: 36px; height: 36px; }
  .cs-chead .cs-vsep { display: none; }
  /* Todo en un solo alto de pantalla: el gráfico se queda con el espacio que sobra */
  .cs-screen { height: calc(100dvh - var(--cs-bar) - var(--s-2) * 2); min-height: 540px; }
  .cs-term { flex: 1; min-height: 0; }
  .cs-chart { flex: 1; min-height: 0; }
  .cs-plot { flex: 1; min-height: 180px; }
  .cs-l { display: none; } .cs-s { display: inline; }
  .cs-legend { left: var(--s-3); top: var(--s-2); right: 70px; flex-wrap: wrap; gap: 0 var(--s-2); font-size: var(--t-xs); }
  .cs-legend span:first-child { display: none; }
  .cs-hint { left: var(--s-2); top: 30px; max-width: calc(100% - 76px); padding: 4px 4px 4px var(--s-3); font-size: 12.5px; }
  .cs-hint span { display: none; }
  .cs-zoom { display: flex; position: absolute; right: 70px; bottom: 36px; border-radius: 12px; overflow: hidden; border: 1px solid var(--rule); background: color-mix(in srgb, var(--panel) 92%, transparent); }
  .cs-zoom button { width: 40px; height: 40px; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; }
  .cs-zoom button + button { border-left: 1px solid var(--rule); }
  .cs-live { right: 70px; bottom: 84px; }

  /* Reproducción y ticket, fijos abajo mientras operas */
  .cs-dock { flex-direction: column; align-items: stretch; gap: var(--s-2); padding: var(--s-2); }
  .cs-replay { gap: var(--s-2); }
  .cs-replay .cs-seg { display: none; }
  .cs-spd { display: inline-flex; width: 56px; flex: none; padding: 0; }
  .cs-replay #csEnd { flex: 1; min-width: 0; }
  .cs-replay #csEnd span { overflow: hidden; text-overflow: ellipsis; }
  .cs-ticket { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "tf tf tf" "sell sum buy"; gap: var(--s-2); border-left: 0; padding: 0; }
  .cs-tsum { display: block; grid-area: sum; height: 48px; padding: 0 var(--s-3); border-radius: 14px; border: 1px solid var(--rule); background: var(--panel2); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
  .cs-ticket.open .cs-tsum { border-color: color-mix(in srgb, #c471ed 55%, var(--rule)); }
  .cs-tf { grid-area: tf; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: var(--s-2); padding-bottom: var(--s-2); border-bottom: 1px solid var(--rule); }
  .cs-ticket:not(.open) .cs-tf { display: none; }
  .cs-fld label { height: 38px; }
  .cs-fld input { width: 100%; min-width: 0; font-size: 16px; }
  .cs-lots { min-width: 0; align-self: end; padding-bottom: 8px; }
  .cs-sell, .cs-buy { height: 48px; min-width: 0; padding: 0 var(--s-2); }
  .cs-sell { grid-area: sell; } .cs-buy { grid-area: buy; }
  .cs-toast { top: calc(var(--cs-bar) + var(--s-2)); bottom: auto; transform: translate(-50%, -12px); border-radius: 16px; text-align: center; width: max-content; max-width: calc(100vw - 32px); }
  .cs-toast.on { transform: translate(-50%, 0); }

  .cs-below { grid-template-columns: 1fr; gap: var(--s-3); margin-top: var(--s-3); }
  .cs-below .cs-card:last-child { grid-column: auto; }
  .cs-card { padding: var(--s-4); }
  .cs-perf { grid-template-columns: 1fr; gap: var(--s-4); }
  .cs-sheet { max-height: calc(100dvh - 32px); overflow-y: auto; padding: var(--s-5); }
  .cs-big { font-size: 34px; }
}
@media (max-width: 380px) {
  .cs-replay .cs-seg button { padding: 4px 7px; }
}

/* Dibujo seleccionado: botón para eliminarlo dentro de la barra de ayuda */
.cs-hint .cs-del { height: 30px; padding: 0 var(--s-3); font-size: 12.5px; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.cs-hint .cs-del:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* ---------- Catálogo interno de plantillas y componentes (#/plantillas, app/plantillas.js) ---------- */
.d-kit { max-width: 880px; margin: 0 auto; }
.d-kit-sec { margin-top: var(--s-7); }
.d-kit-sec .d-h { margin-bottom: var(--s-3); }
.d-kit-sec .d-help { margin: var(--s-2) 0 var(--s-4); }
.d-kit-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.d-kit-pages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.d-kit-pages li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-4); border: 1px solid var(--rule); border-radius: var(--r-row); background: var(--surface-card); }
.d-kit-pages li div { display: grid; gap: 2px; min-width: 0; }
.d-kit-pages li span { color: var(--muted); font-size: var(--t-sm); }
.d-kit-opts { display: grid; gap: var(--s-6); }
.d-kit-idx { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
.d-kit-opt .lfb:empty { display: none; }
.d-kit-sw, .d-kit-sp, .d-kit-ty { list-style: none; margin: 0; padding: 0; }
.d-kit-sw { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.d-kit-sw li { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); }
.d-kit-sw i { width: 36px; height: 36px; border-radius: var(--r-chip); border: 1px solid var(--rule); flex: none; }
.d-kit-sp { display: grid; gap: var(--s-2); }
.d-kit-sp li { display: flex; align-items: center; gap: var(--s-3); font-size: var(--t-sm); }
.d-kit-sp i { height: 12px; border-radius: 3px; background: var(--g-brand); flex: none; }
.d-kit-ty { display: grid; gap: var(--s-3); }
.d-kit-ty code, .d-kit-sw code, .d-kit-sp code { color: var(--muted); font-size: var(--t-xs); }
@media (max-width: 560px) { .d-kit-pages li { flex-direction: column; align-items: stretch; } }

/* ---------- Navegación por secciones (Inicio, Clases, Práctica, Simuladores, Retos, Herramientas; Tu panel en el menú) ---------- */
@media (min-width: 900px) and (max-width: 1199px) {
  .d-tabs { margin-left: var(--s-3); gap: 0; }
  .d-tabs .d-tabbtn { padding: var(--s-2) var(--s-3); }
  .d-tabs .d-tabbtn .ph { display: none; }
}
.d-amenu { position: fixed; z-index: 30; min-width: 220px; padding: var(--s-2); display: grid; gap: 2px; border-radius: var(--r-card);
  border: 1px solid var(--rule); background: var(--panel); box-shadow: var(--soft); }
.d-amenu button { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-chip);
  background: none; color: var(--ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.d-amenu button:hover, .d-amenu button:focus-visible { background: color-mix(in srgb, #8b3cf7 14%, transparent); outline: none; }
.d-amenu .ph { width: 20px; height: 20px; color: var(--muted); }
.d-home-reto { grid-area: reto; }
.d-home-reto .d-reto-card { border-color: color-mix(in srgb, #f5b942 40%, var(--rule)); background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, #f5b942 14%, transparent), transparent 60%), var(--surface-card); }
.d-home-quick { margin-top: var(--s-4); }
.d-cls-extra { margin-top: var(--s-6); }
#tab-retos > div + div, #tab-herr .d-rsec + .d-rsec { margin-top: var(--s-6); }
.d-rhist li { justify-content: space-between; }

/* ---------- Práctica: curso que se practica y juegos ---------- */
.d-pcourse { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); max-width: 640px; }
.d-pcourse-b { display: flex; align-items: center; gap: var(--s-3); min-height: 64px; padding: var(--s-3); border-radius: var(--r-card); border: 1px solid var(--rule);
  background: var(--surface-card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.d-pcourse-b span:last-child { display: grid; gap: 2px; min-width: 0; }
.d-pcourse-b b { font-size: 15px; font-weight: 500; }
.d-pcourse-b small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.d-pcourse-b.on { border-color: transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--g-violet) border-box; border: 1.5px solid transparent; }
.d-pcourse-b:focus-visible { outline: 2px solid #c471ed; outline-offset: 2px; }
@media (max-width: 420px) { .d-pcourse-b small { display: none; } }
.d-pgames { margin-top: var(--s-6); }

/* Tu cuenta: apodo y grupos de estudio, a lo ancho debajo de los datos */
.d-me-social { grid-column: 1 / -1; }
.d-me-social .d-grp { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; }

/* ---------- Journal de trading (app/journal.js, pantalla #jr) ---------- */
.d-jr { max-width: 980px; margin: 0 auto; padding-bottom: 110px; }
.d-jr-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: var(--s-4) 0; }
.d-jr-acts .d-cta, .d-jr-acts .d-btn2 { width: auto; padding: 0 var(--s-5); }
.d-jr-empty { margin-top: var(--s-4); }
.d-jr-empty .lx { display: grid; gap: var(--s-3); margin: var(--s-3) 0; padding-left: 1.2em; line-height: 1.55; }
.d-jr-filters { align-items: flex-end; }
.d-jr .d-mk-kpis b small { font-size: 14px; font-weight: 400; color: var(--muted); }
.d-jr .d-rsec { margin-top: var(--s-6); }
.d-jr .d-rsec .d-h + .d-mk-scroll, .d-jr .d-rsec .d-help + .d-mk-scroll { margin-bottom: var(--s-5); }
.d-jr-form { gap: var(--s-4); }
.d-jr-form .d-panel { display: grid; gap: var(--s-4); }
.d-jr-form .d-h { margin: 0; }
.d-jr-grid { display: grid; gap: var(--s-4); }
@media (min-width: 700px) { .d-jr-grid { grid-template-columns: 1fr 1fr; } }
.d-flab { font-size: 13.5px; color: var(--muted); }
.d-jr-form textarea { width: 100%; min-height: 120px; padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel2);
  color: var(--ink); font: inherit; font-size: 16px; line-height: 1.5; resize: vertical; }
.d-jr-form textarea:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-jr-seg { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-jr-seg label, .d-jr-errs label { position: relative; cursor: pointer; }
.d-jr-seg input, .d-jr-errs input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.d-jr-seg span, .d-jr-errs span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4); border-radius: 999px; border: 1px solid var(--rule);
  background: var(--panel2); color: var(--muted); font-size: 14px; font-weight: 500; }
.d-jr-seg input:checked + span, .d-jr-errs input:checked + span { color: var(--ink); border-color: transparent; background: color-mix(in srgb, #8b3cf7 26%, var(--panel2)); }
.d-jr-seg input:focus-visible + span, .d-jr-errs input:focus-visible + span { outline: 2px solid #c471ed; outline-offset: 2px; }
.d-jr-errs { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; border: 0; }
.d-jr-errs legend { width: 100%; margin-bottom: var(--s-2); font-size: 13.5px; color: var(--muted); }
.d-jr-errs input:checked + span { background: color-mix(in srgb, var(--bad) 22%, var(--panel2)); }
.d-jr-calc { margin: 0; min-height: 1.5em; font-size: 15px; color: var(--muted); }
.d-jr-calc b.up { color: var(--good); } .d-jr-calc b.dn { color: var(--bad); }
.d-jr-calc.bad { color: var(--bad); }
.d-jr-imgs { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-jr-img { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-3); border-radius: var(--r-chip); border: 1px solid var(--rule); color: var(--ink); font-size: 14px; text-decoration: none; }
.d-jr-img .ph { width: 18px; height: 18px; color: var(--liq); }
.d-jr-win .d-trow-e { color: var(--good); font-weight: 600; }
.d-jr-loss .d-trow-e { color: var(--bad); font-weight: 600; }
/* Operaciones abiertas: naranja (verde y rojo quedan para el resultado de las cerradas), con la palabra «Abierta» para no depender del color */
.d-jr, .d-jr-card { --jr-open: var(--accent); --jr-open-ink: color-mix(in srgb, var(--accent) 68%, var(--ink)); }
.d-trow.d-jr-open { border-color: color-mix(in srgb, var(--jr-open) 45%, var(--rule)); background: color-mix(in srgb, var(--jr-open) 9%, var(--panel)); box-shadow: inset 3px 0 0 var(--jr-open); }
.d-trow.d-jr-open:hover:not(:disabled) { border-color: var(--jr-open); }
.d-jr-open .d-trow-m { white-space: normal; }
.d-jr-open .d-trow-i { color: var(--jr-open-ink); background: color-mix(in srgb, var(--jr-open) 16%, var(--panel2)); }
.d-jr-open .d-trow-e, .d-jr-openline { display: inline-flex; align-items: center; gap: var(--s-2); padding: 2px 10px; border-radius: 999px; font-weight: 600;
  color: var(--jr-open-ink); background: color-mix(in srgb, var(--jr-open) 16%, transparent); }
.d-jr-open .d-trow-e::before, .d-jr-openline::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--jr-open); animation: d-jr-live 2s ease-in-out infinite; }
@keyframes d-jr-live { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--jr-open) 60%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.d-jr-openline { justify-self: start; margin: 0; font-size: var(--t-sm); }
.d-jr-calc b.op { color: var(--jr-open-ink); }
.d-jr-new .d-trow-t::after { content: 'Nuevo'; margin-left: var(--s-2); padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; vertical-align: middle;
  color: var(--onaccent); background: var(--accent); }
.d-jr-card { display: grid; gap: var(--s-3); }
.d-jr-card-top { display: flex; align-items: flex-start; gap: var(--s-3); }
.d-jr-card-top .d-sim-ic { --g: var(--g-violet); }
.d-jr-card-top .d-help { margin: var(--s-1) 0 0; }
.d-jr-card .d-mk-kpis { margin: 0; }
#tab-perf #perfTrade { margin-bottom: var(--s-6); }
/* Laboratorio de setups (app/setups-panel.js, solo administración) */
.d-stp { max-width: 980px; margin: 0 auto; padding-bottom: 110px; }
.d-stp-head { display: grid; gap: var(--s-1); margin-bottom: var(--s-4); }
.d-stp-head .d-stp-back { justify-self: start; padding: 0; margin-bottom: var(--s-2); }
.d-stp-head .d-stp-view { justify-self: start; margin-top: var(--s-3); }
.d-stp-sec { margin-top: var(--s-6); display: grid; gap: var(--s-3); }
.d-stp-sec .d-h { margin: 0; }
.d-stp-sec h4.d-h { margin-top: var(--s-3); font-size: var(--t-sm); }
.d-stp-sec p { margin: 0; line-height: 1.55; }
.d-stp-k { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .d-stp-k { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.d-stp-ver { padding: var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel2); font-size: 15px; line-height: 1.55; }
.d-stp-lib { display: grid; gap: var(--s-3); }
.d-stp-acc .d-tacc-b { display: grid; gap: var(--s-3); }
.d-stp-acc .d-tacc-b > .d-btn2, .d-stp-list > .d-btn2 { justify-self: start; margin-top: var(--s-3); }
.d-stp-list { display: grid; gap: var(--s-2); }
.d-stp-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 var(--s-3); border-radius: 999px; font-size: var(--t-xs); font-weight: 600; margin-right: var(--s-2); }
.d-stp-chip.good { color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); }
.d-stp-chip.warn { color: var(--liq); background: color-mix(in srgb, var(--liq) 16%, transparent); }
.d-stp-chip.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.d-stp-rules { display: grid; gap: var(--s-2); margin: 0; padding-left: 1.3em; line-height: 1.55; }
.d-stp-curve { width: 100%; height: 160px; display: block; border-radius: var(--r-row); background: var(--panel2); }
.d-stp-curve polyline { fill: none; stroke: var(--fvg); stroke-width: 2; vector-effect: non-scaling-stroke; }
.d-stp-curve line.b { stroke: var(--rule); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.d-stp-flt { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.d-stp-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.d-stp-dot.good { background: var(--good); }
.d-stp-dot.bad { background: var(--bad); }
.d-stp-nav { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-5); }
.d-stp-acts { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.d-stp-mine textarea { width: 100%; padding: var(--s-3) var(--s-4); border-radius: var(--r-row); border: 1px solid var(--rule); background: var(--panel2); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.5; resize: vertical; }
.d-stp-mine textarea:focus-visible { outline: 2px solid #c471ed; outline-offset: 1px; }
.d-stp-mine .d-seg { justify-self: start; }
.d-stp-saved:empty { display: none; }
.d-stp-risk { margin-top: var(--s-6); }
.d-stp-charts { display: grid; gap: var(--s-4); }
.d-stp-fig { margin: 0; display: grid; gap: var(--s-2); }
.d-stp-fig figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); font-size: var(--t-sm); }
.d-stp-fig figcaption span { color: var(--muted); }
}
