/* Los colores, el tablero y el fondo vienen del escenario activo (theme.json -> variables CSS). */
:root {
  --bg: #120c08;
  --bg-image: none;
  --panel: rgba(36, 26, 19, .72);
  --panel2: rgba(58, 42, 30, .8);
  --text: #f6ecda;
  --muted: #b9a487;
  --accent: #d9a441;
  --accent-text: #1a120a;
  --sq-light: #e8d3ad;
  --sq-dark: #9a6a43;
  --coords: #5b3a1f;
  --frame: linear-gradient(145deg, #5a3a22, #2b1a0e);
  --board-texture: none;
  --texture-opacity: .4;
  --texture-blend: soft-light;
  --font-display: Georgia, serif;
  --radius: 18px;
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --good: #5cc98a;
  --bad: #ef6b5b;
  --q-best: #5cc98a;
  --q-inacc: #f2c94c;
  --q-mistake: #f2994a;
  --q-blunder: #eb5757;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
/* Escenario de fondo fijo + velo para que se lea la interfaz. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2;
  background: var(--bg-image) center / cover no-repeat;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--bg) 10%, transparent), color-mix(in srgb, var(--bg) 62%, transparent) 80%);
}
h1, h2, h3, .brand span { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 .4rem; line-height: 1.15; }
h2 { font-size: 1.15rem; margin: 0 0 .9rem; }
h3.sub { font-size: 1rem; margin: 1.2rem 0 .6rem; display: flex; gap: .6rem; align-items: baseline; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.lead { max-width: 640px; font-size: 1.02rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--accent); margin: 0 0 .3rem; font-weight: 600; }
.hidden { display: none !important; }
.empty { padding: .4rem 0; }
.error { color: var(--bad); }
.loading { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.glass {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .28);
}

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 999px; padding: .72rem 1.2rem;
  font: 600 .93rem Inter, system-ui, sans-serif; cursor: pointer; text-decoration: none;
  transition: filter .15s, transform .08s, background .15s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 12%, transparent); }
.btn.danger { color: var(--bad); }
.btn.small { padding: .38rem .8rem; font-size: .83rem; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center;
  background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; width: 42px; height: 42px; cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }
.icon-btn.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.icon-btn:disabled { opacity: .35; cursor: default; }
input, select {
  width: 100%; padding: .78rem 1rem; border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--text);
  font: 1rem Inter, system-ui, sans-serif;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=range] { padding: 0; accent-color: var(--accent); border: 0; background: none; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: .15rem 0 0; }
label { display: block; margin: 1rem 0 .45rem; font-weight: 600; font-size: .9rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; cursor: pointer; }
label.check.big { padding: .8rem .9rem; border-radius: 14px; background: color-mix(in srgb, var(--text) 5%, transparent); border: 1px solid var(--line); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 1.2rem; }
.seg { display: flex; background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 999px; padding: 4px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; color: var(--text); padding: .55rem; border-radius: 999px; font: 500 .9rem Inter, sans-serif; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-text); }

.pill { font-size: .74rem; font-weight: 600; padding: .25rem .65rem; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); white-space: nowrap; }
.pill.hot { background: var(--accent); color: var(--accent-text); }
.pill.good { background: color-mix(in srgb, var(--good) 28%, transparent); }
.pill.bad { background: color-mix(in srgb, var(--bad) 28%, transparent); }
.badge { background: var(--bad); color: white; font-size: .7rem; font-weight: 700; min-width: 1.3rem; height: 1.3rem; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; padding: 0 .35rem; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px var(--panel); }
.dot.w { background: #f4f1ea; }
.dot.b { background: #1a1a1a; }
.dot.both { background: linear-gradient(90deg, #f4f1ea 50%, #1a1a1a 50%); }

/* ---------- estructura ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: .65rem 16px; max-width: 1240px; margin: 0 auto;
}
.top::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(color-mix(in srgb, var(--bg) 70%, transparent), transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  mask-image: linear-gradient(black 60%, transparent);
}
.brand { color: var(--text); text-decoration: none; font-size: 1.2rem; display: flex; align-items: center; gap: .45rem; }
.brand img { width: 32px; height: 32px; }
.tabs-top { display: flex; gap: .25rem; margin-left: .5rem; background: color-mix(in srgb, var(--text) 7%, transparent); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs-top a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .88rem; padding: .38rem .9rem; border-radius: 999px; }
.tabs-top a.on { background: var(--accent); color: var(--accent-text); }
.top-actions { display: flex; gap: .5rem; margin-left: auto; }
.page { max-width: 820px; margin: 0 auto; padding: 0 16px 4rem; }
.page.wide { max-width: 1100px; }
.page section { margin-top: 2rem; }
.page .hello { margin-top: 1.4rem; }
.center { min-height: 80vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 24px; padding: 1.8rem; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.welcome, .invite { text-align: center; }
.welcome form { text-align: left; }
.welcome .btn, .invite .btn { margin-top: 1rem; }
.hero-pieces { display: flex; justify-content: center; gap: .2rem; margin-bottom: .4rem; }
.hero-pieces img { width: 88px; height: 88px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); }
.note { background: color-mix(in srgb, var(--accent) 15%, transparent); padding: .6rem .8rem; border-radius: 12px; font-size: .9rem; }
.count { color: var(--muted); font-family: Inter, sans-serif; font-weight: 500; font-size: .9rem; margin-left: .3rem; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: .8rem 1rem; border-radius: 16px; }
.banner span { display: flex; gap: .5rem; align-items: center; }

.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; text-align: left;
  color: var(--text); border-radius: var(--radius); text-decoration: none;
  padding: 1.1rem; cursor: pointer; font: inherit; transition: border-color .15s, transform .15s, background .15s;
}
.mode:hover { border-color: var(--accent); transform: translateY(-3px); }
.mode-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); margin-bottom: .3rem; }
.mode-ic .ic { width: 24px; height: 24px; }
.mode span:last-child { color: var(--muted); font-size: .82rem; }
@media (max-width: 860px) { .mode-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) {
  .mode-grid { grid-template-columns: 1fr; gap: .55rem; }
  .mode { display: grid; grid-template-columns: auto 1fr; column-gap: .8rem; align-items: center; padding: .85rem 1rem; }
  .mode-ic { grid-row: span 2; margin: 0; }
  .tabs-top { margin-left: 0; }
  .brand span { display: none; }
}

.game-list { display: flex; flex-direction: column; gap: .5rem; }
.game-row {
  display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; color: var(--text); text-decoration: none;
  transition: background .15s;
}
.game-row:hover { background: var(--panel2); }
.gr-ic { position: relative; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--text) 8%, transparent); }
.gr-ic .dot { position: absolute; right: -3px; bottom: -3px; }
.gr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gr-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- aprender ---------- */
.study-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.study-card { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s; }
.study-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.study-card .mini { border-radius: 0; }
.sc-body { padding: .8rem .95rem 1rem; display: flex; flex-direction: column; gap: .1rem; }
.sc-body .eyebrow { margin: 0; }
.mini { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.mini i { position: relative; display: block; }
.mini i.l { background: var(--sq-light); }
.mini i.d { background: var(--sq-dark); }
.mini img { position: absolute; inset: 4%; width: 92%; height: 92%; }
.from-pos { display: flex; gap: .8rem; align-items: center; margin-bottom: .4rem; }
.from-pos .mini { width: 110px; flex: none; }
.study-head { margin: .2rem 0 .6rem; }
.study-head h1 { font-size: clamp(1.4rem, 3.4vw, 2rem); margin: .3rem 0 .1rem; }
.study-head p { margin: 0; font-size: .9rem; }
.back { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); text-decoration: none; font-size: .88rem; }
.back .ic { width: 16px; height: 16px; }
.story { padding: 1rem 1.1rem; overflow-y: auto; line-height: 1.65; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal {
  position: relative; background: color-mix(in srgb, var(--bg) 82%, var(--text) 6%);
  border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem 1.4rem 1.4rem;
  width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.55);
  animation: pop .18s cubic-bezier(.2,.8,.2,1);
}
.modal.wide { max-width: 760px; }
.modal h2 { padding-right: 2.5rem; }
.modal-x { position: absolute; top: .8rem; right: .8rem; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.modal-x:hover { background: color-mix(in srgb, var(--text) 16%, transparent); }
.modal p { margin: .4rem 0; }
.modal ol { padding-left: 1.2rem; }
.confirm-text { font-size: 1.05rem; padding-right: 2.4rem; }
.warn { color: var(--bad); font-size: .88rem; }
.linkbox { display: flex; gap: .5rem; margin-top: .8rem; }
.linkbox input { font-size: .85rem; }
.menu-list { display: flex; flex-direction: column; gap: .2rem; }
.menu-list button { display: flex; gap: .8rem; align-items: center; text-align: left; background: none; border: 0; color: var(--text); padding: .85rem .7rem; border-radius: 12px; font: 500 1rem Inter, sans-serif; cursor: pointer; }
.menu-list button:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.menu-list .ic { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .7rem 1.1rem; border-radius: 999px; font-weight: 600; z-index: 100; transition: opacity .4s; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.out { opacity: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; }
.theme-card, .piece-card {
  display: flex; flex-direction: column; gap: .15rem; text-align: left; cursor: pointer;
  background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text);
  border: 2px solid transparent; border-radius: 16px; padding: .55rem; font: inherit; transition: border-color .15s;
}
.theme-card.on, .piece-card.on { border-color: var(--accent); }
.theme-card span, .piece-card span { font-size: .76rem; color: var(--muted); }
.tc-scene { height: 92px; border-radius: 11px; background: var(--tbg) center / cover; display: grid; place-items: center; margin-bottom: .4rem; }
.tc-board { width: 64px; height: 64px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px; background: var(--tframe); border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.5); }
.tc-board i.l { background: var(--tl); }
.tc-board i.d { background: var(--td); }
.pieces-grid.disabled { opacity: .45; }
.pc-row { display: grid; grid-template-columns: repeat(6, 1fr); background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 10px; margin-bottom: .35rem; }
.pc-row img { width: 100%; aspect-ratio: 1; }
.legend { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .9rem; }
.legend th { text-align: left; font-size: .8rem; color: var(--muted); padding-bottom: .4rem; }
.legend td { padding: .3rem .2rem; border-top: 1px solid var(--line); }
.legend img { width: 36px; height: 36px; vertical-align: middle; }

/* ---------- partida ---------- */
.game {
  max-width: 1240px; margin: 0 auto; padding: 0 16px 2rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.4rem; align-items: start;
}
/* El tablero cabe en la altura de la pantalla (barras de jugadores + controles incluidos). */
.stage { width: 100%; max-width: min(100%, calc(100vh - 210px), 760px); min-width: 0; justify-self: center; }
.stage.lib { max-width: min(100%, calc(100vh - 320px), 760px); }
.board-area { display: flex; gap: 10px; align-items: stretch; }
.board-frame { flex: 1; min-width: 0; padding: clamp(6px, 1.4vw, 12px); border-radius: 16px; background: var(--frame); box-shadow: 0 30px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.12), inset 0 -2px 6px rgba(0,0,0,.4); }
#board { aspect-ratio: 1; }
.player-bar { display: flex; align-items: center; gap: .65rem; padding: .55rem .15rem; min-height: 54px; }
.avatar { width: 38px; height: 38px; border-radius: 12px; background: color-mix(in srgb, var(--text) 8%, transparent); border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.avatar img { width: 32px; height: 32px; }
.pb-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pb-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caps { display: flex; align-items: center; flex-wrap: wrap; margin-left: auto; }
.caps img { width: 22px; height: 22px; margin-left: -6px; }
.adv { font-size: .8rem; color: var(--muted); margin-left: .35rem; }
.turn-ind { font-size: .74rem; font-weight: 700; background: var(--accent); color: var(--accent-text); padding: .2rem .6rem; border-radius: 99px; }
.controls { display: flex; justify-content: center; gap: .4rem; margin-top: .3rem; flex-wrap: wrap; }
.controls .sep { width: 1px; background: var(--line); margin: 6px .2rem; }
.coach { margin-top: .7rem; padding: .75rem .95rem; border-radius: 16px; display: flex; flex-direction: column; gap: .45rem; }
.coach p { margin: 0; }
.status { font-size: .93rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.status .ic { width: 18px; height: 18px; color: var(--accent); }
.status.hot { color: var(--accent); font-weight: 600; }
.status.end { font-size: 1.02rem; }
.coach-line { font-size: .92rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.coach-line .ic { width: 18px; height: 18px; color: var(--accent); }
.note-line { font-size: .95rem; line-height: 1.55; padding-left: .8rem; border-left: 3px solid var(--accent); }
.xline { display: flex; flex-wrap: wrap; gap: .2rem; }
.coach .qbadge { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem; border-radius: 8px; font-weight: 800; font-size: .8rem; color: #111; }
.qbadge.q-best { background: var(--q-best); }
.qbadge.q-good { background: color-mix(in srgb, var(--text) 70%, transparent); }
.qbadge.q-inacc { background: var(--q-inacc); }
.qbadge.q-mistake { background: var(--q-mistake); }
.qbadge.q-blunder { background: var(--q-blunder); }

/* barra de evaluación */
.evalbar { position: relative; width: 14px; border-radius: 8px; overflow: hidden; background: #1b1b1b; border: 1px solid var(--line); flex: none; transition: opacity .2s; }
.evalbar.loading { opacity: .5; }
.evalfill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #f2efe8; transition: height .45s cubic-bezier(.2,.8,.2,1); }
.evalbar.flipped { background: #f2efe8; }
.evalbar.flipped .evalfill { background: #1b1b1b; }
.evaltext { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); font: 700 9px Inter, sans-serif; color: #888; mix-blend-mode: difference; white-space: nowrap; }

.game-side { border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; height: min(680px, calc(100vh - 100px)); position: sticky; top: 72px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: .9rem .3rem; font: 600 .86rem Inter, sans-serif; cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; gap: .35rem; }
.tabs button .ic { width: 17px; height: 17px; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
.tab-body { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tab-body.on { display: flex; }

.acc { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.acc > div { display: flex; flex-direction: column; line-height: 1.15; }
.acc b { font-size: 1.35rem; font-family: var(--font-display); }
.acc-k { margin-left: auto; flex-direction: row !important; gap: .6rem; font-weight: 700; font-size: .82rem; }
.acc.pending { padding: .6rem 1rem; }
.q-inacc { color: var(--q-inacc); }
.q-mistake { color: var(--q-mistake); }
.q-blunder { color: var(--q-blunder); }

.move-list { position: relative; list-style: none; margin: 0; padding: .6rem; overflow-y: auto; flex: 1; font-variant-numeric: tabular-nums; }
.move-list li { display: grid; grid-template-columns: 2.4rem 1fr 1fr; align-items: center; }
.move-list li:nth-child(odd) { background: color-mix(in srgb, var(--text) 4%, transparent); border-radius: 8px; }
.move-list li.empty { display: block; background: none; padding: .4rem; }
.move-list li.result { display: block; text-align: center; font-weight: 700; padding: .5rem; background: none; }
.mn { color: var(--muted); font-size: .85rem; padding-left: .4rem; }
.mv, .mv-empty { background: none; border: 0; color: var(--text); text-align: left; padding: .38rem .55rem; border-radius: 8px; font: 500 .95rem Inter, sans-serif; cursor: pointer; }
.mv-empty { color: var(--muted); cursor: default; }
.mv:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.mv.cur { background: var(--accent); color: var(--accent-text); }
.mv sup { font-weight: 800; margin-left: 2px; }
.mv.q-inacc sup { color: var(--q-inacc); }
.mv.q-mistake sup { color: var(--q-mistake); }
.mv.q-blunder sup { color: var(--q-blunder); }
.mv.cur sup { color: inherit; }
.mv.noted::after { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: 5px; vertical-align: middle; }
.mv.noted.cur::after { background: var(--accent-text); }

.chat { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble { background: var(--panel2); padding: .55rem .8rem; border-radius: 16px 16px 16px 5px; white-space: pre-wrap; word-break: break-word; }
.msg.mine .bubble { background: var(--accent); color: var(--accent-text); border-radius: 16px 16px 5px 16px; }
.sys { align-self: center; font-size: .78rem; color: var(--muted); text-align: center; padding: .2rem .6rem; }
.chat-form { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); }
.chat-form input { padding: .62rem .9rem; border-radius: 999px; }

.actions { display: flex; flex-direction: column; gap: .5rem; padding: .9rem; overflow-y: auto; }
.actions .btn { justify-content: flex-start; }
.actions label.check { margin: 0; }

@media (max-width: 900px) {
  .game { grid-template-columns: 1fr; gap: .8rem; padding: 0 10px 2rem; }
  .stage { max-width: 100%; }
  .game-side { height: 440px; position: static; }
  .top { padding: .5rem 12px; }
  .evalbar { width: 10px; }
  .controls { gap: .25rem; flex-wrap: nowrap; }
  .controls .icon-btn { width: 34px; height: 38px; border-radius: 10px; }
  .controls .icon-btn .ic { width: 18px; height: 18px; }
  .controls .sep { margin: 6px 0; }
}

/* ---------- tablero ---------- */
.board {
  position: relative; width: 100%; height: 100%;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 6px; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
/* Textura del escenario (madera, mármol, piedra…) sobre las casillas. */
.board::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: var(--board-texture) center / 100% 100%;
  mix-blend-mode: var(--texture-blend); opacity: var(--texture-opacity);
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sq.last::before { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.sq.sel::before { background: rgba(92, 201, 138, .5); }
.sq.check::before { background: radial-gradient(circle, rgba(255,40,40,.95) 0%, rgba(255,40,40,.45) 45%, transparent 75%); }
.sq.target::after { content: ''; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(15, 20, 15, .35); pointer-events: none; z-index: 4; }
.sq.cap-target::after { content: ''; position: absolute; inset: 5%; border-radius: 50%; border: 5px solid rgba(15, 20, 15, .35); pointer-events: none; z-index: 4; }
.pc { position: relative; width: 96%; height: 96%; z-index: 3; cursor: grab; pointer-events: none; will-change: transform; }
.pc.ghost { position: fixed; left: 0; top: 0; z-index: 1000; filter: drop-shadow(0 10px 12px rgba(0,0,0,.5)); scale: 1.15; }
.coord { position: absolute; font: 700 clamp(8px, 1.5vw, 11px) Inter, sans-serif; z-index: 3; pointer-events: none; opacity: .85; }
.sq.light .coord { color: var(--sq-dark); }
.sq.dark .coord { color: var(--sq-light); }
.coord.rank { top: 2px; left: 4px; }
.coord.file { bottom: 1px; right: 4px; }

.arrows { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.arrow { stroke-width: .17; stroke-linecap: round; opacity: .85; }
.arrow.hint { stroke: #4aa3ff; }
.arrow.best { stroke: #5cc98a; }
.arrow.bad { stroke: #eb5757; }
.ah.hint { fill: #4aa3ff; }
.ah.best { fill: #5cc98a; }
.ah.bad { fill: #eb5757; }

.promo { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 20; }
.promo-box { background: color-mix(in srgb, var(--bg) 85%, var(--text) 5%); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; text-align: center; }
.promo-box p { margin: 0 0 .6rem; font-weight: 600; }
.promo-row { display: flex; gap: .5rem; }
.promo-row button { width: min(18vw, 78px); height: min(18vw, 78px); background: color-mix(in srgb, var(--text) 10%, transparent); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; padding: 4px; }
.promo-row button:hover { background: var(--accent); }
.promo-row img { width: 100%; height: 100%; }
.promo-cancel { margin-top: .7rem; background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }
