/* Escaque — identidad: pizarra azul, piedra clara y latón. */
:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #0c0d10;
  --bg-glow: rgba(214, 168, 92, 0.07);
  --surface: #15171c;
  --surface-2: #1b1e24;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #ecebe6;
  --muted: #8f939c;
  --faint: #5d626c;
  --brass: #d6a85c;
  --brass-ink: #1a1408;
  --ok: #5fbf8a;
  --warn: #e0a347;
  --bad: #e26a5a;

  --sq-light: #dde2e5;
  --sq-dark: #6c8094;
  --coord-light: #6c8094;
  --coord-dark: #dde2e5;
  --hl-last: rgba(214, 168, 92, 0.5);
  --hl-select: rgba(214, 168, 92, 0.62);
  --dot: rgba(18, 22, 30, 0.32);
  --board-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.06);

  --radius: 14px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f2f0eb;
  --bg-glow: rgba(108, 128, 148, 0.12);
  --surface: #ffffff;
  --surface-2: #f7f6f2;
  --line: rgba(20, 22, 28, 0.08);
  --line-strong: rgba(20, 22, 28, 0.16);
  --text: #17181c;
  --muted: #5f646d;
  --faint: #9a9ea6;
  --brass: #b5832f;
  --brass-ink: #fffaf0;
  --board-shadow: 0 24px 60px -28px rgba(30, 36, 48, 0.45), 0 0 0 1px rgba(20, 22, 28, 0.06);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 700px at 30% -10%, var(--bg-glow), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ---------- barra superior ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  max-width: 1240px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.logo {
  width: 26px;
  height: 26px;
}
.logo-frame {
  fill: var(--surface-2);
}
.logo-fill {
  fill: var(--brass);
  clip-path: inset(0 round 0);
}
.logo-stroke {
  fill: none;
  stroke: var(--line-strong);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s var(--ease-out);
}
.icon-btn:hover {
  border-color: var(--line-strong);
}
.icon-btn:active {
  transform: scale(0.95);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}
.conn i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}
.conn[data-s='open'] i {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}
.conn[data-s='reconnecting'] i,
.conn[data-s='connecting'] i {
  animation: blink 1s ease-in-out infinite;
}
.conn[data-s='offline'] i {
  background: var(--bad);
}
.conn[data-s='reconnecting'],
.conn[data-s='offline'] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* ---------- botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease-out), opacity 0.15s;
}
.btn:hover {
  border-color: var(--line-strong);
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.btn svg .fill {
  fill: currentColor;
  stroke: none;
}
.btn.primary {
  background: var(--brass);
  border-color: transparent;
  color: var(--brass-ink);
  font-weight: 600;
}
.btn.primary:hover {
  background: color-mix(in srgb, var(--brass) 88%, white);
}
.btn.ghost {
  background: transparent;
}
.btn.big {
  height: 54px;
  font-size: 16px;
  border-radius: 14px;
  width: 100%;
}
.btn.sm {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
}
.btn.wa {
  background: #1f8f55;
  border-color: transparent;
  color: #fff;
}
.btn.wa:hover {
  background: #23a160;
}
.btn.armed {
  border-color: var(--bad);
  color: var(--bad);
}

.link-btn {
  background: none;
  border: 0;
  padding: 6px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}
.link-btn:hover {
  color: var(--text);
}

/* ---------- portada ---------- */

.home {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
}

.eyebrow {
  margin: 0 0 18px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--brass);
  font-weight: 500;
}

.home h1 {
  margin: 0;
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.lede {
  margin: 18px 0 34px;
  max-width: 30em;
  font-size: 17px;
  color: var(--muted);
}

.create {
  display: grid;
  gap: 22px;
  max-width: 460px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.tc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tc-tile {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 14px 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s var(--ease-out);
}
.tc-tile:hover {
  border-color: var(--line-strong);
}
.tc-tile:active {
  transform: scale(0.98);
}
.tc-tile input,
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.tc-main {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.tc-sub {
  font-size: 12px;
  color: var(--muted);
}
.tc-tile:has(input:checked) {
  border-color: var(--brass);
  background: color-mix(in srgb, var(--brass) 9%, var(--surface));
}
.tc-tile:has(input:focus-visible),
.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.segmented label {
  position: relative;
  border-radius: 9px;
}
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 9px;
  transition: background 0.15s, color 0.15s;
}
.segmented label:has(input:checked) span {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot-w {
  background: #f7f3ea;
  box-shadow: inset 0 0 0 1.5px #1a1b1f;
}
.dot-b {
  background: #23262d;
  box-shadow: inset 0 0 0 1.5px #a9afb8;
}
.dot-r {
  background: linear-gradient(90deg, #f7f3ea 50%, #23262d 50%);
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.form-error {
  margin: -8px 0 0;
  min-height: 1em;
  color: var(--bad);
  font-size: 14px;
}

.home-visual {
  display: grid;
  place-items: center;
}
.hero-board {
  width: min(100%, 560px);
  transform: perspective(1400px) rotateY(-9deg) rotateX(5deg);
  animation: hero-in 0.9s var(--ease-out) both;
}
@keyframes hero-in {
  from {
    opacity: 0;
    transform: perspective(1400px) rotateY(-16deg) rotateX(8deg) translateY(18px);
  }
}

/* ---------- tablero ---------- */

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--board-shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  container-type: inline-size;
}

.squares {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.sq {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 0;
  cursor: default;
  background: var(--sq-light);
}
.sq.dark {
  background: var(--sq-dark);
}
.sq:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: -3px;
  z-index: 1;
}
.sq.last::before,
.sq.selected::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hl-last);
}
.sq.selected::before {
  background: var(--hl-select);
}
.sq.check::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(239, 84, 64, 0.95) 0%, rgba(226, 62, 46, 0.55) 38%, rgba(226, 62, 46, 0) 72%);
}
.sq.dest::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  height: 30%;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--dot);
}
.sq.dest.capture::after {
  width: 92%;
  height: 92%;
  background: transparent;
  box-shadow: inset 0 0 0 calc(0.9cqi) var(--dot);
}
.sq.hover {
  box-shadow: inset 0 0 0 calc(0.5cqi) rgba(255, 255, 255, 0.85);
}
.is-movable .sq.own,
.is-movable .sq.dest {
  cursor: pointer;
}

