/* ============================================================
   Dominó Online — hoja de estilos
   Fichas 3D reales (cara + 4 paredes extruidas sobre un cuerpo),
   mesa de fieltro con marco de madera y tipografía Outfit.
   OJO: --u de las fichas del tablero (44px) debe coincidir con
   la constante U de app.js.
   ============================================================ */

:root {
  --bg: #08110e;
  --felt-1: #1f7a54;
  --felt-2: #0e4531;
  --felt-3: #072518;
  --wood-1: #6b4526;
  --wood-2: #33200f;
  --ivory-1: #fffdf6;
  --ivory-2: #f1eade;
  --ivory-3: #ddd4c2;
  --bone: #b7ae9b;
  --bone-dark: #8e8675;
  --ink: #14161c;
  --gold: #f2c977;
  --gold-light: #e8cb7a;
  --gold-dim: #a9863f;
  --text: #eef3f0;
  --text-dim: #9fb3ab;
  --glass: rgba(9, 24, 19, 0.62);
  --hairline: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);

  /* Superficies para tarjetas de la landing (menú/salas), separadas del
     verde de fieltro del tablero: mismo espíritu "lounge" oscuro, más neutro. */
  --surface: #0d1b15;
  --surface-2: #14251d;
  --success: #5ecb88;
  --danger: #e56b6f;

  --font-sans: 'Plus Jakarta Sans', 'Outfit', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;

  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(120% 90% at 50% 0%, #14281f 0%, var(--bg) 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* Visible para lectores de pantalla, invisible en pantalla: para etiquetas
   de formulario que no necesitan un texto visible junto al campo. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Foco de teclado visible y consistente en toda la app (botones, enlaces,
   inputs, fichas). No sustituye el estilo de :focus ya afinado en algunos
   controles (p. ej. .field input), que sigue aplicándose además de este. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================ FICHA 3D ============================ */

.tile {
  --u: 44px;
  --t: 7px;
  position: relative;
  width: var(--u);
  height: calc(var(--u) * 2);
  transform-style: preserve-3d;
  flex: 0 0 auto;
}

.tile__body,
.tile__face {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--u) * 0.13);
}

