/* ------------------------------------------------------------------ temas (5 paletas) */
:root, [data-theme="medianoche"] {
  --bg: #121417; --bg2: #171a1e; --panel: #1c2026; --panel2: #242932; --line: #2f3540;
  --text: #ece8df; --text-2: #d3cfc6; --muted: #98a0ab;
  --accent: #e9b44c; --accent-ink: #1d1606; --glow: #232833;
  --green: #6fb37a; --red: #e2645b; --orange: #e8913a; --yellow: #e2c34f;
  --sq-light: #ecdab9; --sq-dark: #ae8a68; --hl-last: rgba(247, 213, 90, .5); --hl-sel: rgba(120, 190, 120, .55); --dest: rgba(20, 85, 30, .45);
  --clock-bg: #f2efe7; --clock-fg: #15171b; --graph-bg: #2b2f36; --graph-fill: #e8e4da;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="bosque"] {
  --bg: #0f1712; --bg2: #131d17; --panel: #17231c; --panel2: #1f2e25; --line: #2b3f32;
  --text: #e7efe8; --text-2: #c5d3c8; --muted: #8fa596;
  --accent: #8fd16f; --accent-ink: #0d1f08; --glow: #1c3325;
  --green: #8fd16f; --red: #e8705f; --orange: #e99a48; --yellow: #e0d25a;
  --sq-light: #eeeed2; --sq-dark: #769656; --hl-last: rgba(246, 246, 105, .55); --hl-sel: rgba(186, 202, 68, .7); --dest: rgba(0, 0, 0, .18);
  --clock-bg: #eef3e9; --clock-fg: #102015; --graph-bg: #1f2e25; --graph-fill: #dfe9d8;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
[data-theme="oceano"] {
  --bg: #0a1120; --bg2: #0d1628; --panel: #111c32; --panel2: #172640; --line: #23375b;
  --text: #e4ecf8; --text-2: #c1cee4; --muted: #8698b6;
  --accent: #46c4ec; --accent-ink: #03202b; --glow: #142a52;
  --green: #5fd1a1; --red: #f0697a; --orange: #f2a34a; --yellow: #f0d36a;
  --sq-light: #dee3e6; --sq-dark: #8ca2ad; --hl-last: rgba(155, 199, 0, .45); --hl-sel: rgba(70, 196, 236, .5); --dest: rgba(10, 40, 70, .4);
  --clock-bg: #e8f4fb; --clock-fg: #0a1730; --graph-bg: #172640; --graph-fill: #d9e6f4;
  --shadow: 0 10px 30px rgba(0, 8, 25, .5);
  color-scheme: dark;
}
[data-theme="claro"] {
  --bg: #f3efe6; --bg2: #fbf9f4; --panel: #ffffff; --panel2: #f1ebdf; --line: #e2d9c8;
  --text: #24201a; --text-2: #4b443a; --muted: #7c7365;
  --accent: #b8621b; --accent-ink: #fffaf2; --glow: #fff8ea;
  --green: #2f8f4e; --red: #c8443a; --orange: #c9741f; --yellow: #b8961a;
  --sq-light: #f0d9b5; --sq-dark: #b58863; --hl-last: rgba(205, 210, 106, .7); --hl-sel: rgba(100, 160, 90, .55); --dest: rgba(20, 85, 30, .4);
  --clock-bg: #24201a; --clock-fg: #fffaf2; --graph-bg: #efe8da; --graph-fill: #3b342b;
  --shadow: 0 10px 28px rgba(60, 45, 20, .12);
  color-scheme: light;
}
[data-theme="neon"] {
  --bg: #0c0916; --bg2: #110d1f; --panel: #17122a; --panel2: #21193a; --line: #35295a;
  --text: #f0eaff; --text-2: #d2c7f2; --muted: #9b8fc2;
  --accent: #ff4fd8; --accent-ink: #2a0322; --glow: #2c1758;
  --green: #4ff0b4; --red: #ff5d7a; --orange: #ffa24f; --yellow: #ffe35a;
  --sq-light: #e8defd; --sq-dark: #8a6fd1; --hl-last: rgba(255, 79, 216, .38); --hl-sel: rgba(79, 230, 255, .5); --dest: rgba(40, 10, 70, .4);
  --clock-bg: #fbe9ff; --clock-fg: #1d0b2c; --graph-bg: #21193a; --graph-fill: #e5dcff;
  --shadow: 0 10px 34px rgba(120, 40, 200, .25);
  color-scheme: dark;
}
:root {
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at 80% -10%, var(--glow) 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--accent) 6%, transparent) 0%, transparent 60%), var(--bg);
  color: var(--text); font: 15px/1.55 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.display { font-family: var(--serif); font-weight: 800; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.01em; }
