/* Layout: cuaderno de repertorio — lista de aperturas en rejilla; entrenador con tablero a la izquierda y panel de notación a la derecha (apilado en móvil). */
:root {
  --bg: #eef1ed; --surface: #ffffff; --surface-2: #e3e8e2; --ink: #18211c; --muted: #5b6a61; --line: #cfd8d0;
  --accent: #2c6a4a; --accent-ink: #ffffff; --brass: #b07d24;
  --sq-light: #ebe8d2; --sq-dark: #779657; --sq-last: rgba(214, 178, 60, .55); --sq-sel: rgba(44, 106, 74, .55); --sq-hint: rgba(64, 140, 220, .55);
  --good: #2e7d4f; --warn: #b8741a; --bad: #b3392f; --new: #6b6f8a;
  --f-display: "Spectral", Georgia, "Times New Roman", serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #111613; --surface: #19201c; --surface-2: #222b26; --ink: #e5ebe6; --muted: #98a79d; --line: #2e3933;
  --accent: #5db487; --accent-ink: #0d1611; --brass: #d9a64a;
  --sq-light: #d9d6be; --sq-dark: #6a8a4c;
  --good: #5fc08a; --warn: #e0a24a; --bad: #ec7468; --new: #a4a8c8; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #111613; --surface: #19201c; --surface-2: #222b26; --ink: #e5ebe6; --muted: #98a79d; --line: #2e3933;
  --accent: #5db487; --accent-ink: #0d1611; --brass: #d9a64a;
  --sq-light: #d9d6be; --sq-dark: #6a8a4c;
  --good: #5fc08a; --warn: #e0a24a; --bad: #ec7468; --new: #a4a8c8; color-scheme: dark }
* { box-sizing: border-box }
html, body { background: var(--bg) }
body { color: var(--ink); font: 16px/1.5 var(--f-body); }
.wrap { max-width: 1120px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.15 }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.5rem }
h3 { font-size: 1.15rem }
button { font: inherit; color: inherit; cursor: pointer }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700 }
.muted { color: var(--muted) }
.mono { font-family: var(--f-mono); font-size: .92em }

.top { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px }
.top p { margin: 6px 0 0; max-width: 60ch; color: var(--muted) }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 14px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center }
.btn:hover { border-color: var(--accent) }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn.primary:disabled { opacity: .45; cursor: default }
.btn.ghost { background: transparent }
.btn.small { padding: 5px 10px; font-size: .9rem }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px }
.stat b { display: block; font-family: var(--f-display); font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums }
.stat span { font-size: .85rem; color: var(--muted) }
.stat.due b { color: var(--brass) }

.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin: 8px 0 18px }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface) }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-weight: 600; font-variant-numeric: tabular-nums }
.seg button + button { border-left: 1px solid var(--line) }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink) }
.ctl-label { font-size: .9rem; color: var(--muted); margin-right: 6px }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px }
.card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0 }
.card:hover { border-color: var(--accent) }
.card .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline }
.card p { margin: 0; font-size: .92rem; color: var(--muted) }
.side-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink); vertical-align: -1px; margin-right: 6px }
.side-dot.w { background: #fafafa } .side-dot.b { background: #1a1a1a }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: flex }
.bar i { display: block; height: 100% }
.bar .g { background: var(--good) } .bar .a { background: var(--warn) }
.card .meta { font-size: .82rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap }
.card .meta .due { color: var(--brass); font-weight: 700 }

.chip { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap }
.chip.nueva { color: var(--new) } .chip.aprendiendo { color: var(--warn) } .chip.pendiente { color: var(--brass) } .chip.repaso { color: var(--accent) } .chip.dominada { color: var(--good) }

.lines { display: flex; flex-direction: column; gap: 8px; margin-top: 14px }
.line-row { display: grid; grid-template-columns: 2rem 1fr auto; gap: 10px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px }
.line-row .rank { font-family: var(--f-display); font-size: 1.3rem; color: var(--muted); text-align: center }
.line-row .txt { min-width: 0 }
.line-row .txt .mono { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.line-row .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end }
.line-row.out { opacity: .55 }

/* Entrenador a pantalla completa: barra superior, explicación de la jugada, tablero y barra inferior fija (sin scroll). En pantallas anchas, tablero a la izquierda y columna de notas a la derecha. */
:root { --arrow: rgba(201, 58, 46, .82); --arrow-hint: rgba(44, 106, 74, .8) }
.tv { position: fixed; inset: 0; z-index: 5; background: var(--bg); display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "prog" "card" "board" "bar";
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tv-top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px; min-width: 0 }
.tv-title { flex: 1; min-width: 0; line-height: 1.2 }
.tv-title .eyebrow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.tv-title strong { display: block; font-family: var(--f-display); font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.icon { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 10px; display: inline-grid; place-items: center; flex: none }
.icon:hover { background: var(--surface-2) }
.icon svg, .tb svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }
.tv-prog { grid-area: prog; height: 6px; margin: 0 12px 8px; border-radius: 3px; background: var(--surface-2); overflow: hidden }
.tv-prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s }
.tv-card { grid-area: card; margin: 0 10px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  height: clamp(7.4em, 22vh, 11.5em); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; font-size: 1rem; line-height: 1.42 }
.tv-card .mv { font-family: var(--f-mono); font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: 3px; flex-wrap: wrap }
.tv-card .mv b { color: var(--ink); font-size: .95rem }
.tv-card .who { font-family: var(--f-body); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor }
.tv-card .who.me { color: var(--accent) } .tv-card .who.op { color: var(--muted) }
.tv-card p { margin: 0 }
.tv-card .st { font-weight: 700; margin-bottom: 4px }
.tv-card .st.ok { color: var(--good) } .tv-card .st.err { color: var(--bad) } .tv-card .st.done { color: var(--accent) }
.tv-card .prev { color: var(--muted); font-size: .9rem; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line) }
.tv-boardarea { grid-area: board; min-height: 0; min-width: 0; display: grid; place-items: start center; padding: 0 6px }
.board-wrap { position: relative; width: 100%; max-width: 100%; touch-action: none; user-select: none; -webkit-user-select: none }
.board { position: relative; width: 100%; aspect-ratio: 1; max-width: 100%; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px var(--line) }
.board.shake { animation: shake .3s }
@keyframes shake { 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
@media (prefers-reduced-motion: reduce) { .board.shake { animation: none; box-shadow: 0 0 0 3px var(--bad) } .tv-prog i { transition: none } }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3 }
.sq { position: relative; background: var(--sq-light) }
.sq.d { background: var(--sq-dark) }
.sq.last::before, .sq.sel::before, .sq.hint::before, .sq.wrong::before { content: ""; position: absolute; inset: 0 }
.sq.last::before { background: var(--sq-last) }
.sq.sel::before { background: var(--sq-sel) }
.sq.hint::before { background: var(--sq-hint) }
.sq.wrong::before { background: rgba(200, 50, 40, .5) }
.sq.target::after { content: ""; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(20, 40, 30, .28) }
.sq.target.cap::after { left: 4%; top: 4%; width: 92%; height: 92%; background: transparent; border: 5px solid rgba(20, 40, 30, .28) }
.pc { position: absolute; inset: 0; background-size: 100% 100%; z-index: 1; pointer-events: none }
.coord { position: absolute; font: 700 10px/1 var(--f-body); z-index: 2; pointer-events: none; opacity: .8 }
.coord.f { right: 3px; bottom: 3px } .coord.r { left: 3px; top: 3px }
.sq .coord { color: var(--sq-dark) } .sq.d .coord { color: var(--sq-light) }
.drag { position: fixed; z-index: 50; pointer-events: none; background-size: 100% 100%; transform: translate(-50%, -50%) }
.tv-bar { grid-area: bar; display: flex; align-items: center; gap: 2px; padding: 8px 6px 10px; border-top: 1px solid var(--line); background: var(--surface) }
.tb { border: 0; background: transparent; min-width: 44px; height: 52px; border-radius: 10px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); padding: 0 4px }
.tb:hover { background: var(--surface-2); color: var(--ink) }
.tb:disabled { opacity: .3; cursor: default; background: transparent }
.tb.big svg { width: 30px; height: 30px; stroke-width: 2.4 }
.tb.big { color: var(--ink); min-width: 52px }
.tb.on { color: var(--accent) }
.tb-main { flex: 1; min-width: 0; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: .9rem; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 4px }
.tb-main.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.tb-main .sub { font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums }
.tv-side { grid-area: side; display: none; min-height: 0; overflow-y: auto; padding: 0 10px 10px }
.moves { font-family: var(--f-mono); font-size: .95rem; display: flex; flex-wrap: wrap; gap: 2px 4px; line-height: 1.9 }
.moves .n { color: var(--muted); margin-left: 6px }
.moves button { border: 0; background: transparent; padding: 0 4px; border-radius: 4px; font: inherit }
.moves button.cur { background: var(--accent); color: var(--accent-ink) }
.moves button.fut { color: var(--muted); opacity: .5 }
.moves .hidden { color: var(--muted) }
.idea { margin: 10px 0 0; font-size: .95rem; border-left: 3px solid var(--brass); padding-left: 10px }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.18);
  max-height: 62vh; overflow-y: auto; padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)) }
.sheet .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px }
.lines-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px }
.lines-list button { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; font-weight: 600; display: flex; gap: 8px; align-items: center }
.lines-list button.cur { border-color: var(--accent); color: var(--accent) }
.lines-list .k { font-family: var(--f-mono); color: var(--muted); font-size: .85rem; min-width: 2ch }
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35) }
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .tv { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "top top" "prog prog" "board card" "board side" "board bar"; column-gap: 8px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) }
  .tv-card { height: auto; max-height: 40vh; margin: 0 14px 10px 0 }
  .tv-side { display: block; padding: 0 14px 10px 0 }
  .tv-bar { border: 1px solid var(--line); border-radius: 12px; margin-right: 14px }
  .tv-boardarea { padding: 0 10px 0 16px }
  .only-narrow { display: none !important }
}

.opt { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); margin: 2px 0 8px; cursor: pointer }
.opt input { width: 18px; height: 18px; accent-color: var(--accent) }

/* Niveles Elo: selector, recomendación de repertorio y guía por apertura */
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0 }
.wrapseg { display: inline-grid; grid-template-columns: repeat(4, auto); gap: 1px; background: var(--line) }
.wrapseg button { background: var(--surface) }
.seg.wrapseg button + button { border-left: 0 }
.wrapseg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink) }
@media (max-width: 560px) { .wrapseg { grid-template-columns: 1fr 1fr; width: 100% } }
.lvl { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 1px 8px; border-radius: 999px; white-space: nowrap; vertical-align: 1px }
.lvl.ok { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent) }
.lvl.hi { border: 1px dashed var(--muted); color: var(--muted) }
.rep { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; margin: 4px 0 14px }
.rep-head p { margin: 4px 0 4px; max-width: 70ch }
.rep-row { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 4px 12px; align-items: baseline; border-top: 1px solid var(--line); padding-top: 8px }
.rep-k { font-weight: 700; font-size: .9rem; color: var(--muted) }
.rep-v { display: flex; flex-wrap: wrap; gap: 6px }
.rep-link { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 3px 12px; font-weight: 600; font-size: .92rem }
.rep-link:hover { border-color: var(--accent); color: var(--accent) }
@media (max-width: 560px) { .rep-row { grid-template-columns: minmax(0, 1fr) } }
.guide { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 14px; display: grid; gap: 2px }
.g-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px }
.g-head h2 { font-size: 1.2rem }
.g-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 4px 14px; padding: 8px; border-radius: 8px; align-items: baseline }
.g-row p { margin: 0; font-size: .95rem; color: var(--muted) }
.g-row.cur { background: var(--surface-2) }
.g-row.cur p { color: var(--ink) }
.g-k { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 700; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums }
.g-row.cur .g-k { color: var(--accent) }
@media (max-width: 560px) { .g-row { grid-template-columns: minmax(0, 1fr) } }
.tv-card .mv .lvl { font-family: var(--f-body) }