.tile__body {
  background: linear-gradient(160deg, var(--bone-dark) 0%, #6d6758 100%);
  /* sombra simétrica: no depende de la rotación de la ficha */
  box-shadow: 0 0 14px 3px rgba(0, 0, 0, 0.45);
}

.tile__face {
  transform: translateZ(var(--t));
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(155deg, var(--ivory-1) 0%, var(--ivory-2) 58%, var(--ivory-3) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(0, 0, 0, 0.09),
    inset 0 0 0 1px rgba(105, 94, 74, 0.45);
}

/* Paredes: van de z=0 (cuerpo) a z=--t (cara), en las cuatro caras.
   Más oscuras que la cara para que el canto se lea como volumen. */
.tile__wall {
  position: absolute;
  background: linear-gradient(180deg, var(--ivory-3) 0%, #8b8474 55%, #5f5a4c 100%);
}

.tile__wall--b {
  top: 100%;
  left: 0;
  width: 100%;
  height: var(--t);
  transform-origin: 50% 0%;
  transform: rotateX(90deg);
}

.tile__wall--t {
  bottom: 100%;
  left: 0;
  width: 100%;
  height: var(--t);
  transform-origin: 50% 100%;
  transform: rotateX(-90deg);
}

.tile__wall--r {
  left: 100%;
  top: 0;
  width: var(--t);
  height: 100%;
  transform-origin: 0% 50%;
  transform: rotateY(-90deg);
  background: linear-gradient(90deg, var(--ivory-3) 0%, #8b8474 55%, #5f5a4c 100%);
}

.tile__wall--l {
  right: 100%;
  top: 0;
  width: var(--t);
  height: 100%;
  transform-origin: 100% 50%;
  transform: rotateY(90deg);
  background: linear-gradient(270deg, var(--ivory-3) 0%, #8b8474 55%, #5f5a4c 100%);
}

.tile__half {
  flex: 1 1 50%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 9%;
  gap: 4%;
  place-items: center;
}

.tile__half > i {
  width: 100%;
  aspect-ratio: 1;
}

.tile__half > i.pip {
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #60656f 0%, #24272e 45%, #0e1014 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.85),
    0 0.5px 0 rgba(255, 255, 255, 0.6);
}

.tile__bar {
  height: 2px;
  margin: 0 9%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(72, 63, 45, 0.75) 12%, rgba(72, 63, 45, 0.75) 88%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tile--back .tile__face {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 7px),
    linear-gradient(160deg, #23443a, #11241d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.tile--back .tile__body,
.tile--back .tile__wall {
  background: linear-gradient(180deg, #1b322a, #0c1a15);
}

.tile__mark {
  margin: auto;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 201, 119, 0.5);
  box-shadow: inset 0 0 0 2px rgba(242, 201, 119, 0.14);
}

.tile--mini {
  --u: 17px;
  --t: 3px;
}

/* ============================ PANTALLAS ============================ */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.screen--lobby {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* El menú ya no es una tarjeta centrada suelta: es la página de inicio,
   con su propio scroll interno (el resto de pantallas siguen siendo
   paneles de app de altura fija, sin scroll de documento). */
.screen--menu {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  .screen--menu {
    scroll-behavior: auto;
  }
}

/* ---- tarjeta de menú ---- */
.menu-card {
  width: min(420px, 100%);
  padding: 32px 28px 24px;
  border-radius: 26px;
  background: linear-gradient(170deg, rgba(28, 54, 44, 0.92), rgba(9, 22, 17, 0.95));
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-title {
  margin: 0;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.menu-title--sm {
  font-size: 28px;
}

.menu-sub {
  margin: -6px 0 6px;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.menu-status {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field input {
  font: inherit;
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: rgba(242, 201, 119, 0.55);
  box-shadow: 0 0 0 3px rgba(242, 201, 119, 0.12);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--hairline);
}

.segmented button {
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}

.segmented button.is-active {
  background: linear-gradient(180deg, rgba(242, 201, 119, 0.9), rgba(169, 134, 63, 0.9));
  color: #23190a;
  font-weight: 600;
}

.btn {
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, filter 0.14s;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
}

.btn strong {
  font-weight: 600;
  font-size: 16px;
}

.btn em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-dim);
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: linear-gradient(180deg, #2fa36e, #14653f);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 22px rgba(20, 101, 63, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn--primary em {
  color: rgba(255, 255, 255, 0.72);
}

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

.link-btn:hover {
  color: var(--text);
}

/* ---- sala de espera ---- */
.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.lobby-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lobby-list li {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  font-size: 14px;
  text-align: left;
}

.lobby-list li.is-empty {
  color: var(--text-dim);
  border-style: dashed;
  background: transparent;
}

/* ============================ HUD ============================ */

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  z-index: 40;
}

.hud__score {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: baseline;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.hud__score:last-of-type {
  justify-self: end;
  text-align: right;
  grid-template-columns: auto auto;
}

.hud__score.is-leading {
  border-color: rgba(242, 201, 119, 0.4);
  background: rgba(242, 201, 119, 0.08);
}

.hud__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.hud__score b {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.hud__score small {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-dim);
}

.hud__center {
  text-align: center;
  display: flex;
  flex-direction: column;
}

.hud__round {
  font-size: 14px;
  font-weight: 600;
}

.hud__target {
  font-size: 11px;
  color: var(--text-dim);
}

.hud__tools {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.icon-btn.is-off {
  color: var(--text-dim);
}

/* ============================ MESA ============================ */

.table {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(96px, 13%) 1fr minmax(96px, 13%);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    '.    top   .'
    'left board right';
  gap: 6px;
  padding: 10px;
  position: relative;
}

.seat {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.seat--top {
  grid-area: top;
}

.seat--left {
  grid-area: left;
}

.seat--right {
  grid-area: right;
}

.seat__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s;
}

.seat__inner.is-turn {
  border-color: rgba(242, 201, 119, 0.55);
  background: rgba(242, 201, 119, 0.07);
  box-shadow: 0 0 22px rgba(242, 201, 119, 0.16);
}

.plate {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
}

.plate__name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11ch;
}

.plate__chip {
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
}

.is-mate .plate__name {
  color: #9fe3bd;
}

.is-rival .plate__name {
  color: #f3bdb0;
}

.plate__count {
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
}

.fan {
  display: flex;
  perspective: 500px;
}

.fan .tile {
  margin: 0 -4px;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}

.fan--left,
.fan--right {
  flex-direction: column;
}

.fan--left .tile,
.fan--right .tile {
  margin: -6px 0;
}

.thinking {
  position: absolute;
  top: -10px;
  right: -6px;
  display: flex;
  gap: 3px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--hairline);
}

.thinking i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 1.1s infinite;
}

.thinking i:nth-child(2) {
  animation-delay: 0.16s;
}

.thinking i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }
  30% {
    opacity: 1;
  }
}

.passbadge {
  position: absolute;
  top: -12px;
  left: -8px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(214, 96, 77, 0.9);
  color: #fff;
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
}

/* ---- tablero ---- */
.board {
  grid-area: board;
  position: relative;
  min-height: 0;
  border-radius: 22px;
  perspective: 1500px;
  perspective-origin: 50% 42%;
  z-index: 35; /* las fichas vuelan por encima de los asientos y del borde */
  overflow: visible;
  border: 9px solid transparent;
  background:
    linear-gradient(var(--felt-2), var(--felt-2)) padding-box,
    linear-gradient(160deg, var(--wood-1), var(--wood-2) 55%, #1c1109) border-box;
  box-shadow:
    0 26px 50px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.board__felt {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background:
    radial-gradient(120% 120% at 50% 18%, var(--felt-1) 0%, var(--felt-2) 46%, var(--felt-3) 100%);
}

.board__felt::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 3px);
}

.board__tilt {
  position: absolute;
  inset: 0;
  transform: rotateX(21deg);
  transform-style: preserve-3d;
}

.board__chain {
  position: absolute;
  left: 50%;
  top: 50%;
  /* Un punto en el centro del tablero: las fichas se colocan alrededor de él y
     al crecer la cadena se reacomodan con transición, sin saltos. */
  width: 0;
  height: 0;
  transform-origin: 0 0;
  transform-style: preserve-3d;
  pointer-events: none;
  transition: transform 0.9s cubic-bezier(0.22, 0.75, 0.25, 1);
}

/* La celda mide siempre 1x2 unidades (44x88) y la ficha va centrada dentro,
   un poco más pequeña, para que quede aire entre fichas contiguas.
   El tamaño fijo mantiene el origen de rotación en el centro exacto. */
.slot {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 88px;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.22, 0.75, 0.25, 1);
}

/* 41px sobre una celda de 44px deja 3px de aire entre fichas contiguas,
   que es lo que separa visualmente una ficha de la siguiente. */
.slot .tile {
  --u: 42px;
  --t: 9px;
}

.slot.is-last .tile__face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1.5px rgba(242, 201, 119, 0.85),
    0 0 18px rgba(242, 201, 119, 0.4);
}

.is-dropping {
  animation: dropIn 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateZ(90px) scale(1.18);
  }
  to {
    opacity: 1;
    transform: translateZ(0) scale(1);
  }
}

.board__hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
  pointer-events: none;
}

.ends-chip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 5;
}

.ends-chip b {
  font-size: 15px;
  color: var(--gold);
}

.ends-chip i {
  opacity: 0.4;
}

.feed {
  position: absolute;
  left: 20px;
  bottom: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: 6;
  max-width: 34%;
}

.feed li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed li:last-child {
  color: rgba(255, 255, 255, 0.85);
}

.feed li.is-new {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
}

/* ============================ ZONA DEL JUGADOR ============================ */

.myarea {
  padding: 4px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.55), transparent);
  z-index: 30;
}

.turnbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  padding: 6px 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.turnbar__title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.turnbar__hint {
  font-size: 11.5px;
  font-weight: 400;
  opacity: 0.85;
}

.turnbar.is-mine {
  color: #0f1a13;
  font-weight: 600;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  box-shadow: 0 6px 18px rgba(242, 201, 119, 0.25);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    box-shadow: 0 6px 26px rgba(242, 201, 119, 0.5);
  }
}

.hand {
  display: flex;
  justify-content: center;
  gap: 10px;
  perspective: 900px;
  min-height: calc(44px * 2 + 18px);
  padding-top: 14px;
}

.hand-slot {
  transform-style: preserve-3d;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.25, 1), filter 0.18s;
  cursor: default;
}

.hand-slot .tile {
  --u: 46px;
  --t: 8px;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55));
}

.hand-slot.is-playable {
  cursor: pointer;
}

.hand-slot.is-playable .tile__face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1.5px rgba(242, 201, 119, 0.7);
}

.hand-slot.is-playable:hover {
  transform: translateY(-15px) rotateX(-12deg) scale(1.04);
}

.hand-slot.is-selected {
  transform: translateY(-20px) rotateX(-14deg) scale(1.07);
}

.hand-slot.is-selected .tile__face {
  box-shadow:
    inset 0 0 0 2px var(--gold),
    0 0 24px rgba(242, 201, 119, 0.55);
}