.coord {
  position: absolute;
  font-size: max(9px, 1.55cqi);
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}
.coord.file {
  right: 5%;
  bottom: 5%;
}
.coord.rank {
  left: 5%;
  top: 5%;
}
.sq.light .coord {
  color: var(--coord-light);
}
.sq.dark .coord {
  color: var(--coord-dark);
}

.pieces {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 12.5%;
  height: 12.5%;
  will-change: transform;
  z-index: 2;
}
.piece {
  transition: opacity 0.18s ease-out, scale 0.18s ease-out;
}
.piece.anim {
  transition: transform 0.2s var(--ease-out), opacity 0.18s ease-out, scale 0.18s ease-out;
}
.piece.dragging {
  z-index: 5;
  transition: none;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
}
.piece.captured {
  transition: opacity 0.2s ease-out, scale 0.2s ease-out;
  opacity: 0;
  scale: 0.7;
}
.piece.appear {
  opacity: 0;
  scale: 0.85;
}
.piece svg,
.promotion-choice svg {
  width: 100%;
  height: 100%;
}

.pc .body > * {
  stroke-linejoin: round;
  stroke-width: 3.2;
}
.pc-w .body > * {
  fill: #f7f3ea;
  stroke: #1a1b1f;
}
.pc-b .body > * {
  fill: #23262d;
  stroke: #0b0c0e;
}
.pc .detail * {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}
.pc-w .detail * {
  stroke: #1a1b1f;
}
.pc-b .detail * {
  stroke: #a9afb8;
}
.pc .detail .eye {
  stroke: none;
}
.pc-w .detail .eye {
  fill: #1a1b1f;
}
.pc-b .detail .eye {
  fill: #a9afb8;
}