@media (max-width: 560px) {
  .line-row { grid-template-columns: 1.6rem minmax(0, 1fr) }
  .line-row .acts { grid-column: 2 / -1; justify-content: flex-start }
  .line-row .rank { align-self: start; font-size: 1.1rem }
}

/* Entrenador personal */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); margin-bottom: 18px }
.tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; color: var(--muted) }
.tabs button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2 }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12) }
.panel-c { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 0 0 16px; display: grid; gap: 10px; min-width: 0 }
.panel-c h2 { font-size: 1.35rem }
.panel-c p { margin: 0; max-width: 72ch }
.panel-c .summary { margin: 4px 0 0 }
.h3c { font-size: 1rem; margin-top: 8px }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px }
.steps .mono { word-break: break-all; background: var(--surface-2); padding: 1px 5px; border-radius: 4px }
.panel-c.mine { grid-template-columns: minmax(0, 1fr) auto; align-items: center }
@media (max-width: 560px) { .panel-c.mine { grid-template-columns: minmax(0, 1fr) } }
.dg { display: grid; gap: 8px }
.dg-row { display: grid; grid-template-columns: 11rem minmax(0, 1fr) 3.2rem; gap: 2px 10px; align-items: center }
.dg-k { font-weight: 600; font-size: .92rem }
.dg-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden }
.dg-bar i { display: block; height: 100%; background: var(--brass); border-radius: 5px }
.dg-v { font-variant-numeric: tabular-nums; text-align: right; font-weight: 700; font-size: .9rem }
.dg-note { grid-column: 1 / -1; font-size: .85rem; color: var(--muted) }
@media (max-width: 560px) { .dg-row { grid-template-columns: minmax(0, 1fr) 3.2rem } .dg-bar { grid-column: 1 / -1; grid-row: 2 } }
.prio { margin: 0; padding-left: 1.3em; display: grid; gap: 10px }
.prio li { display: grid; gap: 4px; justify-items: start }
.prio li span { color: var(--muted); font-size: .93rem }
.tbl-wrap { overflow-x: auto }
.tbl { border-collapse: collapse; width: 100%; font-size: .92rem }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line) }
.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted) }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-align: left }
.prio-chip { background: color-mix(in srgb, var(--brass) 20%, transparent); color: var(--brass) }
.lesson h3 { font-size: 1.02rem; margin-top: 6px }
.ticks { margin: 0; padding-left: 1.2em; display: grid; gap: 5px }
.ticks li::marker { color: var(--accent) }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr } }
.ex-p { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px }
.opts { display: grid; gap: 6px; margin-top: 8px }
.opt-b { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: .95rem; align-items: start }
.opt-b:hover:not(:disabled) { border-color: var(--accent) }
.opt-b .ol { font-weight: 700; color: var(--muted); font-family: var(--f-mono) }
.opt-b em { display: block; font-style: normal; font-size: .88rem; margin-top: 4px; color: var(--muted) }
.opt-b.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--bg)) }
.opt-b.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg)) }
.opt-b.dim { opacity: .55 }
.opt-b:disabled { cursor: default; color: var(--ink) }
.explain { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: .95rem }
.bar-note { flex: 1; text-align: center; color: var(--muted); font-size: .9rem }
.sheet.ask { display: grid; gap: 10px }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.chipq { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: .9rem; text-align: left }
.chipq:hover:not(:disabled) { border-color: var(--accent); color: var(--accent) }
.ask-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end }
.ask-form textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; resize: vertical; min-height: 2.6em; width: 100% }
.ask-q { font-weight: 700 }
.ask-a p { margin: 0 0 8px }
.small { font-size: .82rem }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0) }
.ask-btn { color: var(--accent) }
@media (max-width: 560px) { .section-title { flex-direction: column; align-items: flex-start; gap: 2px } }

.tv-card.tall { height: clamp(12em, 48vh, 30em) }
@media (min-width: 900px) and (min-aspect-ratio: 1/1) { .tv-card.tall { height: auto; max-height: 62vh } }

.themes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px }
.themes li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line) }
.th-n { font-family: var(--f-display); font-size: 1.3rem; font-weight: 700; color: var(--brass); text-align: center; font-variant-numeric: tabular-nums }
.th-t { font-weight: 600 }
.th-b { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end }
@media (max-width: 560px) { .themes li { grid-template-columns: 2.2rem minmax(0, 1fr) } .th-b { grid-column: 2; justify-content: flex-start } }

.lastmv { font-size: .92rem; margin: 2px 0 4px }
.lastmv b { font-family: var(--f-mono) }

.tcs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px }
.tc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; background: var(--bg) }
.tc-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline }
.tc-f { font-weight: 600 }
.card.locked { opacity: .78 }
.lock-chip { background: color-mix(in srgb, var(--brass) 18%, transparent); color: var(--brass) }
.foot { margin-top: 36px; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center }
.confirm { display: inline-flex; gap: 8px; align-items: center }
.queue-info { font-size: .88rem; color: var(--muted) }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: .85rem; color: var(--muted); align-items: center }


