/* Estructura de navegación de la app: pestañas (escritorio), barra inferior (móvil) y las cinco
   secciones de inicio. Se carga después de app-brand.css y usa sus colores. Prefijo d- para no
   chocar con las clases originales.

   SISTEMA DE ESPACIADO (el mismo 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));
}
[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); }

/* 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 { 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: 10.5px; 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 { margin: 0 0 var(--s-3); }
.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 { margin-top: var(--s-7) !important; }
.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: 11px; 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-les > div, .d-place > div, .d-cheer > div, .d-bh { min-width: 0; overflow-wrap: break-word; }

/* ---------- HOY ---------- */
.d-hoy { display: flex; flex-direction: column; }
.d-col { display: contents; }
.d-intro { order: 1; }
.d-ring { order: 2; margin-top: var(--s-5); }
.d-cheer { order: 3; margin-top: var(--s-5); }
.d-focus { order: 4; margin-top: var(--s-6); }
.d-actions { order: 5; margin-top: var(--s-5); }
.d-legend { order: 6; }
.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-cheer { display: flex; gap: var(--s-4); align-items: center; padding: var(--s-4); border-radius: var(--r-row); background: linear-gradient(110deg, rgba(255,112,67,.16), rgba(255,212,138,.05)); border: 1px solid rgba(255,138,76,.28); }
.d-spark { flex: none; width: 44px; height: 44px; border-radius: var(--r-chip); background: var(--g-orange); display: grid; place-items: center; color: #1f2126; }
.d-spark .ph { width: 24px; height: 24px; }
.d-cheer-t { margin: 0; font-weight: 600; }
.d-cheer-x { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.d-focus-row { display: flex; align-items: center; gap: var(--s-4); }
.d-focus-row b { font-size: 48px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.d-focus-row b .ph { width: 40px; height: 40px; color: var(--good); }
.d-focus-row span { font-size: 18px; font-weight: 300; line-height: 1.35; }
.d-actions-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.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; }
.d-actions .d-help { margin: var(--s-2) 0 0; }
#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-a-t { margin: 0; font-weight: 500; font-size: 15.5px; line-height: 1.3; }
.d-a-m { margin: var(--s-1) 0 0; color: var(--muted); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.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-legend { list-style: none; margin: var(--s-5) 0 0; padding: var(--s-5) 0 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.d-legend li { display: grid; gap: var(--s-2); }
.d-legend .dot { width: 12px; height: 12px; }
.d-legend b { font-size: 24px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.d-legend li > span:last-child { color: var(--muted); font-size: 13px; }
.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-hoy { display: grid; grid-template-columns: minmax(340px, 392px) 1fr; gap: var(--s-5); align-items: start; }
  .d-col { display: flex; flex-direction: column; }
  .d-left { 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-right { gap: var(--s-5); }
  .d-cheer, .d-actions, .d-trade { margin-top: 0; }
  .d-ring { margin-top: var(--s-6); }
  .d-focus { margin-top: var(--s-6); }
  .d-actions, .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 { 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); }
.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-belt { position: relative; overflow: hidden; padding: var(--s-5); border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--surface-card); box-shadow: var(--soft); }
.d-belt::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--bg-belt); }
.d-belt::after { content: ''; position: absolute; right: -25%; top: -55%; width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--bg-belt); opacity: .08; filter: blur(30px); pointer-events: none; }
.d-belt.cur { border: 1.5px solid transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--bg-belt) border-box; }
.d-belt.locked, .d-belt.soon { background: transparent; box-shadow: none; }
.d-belt.locked .d-les, .d-belt.soon .d-les { opacity: .55; }
.d-belt.soon { border-style: dashed; }
.d-belt header { display: flex; align-items: center; gap: var(--s-4); }
.d-bn { font-size: 32px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; background: var(--bg-belt); -webkit-background-clip: text; background-clip: text; color: transparent; }
.d-bh h3 { margin: 0; font-size: 19px; font-weight: 500; }
.d-bs { display: inline-flex; align-items: center; gap: var(--s-1); margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.d-belt.done .d-bs { color: var(--good); } .d-belt.cur .d-bs { color: var(--ink); }
.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-lessons { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-2); }
.d-les { display: grid; grid-template-columns: 44px 1fr; gap: var(--s-3); align-items: center; padding: var(--s-3); border-radius: var(--r-row); background: color-mix(in srgb, var(--ink) 3%, transparent); }
.d-les > button { grid-column: 1 / -1; min-height: 44px; }
@media (min-width: 560px) { .d-les { grid-template-columns: 44px 1fr auto; padding: var(--s-3) var(--s-3) var(--s-3) var(--s-3); } .d-les > button { grid-column: auto; } }
.d-les.d-next { background: color-mix(in srgb, #8b3cf7 10%, transparent); }
.d-les.soon { grid-template-columns: 1fr; padding: var(--s-3) var(--s-4); }
.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-les.done .d-lring::before { background: color-mix(in srgb, var(--good) 16%, var(--panel)); }
.d-lk { margin: 0; font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-les h4 { margin: 2px 0 0; font-size: 16px; font-weight: 500; line-height: 1.25; }
.d-lstat { margin: var(--s-1) 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.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 { margin: var(--s-6) 0 0; }
.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 ---------- */
#simRoutine .pathcard { margin: 0; }
.d-simsoon { margin-top: var(--s-7) !important; }

/* ---------- RENDIMIENTO ---------- */
#perfMods { margin-top: var(--s-7); }
.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); }
#perfTrade { margin-top: var(--s-5); }

/* ---------- 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 .modes { margin: 0 0 var(--s-5); gap: var(--s-4); }
#home .mode, #home .lvl, #home .pathcard, #home .rank { padding: var(--s-5); }
#home .mode, #home .lvl, #home .pathcard, #home .rank, #home .evalcard { border-radius: var(--r-card); }
#home .diffrow { margin: var(--s-6) 0 var(--s-2); }
#home .diffnote { margin: 0; }
#home .levels { margin: 0; gap: var(--s-4); }
@media (min-width: 720px) { #home .levels { gap: var(--s-5); } }
#home .evalcard { margin: 0; }
#home .rank { gap: var(--s-5); }
#home .foot { margin-top: var(--s-8); padding-top: var(--s-5); 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-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-bottom: var(--s-4); }
#home .modes + .d-help { margin-top: var(--s-4); }
#home .diffrow { margin-top: var(--s-7); }
.d-weak { margin-top: var(--s-7); }
.d-belts { gap: var(--s-5); }
.d-place { margin-bottom: var(--s-7); }
.d-simsoon { margin-top: var(--s-8) !important; }
#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-cheer { margin-top: var(--s-6); }
.d-focus { margin-top: var(--s-7); }
.d-actions { margin-top: var(--s-6); }
.d-trade { margin-top: var(--s-5); }
.d-legend { margin-top: var(--s-6); padding-top: var(--s-6); }
#home .foot { margin-top: var(--s-8); }
@media (min-width: 900px) {
  main { padding-top: var(--s-8); }
  .d-hoy { gap: var(--s-6); }
  .d-right { gap: var(--s-6); }
  .d-belts { gap: var(--s-6); }
  .d-mods { gap: var(--s-6); }
  #home .levels { gap: var(--s-6); }
  .d-cheer, .d-actions, .d-trade { margin-top: 0; }
  .d-mods .mod, .d-belt, #home .mode, #home .lvl, #home .pathcard, #home .rank { padding: var(--s-6); }
}

/* ---------- Lecciones ---------- */
.lesson .lhead { margin-bottom: var(--s-3); }
.lesson .ltrack { margin-bottom: var(--s-7); }
.lbody .lh { margin: 0 0 var(--s-5); }
.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 { 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 { gap: var(--s-3); margin: var(--s-5) 0 var(--s-6); }
.gloss div { padding: var(--s-4); }
.lwrap { margin: var(--s-5) 0; }
.stepbox { margin-top: var(--s-5); padding: var(--s-5); }
.stepn { margin-bottom: var(--s-2); }
.stepctl { margin-top: var(--s-5); gap: var(--s-3); }
.other { margin-top: var(--s-4); }
.cmp { 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 { gap: var(--s-3); margin: var(--s-5) 0; }
.toc li button { padding: var(--s-4) var(--s-5); gap: var(--s-4); }
.sumt { 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 { gap: var(--s-3); margin-top: var(--s-4); }
.rvi > div { padding: var(--s-4); }
.pdone { margin-top: var(--s-4) !important; }
.lcont { margin: var(--s-4) 0 var(--s-6); }
.lbody { padding-bottom: 160px; }
.lnav { padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); }
.lnav .in { gap: var(--s-3); }
.lhint { 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 { margin-bottom: var(--s-6); gap: var(--s-3); }
.stepper { margin-bottom: var(--s-6); }
.steprow { margin-bottom: var(--s-3); }
.playgrid { gap: var(--s-6); }
.qhead { gap: var(--s-3); }
.prompt { margin: var(--s-3) 0 var(--s-5); }
.shint { margin: 0 0 var(--s-5); padding-left: var(--s-3); }
.side { gap: var(--s-4); }
.controls { gap: var(--s-3); }
.card { 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 { gap: var(--s-3); }
.elist { gap: var(--s-3); margin: var(--s-2) 0 var(--s-4); }
@media (min-width: 920px) { .playgrid { gap: var(--s-7); } .side { top: 96px; } }

/* ---------- Resultados y resumen de casos ---------- */
.result { 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); }
.tkh { margin: var(--s-7) 0 var(--s-3); }
.ticket { margin: 0 0 var(--s-6); padding: var(--s-4) var(--s-5); }
.ticket th, .ticket td { padding: var(--s-3) 0; }
.csteps { 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-actions { order: 4; } .d-courses { order: 5; margin-top: var(--s-6); } .d-simblock { order: 6; margin-top: var(--s-6); }
.d-focus { order: 7; } .d-legend { order: 8; } .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.challenge { --t: 242 70 111; --g: linear-gradient(135deg, #ff7043 0%, #f2466f 55%, #c471ed 100%); }
.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); }
}
@media (min-width: 900px) and (max-width: 1099px) { .d-right .d-sims { grid-template-columns: 1fr; } }

/* Pie de la app: origen de la plataforma */
#home .foot { align-items: center; }
.d-origin { flex-basis: 100%; margin: 0 0 var(--s-2); color: var(--muted); font-size: 13.5px; }
.d-origin { 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-panel { grid-area: panel; 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 {
  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-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 { margin: 0 0 var(--s-3); }
.lbody .box.why h4::before { display: none; }
.lbody .box.why h4 { 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 { 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-mono.ghost { background: none; border: 1px dashed var(--rule); color: var(--muted); font-size: 22px; font-weight: 300; }
.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); }
.d-rpract { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; }
.d-rpract .d-help { margin: var(--s-2) 0 0; max-width: 60ch; }

/* Cursos activos en Inicio */
.d-courses .d-help { margin: var(--s-2) 0 var(--s-4); }
.d-clist { display: grid; gap: var(--s-3); }
.d-clist .d-course { padding: var(--s-4); align-items: center; }
.d-clist .d-course .d-abtn { align-self: center; }
.d-clist .d-course.more { border-style: dashed; background: transparent; }
.d-clist .d-course.more:hover { border-color: color-mix(in srgb, #c471ed 50%, var(--rule)); }
.d-clist .d-course.more h3 { font-size: 15px; }

/* 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 > header .d-bs { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s-1); font-size: 13px; color: var(--muted); }
.d-mdot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.d-mgroup.locked .d-mods { opacity: .6; }
.d-rpract { grid-column: 1 / -1; }
@media (min-width: 900px) { .d-courses { margin-top: 0; } }
@media (max-width: 480px) { .d-clist .d-course .d-mono { width: 40px; height: 40px; font-size: 12px; } .d-clist .d-course { gap: var(--s-3); } }

/* ---------- 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: 11.5px; 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: 11px; 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 ---------- */
@media (min-width: 720px) { #home .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { #home .levels { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lvl.free .pips i.f { background: var(--g-violet); }
.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: 11.5px; 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); }
.d-mk-bd { margin: var(--s-3) 0 var(--s-4); font-size: 14px; line-height: 1.5; color: var(--muted); }
#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, 64vh, 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 th, .d-mk-t td { padding-left: 10px; }
  .d-mk-t thead th { font-size: 10.5px; 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: 11.5px; 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, 62vh, 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(100vh - 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; }
}