.promotion {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(2px);
  animation: fade 0.15s ease-out;
}
.promotion-list {
  position: absolute;
  width: 12.5%;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--line-strong);
}
.promotion-list.from-bottom {
  flex-direction: column-reverse;
}
.promotion-choice {
  aspect-ratio: 1;
  border: 0;
  padding: 6%;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s;
}
.promotion-choice:hover,
.promotion-choice:focus-visible {
  background: color-mix(in srgb, var(--brass) 25%, transparent);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ---------- partida ---------- */

.game {
  max-width: 1240px;
  margin: 0 auto;
  padding: 4px 20px 32px;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(280px, 340px);
  justify-content: center;
  gap: 28px;
  align-items: start;
}

.stage {
  --board: min(calc(100vh - 210px), calc(100dvh - 210px), 760px, calc(100vw - 420px));
  width: var(--board);
  display: grid;
  gap: 10px;
}

.board-wrap {
  position: relative;
}

.player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
}
.who {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: none;
}
.swatch-w {
  background: #f7f3ea;
  box-shadow: inset 0 0 0 1.5px #1a1b1f;
}
.swatch-b {
  background: #23262d;
  box-shadow: inset 0 0 0 1.5px #5a606b;
}
.who-text {
  display: grid;
  line-height: 1.2;
}
.name {
  font-weight: 600;
  font-size: 15px;
}
.presence-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.presence {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.presence.on {
  background: var(--ok);
}
.presence.off {
  background: var(--bad);
}
.presence.empty {
  background: var(--faint);
  animation: blink 1.4s ease-in-out infinite;
}

.clock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  min-width: 118px;
  text-align: right;
  padding: 6px 14px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.clock.running {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
}
.clock.low {
  color: var(--bad);
}
.clock.running.low {
  background: var(--bad);
  color: #fff;
}
.player.winner .name::after {
  content: ' · ganó';
  color: var(--brass);
  font-weight: 500;
}

.side {
  display: grid;
  gap: 12px;
  padding-top: 62px;
}

.status-card,
.moves-card,
.offer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.status-card {
  padding: 16px 18px;
}
.status-line {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.status-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  min-height: 1.2em;
}

.offer {
  padding: 14px 16px;
  border-color: color-mix(in srgb, var(--brass) 55%, transparent);
  animation: rise 0.25s var(--ease-out);
}
.offer p {
  margin: 0;
  font-size: 14px;
}
.offer-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.moves-card {
  overflow: hidden;
}
.moves-head {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.tc-chip {
  font-family: var(--mono);
}
.moves {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  height: min(360px, calc(100vh - 470px));
  min-height: 140px;
  overflow-y: auto;
  scroll-behavior: smooth;
  font-family: var(--mono);
  font-size: 14px;
}
.moves li {
  display: grid;
  grid-template-columns: 44px 1fr 1fr;
  padding: 3px 16px;
}
.moves li:nth-child(even) {
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.moves .n {
  color: var(--faint);
}
.moves .m.cur {
  color: var(--brass);
  font-weight: 600;
}
.moves li.empty {
  display: block;
  font-family: var(--font);
  color: var(--muted);
  font-size: 13px;
  padding: 10px 16px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.actions .btn[hidden] {
  display: none;
}

/* ---------- capa sobre el tablero ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 6%;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 52%, transparent);
  backdrop-filter: blur(3px) saturate(0.9);
  border-radius: 10px;
  animation: fade 0.3s ease-out;
}
.overlay[hidden] {
  display: none;
}
.card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: rise 0.4s var(--ease-out);
}
.card h2 {
  margin: 6px 0 6px;
  font-size: 28px;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.card .muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.card .note {
  margin: 12px 0 0;
  color: var(--brass);
  font-size: 14px;
  font-weight: 500;
}
.kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-family: var(--mono);
}
.card.end[data-tone='win'] h2 {
  color: var(--brass);
}
.card.end[data-tone='win'] {
  border-color: color-mix(in srgb, var(--brass) 60%, transparent);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6), 0 0 60px -20px color-mix(in srgb, var(--brass) 60%, transparent);
}
.end-actions,
.share-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.end-actions .btn,
.share-row .btn {
  flex: 1;
}
.card .link-btn {
  margin-top: 10px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass) 60%, transparent);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  to {
    box-shadow: 0 0 0 10px transparent;
  }
}

.link-field {
  display: flex;
  gap: 6px;
  margin-top: 18px;
  padding: 5px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.link-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  outline: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

/* ---------- conexión propia caída ---------- */

.net-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--warn);
  color: #1a1206;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s var(--ease-out);
}
.net-banner[hidden] {
  display: none;
}
.spinner.sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: rgba(26, 18, 6, 0.25);
  border-top-color: #1a1206;
}
.game.is-offline .presence-wrap {
  opacity: 0.35;
}
.game.is-offline .clock.running {
  opacity: 0.6;
}
.status-sub:empty {
  display: none;
}

/* ---------- avisos y estados ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  translate: -50% 20px;
  opacity: 0;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  transition: opacity 0.2s, translate 0.25s var(--ease-out);
  z-index: 100;
}
.toast.show {
  opacity: 1;
  translate: -50% 0;
}
.toast[data-tone='warn'] {
  background: var(--warn);
  color: #1a1206;
}

.loading,
.missing {
  min-height: 70vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
}
.missing h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.02em;
}
.missing p {
  margin: 0 0 10px;
  color: var(--muted);
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--brass);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- celular y tablet ---------- */

@media (max-width: 900px) {
  .home {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 8px;
    gap: 36px;
  }
  .hero-board {
    width: min(100%, 360px);
    transform: none;
    animation: none;
  }
  .create {
    max-width: none;
  }

  .game {
    grid-template-columns: 1fr;
    padding: 0 0 24px;
    gap: 12px;
  }
  .stage {
    --board: min(100vw, calc(100dvh - 250px), 640px);
    width: var(--board);
    justify-self: center;
    gap: 6px;
  }
  .stage .board,
  .overlay {
    border-radius: 0;
  }
  .player {
    padding: 0 12px;
    min-height: 46px;
  }
  .clock {
    font-size: 22px;
    min-width: 100px;
    padding: 5px 12px;
  }
  .side {
    padding: 0 12px;
    gap: 10px;
  }
  .status-card {
    padding: 12px 14px;
  }
  .status-line {
    font-size: 17px;
  }
  .moves-head {
    display: none;
  }
  .moves {
    display: flex;
    height: auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 8px;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .moves li {
    display: inline-flex;
    gap: 6px;
    padding: 0 8px;
    background: none !important;
  }
  .actions {
    grid-template-columns: repeat(2, 1fr);
  }
  .card {
    padding: 18px;
  }
  .card h2 {
    font-size: 22px;
  }
}

@media (max-width: 420px) {
  .tc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .conn span {
    display: none;
  }
  .conn {
    padding: 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