/* ===== Web: barra superior, portada, alta, cuenta y panel ===== */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg) }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--bg) }
.tb-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.brand { border: 0; background: none; display: inline-flex; gap: 10px; align-items: center; font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; padding: 4px 0 }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 1.3rem; line-height: 1 }
.tb-r { display: flex; gap: 8px; align-items: center; min-width: 0 }
.chip.plan { color: var(--accent) } .chip.demo { color: var(--brass) }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; padding: 0; font-weight: 700 }
.avatar img { width: 100%; height: 100%; object-fit: cover }
.tp { height: 3px; background: var(--surface-2) } .tp i { display: block; height: 100%; background: var(--brass); transition: width .4s }
@media (max-width: 520px) { .brand span:last-child { display: none } .chip.plan { max-width: 46vw; overflow: hidden; text-overflow: ellipsis } }
.btn.big { padding: 12px 18px; font-size: 1.02rem; border-radius: 10px }
.btn .g, .btn svg.g { width: 20px; height: 20px }
.tab-cta { color: var(--accent) !important }
.splash { min-height: 50vh; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted) }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 1s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none } }
.ob { max-width: 560px; margin: 24px auto; display: grid; gap: 12px }
.ob h1 { font-size: clamp(1.7rem, 4vw, 2.3rem) }
.ob p { margin: 0 }
.ob-dots { display: flex; gap: 6px } .ob-dots i { width: 28px; height: 5px; border-radius: 3px; background: var(--surface-2) } .ob-dots i.on { background: var(--accent) }
.ob-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px }
.ob-form { display: grid; gap: 10px }
.pick { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer }
.pick input { width: 20px; height: 20px; accent-color: var(--accent) }
.ob-user, .code-form { display: grid; gap: 6px }
.ob-user label, .code-form label { font-weight: 600; font-size: .92rem }
input:not([type=checkbox]), .sel { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; min-width: 0; width: 100% }
input:focus-visible, .sel:focus-visible { outline: 3px solid var(--brass); outline-offset: 1px }
.row-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px }
.form-msg { min-height: 1.3em; color: var(--bad); font-size: .92rem; margin: 0 }
.w-progress { display: grid; gap: 8px }
.w-step { font-weight: 600; margin: 0 }
.bar.big { height: 10px; border-radius: 5px }
.cta-panel { background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 8%, var(--surface))) }
#w-modal .w-dialog { position: fixed; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25) }
#w-modal .scrim { z-index: 39 }
#w-modal h3 { font-size: 1.02rem; margin-top: 4px }
.w-x { justify-self: end }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25) }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap }
.daybars { display: flex; align-items: flex-end; gap: 3px; height: 70px; padding-top: 6px }
.daybars i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .85 }
.spark-wrap { display: grid; gap: 4px } .spark { width: 100%; height: 60px }
.block { display: block }
.tbl.ad tbody tr { cursor: pointer } .tbl.ad tbody tr:hover { background: var(--surface-2) }
.tbl input { padding: 6px 8px } .tbl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent) }
.up { color: var(--good) } .down { color: var(--bad) }
.chip.p-club { color: var(--accent) } .chip.p-trial { color: var(--brass) } .chip.p-expired { color: var(--bad) } .chip.p-pro { color: var(--good) }
.ad-config { display: grid; gap: 10px } .ad-config > label:not(.pick) { display: grid; gap: 4px; max-width: 320px; font-weight: 600; font-size: .92rem } .ad-config > label.pick { max-width: 320px }
.ad-plan { display: flex; flex-wrap: wrap; gap: 8px; align-items: center } .ad-plan label { display: flex; gap: 6px; align-items: center } .ad-plan .sel, .ad-plan input { width: auto }
.controls .sel { width: auto }

.w-dialog:focus { outline: none }

/* ===== Estilo de app de ajedrez (2026-11-09, ver DESIGN.md): claro, navegación global arriba y pestañas abajo en móvil ===== */
:root, :root[data-theme="light"] {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #eceae4; --ink: #1d1d1b; --muted: #595b5f; --line: #dddbd4;
  --accent: #2f5bea; --accent-ink: #ffffff; --accent-soft: #e8eefe; --brass: #b4570d;
  --f-display: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
body { font-size: 17px; background: var(--bg) }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em }
.btn { border-radius: 8px; min-height: 44px; justify-content: center }
.btn.big { border-radius: 10px; min-height: 52px; padding: 12px 20px }
.btn.small { min-height: 44px }
.brand { min-height: 48px }
.btn.primary:hover { background: #2348c4; border-color: #2348c4 }
.eyebrow { text-transform: none; letter-spacing: 0; font-size: .92rem; font-weight: 600; color: var(--accent) }
:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px }

/* Barra superior */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: none }
.tb-in { gap: 8px; padding-block: 0; min-height: 56px }
.brand { gap: 10px; font-family: var(--f-body); font-weight: 700; font-size: 1.1rem; flex: none }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center }
.brand .logo svg { width: 22px; height: 22px; fill: currentColor; stroke: none }
.tnav { display: flex; align-items: stretch; gap: 2px; margin-right: auto; margin-left: 16px; align-self: stretch }
.tnav > * { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 56px; border: 0; background: none; color: var(--muted);
  font: 600 1rem var(--f-body); text-decoration: none; cursor: pointer; box-shadow: inset 0 -3px 0 transparent; transition: color .15s, box-shadow .15s, background-color .15s }