.display em { color: var(--accent); font-style: normal; }
.lead { font-size: 1.12rem; color: var(--text-2); max-width: 46em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ cabecera */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 800 1.3rem var(--serif); }
.brand:hover { text-decoration: none; }
.brand img { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.mainnav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.mainnav a.on { color: var(--text); background: var(--panel2); }
.mainnav a.gold { color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 10px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.badge-prem { background: linear-gradient(135deg, #f3cd6a, #c8932c); color: #241a05; font-size: .68rem; font-weight: 800; padding: 2px 7px; border-radius: 5px; letter-spacing: .04em; }
.badge-prem.big { font-size: .9rem; padding: 6px 14px; display: inline-block; margin-bottom: 8px; }
.badge { background: var(--panel2); color: var(--muted); font-size: .7rem; padding: 1px 6px; border-radius: 4px; }

main { flex: 1; width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.wrap.wide { max-width: 1320px; padding-top: 18px; }
.wrap.narrow { max-width: 640px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

.flash { max-width: 1120px; margin: 14px auto 0; padding: 11px 16px; border-radius: 10px; background: var(--panel2); border-left: 4px solid var(--accent); }
.flash.ok { border-color: var(--green); }
.flash.err { border-color: var(--red); }
.alert { padding: 10px 14px; border-radius: 9px; background: color-mix(in srgb, var(--red) 14%, transparent); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); margin-bottom: 14px; }
.banner { display: block; padding: 12px 18px; border-radius: 10px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent) 5%, transparent)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); margin-bottom: 22px; }

/* ------------------------------------------------------------------ botones y formularios */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: 600 .95rem var(--font); transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); background: var(--panel); }
.btn.gold { background: linear-gradient(135deg, #f3cd6a, #c8932c); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.lg { padding: 14px 26px; font-size: 1.05rem; }
.btn.sm { padding: 7px 12px; font-size: .86rem; }
.btn.xs { padding: 4px 9px; font-size: .78rem; border-radius: 7px; }
.btn.block { width: 100%; }
.btn.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); } }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); }
.radios { display: flex; gap: 16px; flex-wrap: wrap; }
.radio { flex-direction: row !important; align-items: center; color: var(--text) !important; cursor: pointer; }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card h3:not(:first-child) { margin-top: 18px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.authcard { max-width: 420px; margin: 30px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; }
.checks { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: .9rem; }
.checks .ok { color: var(--green); }
.checks .bad { color: var(--red); }
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; min-width: 140px; }
.stat b { display: block; font: 800 1.6rem var(--serif); }
.stat span { color: var(--muted); font-size: .85rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: .82rem; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tabs a.on { background: var(--panel2); color: var(--text); }
.pager { display: flex; gap: 6px; margin: 16px 0; }
.pager a { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.pager a.on { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------------ portada */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 50px; align-items: center; padding: 30px 0; }
.hero .display { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.cta { display: flex; gap: 12px; margin: 26px 0 14px; flex-wrap: wrap; }
.hero-board { max-width: 480px; width: 100%; justify-self: center; transform: perspective(1200px) rotateY(-8deg) rotateX(4deg); box-shadow: 0 30px 60px rgba(0, 0, 0, .5); border-radius: 6px; }
.hero-sm { padding: 10px 0 20px; }

/* ------------------------------------------------------------------ lobby */
.lobby { display: grid; grid-template-columns: 1fr 340px; gap: 30px; align-items: start; }
.tcgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }
.tc {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 22px 22px 18px; border-radius: 14px; cursor: pointer; text-align: left;
  background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--line);
  color: var(--text); font-family: var(--font); transition: border-color .15s, transform .1s;
}
.tc:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.tc:disabled { opacity: .5; cursor: default; }
.tc.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.tc-min { font: 800 2.6rem/1 var(--serif); }
.tc-min small { font: 500 1rem var(--font); color: var(--muted); margin-left: 6px; }
.tc-name { color: var(--muted); font-weight: 500; }
.tc-q { font-size: .78rem; color: var(--green); min-height: 1.2em; }
.tc.locked .tc-min { color: var(--muted); }
.lock { position: absolute; top: 14px; right: 14px; font-size: .75rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 3px 9px; border-radius: 99px; }
.seek { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--accent); margin-bottom: 14px; }
.seek > div:nth-child(2) { flex: 1; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.glist { list-style: none; padding: 0; margin: 0 0 10px; }
.glist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.res { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; font-weight: 700; font-size: .8rem; }
.res.win { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.res.loss { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.res.draw { background: var(--panel2); color: var(--muted); }

/* ------------------------------------------------------------------ tablero */
.board { position: relative; width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; touch-action: none; border-radius: 4px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.sqgrid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { position: relative; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq.last::before, .sq.sel::before, .sq.chk::before, .sq.hover::before { content: ''; position: absolute; inset: 0; }
.sq.last::before { background: var(--hl-last); }
.sq.sel::before { background: var(--hl-sel); }
.sq.hover::before { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .65); }
.sq.chk::before { background: radial-gradient(circle, rgba(255, 40, 30, .95) 0%, rgba(230, 30, 20, .6) 35%, rgba(200, 0, 0, 0) 75%); }
.sq.dest::after { content: ''; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: var(--dest); z-index: 2; pointer-events: none; }
.sq.cap::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 5px var(--dest); z-index: 2; pointer-events: none; }
.pc { position: absolute; inset: 0; background-size: 100% 100%; z-index: 1; cursor: pointer; }
.pc.dragging { opacity: .25; }
.pc.ghost { position: fixed; inset: auto; left: 0; top: 0; z-index: 1000; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .4)); }
.cf, .cr { position: absolute; font-size: 11px; font-weight: 700; pointer-events: none; z-index: 1; }
.cf { right: 4px; bottom: 2px; }
.cr { left: 4px; top: 2px; }
.sq.light .cf, .sq.light .cr { color: var(--sq-dark); }
.sq.dark .cf, .sq.dark .cr { color: var(--sq-light); }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.promobox { position: absolute; width: 12.5%; height: 50%; display: flex; flex-direction: column; z-index: 10; background: rgba(250, 248, 240, .97); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); border-radius: 4px; }
.promobox[style*="bottom"] { flex-direction: column-reverse; }
.promobox button { flex: 1; border: 0; background: center/86% no-repeat; cursor: pointer; }
.promobox button:hover { background-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ------------------------------------------------------------------ partida */
.game { display: grid; grid-template-columns: minmax(0, 660px) minmax(300px, 380px); gap: 26px; justify-content: center; align-items: start; }
.boardcol { display: flex; flex-direction: column; gap: 10px; }
.pbar { display: flex; align-items: center; gap: 10px; padding: 4px 2px; }
.pname { font-weight: 600; font-size: 1.02rem; }
.prating { color: var(--muted); font-size: .9rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.clock { margin-left: auto; font: 700 1.6rem/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; padding: 8px 14px; border-radius: 8px; background: var(--panel); color: var(--muted); min-width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
.clock.run { background: var(--clock-bg); color: var(--clock-fg); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.clock.low.run { background: var(--red); color: #fff; }
.notice { min-height: 1.4em; font-size: .88rem; }
.notice.err { color: var(--red); }
.notice.warn { color: var(--accent); }
.sidecol { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-weight: 600; background: var(--panel2); }
.moves { list-style: none; counter-reset: mv; margin: 0; padding: 6px 0; max-height: 240px; min-height: 120px; overflow-y: auto; font-variant-numeric: tabular-nums; }
.moves li { counter-increment: mv; display: grid; grid-template-columns: 42px 1fr 1fr; padding: 2px 10px; }
.moves li::before { content: counter(mv) '.'; color: var(--muted); }
.moves li:nth-child(odd) { background: color-mix(in srgb, var(--text) 3%, transparent); }
.moves .mv { cursor: pointer; padding: 1px 6px; border-radius: 5px; }
.moves .mv:hover { background: var(--panel2); }
.moves .mv.cur { background: var(--accent); color: var(--accent-ink); }
.moves .mv.inaccuracy { color: var(--yellow); }
.moves .mv.mistake { color: var(--orange); }
.moves .mv.blunder { color: var(--red); }
.moves .mv.cur.inaccuracy, .moves .mv.cur.mistake, .moves .mv.cur.blunder { color: var(--accent-ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.offer { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); border-top: 1px solid var(--line); }
.offer span { flex: 1; font-weight: 600; }
.endbox { padding: 18px 14px; border-top: 1px solid var(--line); text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent); }
.endres { font: 800 1.5rem var(--serif); }
.endbox[data-res="win"] .endres { color: var(--green); }
.endbox[data-res="loss"] .endres { color: var(--red); }
.enddelta { font-weight: 700; margin: 4px 0 12px; }
.endbtns { display: grid; gap: 8px; }
.chat .chatlog { height: 170px; overflow-y: auto; padding: 10px 14px; font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.msg b { color: var(--muted); font-weight: 600; }
.msg.mine b { color: var(--accent); }
.msg span { word-wrap: break-word; }
.chatform { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.chatform input { flex: 1; padding: 8px 10px; }
.quick { display: flex; gap: 6px; padding: 0 14px 12px; flex-wrap: wrap; }
.quick button { background: var(--panel2); color: var(--muted); border: 0; border-radius: 99px; padding: 4px 10px; font: .78rem var(--font); cursor: pointer; }
.quick button:hover { color: var(--text); }

/* ------------------------------------------------------------------ análisis */
.anboard { display: flex; gap: 10px; }
.anboard .boardwrap { flex: 1; min-width: 0; }
.evalbar { position: relative; width: 26px; flex: none; border-radius: 4px; overflow: hidden; background: #3a3d44; }
.evalfill { position: absolute; left: 0; right: 0; bottom: 0; background: #f2efe7; transition: height .35s ease; }
.evalbar.flipped .evalfill { bottom: auto; top: 0; background: #3a3d44; }
.evalbar.flipped { background: #f2efe7; }
#evaltxt { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: .66rem; font-weight: 800; color: #8a8f98; writing-mode: vertical-rl; }
.navbtns { display: flex; gap: 8px; justify-content: center; }
.engine { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.enginehead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.switch { margin-left: auto; display: flex; gap: 5px; align-items: center; color: var(--muted); cursor: pointer; }
.enginelines { min-height: 3.2em; }
.eline { display: flex; gap: 10px; font-size: .86rem; padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eline b { min-width: 48px; color: var(--accent); }
.eline span { overflow: hidden; text-overflow: ellipsis; }
.comment { padding: 8px 14px; border-top: 1px solid var(--line); min-height: 1em; }
.comment:empty { display: none; }
.comment.blunder b { color: var(--red); }
.comment.mistake b { color: var(--orange); }
.comment.inaccuracy b { color: var(--yellow); }
.progress { height: 4px; background: var(--panel2); }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
#graph { width: 100%; height: 120px; display: block; cursor: pointer; }
.acc { padding: 10px 14px; display: grid; gap: 10px; }
.accrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.accrow .small { grid-column: 1 / -1; color: var(--muted); }
.accpct { font: 800 1.2rem var(--serif); color: var(--accent); }
.accrow i { font-style: normal; }
.accrow i.inaccuracy { color: var(--yellow); }
.accrow i.mistake { color: var(--orange); }
.accrow i.blunder { color: var(--red); }
.upsell { padding: 16px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 14%, transparent), var(--panel)); }

/* ------------------------------------------------------------------ premium */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 20px 0; align-items: stretch; }
.plan { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px; display: flex; flex-direction: column; }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 20px 50px color-mix(in srgb, var(--accent) 8%, transparent); }
.ribbon { position: absolute; top: -12px; left: 22px; background: linear-gradient(135deg, #f3cd6a, #c8932c); color: #241a05; font-weight: 800; font-size: .75rem; padding: 4px 12px; border-radius: 99px; }
.price { font: 800 2.4rem var(--serif); margin: 4px 0 8px; }
.price small { font: 500 1rem var(--font); color: var(--muted); }
.save { color: var(--green); font-weight: 600; margin: 0 0 8px; }
.feat { list-style: none; padding: 0; margin: 8px 0 20px; flex: 1; }
.feat li { padding: 6px 0 6px 26px; position: relative; font-size: .93rem; }
.feat li.yes::before { content: '✓'; position: absolute; left: 0; color: var(--green); font-weight: 800; }
.feat li.no { color: var(--muted); }
.feat li.no::before { content: '—'; position: absolute; left: 0; }
.ppbox { min-height: 50px; }
.lockcard { text-align: center; max-width: 520px; margin: 30px auto; padding: 36px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, transparent), var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 18px; }
.lockicon { font-size: 2.6rem; color: var(--accent); }

/* ------------------------------------------------------------------ aprender */
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 30px; }
.lesson { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto auto; gap: 2px 12px; padding: 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.lesson:hover { border-color: var(--accent); text-decoration: none; }
.lesson.locked { opacity: .78; }
.lnum { grid-row: 1 / 4; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--panel2); font: 800 1.1rem var(--serif); color: var(--accent); }
.ltitle { font-weight: 700; }
.lmeta { color: var(--muted); }
.lessonpage { max-width: 900px; margin: 0 auto; }
.lsection { padding: 22px 0; border-bottom: 1px solid var(--line); }
.lbody { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
.lbody > .ltext:only-child { grid-column: 1 / -1; }
.ltext ul, .ltext ol { padding-left: 1.3em; }
.ltext li { margin: 4px 0; }
.mini.board { max-width: 320px; }
.exercise { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.exprompt { font-weight: 600; font-size: .92rem; }
.exfeedback { min-height: 1.3em; font-weight: 600; }

/* ------------------------------------------------------------------ móvil */
@media (max-width: 980px) {
  .game { grid-template-columns: minmax(0, 1fr); }
  .lobby, .cols2, .hero { grid-template-columns: 1fr; }
  .hero-board { transform: none; max-width: 380px; }
  .plans { grid-template-columns: 1fr; }
  .lbody { grid-template-columns: 1fr; }
  .mini.board { max-width: 100%; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .mainnav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .userbox { margin-left: auto; }
  .wrap { padding: 18px 14px 50px; }
  .wrap.wide { padding: 8px 6px 40px; }
  .tcgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tc { padding: 16px; }
  .tc-min { font-size: 2rem; }
  .clock { font-size: 1.3rem; min-width: 90px; padding: 6px 10px; }
  .grid3, .checks { grid-template-columns: 1fr; }
  .board { border-radius: 0; }
  .playing .foot { display: none; }
}

/* ------------------------------------------------------------------ contra la computadora */
.botentry { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--panel); border: 1px dashed var(--line); color: var(--text); margin-bottom: 14px; }
.botentry:hover { border-color: var(--accent); text-decoration: none; }
.botentry-ico { font-size: 1.8rem; }
.botoffer { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: 12px; background: color-mix(in srgb, var(--green) 12%, transparent); border: 1px solid color-mix(in srgb, var(--green) 45%, transparent); margin-bottom: 14px; }
.botoffer span { flex: 1; min-width: 220px; }
.botsetup { max-width: 980px; margin: 0 auto; }
.botsetup h3 { margin-top: 22px; }
.botgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.botcard { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border-radius: 12px; cursor: pointer; text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--font); }
.botcard:hover { border-color: var(--muted); }
.botcard.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, transparent), var(--panel)); }
.botname { font-weight: 700; }
.botelo { font: 800 1.3rem var(--serif); color: var(--accent); }
.botopts { display: flex; gap: 30px; flex-wrap: wrap; margin-bottom: 26px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { background: var(--panel); color: var(--muted); border: 0; border-right: 1px solid var(--line); padding: 9px 14px; font: 500 .9rem var(--font); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.thinking { color: var(--accent); font-size: .85rem; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ------------------------------------------------------------------ pulido visual */
body { transition: background-color .3s ease, color .3s ease; }
.card, .panel, .tc, .plan, .lesson, .botcard, .stat, .authcard, .seek, .botentry, .exercise { box-shadow: var(--shadow); }
.panel-h { letter-spacing: .01em; }
.mainnav a { position: relative; }
.mainnav a.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--accent); }
.display { background: linear-gradient(180deg, var(--text) 55%, color-mix(in srgb, var(--text) 70%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.display em { -webkit-text-fill-color: var(--accent); }
.tc { overflow: hidden; }
.tc::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.tc:hover:not(:disabled)::after, .tc.active::after { transform: scaleX(1); }
.board { box-shadow: 0 0 0 6px var(--panel2), 0 0 0 7px var(--line), var(--shadow); }
.hero-board .board, .mini.board { box-shadow: 0 0 0 5px var(--panel2), var(--shadow); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.flash { box-shadow: var(--shadow); }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
* { scrollbar-color: var(--line) transparent; }

/* ------------------------------------------------------------------ selector de tema */
.themepick { position: relative; }
.themebtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; display: grid; place-items: center; padding: 0; transition: border-color .15s, transform .15s; }
.themebtn:hover { border-color: var(--accent); transform: rotate(-12deg); }
.themebtn svg { width: 18px; height: 18px; }
.themepop { position: absolute; right: 0; top: calc(100% + 10px); width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); padding: 8px; z-index: 50; }
.themepop h4 { margin: 4px 8px 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.themeopt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text); font: 500 .92rem var(--font); cursor: pointer; text-align: left; }
.themeopt:hover { background: var(--panel2); }
.themeopt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.swatch { display: grid; grid-template-columns: repeat(2, 13px); grid-template-rows: repeat(2, 13px); border-radius: 6px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.swatch i { display: block; }
.themeopt small { display: block; color: var(--muted); font-size: .75rem; }
.themegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.themegrid .themeopt { border-color: var(--line); flex-direction: column; align-items: flex-start; }
.themegrid .swatch { grid-template-columns: repeat(4, 1fr); grid-template-rows: 22px; width: 100%; }
@media (max-width: 640px) { .themepop { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }

/* ------------------------------------------------------------------ motores y niveles */
.enginegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.enginecard { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 18px; border-radius: 14px; cursor: pointer; text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--font); box-shadow: var(--shadow); transition: border-color .15s; }
.enginecard:hover { border-color: var(--muted); }
.enginecard.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, transparent), var(--panel)); }
.enginecard.off { opacity: .5; cursor: not-allowed; }
.engname { font: 800 1.2rem var(--serif); }
.englevels { color: var(--accent); font-weight: 600; }
.engstatus { font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; margin-top: 4px; }
.engstatus.ok { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.engstatus.bad { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.engstatus.checking { color: var(--muted); background: var(--panel2); }
.levelbox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); max-width: 720px; }
.levelhead { display: flex; gap: 16px; align-items: flex-start; min-height: 74px; }
.levelhead p { margin: 4px 0 0; }
.lvlnum { flex: none; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font: 800 1.6rem var(--serif); background: var(--accent); color: var(--accent-ink); }
.lvlelo { color: var(--accent); font-weight: 700; margin-left: 6px; }
#lvlRange { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 99px; margin: 16px 0 8px; padding: 0; border: 0;
  background: linear-gradient(90deg, var(--accent) var(--pct, 50%), var(--panel2) var(--pct, 50%)); cursor: pointer; }
#lvlRange::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0, 0, 0, .3); }
#lvlRange::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); }
.lvlscale { display: flex; justify-content: space-between; }