.hand-slot.is-dead {
  filter: grayscale(0.55) brightness(0.62);
  cursor: not-allowed;
}

.shake {
  animation: shake 0.3s;
}

@keyframes shake {
  25% {
    transform: translateX(-5px) rotate(-2deg);
  }
  75% {
    transform: translateX(5px) rotate(2deg);
  }
}

.sidepick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
  font-size: 13px;
  animation: popIn 0.2s ease-out;
}

.btn--side {
  flex-direction: row;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(47, 163, 110, 0.9), rgba(20, 101, 63, 0.9));
}

.btn--side b {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold);
  font-size: 12px;
}

/* ============================ OVERLAYS ============================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 9, 7, 0.72);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease-out;
}

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

.overlay__card {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 26px 26px 20px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(170deg, rgba(30, 58, 47, 0.96), rgba(8, 20, 15, 0.98));
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: riseIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
}

.overlay__card h3 {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.overlay__card.is-win h3 {
  color: var(--gold);
}

.overlay__card.is-lose h3 {
  color: #f0a79a;
}

.overlay__sub {
  margin: -6px 0 4px;
  color: var(--text-dim);
  font-size: 14px;
}

.sum {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--hairline);
}

.sum__row {
  display: grid;
  grid-template-columns: 9ch 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 9px;
  font-size: 12.5px;
}

.sum__row.is-me {
  background: rgba(242, 201, 119, 0.1);
}

.sum__name {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.sum__tiles {
  display: flex;
  gap: 3px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.sum__tiles em {
  font-style: normal;
  font-size: 11px;
  color: var(--gold);
}

.sum__pts {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.overlay__score {
  display: flex;
  gap: 10px;
}

.overlay__score span {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.overlay__score b {
  font-size: 24px;
  color: var(--text);
}

.overlay__tick {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-dim);
}

.overlay__card--rules {
  text-align: left;
}

.overlay__card--rules h3 {
  text-align: center;
}

.rules {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #d5e2dc;
}

.rules b {
  color: var(--gold);
  font-weight: 600;
}

/* ============================ RESPONSIVE ============================ */

@media (max-width: 900px) {
  .hud {
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    padding: 8px 12px;
  }
  .hud__tools {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .hud__score small {
    display: none;
  }
  .table {
    grid-template-columns: 74px 1fr 74px;
    padding: 6px;
  }
  .feed {
    display: none;
  }
  .hand-slot .tile {
    --u: 38px;
    --t: 6px;
  }
  .hand {
    gap: 6px;
    min-height: calc(38px * 2 + 18px);
  }
  .fan .tile {
    --u: 13px;
    --t: 2px;
  }
  .plate {
    font-size: 11px;
  }
  .menu-title {
    font-size: 34px;
  }
}

@media (max-width: 560px) {
  .hand-slot .tile {
    --u: 32px;
    --t: 5px;
  }
  .hand {
    gap: 4px;
    min-height: calc(32px * 2 + 16px);
  }
  .hand-slot.is-playable:hover {
    transform: none;
  }
  .sum__row {
    grid-template-columns: 7ch 1fr auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