.tnav > *:hover { color: var(--ink); background: var(--bg) }
.tnav > [aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent) }
.tnav svg, #bnav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.tb-r { gap: 10px }
.chip.plan { background: var(--accent-soft); color: #1d3fae; border: 0; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .9rem }
.avatar { width: 40px; height: 40px }
.tabs { display: none !important }

/* Pestañas inferiores (móvil) */
#bnav { display: none }
@media (max-width: 899px) {
  .tnav { display: none }
  /* Portada en móvil: las secciones pasan a una fila deslizable bajo la barra y la acción principal sigue visible */
  .is-landing .tb-in { flex-wrap: wrap }
  .is-landing .tnav { display: flex; order: 3; width: 100%; margin: 0 -16px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line) }
  .is-landing .tnav > * { min-height: 48px; white-space: nowrap; padding: 0 12px }
  .is-landing .tb-r .btn:not(.tb-cta) { display: none }
  body.has-bnav { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) }
  body.has-bnav #bnav:not([hidden]) { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px) }
  #bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 64px; border: 0; background: none;
    color: var(--muted); font: 600 .8rem var(--f-body); cursor: pointer }
  #bnav button svg { width: 24px; height: 24px }
  #bnav [aria-current="page"] { color: var(--accent) }
  #bnav [aria-current="page"] svg { stroke-width: 2.2 }
}

/* Portada */
.lp { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding-bottom: 8px }
.lp > * { min-width: 0 }
.lp h2 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem); line-height: 1.15 }
.lp-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; padding: 40px 0 56px }
.lp-hero h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.4rem); line-height: 1.06; letter-spacing: -0.02em }
.lp-hero-t p { font-size: 1.2rem; color: var(--muted); margin: 18px 0 0; max-width: 46ch }
.lp-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px }
.lp-note { font-size: .95rem; color: var(--muted); margin-top: 12px }
.lp-plan { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; scroll-margin-top: 72px }
.lp-plan-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px }
.lp-plan-h h2 { font-size: 1.25rem }
.lp-plan-h span { font-size: .85rem; color: var(--muted); background: var(--bg); padding: 2px 10px; border-radius: 999px }
/* Selector segmentado único (portada y app): como los conmutadores de Lichess */
.seg, .seg.wrapseg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none; background: var(--surface-2); border: 0; border-radius: 10px; padding: 4px; gap: 4px; overflow: visible }
.seg.wrapseg { grid-auto-flow: row; grid-template-columns: repeat(4, auto) }
.seg button, .seg.wrapseg button { min-height: 44px; border: 0 !important; border-radius: 8px; background: none; padding: 6px 14px; font: 600 1rem var(--f-body); color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s }
.seg button:hover { color: var(--ink) }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"], .seg.wrapseg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .14) }
@media (max-width: 560px) { .seg.wrapseg { grid-template-columns: 1fr 1fr; width: 100% } }
.lp-plan .seg { display: grid; width: 100%; margin-bottom: 16px }
.lp-sheet h3 { font-size: 1.1rem }
.lp-sheet .meta { color: var(--muted); margin: 2px 0 10px; font-size: .92rem }
.lp-sheet table { width: 100%; border-collapse: collapse; font-size: .98rem }
.lp-sheet td { padding: 10px 0; border-top: 1px solid var(--line); vertical-align: top }
.lp-sheet td:first-child { width: 96px; font-weight: 600 }
.lp-sheet td:last-child { text-align: right; white-space: nowrap; color: var(--muted); padding-left: 12px }
.lp-sheet .why { margin: 12px 0 0; background: var(--accent-soft); color: #1b2c66; padding: 12px 14px; border-radius: 8px; font-size: .95rem }
.lp-how, .lp-inc, .lp-price { padding: 56px 0; border-top: 1px solid var(--line); scroll-margin-top: 64px }
.lp-how h2, .lp-price h2 { scroll-margin-top: 72px }
.lp-steps { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: st }
.lp-steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; counter-increment: st; display: flex; flex-direction: column; gap: 8px }
.lp-steps li b { font-size: 1.15rem; display: flex; gap: 10px; align-items: center }
.lp-steps li b::before { content: counter(st); width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .95rem; flex: none }
.lp-steps p { margin: 0; color: var(--muted) }
.lp-call { margin-top: auto; background: var(--bg); border-radius: 8px; padding: 12px 14px; font-size: .95rem }
.lp-inc { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 40px; align-items: center }
.lp-inc figure { margin: 0 }
.lp-inc img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; filter: grayscale(1) contrast(1.05) }
.lp-feats { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 14px }
.lp-feats li { padding-left: 34px; position: relative; color: var(--muted) }
.lp-feats li::before { content: ""; position: absolute; left: 0; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%232f5bea' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat }
.lp-feats b { display: block; color: var(--ink); font-size: 1.08rem }
.lp-tbl { overflow-x: auto; margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px }
.lp-price table { width: 100%; min-width: 600px; border-collapse: collapse }
.lp-price th, .lp-price td { text-align: left; padding: 14px 16px; vertical-align: middle; border-top: 1px solid var(--line) }
.lp-price thead th { border-top: 0; font-size: 1.2rem }
.lp-price tbody th { font-weight: 400 }
.lp-price thead th small { display: block; font-size: .85rem; font-weight: 400; color: var(--muted) }
.lp-price .rec { background: var(--accent-soft) }
.lp-price thead .rec small { color: #1b2c66 }
.lp-pcards { display: none }
@media (max-width: 640px) {
  .lp-tbl { display: none }
  .lp-pcards { display: grid; gap: 12px; margin-top: 20px }
  .lp-pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px }
  .lp-pcard.rec { border: 2px solid var(--accent) }
  .lp-pcard h3 { font-size: 1.25rem } .lp-pcard h3 small { font-size: .9rem; font-weight: 400; color: var(--muted); margin-left: 6px }
  .lp-pcard ul { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 6px; color: var(--muted) }
  .lp-pcard li b { color: var(--ink); font-weight: 600 }
  .lp-pcard .btn { width: 100% }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.lp-close { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; background: var(--accent-soft); border-radius: 16px; padding: 32px; margin: 8px 0 32px }
.lp-close p { margin: 6px 0 0; color: #1b2c66 }
.lp-foot { border-top: 1px solid var(--line); padding: 20px 0 8px; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px }
.lp-foot p { margin: 0 }
.lp .rv { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1) }
.lp .rv.in { opacity: 1; transform: none }
@media (prefers-reduced-motion: reduce) { .lp .rv { opacity: 1; transform: none; transition: none } }
@media (max-width: 899px) {
  .lp-hero { grid-template-columns: 1fr; gap: 28px; padding: 20px 0 40px }
  .lp-ctas .btn { flex: 1 1 100% }
  .lp-steps { grid-template-columns: 1fr }
  .lp-inc { grid-template-columns: 1fr; gap: 24px }
  .lp-close { padding: 24px }
  .lp-close .btn { flex: 1 1 100% }
  .lp-sheet td:first-child { width: 84px }
}
@media (max-width: 899px) { .tb-r .btn.small { padding: 8px 14px } }
@media (max-width: 520px) { .brand span:last-child { display: inline } .brand { font-size: 1rem } .chip.plan { display: none } }
@media (max-width: 380px) { .brand span:last-child { display: none } }

/* Alta: paso del usuario con ayuda */
.ob.ob-wide { max-width: 760px }
.ob-step { color: var(--muted); font-size: .95rem }
.ob-user .row-in { display: flex; gap: 10px }
.ob-user .row-in input { flex: 1; min-height: 48px; font-size: 1.05rem; border-radius: 8px }
.form-msg.ok { color: #11602c; background: #e8f6ec; padding: 10px 14px; border-radius: 8px }
.uh { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 14px }
.uh figure { margin: 0 }
.uh p { margin: 0; font-size: 16px }
.uh figcaption { font-size: 15px; color: var(--muted); margin-top: 8px }
.win { background: #fff; border: 1px solid #d4d4d4; border-radius: 8px; overflow: hidden; font-family: system-ui, sans-serif; font-size: 13px; color: #222 }
.win .top { display: flex; gap: 6px; align-items: center; padding: 8px 10px; background: #ececec }
.win .top i { width: 9px; height: 9px; border-radius: 50%; background: #c4c4c4 }
.win .url { flex: 1; margin-left: 8px; background: #fff; padding: 4px 10px; border-radius: 12px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.win mark { background: #ffe14d; color: #000; padding: 0 2px; outline: 2px solid #e0461d }
.win .body { display: flex; gap: 12px; align-items: center; padding: 16px }
.win .av { width: 48px; height: 48px; background: #cfcfcf; flex: none; border-radius: 6px }
.win .name { font-weight: 700; font-size: 16px }
.win .sub { color: #767676; margin-top: 3px }
.win.dark { background: #262421; border-color: #3a3835 } .win.dark .top { background: #1a1917 } .win.dark .url { background: #3a3835; color: #ccc }
.win.dark .name { color: #eee } .win.dark .av { background: #555 }
@media (max-width: 640px) { .uh { grid-template-columns: 1fr } .ob-user .row-in { flex-direction: column } }
@media (max-width: 899px) { .lp-inc figure { order: 2 } }
.lp-hero h1 { font-size: clamp(2.1rem, 1.4rem + 2.2vw, 3rem) }

/* Botón con icono en la barra del entrenador (Reproducir el plan) */
.tb-main svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round }

/* Elo de la semana en Mi cuenta */
.elo-week { margin: 8px 0 4px }
.elo-week b { font-size: 1.25rem; color: var(--accent); font-variant-numeric: tabular-nums }
.start-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: .92rem; color: var(--muted, #5c5c5c) }
.start-form input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, #fff); color: inherit; min-height: 40px }

/* ===== Claves de la apertura (keys-ui.js) ===== */
.keys { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 14px }
.keys figure { margin: 0 }
.keys figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; line-height: 1.4 }
.kb { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .15) }
.kb i { background: var(--sq-light); background-size: 100% 100%; background-repeat: no-repeat }
.kb i.d { background-color: var(--sq-dark) }
.kb svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none }
.keys h2 { margin: 0 0 8px; font-size: 1.15rem }
.keys ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px }
.keys li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 10px; font-size: .95rem; line-height: 1.4; padding-bottom: 7px; border-bottom: 1px solid var(--line) }
.keys li:last-child { border-bottom: 0 }
.keys li b { font-weight: 700 }
.keys li.kt-plan b, .keys li.kt-debil-rival b { color: var(--accent) }
.keys li.kt-debil-tuyo b, .keys li.kt-evita b { color: #b3261e }
.keys-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px }
.keys-line { font-size: .88rem; margin: 6px 0 0; color: var(--ink, inherit); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.kq { max-width: 640px; margin: 14px auto 0 }
.kq-prog { font-size: .88rem; color: var(--muted); margin-bottom: 8px }
.kq-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 20px; min-height: 220px }
.kq-card h2 { font-size: 1.25rem; line-height: 1.35; margin: 10px 0 12px }
.kq-a { font-size: 1.08rem; line-height: 1.5; background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin: 0 }
@media (max-width: 720px) {
  .keys { grid-template-columns: minmax(0, 1fr); padding: 14px }
  .keys-pos { max-width: 340px; width: 100%; margin: 0 auto }
  .keys li { grid-template-columns: minmax(0, 1fr); gap: 2px }
}

/* ---------- Hoy · Tu progreso · Preparar rival (maqueta aprobada 2026-11-11, js/hub.js) ---------- */
:root { --ok-ink: #1f7a4d; --ok-soft: #e3f3ea; --bad-ink: #b42318; --warm-ink: #8a3f06; --warm-soft: #fbeee2; --seg-edge: #bdbab1 }
.hb-i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none }
.hb-top { align-items: flex-start }
.hb-top h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2rem) }
.hb-top h1:focus { outline: none }
.hb-eb { display: flex; align-items: center; gap: 10px; flex-wrap: wrap }
.hb-streak { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; border-radius: 999px; background: var(--warm-soft); color: var(--warm-ink); font-size: .9375rem }
.hb-streak .hb-i { width: 18px; height: 18px; color: var(--brass) }
.hb-streak.zero { background: var(--surface-2); color: var(--muted) }
.hb-streak.zero .hb-i { color: var(--muted) }
.hb-party .hb-streak { animation: hb-pop .6s ease-out 2 }
@keyframes hb-pop { 0% { transform: scale(1) } 40% { transform: scale(1.18) } 100% { transform: scale(1) } }

/* lista de bloques (Hoy, Qué preparar) */
.hb-list { list-style: none; margin: 0 0 16px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden }
.hb-row + .hb-row { border-top: 1px solid var(--line) }
.hb-row > button, .hb-row > .hb-static { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer }
.hb-row > .hb-static { cursor: default }
.hb-row > button:hover { background: var(--bg) }
.hb-ic { width: 28px; height: 40px; display: grid; place-items: center; flex: none; color: var(--accent) }
.hb-tx { flex: 1; min-width: 0; display: flex; flex-direction: column }
.hb-tx b { font-weight: 700 }
.hb-tx span { color: var(--muted); font-size: .9375rem }
.hb-min { color: var(--muted); font-size: .9375rem; white-space: nowrap }
.hb-row.done .hb-ic, .hb-row.done .hb-min { color: var(--ok-ink) }
.hb-row.done .hb-min { font-weight: 700 }
.hb-row.done .hb-tx b { color: var(--muted) }
.hb-go { margin: 0 0 22px }
.hb-go .btn { width: 100%; justify-content: center }
@media (min-width: 900px) { .hb-go .btn { width: auto; min-width: 320px } }

/* plan del mes */
.hb-plan-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap }
.hb-plan-h h2 { margin: 0 }
.hb-plan-n { margin: 10px 0 8px }
.hb-goals { list-style: none; margin: 14px 0 6px; padding: 0 }
.hb-goals li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line) }
.hb-goals li > span { flex: 1 }
.hb-goals li .hb-i { width: 20px; height: 20px; color: var(--muted) }
.hb-goals li.ok .hb-i { color: var(--ok-ink) }
.hb-goals .btn { min-height: 44px; min-width: 56px }
.hb-cta h2 { display: flex; align-items: center; gap: 8px }
.hb-note { font-size: .875rem; color: var(--muted) }

/* controles segmentados: la plataforma manda; el ritmo es secundario y más pequeño */
.hb-plat { display: grid; width: 100%; margin-bottom: 14px }
.hb-keys { margin-bottom: 12px; background: none; padding: 0; gap: 8px }
.hb-keys button { min-height: 44px; border: 1px solid var(--line) !important; border-radius: 999px; padding: 6px 16px; background: var(--surface) }
.hb-keys button[aria-pressed="true"] { background: var(--accent-soft); color: #1d3fae; border-color: #b9c8f7 !important; box-shadow: none }
.hb-plat button[aria-pressed="true"], .hb-rf .seg button[aria-pressed="true"] { box-shadow: none }
.hb-plat button[aria-pressed="true"]:not(:focus-visible), .hb-rf .seg button[aria-pressed="true"]:not(:focus-visible) { outline: 1px solid var(--seg-edge); outline-offset: -1px }
.seg button:focus-visible, .hb-row > button:focus-visible, .btn:focus-visible, .linkish:focus-visible, .avatar:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px }

/* Elo y gráfica */
.hb-elo { display: flex; align-items: flex-end; gap: 6px 14px; flex-wrap: wrap }
.hb-big { font-size: 2.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums }
.up { color: var(--ok-ink); font-weight: 700 }
.down { color: var(--bad-ink); font-weight: 700 }
.flat { color: var(--muted); font-weight: 700 }
em.up, em.down, em.flat { font-style: normal }
.hb-fig { margin: 14px 0 6px }
.hb-ch { display: grid; grid-template-columns: auto 1fr; gap: 8px }
.hb-ya { display: flex; flex-direction: column; justify-content: space-between; font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; padding: 2px 0 }
.hb-chart { display: block; width: 100%; height: 150px }
.hb-chart .gl { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke }
.hb-chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke }
.hb-chart .mk { stroke: var(--brass); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke }
.hb-xa { display: flex; justify-content: space-between; gap: 8px; font-size: .875rem; color: var(--muted); margin-top: 4px; padding-left: 40px }
.hb-mk { color: var(--warm-ink); text-align: center }
.hb-empty { padding: 8px 0 }
.hb-otb { margin-top: 12px }
.hb-otb label { display: block; font-weight: 600; margin-bottom: 6px }

/* indicadores del mes y barras por tema */
.hb-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.hb-kpis .stat span { font-size: .9375rem }
.hb-kpis .stat em { display: block; margin-top: 2px; font-size: .875rem }
@media (max-width: 560px) { .hb-kpis { grid-template-columns: 1fr } .hb-kpis .stat { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline } .hb-kpis .stat em { grid-column: 2 } }
.hb-sk { display: grid; grid-template-columns: minmax(96px, 150px) 1fr 64px; gap: 12px; align-items: center; margin: 10px 0 }
.hb-sk .bar { height: 10px; border-radius: 5px }
.hb-sk .bar i { display: block; height: 100%; border-radius: 5px; background: var(--accent) }
.hb-sk .bar i.g { background: var(--ok-ink) }
.hb-sk .bar i.warn { background: var(--brass) }
.hb-sk b { text-align: right; font-variant-numeric: tabular-nums }
.hb-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .875rem; color: var(--muted); margin: 4px 0 0 }
.hb-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--accent) }
.hb-leg i.g { background: var(--ok-ink) } .hb-leg i.warn { background: var(--brass) }
@media (max-width: 560px) { .hb-sk { grid-template-columns: 96px 1fr 58px; gap: 8px } .hb-big { font-size: 2.3rem } }

/* invitado: vista previa difuminada */
.hb-preview { position: relative; margin-top: 12px }
.hb-preview .hb-fig { filter: blur(3px); opacity: .55; pointer-events: none }
.hb-feats { list-style: none; margin: 0 0 14px; padding: 0 }
.hb-feats li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line) }
.hb-feats li:first-child { border-top: 0 }
.hb-feats .hb-i { color: var(--accent) }

/* preparar rival */
.hb-prem { vertical-align: middle; margin-left: 6px; background: var(--warm-soft); color: var(--warm-ink) }
.hb-rf .seg { margin-bottom: 14px }
.hb-rf label { display: block; font-weight: 600; margin-bottom: 6px }
.hb-rf .bar { margin-top: 10px }
.hb-step { margin: 8px 0 0 }
.hb-2c { display: grid; gap: 16px; margin-bottom: 16px }
.hb-2c > .panel-c { margin: 0 }
@media (min-width: 900px) { .hb-2c { grid-template-columns: 1.3fr 1fr; align-items: stretch } }
.hb-rep-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap }
.hb-lead { font-size: 1.1rem }
.hb-h2b { margin-top: 22px }
.hb-ops td.down { color: var(--bad-ink) }
.hb-plain { list-style: none; margin: 0; padding: 0 }
.hb-plain li { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--line) }
.hb-plain li:first-child { border-top: 0 }
.hb-plain span { color: var(--muted); font-size: .9375rem }
.hb-deep { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line) }
.hb-tp { margin-top: 6px }
.hb-prev { margin: 0; padding-left: 18px }
.hb-prev li { padding: 2px 0 }
.hb-prev .linkish { min-height: 44px }
.hb-foot-acc { display: inline-flex; align-items: center; min-height: 44px }

/* comunes: salto al contenido, avatar, aviso por encima de la barra inferior, chips con contraste AA */
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700 }
.skip:focus { top: 12px }
#app:focus, #app h1:focus { outline: none }
.tb-r .avatar { flex: none; width: 44px; height: 44px }
@media (max-width: 899px) { body.has-bnav .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)) } }
.lvl { font-size: .8125rem; padding: 2px 9px }
.lvl.ok { color: #1d3fae }
.prio-chip { color: #7a3705 }
.chip.aprendiendo { color: #8a5a00 } .chip.pendiente { color: var(--warm-ink) } .chip.nueva { color: #3d3f44 }
.rep-link { min-height: 44px; padding: 8px 14px }
.tbl th { font-size: .875rem }
@media (prefers-reduced-motion: no-preference) { .hb-row > button { transition: background-color .15s } }
@media (prefers-reduced-motion: reduce) { .hb-party .hb-streak { animation: none } }
@media (max-width: 899px) { body.has-bnav #bnav:not([hidden]) { padding-left: 6px; padding-right: 6px } }
.hb-ops { font-size: 1rem }

/* ---------- Planes y pagos (js/billing.js) ---------- */
.chip.beta { background: var(--warm-soft); color: var(--warm-ink); border: 0; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .9rem; white-space: nowrap }
@media (max-width: 520px) { .chip.beta { font-size: .8125rem; padding: 3px 9px } .chip.demo { display: none } }
.pricing { display: grid; gap: 16px }
.pr-int { justify-self: center }
.pr-test { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--warm-soft); color: var(--warm-ink); text-align: center }
.pr-grid { display: grid; gap: 16px; align-items: stretch }
@media (min-width: 900px) { .pr-grid { grid-template-columns: 1fr 1.08fr 1fr } }
.pr-card { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px }
.pr-card.rec { border: 2px solid var(--accent) }
.pr-badge { position: absolute; top: -13px; left: 20px; background: var(--accent); color: #fff; font-weight: 700; font-size: .875rem; padding: 3px 12px; border-radius: 999px }
.pr-card h3 { margin: 0; font-size: 1.35rem }
.pr-sub { margin: 0; color: var(--muted) }
.pr-price { margin: 8px 0 4px; display: flex; flex-direction: column }
.pr-price b { font-size: 2rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums }
.pr-price span { color: var(--muted); font-size: .9375rem }
.pr-card ul { list-style: none; margin: 6px 0 12px; padding: 0; flex: 1 }
.pr-card li { padding: 6px 0 6px 26px; position: relative; border-top: 1px solid var(--line) }
.pr-card li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 12px; height: 7px; border-left: 2px solid var(--ok-ink); border-bottom: 2px solid var(--ok-ink); transform: rotate(-45deg) }
.pr-cta .btn { width: 100%; justify-content: center; min-height: 48px }
.pr-cur { display: block; text-align: center; font-weight: 700; color: var(--ok-ink); padding: 12px 0 }
.pr-note { margin: 0; color: var(--muted); text-align: center }
.pr-trust { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; color: var(--muted); font-size: .9375rem }
.pr-trust li::before { content: "✓ "; color: var(--ok-ink); font-weight: 700 }
.pr-legal { margin: 0; text-align: center; color: var(--muted); font-size: .875rem }
.pr-legal a { color: var(--accent) }
.w-dialog .pricing { margin: 10px 0 16px }
.ad-pay { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 16px 0; display: grid; gap: 10px }
.ad-pay legend { font-weight: 700; padding: 0 6px }
.ad-prices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) }
.ad-prices input { width: 100% }
@media (max-width: 1180px) { .is-landing .tb-r .chip.beta, .is-landing .tb-r .chip.demo { display: none } }
