:root {
  /* La mesa: marrón oscuro, el mismo del fondo del tablero 3D. Las hojas de cartulina se apoyan encima. */
  --bg: #2a2017;
  --bg2: #3a2d21;
  --card: #43352a;
  --card2: #4e3f32;
  --line: #6a5844;
  --text: #f6f1e4;
  --muted: #c9bda5;
  --primary: #3d9be9;
  --primary2: #63b1f0;
  --on-primary: #06223b;   /* texto sobre el celeste: el blanco no llegaba al contraste mínimo */
  --good: #2ecc71;
  --bad: #e74c3c;
  --gold: #f5c542;
  --gold-ink: #7a5200;      /* el oro como letra sobre cartulina: el amarillo no se lee sobre crema */
  --bad-ink: #ff8a80;
  --focus: var(--gold);
  /* Cartulina: lo que se toca es una pieza de papel sobre la mesa (inicio, sala, partida y ventanas) */
  --paper: #F4F1E4;         /* hoja */
  --paper-hi: #FFFDF5;      /* pieza apoyada encima de una hoja: botones, campos, fichas */
  --paper-2: #E8E1CB;       /* bloque con tinte dentro de una hoja: filas, columnas */
  --ink: #16130d;
  --ink2: #4d473b;
  --ink-line: rgba(22, 19, 13, .22);
  --red: #d62f2f;
  --board: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* Letra redondeada del juego: todo el texto; los títulos y etiquetas van en la letra del tablero (--board) */
  --fun: "Fredoka", "Segoe UI", Roboto, system-ui, sans-serif;
}
/* Las hojas de cartulina cambian los colores de adentro: así las filas, chips y textos que ya usan estos
   tokens se leen bien sobre crema sin tocar cada regla. */
.home-card, .card, .modal-card, .auction, #panel, .tab-body, .menu, .lobby-bar, .toast, #tutorial, .conn {
  --text: var(--ink); --muted: var(--ink2); --card: var(--paper-2); --card2: var(--paper-2); --bg2: var(--paper-2);
  --line: var(--ink-line); --primary: var(--red); --good: #1b7a40; --bad: #b3261e; --bad-ink: #b3261e; --focus: var(--ink); --gold-text: var(--gold-ink);
  color: var(--ink);
}
@font-face { font-family: "Fredoka"; font-weight: 400 700; font-display: swap; src: url(../fonts/fredoka.woff2) format("woff2"); }
/* Letra del tablero (se dibuja en un canvas: ver js/boardTexture.js) */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(../fonts/barlow-condensed-800.woff2) format("woff2"); }
.card-popup, .arrest-card, .party-card { font-family: var(--fun); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: var(--fun); -webkit-tap-highlight-color: transparent; scrollbar-color: var(--ink2) transparent; scrollbar-width: thin; }
/* El zoom con dos dedos queda permitido; lo que se evita es el zoom por doble toque en medio de la partida */
body { touch-action: manipulation; caret-color: var(--red); }
/* Partida: se puede deslizar pero no agrandar la página con dos dedos (el pellizco es para la cámara del tablero).
   :where() no suma especificidad: lo que ya tiene su propio touch-action (tablero, minijuegos) lo conserva. */
:where(body[data-screen="game"]), :where(body[data-screen="game"] *) { touch-action: pan-x pan-y; }
::selection { background: var(--gold); color: #1a1405; }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Piezas que solo existen en PC (css/desktop.css las muestra) */
.pc-only, .pl .holds, .buy-deed, kbd, .end-go .rg-ico, .dice-sum { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--bad-ink); min-height: 1.2em; text-align: center; font-weight: 600; }
.row { display: flex; gap: 8px; }
.row > input { flex: 1 1 0; width: 0; min-width: 0; }   /* width 0: que el ancho propio del input no ensanche la pantalla en el celular */

input, select {
  background: var(--paper-hi); color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px;
}
input:focus-visible, select:focus-visible { outline-offset: 0; }
input:focus, select:focus { border-color: var(--ink); }
input[type=range] { accent-color: var(--red); }

.btn {
  background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 7px 14px; cursor: pointer;
  font: 800 1.2rem / 1.1 var(--board); letter-spacing: .05em; text-transform: uppercase;
  transition: transform .08s, background .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--gold); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* La acción principal es una placa roja, como la del logo */
.btn.primary { background: var(--red); border-color: #fff; color: #fff; outline: 3px solid var(--ink); box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.btn.primary:hover:not(:disabled) { background: #e8463f; }
.btn.good { background: #1FA457; color: #fff; }
.btn.good:hover:not(:disabled) { background: #26b866; }
.btn.bad { background: #b3261e; color: #fff; }
.btn.bad:hover:not(:disabled) { background: #c8372e; }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.gold:hover:not(:disabled) { background: #ffd866; }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--paper-2); }
.btn.big { padding: 12px 18px; font-size: 1.45rem; width: 100%; }
.btn.small { padding: 5px 10px; font-size: 1.05rem; }
.btn.tiny { padding: 2px 8px; font-size: .98rem; border-width: 2px; border-radius: 10px; letter-spacing: .04em; }

.screen { position: fixed; inset: 0; }

/* ---------- INICIO ---------- */
#screen-home {
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; align-content: safe center; gap: 20px; padding: 16px; overflow: auto;
  background: var(--bg);
}
.home-card { width: min(440px, 100%); background: var(--paper); border: 3px solid var(--ink);
  border-radius: 20px; padding: 30px 24px; display: flex; flex-direction: column; gap: 22px; box-shadow: 0 14px 36px rgba(0, 0, 0, .5); }
.logo { background: #d62f2f; color: #fff; font: 800 clamp(2.5rem, 11vw, 3.4rem) / 1.05 "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif; text-align: center;
  border: 4px solid #fff; outline: 3px solid var(--ink); border-radius: 20px; padding: 8px 10px 8px; letter-spacing: .07em; box-shadow: 0 6px 24px rgba(0,0,0,.4); rotate: -3deg; }
.logo small { display: block; font-size: .42em; font-weight: 600; letter-spacing: .28em; color: #fff; margin-top: 2px; text-transform: uppercase; }
h1.logo { margin: 0; }
.tagline { margin: -8px 4px 0; text-align: center; line-height: 1.4; text-wrap: balance; }
/* Carrusel de personajes: pasa solo; el del medio se agranda y muestra el nombre */
.carousel { display: flex; align-items: center; gap: 6px; }
/* El deslizado horizontal también recorta en vertical: el relleno deja lugar a la ficha agrandada con su aro
   (y a cuando salta al hablar), y el margen negativo lo descuenta para que no ocupe más alto. */
.car-track { position: relative; flex: 1; min-width: 0; display: flex; gap: 12px; padding: 26px 0; margin-block: -14px; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent); }
.car-track::-webkit-scrollbar { display: none; }
.car-track::before, .car-track::after { content: ""; flex: none; width: calc(50% - 40px); }   /* para poder centrar el primero y el último */
/* Los personajes van como fichas: disco de papel crema con borde de tinta; la del medio se agranda y se enciende */
.car-track img { flex: none; width: 56px; height: 56px; border-radius: 50%; background: #F4F1E4; border: 3px solid #16130d;
  scroll-snap-align: center; cursor: pointer; opacity: .45; filter: saturate(.6); transition: scale .25s, opacity .25s, filter .25s, box-shadow .25s; }
.car-track img.focus { scale: 1.3; opacity: 1; filter: none; box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .45); }
.car-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 3px solid #16130d; background: #F4F1E4;
  color: #16130d; font-size: 1.5rem; font-weight: 700; line-height: 1; padding: 0 0 4px; cursor: pointer; transition: transform .12s; }
.car-btn:hover { background: var(--gold); }
.car-btn:active { transform: scale(.92); }
.car-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: -12px; }
.car-name { text-align: center; min-height: 1em; font: 800 1.7rem / 1 "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.car-hear { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px 6px 12px; cursor: pointer;
  background: #F4F1E4; color: #16130d; border: 3px solid #16130d; border-radius: 12px;
  font: 800 1.15rem / 1 "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif; letter-spacing: .06em; text-transform: uppercase; transition: transform .12s; }
.car-hear svg { width: 22px; height: 22px; }
.car-hear:hover { background: var(--gold); }
.car-hear:active { transform: scale(.96); }
#home-portraits img.talk { animation: talk .5s ease-out; border-color: var(--gold); }
@keyframes talk { 0% { transform: scale(1); } 30% { transform: scale(1.25) rotate(-6deg); } 60% { transform: scale(1.12) rotate(5deg); } 100% { transform: scale(1); } }
.divider { text-align: center; color: var(--muted); font-size: .9rem; position: relative; }
#home-error:empty { display: none; }
.home-card .btn, .home-card input { min-height: 44px; }
/* Pantallas bajas: todo más junto, para que las tres formas de jugar entren sin deslizar */
@media (max-height: 900px) { .home-card { gap: 14px; padding: 22px 20px; } .car-track { margin-block: -18px; } .play-mode > span:last-child { padding-block: 9px 10px; } }
/* Botón trabajando (crear sala): no toma otro toque y muestra un giro a la derecha */
.busy { pointer-events: none; opacity: .75; }
.busy::after { content: ""; flex: none; width: 18px; height: 18px; margin-left: auto; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; animation: busy .7s linear infinite; }
.btn.busy::after { display: inline-block; vertical-align: -3px; margin-left: 10px; }
@keyframes busy { to { transform: rotate(360deg); } }
/* Sin conexión: queda arriba hasta que vuelve */
.conn { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 80; white-space: nowrap;
  border-radius: 999px; padding: 6px 16px; font-weight: 700; }
#join-code { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 700; }
.home-modes, .home-panel { display: flex; flex-direction: column; gap: 14px; }
.home-panel h3 { margin: 2px 0 0; font-size: 1.05rem; }
.home-back { align-self: flex-start; }
/* Formas de jugar: tarjetas de casillero. Papel crema, borde de tinta, la franja de color de un grupo
   de propiedades con su pictograma, y el nombre en la letra del tablero. */
.play-mode { --band: #F7E11B; display: flex; align-items: stretch; text-align: left; cursor: pointer; padding: 0; overflow: hidden;
  background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  transition: transform .12s cubic-bezier(.2, .8, .2, 1), box-shadow .12s; }
.play-mode.friends { --band: #9FD8F5; }
.play-mode.tutorial { --band: #1FA457; }
.play-mode.browse { --band: #F7941D; }
.play-mode.daily { --band: #D63A92; }
.play-mode.daily .pm-icon { color: #fff; }
.play-mode:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.play-mode:active { transform: scale(.98); }
.play-mode .pm-icon { flex: none; width: 72px; display: grid; place-items: center; background: var(--band); border-right: 3px solid #16130d; }
.play-mode .pm-icon svg { width: 40px; height: 40px; }
.play-mode > span:last-child { flex: 1; min-width: 0; padding: 12px 14px 13px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.play-mode b { font: 800 1.6rem / 1 "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif; letter-spacing: .03em; text-transform: uppercase; }
.play-mode small { color: #4d473b; font-size: .88rem; line-height: 1.3; }
.play-mode.busy::after { align-self: center; margin: 0 14px 0 0; }
/* Instalar la app: acción aparte y más callada, un renglón con su trazo */
.install { align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; cursor: pointer;
  background: none; border: 0; border-radius: 12px; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px; }
.install:hover { text-decoration-color: var(--red); color: var(--red); }
.install svg { width: 20px; height: 20px; }
.tut-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: rgba(46, 204, 113, .12); border: 1px solid rgba(46, 204, 113, .5); font-size: .92rem; line-height: 1.35; }
/* Burbuja del tutorial: arriba a la izquierda del tablero (debajo del cartel de turno en el celular) */
#tutorial { position: absolute; left: 10px; top: 58px; z-index: 6; width: min(340px, calc(100% - 20px)); padding: 10px 12px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.5); animation: pop .2s ease-out; }
#tutorial p { margin: 6px 0 8px; font-size: .92rem; line-height: 1.38; }
.tut-head { display: flex; justify-content: space-between; align-items: center; font: 800 1.05rem / 1 var(--board); letter-spacing: .06em; text-transform: uppercase; color: #12713a; }
.tut-head span { color: var(--muted); }
.tut-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tut-skip { margin-left: auto; background: none; border: 0; color: var(--muted); font: inherit; font-size: .78rem; text-decoration: underline; cursor: pointer; padding: 4px; }
.tut-glow { animation: tutGlow 1.1s ease-in-out infinite; position: relative; z-index: 1; }
@keyframes tutGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, .0), 0 0 0 2px #2ecc71; } 50% { box-shadow: 0 0 0 7px rgba(46, 204, 113, .35), 0 0 0 2px #2ecc71; } }
/* Texto de presentación bajo la tarjeta del inicio (también es lo que lee Google) */
.about { width: min(440px, 100%); color: var(--muted); font-size: .9rem; line-height: 1.55; padding-bottom: 24px; }
.about h2 { font-size: 1.05rem; line-height: 1.3; color: var(--text); margin: 0 0 8px; text-wrap: balance; }
.about h3 { font-size: .95rem; color: var(--text); margin: 14px 0 4px; }
.about p { margin: 0; }
/* Donación: una pastilla cálida, centrada */
.donate { align-self: center; display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 11px 20px; border-radius: 999px; font-size: .95rem; white-space: nowrap;
  background: linear-gradient(135deg, #ffd36b, #ff9a3d); color: #3a2206; font-weight: 800; text-decoration: none;
  border: 3px solid var(--ink); box-shadow: 0 6px 16px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .12s, box-shadow .15s; }
.donate:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .5); }
.donate:active { transform: scale(.97); }
.donate .emoji { font-size: 1.25em; }
/* En el celular los botones de sonido y pantalla completa flotan abajo a la derecha: se deja lugar para que no la tapen */
@media (max-width: 900px), (orientation: portrait) { .donate { align-self: flex-start; } }
.solo-head { font-weight: 700; color: var(--gold); }
.bots-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; }
.bots-ctrl .stepper { display: flex; align-items: center; gap: 10px; }
.bots-ctrl .stepper b { min-width: 1.2em; text-align: center; font-size: 1.1rem; }
.bots-ctrl .stepper .btn { width: 44px; height: 44px; padding: 0; font-size: 1.3rem; line-height: 1; }
.bots-ctrl small { flex-basis: 100%; }

/* ---------- LOBBY ---------- */
/* La sala es una columna que se desliza, con la barra del paso siguiente pegada abajo */
#screen-lobby { overflow: auto; padding: 16px 16px 0; display: flex; flex-direction: column; }
.lobby { width: 100%; max-width: 1050px; margin: 0 auto; flex: 1 0 auto; display: flex; flex-direction: column; gap: 20px; padding-bottom: 24px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px; }
.code { font-size: 2rem; font-weight: 900; letter-spacing: 6px; color: var(--gold); }
.room-code { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 0; background: none; border: 0; border-radius: 12px;
  text-align: left; cursor: pointer; white-space: nowrap; }
.room-code .muted { font-size: .85rem; }
.room-code:hover .muted { color: var(--text); }
.share-btn { align-self: stretch; min-height: 44px; }
.lobby-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 22px; box-shadow: 0 10px 28px rgba(0, 0, 0, .4); }
.card h2, .card h3 { margin: 0 0 14px; font-size: 1.05rem; }
.card h2:not(:first-child), .card h3:not(:first-child) { margin-top: 26px; }
.side { display: flex; flex-direction: column; gap: 10px; }
.side h2, .side h3 { margin: 16px 0 0; }
.side h2:first-child { margin-top: 0; }
.side #btn-home { align-self: flex-start; margin-top: 14px; min-height: 44px; }
/* En la sala los botones de sonido van en el encabezado: abajo está la barra */
.lobby-head .audio-ctrls { position: static; margin-left: auto; }
.audio-ctrls .tool { width: 44px; height: 44px; }
.lobby-bar { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--paper); border-top: 3px solid var(--ink); box-shadow: 0 -8px 22px rgba(0, 0, 0, .35); }
.lobby-bar-in { max-width: 1050px; margin: 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; }
.lobby-bar p { margin: 0; flex: 1 1 260px; font-weight: 600; line-height: 1.35; text-wrap: pretty; }
.lobby-bar .btn.big { flex: 1 1 260px; width: auto; }
@media (min-width: 700px) { .lobby-bar .btn.big { flex: 0 1 340px; } }
.preview-wrap { position: relative; height: 240px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #4a3a2a, #1e1710 70%); margin-bottom: 12px; }
#preview { width: 100%; height: 100%; display: block; }
#preview-name { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-weight: 800; font-size: 1.2rem;
  text-shadow: 0 2px 6px #000; }
/* Son muchos personajes: la grilla se acomoda sola y tiene su propio scroll */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 16px;
  max-height: min(46vh, 430px); overflow-y: auto; padding: 4px; scrollbar-width: thin; scrollbar-color: var(--ink2) transparent; }
.char { background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 18px; padding: 8px 4px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; transition: border-color .15s, transform .1s; }
.char img { width: 64px; height: 64px; }
.char .n { font-size: .82rem; font-weight: 700; text-align: center; }
.char .by { font-size: .78rem; color: var(--muted); min-height: 1em; }
.char.selected { border-color: var(--c); box-shadow: 0 0 0 2px var(--c) inset; }
.char.taken { opacity: .45; cursor: not-allowed; }
.char.mine { opacity: 1; }
.char:not(.taken):hover { transform: translateY(-2px); }
.char:focus-visible { outline-offset: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.field label { font-weight: 700; font-size: .95rem; }
.field input { min-height: 48px; font-size: 1rem; font-weight: 600; }
.field-hint { margin: 0; font-size: .88rem; line-height: 1.35; color: var(--gold-ink); font-weight: 600; }
.field-hint:empty { display: none; }
.field-hint.err { color: var(--bad-ink); }
.lobby-players { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.lobby-players li { display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 6px 10px; }
.lobby-players img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--c); background: var(--card2); }
.lobby-players .tag { margin-left: auto; font-size: .78rem; color: var(--muted); text-align: right; }
/* Reglas de la sala: plegadas, con el resumen a la vista */
.rules { border-radius: 12px; }
.rules summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px;
  min-height: 44px; padding: 10px 12px; border-radius: 14px; }
.rules summary::-webkit-details-marker { display: none; }
.rules-t { font-weight: 700; }
.rules summary small { grid-column: 1; color: var(--muted); font-size: .85rem; line-height: 1.35; }
.rules summary::after { content: "›"; grid-column: 2; grid-row: 1 / span 2; font-size: 1.6rem; line-height: 1; color: var(--muted); rotate: 90deg; transition: rotate .15s; }
.rules[open] summary::after { rotate: -90deg; }
.settings { display: flex; flex-direction: column; padding: 0 12px 8px; border-top: 1px solid var(--line); }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 44px; padding: 8px 0; font-size: .95rem; }
.settings label + label { border-top: 1px solid var(--ink-line); }
.set-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-t small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.settings select { flex: none; min-height: 44px; padding: 8px 10px; font-size: 1rem; }
.settings input[type=checkbox] { flex: none; width: 24px; height: 24px; accent-color: var(--primary); }
.set-v { flex: none; color: var(--gold-ink); }

/* ---------- JUEGO ---------- */
#screen-game { display: grid; grid-template-columns: 1fr 380px; }
#board-wrap { position: relative; min-height: 0; overflow: hidden; }
#board3d { width: 100%; height: 100%; display: block; touch-action: none; }
#panel { background: var(--paper); border-left: 3px solid var(--ink); display: flex; flex-direction: column; min-height: 0; }
.board-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tool { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 12px; border: 3px solid var(--ink); background: var(--paper);
  color: var(--ink); cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); transition: transform .08s, background .15s; }
.tool:hover { background: var(--gold); }
.tool:active { transform: scale(.94); }
.tool.active { background: var(--gold); }
.ico { display: inline-grid; place-items: center; line-height: 0; }
.ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#turn-banner { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px; padding: 4px 14px 4px 4px; display: flex; align-items: center; gap: 8px;
  font: 800 1.25rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; max-width: calc(100% - 120px); overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
#turn-banner:empty { display: none; }
#turn-banner img { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
.countdown { font-variant-numeric: tabular-nums; color: var(--gold-ink); font-weight: 800; }
.countdown.low { color: #c0281c; }
.pot { position: absolute; left: 10px; bottom: 10px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 12px; padding: 5px 10px; font-size: .88rem; font-weight: 600; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }

/* Dados */
.dice-area { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 12px; pointer-events: none; }
.die { width: 40px; height: 40px; background: #fff; border-radius: 18px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 5px; border: 2px solid var(--ink); box-shadow: 0 4px 10px rgba(0,0,0,.4); }
.die i { width: 7px; height: 7px; border-radius: 50%; background: #222; place-self: center; visibility: hidden; }
.die i.on { visibility: visible; }
.die.rolling { animation: roll .12s linear infinite; }
.die.red i { background: #d62f2f; }
@keyframes roll { 0% { transform: rotate(0) translateY(0); } 50% { transform: rotate(12deg) translateY(-6px); } 100% { transform: rotate(-8deg) translateY(0); } }
/* Tablero angosto: el cartel del pozo y la ronda queda a la izquierda y los dados a la derecha, así no se tapan.
   Se mira el ancho del tablero, no el de la pantalla (con el celular acostado el tablero ocupa menos de la mitad).
   Más angosto todavía, el cartel va en dos renglones y los dados se achican para que entren tres. */
#board-wrap { container-type: inline-size; }
@container (max-width: 620px) {
  .dice-area { left: auto; right: 12px; bottom: 12px; transform: none; gap: 8px; }
}
@container (max-width: 430px) {
  .pot { display: flex; flex-direction: column; gap: 1px; padding: 5px 9px; }
  .pot .sep { display: none; }
}
@container (max-width: 300px) {
  .dice-area { right: 8px; gap: 5px; }
  .dice-area .die { width: 28px; height: 28px; padding: 4px; border-radius: 10px; }
  .dice-area .die i { width: 5px; height: 5px; }
  .pot { left: 8px; }
}

/* Jugadores */
.players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; border-bottom: 3px solid var(--ink); }
.pl { display: flex; align-items: center; gap: 8px; background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px;
  padding: 4px 8px 4px 4px; cursor: pointer; min-width: 0; position: relative; }
/* El turno: un aro dorado alrededor de la ficha, que se lee de lejos */
.pl.turn { box-shadow: 0 0 0 4px var(--gold), 0 4px 12px rgba(0, 0, 0, .3); z-index: 1; }
.pl.out { opacity: .45; filter: grayscale(1); }
.pl img { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--c); background: #fff; flex: none; }
.pl .info { min-width: 0; flex: 1; }
.pl .name { font: 800 1.05rem / 1.05 var(--board); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .money { font-size: .95rem; color: var(--good); font-weight: 700; font-variant-numeric: tabular-nums; }
.pl .money.debt { color: var(--bad); }
.pl .sub { display: flex; align-items: center; gap: 4px; }
/* Íconos al lado de la plata (arriba se pisaban con el nombre) */
.pl .icons { margin-left: auto; font-size: .72rem; white-space: nowrap; overflow: hidden; flex-shrink: 1; min-width: 0; }
.pl.me .name::after { content: " (vos)"; color: var(--muted); font-weight: 400; }

/* Acciones */
.actions { padding: 10px; border-bottom: 3px solid var(--ink); display: flex; flex-direction: column; gap: 8px; }
.actions .msg { font-size: .95rem; color: var(--muted); text-align: center; font-weight: 500; }
.actions .msg b { color: var(--text); }
.actions .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btns .btn { flex: 1; }
.debt-box { background: #FBD9D4; border: 3px solid var(--bad); border-radius: 12px; padding: 8px 10px; font-size: .92rem; font-weight: 500; }
.buy-box { display: flex; gap: 10px; align-items: center; background: var(--paper-hi); border: 3px solid var(--ink); border-radius: 12px; padding: 8px; }
.buy-box .chip { width: 10px; align-self: stretch; border-radius: 4px; }
.buy-box .t { flex: 1; font: 800 1.3rem / 1.05 var(--board); letter-spacing: .03em; text-transform: uppercase; }
.buy-box .t small { font: 500 .85rem var(--fun); text-transform: none; letter-spacing: 0; }

/* Pestañas */
.tabs { display: flex; border-bottom: 3px solid var(--ink); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 5px solid transparent; padding: 9px 4px 6px; cursor: pointer;
  color: var(--muted); font: 800 1.1rem / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; position: relative; }
.tabs button.active { color: var(--ink); border-color: var(--red); }
.badge { background: var(--red); color: #fff; border: 2px solid var(--ink); border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 0 6px; margin-left: 2px; }
.tab-body { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; padding: 10px; display: none; }
.tab.active { display: block; }
/* Registro: letra redondeada y grande, con los jugadores, los lugares y la plata en color */
.lg { font-family: var(--fun); font-size: 1rem; line-height: 1.25; padding: 6px 0;
  border-bottom: 1px solid var(--ink-line); color: var(--ink); overflow-wrap: anywhere; }
.lg.minor { font-size: .86rem; color: var(--muted); }
.lg b { font-weight: 700; color: color-mix(in srgb, var(--c) 56%, #000); }
.lg .lg-money { font-weight: 700; color: var(--gold-ink); }
#tab-chat.active { display: flex; flex-direction: column; gap: 8px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: .95rem; background: var(--paper-hi); border: 2px solid var(--ink); padding: 5px 10px; border-radius: 14px; align-self: flex-start; max-width: 90%; word-wrap: break-word; }
.chat-msg.mine { align-self: flex-end; background: #FFE7A0; }
.chat-msg b { color: color-mix(in srgb, var(--c) 66%, #000); }

/* Propiedades */
.prop-group { margin-bottom: 10px; }
/* Tarjeta de propiedad: toda la tarjeta abre la ficha (el botón .pn se estira con ::after por debajo de todo);
   los botones de acción van en columna a la derecha, por encima de ese estiramiento. */
.prop-row { position: relative; display: flex; align-items: center; gap: 10px; background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 12px;
  padding: 8px 8px 8px 8px; margin-bottom: 6px; transition: transform .08s, background .15s; }
.prop-row .chip { width: 8px; align-self: stretch; border-radius: 4px; flex: none; }
.prop-row .pn { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  background: none; border: 0; padding: 0; text-align: left; font-size: .95rem; font-weight: 600; cursor: pointer; }
.prop-row button.pn::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.prop-row .pn:focus-visible { outline: none; }
.prop-row:has(> button.pn:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.prop-row:has(> button.pn:hover) { background: #FFE7A0; }
.prop-row:has(> button.pn:active) { transform: scale(.985); background: #FFE7A0; }
.prop-row .pn-name { overflow-wrap: anywhere; line-height: 1.2; }
.prop-row .pn small { display: block; color: var(--muted); font-size: .75rem; }
.prop-row .pn-go { display: inline-flex; align-items: center; gap: 1px; margin-top: 3px; color: var(--red);
  font: 800 .82rem / 1 var(--board); letter-spacing: .06em; text-transform: uppercase; }
.prop-row .pn-go .ico svg { width: 1.05em; height: 1.05em; stroke-width: 3; }
.prop-row .pb { position: relative; z-index: 1; flex: none; display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.prop-row .pb .btn.tiny { padding: 5px 10px; }
.prop-row.mort > :not(.pb) { opacity: .6; }
.houses { color: var(--good); letter-spacing: -2px; }
.empty { color: var(--muted); text-align: center; padding: 20px 10px; font-size: .9rem; }

/* Intercambios */
.trade { background: var(--paper-hi); border: 3px solid var(--ink); border-radius: 14px; padding: 10px; margin-bottom: 8px; font-size: .92rem; }
.trade .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.trade .cols div { background: var(--paper-2); border-radius: 10px; padding: 6px 8px; }
.trade .cols h5 { margin: 0 0 4px; font-size: .78rem; color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; width: min(420px, 100%);
  max-height: calc(100dvh - 32px); overflow-y: auto; padding: 16px; position: relative; animation: pop .18s ease-out; }
.modal-card.wide { width: min(640px, 100%); }
.modal-card h3 { margin: 0 0 10px; font: 800 1.7rem / 1.05 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.modal-close { position: absolute; right: 4px; top: 4px; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); touch-action: manipulation; padding: 0; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.deed { font-family: var(--fun); background: var(--paper-hi); color: var(--ink); border-radius: 14px; padding: 10px; border: 3px solid var(--ink); }
.deed .head { border-radius: 8px; border: 3px solid var(--ink); padding: 8px 10px; text-align: center; margin-bottom: 8px; }
.deed .head small { display: block; font: 600 .95rem / 1 var(--board); letter-spacing: .12em; text-transform: uppercase; opacity: .9; margin-top: 3px; }
.deed .head b { display: block; font: 800 1.9rem / 1 var(--board); letter-spacing: .03em; text-transform: uppercase; }
.deed table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.deed td { padding: 3px 4px; }
.deed tr + tr td { border-top: 1px dotted var(--ink-line); }
.deed td:last-child { text-align: right; font-weight: 700; }
.deed .icon { font-size: 2.4rem; text-align: center; }
.deed-badge { width: 64px; height: 64px; margin: 4px auto 8px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 6px var(--ink); }
.deed-badge svg { width: 38px; height: 38px; }
.deed hr { border: 0; border-top: 2px dashed var(--ink-line); margin: 8px 0; }
.owner-line { margin: 10px 0; font-size: .92rem; }
.manage { display: flex; flex-wrap: wrap; gap: 6px; }
.manage .btn { flex: 1; }

/* Trade builder */
.tb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tb-col { background: var(--paper-2); border-radius: 12px; padding: 8px; }
.tb-col h4 { margin: 0 0 8px; font: 800 1.25rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.tb-col label { display: flex; align-items: center; gap: 6px; font-size: .85rem; padding: 3px 0; }
.tb-col input[type=number] { width: 100%; margin-bottom: 6px; }
.tb-col .chip { width: 8px; height: 16px; border-radius: 3px; flex: none; }

/* Carta sacada */
.card-popup { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 60; width: min(320px, 86vw);
  border-radius: 24px; padding: 18px; color: #111; background: #fffdf5; box-shadow: 0 20px 60px rgba(0,0,0,.6);
  text-align: center; animation: cardIn var(--card-in, .9s) cubic-bezier(.2, .8, .3, 1); cursor: pointer; }
/* Entra desde la izquierda boca abajo y se da vuelta: el dorso tapa la carta hasta la mitad del giro */
.card-popup::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(45deg, #b3261e 0 10px, #8f1d17 10px 20px); box-shadow: inset 0 0 0 6px #fffdf5, inset 0 0 0 9px #b3261e;
  animation: cardBack var(--card-in, .9s) cubic-bezier(.2, .8, .3, 1); }
@keyframes cardIn {
  0% { transform: translate(calc(-50% - 70vw), -50%) perspective(900px) rotateY(-180deg) rotateZ(-14deg) scale(.7); opacity: 0; }
  15% { opacity: 1; }
  55% { transform: translate(-50%, -50%) perspective(900px) rotateY(-90deg) rotateZ(-4deg) scale(.95); }
  80% { transform: translate(-50%, -50%) perspective(900px) rotateY(12deg) scale(1.05); }
  100% { transform: translate(-50%, -50%) perspective(900px) rotateY(0) scale(1); } }
@keyframes cardBack { 0%, 54.9% { opacity: 1; } 55%, 100% { opacity: 0; } }
.card-popup .ch { border-radius: 10px; border: 3px solid var(--ink); color: #fff; font: 800 1.55rem / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; padding: 9px 10px 8px; margin-bottom: 12px; }
.card-popup .ch.chance { background: #E67E22; }
.card-popup .ch.chest { background: #1f5fa8; }
.card-popup p { font-size: 1.08rem; margin: 6px 0 10px; line-height: 1.35; }
.card-popup small { color: var(--ink2); }
.card-popup .meme { display: block; width: 100%; max-height: 34dvh; object-fit: contain; border-radius: 10px; border: 3px solid var(--ink); margin: 2px 0 8px; background: #000; }
.card-popup .ch.heaven { background: var(--gold); color: var(--ink); }
.card-popup.cielo { box-shadow: 0 0 0 4px #f5c542, 0 0 60px rgba(245, 197, 66, .7), 0 20px 60px rgba(0,0,0,.6); }
@keyframes flip { from { transform: translate(-50%, -50%) rotateY(90deg) scale(.6); } to { transform: translate(-50%, -50%) rotateY(0) scale(1); } }

/* Subasta */
.auction { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 55; width: min(380px, 92vw);
  max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; padding: 16px; box-shadow: 0 0 0 4px var(--gold), 0 20px 60px rgba(0,0,0,.6); }
.auction-deed { margin-top: 12px; animation: pop .18s ease-out; }
.auction h3 { margin: 0 0 6px; text-align: center; font: 800 1.6rem / 1.05 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.auction .bid { font: 800 3rem / 1 var(--board); text-align: center; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.auction .who { text-align: center; color: var(--muted); margin-bottom: 10px; }
.auction .btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }

/* Toasts */
.toasts { position: fixed; left: 50%; top: 60px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column;
  gap: 6px; align-items: center; pointer-events: none; width: min(420px, 92vw); }
.toast { background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: toastIn .25s ease-out; text-align: center; }
.toast.err { background: #FBD9D4; border-color: var(--bad); }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } }

/* Ganador */
.winner { text-align: center; }
.winner img { width: 140px; height: 140px; border-radius: 50%; border: 4px solid var(--ink); box-shadow: 0 0 0 5px var(--gold); background: #fff; }
.winner h2 { font: 800 2.6rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 10px; }
.winner-thanks { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; }
.winner-thanks p { margin: 0; }
.winner-thanks .donate { align-self: center; margin-top: 0; }
.donate-pulse { animation: donatePulse 1.6s ease-in-out infinite; }
@keyframes donatePulse { 0%, 100% { transform: scale(1.12); } 50% { transform: scale(.95); } }
@media (prefers-reduced-motion: reduce) { .donate-pulse { animation: none; } }

/* ---------- CELULAR ---------- */
@media (max-width: 900px), (orientation: portrait) {
  #screen-game { grid-template-columns: 1fr; grid-template-rows: 48dvh 1fr; }
  #panel { border-left: 0; border-top: 3px solid var(--ink); padding-bottom: var(--safe-b); }
  .players { grid-template-columns: repeat(3, 1fr); padding: 6px; gap: 4px; }
  .pl { padding: 3px 5px 3px 3px; gap: 5px; }
  .pl img { width: 30px; height: 30px; }
  .pl .name { font-size: .78rem; }
  .pl .money { font-size: .8rem; }
  .pl.me .name::after { content: ""; }
  .actions { padding: 8px; }
  .die { width: 34px; height: 34px; padding: 5px; }
  .die i { width: 6px; height: 6px; }
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .char img { width: 54px; height: 54px; }
  /* Personajes en una sola tira que se desliza de costado (sin una lista con scroll adentro de la página) */
  .char-grid { position: relative; display: flex; gap: 10px; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 10px; margin: 0 -22px 14px;
    scroll-snap-type: x proximity; scrollbar-width: none; scroll-padding: 0 22px; }
  .char-grid::-webkit-scrollbar { display: none; }
  .char-grid::before, .char-grid::after { content: ""; flex: none; width: 12px; }
  .char { flex: none; width: 92px; scroll-snap-align: center; }
  .preview-wrap { height: 250px; }
  .lobby-head { flex-wrap: nowrap; }
  /* Cuatro botones (micrófono, escuchar, sonido, pantalla completa) al lado del código de la sala */
  .lobby-head .room-code { min-width: 0; flex: 1; }
  .lobby-head .room-code .muted { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lobby-head .audio-ctrls { gap: 4px; flex: none; }
  .lobby-head .audio-ctrls .tool { width: 40px; height: 40px; }
  .code { font-size: 1.7rem; letter-spacing: 4px; }
}
@media (max-width: 900px) and (orientation: landscape) {
  #screen-game { grid-template-columns: 1fr 320px; grid-template-rows: 1fr; }
  #panel { border-top: 0; border-left: 1px solid var(--line); }
  .players { grid-template-columns: repeat(2, 1fr); }
}

/* Matrimonio */
.marriage-box { background: #FFF1C2; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 10px; font-size: .92rem; }
.marriage-box small { color: var(--muted); }
.marry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.marry-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; border-color: var(--c); padding: 8px 4px; }
.marry-btn img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--c); background: #fff; }
.card-popup .kind { font-weight: 900; font-size: .85rem; letter-spacing: 1px; margin: -4px 0 6px; }

/* Controles de audio */
/* ⚙️ Sonido */
.snd-settings.off { opacity: .55; }
.fs-toggle { font-size: 1.25rem; }
.ios-steps { padding-left: 20px; line-height: 1.5; }
.ios-steps li { margin-bottom: 6px; }
.fs-toggle.on { background: var(--gold); }
.vol-list { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 14px; }
.vol-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name val" "range range"; gap: 4px 10px; align-items: center; }
.vol-name { grid-area: name; font-weight: 700; }
.vol-name small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.vol-val { grid-area: val; color: var(--gold-ink); font: 800 1.2rem / 1 var(--board); font-variant-numeric: tabular-nums; }
.vol-row input[type=range] { grid-area: range; width: 100%; height: 34px; accent-color: var(--red); padding: 0; background: none; border: 0; }
.vol-btns { justify-content: space-between; flex-wrap: wrap; }
.audio-ctrls { position: fixed; right: 12px; bottom: calc(12px + var(--safe-b)); display: flex; gap: 6px; z-index: 40; }
.tool.off { opacity: .45; position: relative; }
.tool.off::after { content: ""; position: absolute; left: 7px; right: 7px; top: 50%; height: 3px; border-radius: 2px; background: var(--red); transform: rotate(-40deg); }
/* Voz: micrófono prendido en verde; el que está hablando se marca con un aro en su retrato */
.tool.live { opacity: 1; background: #BFE8CB; box-shadow: 0 0 0 3px #1FA457, 0 3px 10px rgba(0, 0, 0, .3); }
.pl .vz { font-size: .72rem; flex: none; }
.pl .vz:empty, .lobby-players .vz:empty { display: none; }
.pl.talking > img, .lobby-players li.talking > img { box-shadow: 0 0 0 3px #1FA457, 0 0 10px #1FA457; }
.vz-mute { flex: none; margin-left: auto; width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; cursor: pointer; font-size: 1.1rem; }
.vz-mute[aria-pressed="true"] { background: #e9b0aa; }
.lobby-players .vz-mute:not(.hidden) ~ .tag { margin-left: 6px; }
/* Nombre largo + silenciar + etiquetas en un celular angosto: las etiquetas bajan de renglón en vez de salirse */
.lobby-players li { flex-wrap: wrap; }
.lobby-players li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Modo de juego (sala) ---------- */
.mode-select { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-card { text-align: left; border-radius: 18px; padding: 10px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.mode-card b { font-size: 1rem; }
.mode-card small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.mode-card.static { grid-column: 1 / -1; cursor: default; }
.char .pw { display: none; }
#preview-name small { display: block; font-size: .72rem; font-weight: 500; color: #ffe08a; padding: 0 12px; }

/* ---------- Modo extremo: panel de acciones ---------- */
.power-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--paper-hi); border: 2px dashed var(--ink2);
  border-radius: 12px; padding: 6px 10px; font-size: .88rem; }
.power-box.ready { border-style: solid; border-color: var(--ink); background: #FFF1C2; }
.power-box small { color: var(--muted); }
.items-row { display: flex; flex-wrap: wrap; gap: 6px; }
.item-chip { background: var(--paper-hi); border: 2px solid var(--ink); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: .85rem; }
.item-chip.usable { background: #BFE8CB; cursor: pointer; font-weight: 700; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.choice-grid.dense { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
.choice-grid .btn { white-space: normal; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; }
.choice-grid .btn small { font-size: .7rem; color: var(--muted); font-weight: 500; }
.deck-btn { color: #fff; font-size: 1.3rem; padding: 12px; }
.deck-btn.chance { background: #E67E22; }
.deck-btn.chest { background: #1f5fa8; }
.pot .fx { color: #b34a00; font-weight: 700; }
.wallet { margin-bottom: 8px; }
.card-popup .ch.news { background: #333; }
.card-popup .kind { color: #6c2f8c; font-family: var(--board); font-size: 1.1rem; letter-spacing: .08em; }

/* ---------- Minijuegos ---------- */
.mg-face { width: 28px; height: 28px; border-radius: 50%; border: 3px solid; background: #fff; }
.mg-timer i { display: block; height: 100%; width: 100%; background: #1FA457; transition: width .1s linear; }
.mg-body.locked .mg-joy { pointer-events: auto; }
.mg-big { font: 800 3.4rem / 1 var(--board); font-variant-numeric: tabular-nums; }
.mg-balloon { font-size: 7rem; background: none; border: 0; cursor: pointer; line-height: 1; transition: transform .08s; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; }
.mg-balloon.pop { animation: squish .12s; }
@keyframes squish { 50% { filter: brightness(1.3); } }
.mg-pad { width: 100%; min-height: 200px; border-radius: 18px; border: 3px solid var(--ink); font: 800 2.6rem / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; color: #fff; background: #c0392b;
  cursor: pointer; touch-action: manipulation; }
.mg-pad.go { background: #27ae60; }
.mg-pad.early { background: #555; }
.mg-pad.done { background: #2a7fcc; }
.mg-step { font: 800 1.45rem / 1.05 var(--board); letter-spacing: .03em; text-transform: uppercase; }
.mg-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.mg-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; font-size: .85rem; }
.mg-choice span { font-size: 2.2rem; }
.mg-q { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.mg-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.mg-opt { white-space: normal; padding: 14px 8px; }
.mg-opt.picked, .mg-voter.picked { background: #FFE7A0; box-shadow: 0 0 0 3px var(--gold); }
/* Trivia vista desde afuera: las opciones se leen pero no se tocan, y abajo quién ya respondió */
.mg-options.watch .mg-opt { cursor: default; pointer-events: none; }
.mg-twho { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.mg-tw { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--paper-hi);
  border: 2px solid var(--ink); color: var(--ink); font-size: .85rem; }
.mg-tw img { width: 28px; height: 28px; border-radius: 50%; }
.mg-tw small { color: var(--ink2); }
.mg-tw.done { background: #d9f2df; }
.mg-tw.done small { color: #1b7a40; font-weight: 700; }
.mg-vote { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; width: 100%; }
.mg-voter { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mg-voter .mg-face { width: 44px; height: 44px; }
.mg-prop { font-size: 1.2rem; font-weight: 800; display: flex; flex-direction: column; align-items: center; }
.mg-prop span { font-size: 3rem; }
.mg-guess { width: 100%; }
.mg-mate { font-size: 6rem; transition: transform .2s; }
.mg-mate.mine { animation: shake .25s infinite; }
@keyframes shake { 25% { transform: rotate(-12deg) scale(1.1); } 75% { transform: rotate(12deg) scale(1.1); } }
.mg-pass { font-size: 1.4rem; touch-action: manipulation; }
.mg-wait { color: var(--muted); font-size: 1rem; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.mg-hud { font: 800 1.35rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; min-height: 1.4em; }
/* Joystick de los minijuegos en el celular */
.mg-joy { position: relative; width: 132px; height: 132px; margin: 12px auto 4px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, #2a2216 0 55%, #3d3322 56% 100%);
  border: 3px solid var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; }
.mg-joy.on { box-shadow: 0 0 0 4px var(--gold); }
/* Joystick a la izquierda y golpe a la derecha */
.mg-ctrl { display: flex; align-items: center; justify-content: space-around; gap: 16px; }
.mg-ctrl .mg-joy { margin: 12px 0 4px; }
.mg-hit { position: relative; overflow: hidden; margin-top: 8px; padding: 10px 16px; border-radius: 16px; border: 3px solid var(--ink); background: #c0392b; color: #fff;
  font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.mg-hit small { font-weight: 400; opacity: .8; }
.mg-hit.round { width: 96px; height: 96px; border-radius: 50%; padding: 0; margin: 0; font-size: 2.4rem; flex: none; }
.mg-hit:active { transform: scale(.94); }
.mg-hit.cooling { filter: grayscale(.7) brightness(.75); cursor: default; }
/* La recarga se ve como una cortina oscura que va bajando */
.mg-hit i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, .45); pointer-events: none; }
.mg-hit span { position: relative; z-index: 1; }
.mg-joy-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #b9c7d6 70%); box-shadow: 0 4px 10px rgba(0,0,0,.45); pointer-events: none;
  transition: transform .08s; }
.mg-joy.on .mg-joy-knob { transition: none; }
.mg-run { width: 100%; font-size: 1.2rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.mg-run:active { transform: scale(.97); filter: brightness(1.15); }

/* ---------- Arreglos para celular ---------- */
@media (max-width: 900px), (orientation: portrait) {
  /* El panel no scrollea entero: jugadores y acciones quedan siempre a la vista,
     y solo la pestaña activa (registro, chat, propiedades…) scrollea dentro de su espacio. */
  #screen-game { grid-template-rows: 56dvh 1fr; }
  #panel { overflow: hidden; }
  .players { flex: none; max-height: 34%; overflow-y: auto; }
  .actions { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-bottom: 0; }
  /* Cámara y sonido a la izquierda; secciones a la derecha (reemplazan a las pestañas) */
  .board-tools { left: 8px; right: auto; }
  #tutorial { left: 58px; right: 58px; top: 54px; width: auto; padding: 8px 10px; }
  #tutorial p { font-size: .84rem; margin: 4px 0 6px; }
  .side-tools { display: flex; flex-direction: column; gap: 6px; position: absolute; right: 8px; top: 10px; }
  #turn-banner { max-width: calc(100% - 110px); }
  .tabs { display: none; }
  .tab-body { display: none; }
  .sheet-backdrop { display: none; }
  /* Cada sección se abre en una hoja que sube desde abajo */
  body.sheet-open .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .5); }
  body.sheet-open .tab-body { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; height: 80dvh;
    z-index: 46; background: var(--paper); border-top: 3px solid var(--ink); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.5);
    padding-bottom: var(--safe-b); animation: sheetUp .2s ease-out; }
  body.sheet-open .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
    border-bottom: 3px solid var(--ink); flex: none; position: relative; font: 800 1.6rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; }
  body.sheet-open .sheet-head .modal-close { position: static; }
  body.sheet-open .tab { position: relative; inset: auto; flex: 1; min-height: 0; overflow-y: auto; }
  body.sheet-open #tab-chat.active { display: flex; }
  .prop-row .pb .btn.tiny { min-height: 38px; padding: 6px 10px; font-size: .9rem; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; border-bottom-width: 0; padding-bottom: calc(16px + var(--safe-b)); }
  .mode-select { grid-template-columns: 1fr; }
  .mg-balloon { font-size: 6rem; }
  /* Tablero a pantalla completa (botón ⛶) */
  #screen-game.board-full { grid-template-rows: 1fr 0; }
  #screen-game.board-full #panel { display: none; }
}
/* Pantalla completa también en PC */
#screen-game.board-full { grid-template-columns: 1fr 0; }
#screen-game.board-full #panel { display: none; }
.board-tools .tool.on { background: var(--gold); }

/* Lista de casilleros (📋) */
.sq-list { display: flex; flex-direction: column; gap: 4px; }
.sq-side { font: 800 1rem / 1 var(--board); color: var(--muted); margin: 10px 0 3px; text-transform: uppercase; letter-spacing: .1em; }
.sq-row { display: flex; align-items: center; gap: 8px; background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 12px; padding: 6px 9px; cursor: pointer; }
.sq-row .chip { width: 8px; align-self: stretch; border-radius: 4px; flex: none; }
.sq-row .n { flex: 1; min-width: 0; font-size: .95rem; }
.sq-row .n small { display: block; color: var(--muted); font-size: .76rem; }
.sq-row .own { font-size: .78rem; font-weight: 700; text-align: right; }
.sq-row .who { display: flex; gap: 2px; }
.sq-row .who img { width: 22px; height: 22px; border-radius: 50%; border: 2px solid; background: #fff; }
.sq-row.here { box-shadow: 0 0 0 3px var(--gold); }
.mode-hint { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); text-align: center; }
.mode-hint:empty { display: none; }
/* Duración de la partida: tres botones en fila debajo del modo */
.dur-select { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.dur-t { font-weight: 700; }
.dur-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dur { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; cursor: pointer; font: inherit;
  background: var(--paper-hi); color: var(--ink); border: 2px solid var(--ink-line); border-radius: 12px; }
.dur b { font-size: 1rem; }
.dur small { font-size: .74rem; color: var(--muted); }
.dur.selected { border-color: var(--ink); background: var(--gold); }
.dur.static { cursor: default; }
.dur-select:has(.static) .dur-opts { grid-template-columns: 1fr; }
.dur-hint { font-size: .78rem; color: var(--muted); }
.game-clock.last-round { color: var(--red); }

/* Secciones laterales (solo celular) */
@media (min-width: 901px) and (orientation: landscape) { .side-tools, .sheet-head, .sheet-backdrop { display: none; } }
.side-tools .tool, .board-tools .tool { position: relative; }
.btns.desk-only { display: none; }
/* Confirmar acciones de propiedades: botones bien separados para no tocar el equivocado */
.confirm-row { justify-content: space-between; gap: 24px; margin-top: 14px; }
.confirm-row .btn { flex: 1; padding: 14px 10px; }
@media (min-width: 901px) and (orientation: landscape) { .btns.desk-only { display: flex; } }
.side-tools .badge { position: absolute; top: -5px; right: -5px; margin: 0; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
/* Celular acostado: tablero y panel lado a lado */
@media (max-width: 900px) and (orientation: landscape) {
  #screen-game { grid-template-rows: 1fr; grid-template-columns: 1fr 320px; }
  #screen-game.board-full { grid-template-columns: 1fr 0; }
}

/* ---------- Arresto: barra de luces de patrullero (roja y azul, doble destello) ---------- */
.arrest { position: fixed; inset: 0; z-index: 62; display: grid; place-items: center; padding: 16px; cursor: pointer;
  overflow: hidden; background: rgba(5, 8, 20, .35); transition: opacity .3s; }
.arrest.out { opacity: 0; }
/* Destellos suaves que tiñen toda la pantalla: rojo desde la izquierda, azul desde la derecha */
.arrest::before, .arrest::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.arrest::before { background: radial-gradient(120% 90% at 0% 0%, rgba(255, 20, 30, .75), rgba(255, 0, 0, .35) 45%, rgba(255, 0, 0, .12) 100%);
  animation: strobeA 1s linear infinite; }
.arrest::after { background: radial-gradient(120% 90% at 100% 0%, rgba(30, 90, 255, .75), rgba(0, 60, 255, .35) 45%, rgba(0, 60, 255, .12) 100%);
  animation: strobeB 1s linear infinite; }
/* Doble destello: dos fogonazos cortos de un color y después del otro */
@keyframes strobeA { 0%, 4% { opacity: 1; } 9%, 13% { opacity: .15; } 14%, 20% { opacity: 1; } 26%, 100% { opacity: 0; } }
@keyframes strobeB { 0%, 49% { opacity: 0; } 50%, 54% { opacity: 1; } 59%, 63% { opacity: .15; } 64%, 70% { opacity: 1; } 76%, 100% { opacity: 0; } }
/* El patrullero va pegado arriba del cartel, los dos al centro: no tapa las fichas de los jugadores */
.arrest-stack { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: min(340px, 100%); }
.patrol { width: min(270px, 72vw); height: auto; margin-bottom: -10px; position: relative; z-index: 3; overflow: visible;
  animation: patrolIn .7s cubic-bezier(.2, .8, .3, 1.15) both; }
.patrol .wheel { transform-box: fill-box; transform-origin: center; animation: wheelSpin .23s linear 3; }
.patrol .pl.a { fill: #5a0010; animation: lampA 1s linear infinite; }
.patrol .pl.b { fill: #001a55; animation: lampB 1s linear infinite; }
@keyframes patrolIn { from { transform: translateX(-110vw) rotate(-2deg); } 70% { transform: translateX(10px) rotate(2deg); } to { transform: none; } }
@keyframes wheelSpin { to { transform: rotate(360deg); } }
@keyframes lampA {
  0%, 4%, 14%, 20% { fill: #ff2a35; filter: drop-shadow(0 0 8px #ff1e28) drop-shadow(0 0 22px rgba(255, 0, 0, .8)); }
  5%, 13%, 21%, 100% { fill: #5a0010; filter: none; }
}
@keyframes lampB {
  0%, 49%, 55%, 63%, 71%, 100% { fill: #001a55; filter: none; }
  50%, 54%, 64%, 70% { fill: #2f7bff; filter: drop-shadow(0 0 8px #2f7bff) drop-shadow(0 0 22px rgba(0, 70, 255, .8)); }
}
.arrest-card { position: relative; z-index: 2; background: var(--paper); color: var(--ink); border-radius: 20px; padding: 16px 18px; width: min(340px, 100%);
  text-align: center; box-shadow: 0 0 0 4px #e10000, 0 20px 60px rgba(0, 0, 0, .6); animation: pop .25s ease-out; }
.arrest-card p { font-size: 1.1rem; line-height: 1.35; margin: 4px 0 8px; }
.arrest-card small { color: var(--ink2); }
@media (prefers-reduced-motion: reduce) { .arrest::before, .arrest::after, .patrol, .patrol .wheel, .patrol .pl { animation: none; } .arrest { background: rgba(120, 0, 0, .4); } }

/* ---------- Registro fijo debajo de las acciones (celular) ---------- */
.log-mini { display: none; }
@media (max-width: 900px), (orientation: portrait) {
  .actions { flex: 0 1 auto; }
  /* Solo lo último que pasó: lo más nuevo abajo y bien grande, lo anterior se va apagando */
  .log-mini { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 72px; min-height: 64px; overflow: hidden;
    border-top: 2px solid var(--ink); padding: 4px 12px; background: var(--paper-2); cursor: pointer; }
  .log-mini .lg { flex: none; border: 0; padding: 2px 0; font-size: .92rem; opacity: .62;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .log-mini .lg:nth-last-child(2) { opacity: .82; }
  .log-mini .lg:last-child { font-size: 1.08rem; font-weight: 500; opacity: 1; color: var(--text); }
  .log-mini .lg.new { animation: lgIn .4s cubic-bezier(.2, 1.4, .4, 1); }
}
}

/* ---------- Mis cartas guardadas ---------- */
.wallet-title { font-size: .8rem; color: var(--muted); font-weight: 700; margin: 4px 0; }
.card-row[data-card] { cursor: pointer; }
.saved-card { text-align: center; }
.saved-card .icon { font-size: 3.4rem; line-height: 1.1; }
.saved-card h3 { margin: 6px 0; }
.card-check { display: flex; align-items: center; gap: 6px; }

/* ---------- Minijuegos en 3D ---------- */
.mg-arena3d { position: relative; overflow: hidden; background: #0d141e; touch-action: none; }
/* Héroe de la guitarra: el marcador de los dos, la ruta por la que bajan las flechas y los cuatro botones */
.rt-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.rt-who { position: relative; flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 800; }
.rt-who:last-child { flex-direction: row-reverse; }
.rt-who .mg-face { width: 34px; height: 34px; flex: none; }
.rt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 1.15rem / 1 var(--board); letter-spacing: .03em; text-transform: uppercase; color: var(--ink2); }
.rt-pts { font: 800 1.7rem / 1 var(--board); color: var(--ink); font-variant-numeric: tabular-nums; }
.rt-x { font-style: normal; font-weight: 900; color: var(--gold-ink); min-width: 1.4em; }
.rt-say { position: absolute; top: 100%; left: 40px; font-style: normal; font-size: .8rem; font-weight: 800; opacity: 0; pointer-events: none; white-space: nowrap; }
.rt-who:last-child .rt-say { left: auto; right: 40px; }
.rt-say.on { animation: rtSay .6s ease-out; }
@keyframes rtSay { 0% { opacity: 1; transform: translateY(-4px) scale(1.15); } 100% { opacity: 0; transform: translateY(4px); } }
.rt-vs { flex: 0 0 20%; height: 10px; border-radius: 6px; background: #ff7a59; overflow: hidden; }
.rt-vs i { display: block; height: 100%; width: 50%; background: #4aa3ff; transition: width .25s; }
.rt-road { display: block; width: 100%; border-radius: 12px; border: 3px solid var(--ink); touch-action: none; }
.rt-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.rt-key { height: 58px; border-radius: 14px; border: 3px solid var(--ink); background: color-mix(in srgb, var(--c) 40%, var(--paper-hi)); color: var(--ink);
  font-size: 1.7rem; font-weight: 900; line-height: 1; touch-action: manipulation; cursor: pointer; }
.rt-key:active { background: var(--c); transform: scale(.95); }
.rt-hint { font-size: .8rem; text-align: center; }
/* Pagala bailando: el que baila arriba, al ritmo de la base, con las monedas que junta */
.bl-top { display: flex; align-items: center; gap: 12px; width: 100%; }
.bl-top .bl-dancer { width: 56px; height: 56px; flex: none; animation: blDance var(--beat, 1070ms) ease-in-out infinite; transform-origin: 50% 90%; }
.bl-txt { display: flex; flex-direction: column; gap: 2px; font-weight: 700; }
.bl-coins { font: 800 1.5rem / 1 var(--board); color: #ffd54a; font-variant-numeric: tabular-nums; }
.bl-coins small { font-size: .8rem; opacity: .7; }
@keyframes blDance { 0%, 100% { transform: rotate(-10deg) translateY(0); } 25% { transform: rotate(0) translateY(-8px); } 50% { transform: rotate(10deg) translateY(0); } 75% { transform: rotate(0) translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .bl-top .bl-dancer { animation: none; } }
.btn.dance-go { flex: 1; background: #ffe3f1; border-color: #c2306f; color: #8a1d4d; }
/* Tiros libres */
.bk-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.bk-p { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--paper-hi); color: var(--ink); border: 2px solid var(--ink-line); font-weight: 700; }
.bk-p .mg-face { width: 30px; height: 30px; }
.bk-n { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-pts { font: 800 1.3rem / 1 var(--board); font-variant-numeric: tabular-nums; }
.bk-left { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.bk-p.lead { border-color: var(--gold-ink); background: #fff4cc; }
.bk-p.hot { animation: bkHot .5s ease-out; }
@keyframes bkHot { 30% { transform: scale(1.08); } }
.bk-court { display: block; width: 100%; flex: 1 1 0; min-height: 260px; border-radius: 12px; border: 3px solid var(--ink); touch-action: none; cursor: pointer; }
.bk-hint { font-size: .8rem; text-align: center; }
.mg-room.basquet .mg-body { justify-content: flex-start; gap: 8px; }
@media (pointer: fine) { .rt-key { height: 40px; font-size: 1.3rem; } }
.mg-matebox { min-height: 120px; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.mg-step.hot { color: #c0391b; animation: shake .25s infinite; }
.mg-passbtns { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; width: 100%; }
.mg-pass { font-size: 1.15rem; padding: 18px 8px; touch-action: manipulation; white-space: normal; }
.mg-round { font: 800 1.5rem / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; color: var(--gold-ink); }
.mg-score { font-size: 1rem; margin-bottom: 4px; }
.mg-choice.picked { background: #FFE7A0; box-shadow: 0 0 0 3px var(--gold); }
.mg3d-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------- FIESTA (triple) ---------- */
.party { position: fixed; inset: 0; z-index: 62; display: grid; place-items: center; padding: 16px; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, rgba(80, 20, 120, .55), rgba(0, 0, 0, .7)); transition: opacity .3s; }
.party.out { opacity: 0; }
.party canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.party-card { position: relative; z-index: 2; background: var(--paper); color: var(--ink); border-radius: 20px; padding: 16px 18px; width: min(320px, 100%);
  text-align: center; box-shadow: 0 0 0 4px #ffd700, 0 20px 60px rgba(0, 0, 0, .6); animation: partyPop .6s cubic-bezier(.2, 1.6, .4, 1); }
.party-card img { width: 72px; height: 72px; border-radius: 50%; }
.party-title { animation: pulse .5s ease-in-out infinite; }
@keyframes partyPop { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
.die.gold { background: #ffe680; box-shadow: 0 0 14px #ffd700; }


/* Íconos (Fluent Emoji 3D): reemplazan a los emojis del sistema, ver js/emoji.js */
img.emoji {
  display: inline-block; width: 1.15em !important; height: 1.15em !important; vertical-align: -0.22em;
  margin: 0 .04em; border: 0 !important; border-radius: 0 !important; background: none !important;
  object-fit: contain; pointer-events: none; user-select: none;
}

/* Pantalla de carga: un afiche con el dibujo del tablero (el paño con las franjas celestes y blancas,
   el borde de casilleros de colores y el Obelisco en trazo). Es todo vectorial: se ve nítido en
   cualquier pantalla y no hay que bajar ninguna imagen. */
.loading { position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column; color: #16130d;
  background: linear-gradient(135deg, #CFE8D2 0 24%, #9cc6dc 24% 41%, #e9f3ea 41% 59%, #9cc6dc 59% 76%, #CFE8D2 76%);
  transition: opacity .45s; }
.loading.done { opacity: 0; pointer-events: none; }
/* Borde de arriba y de abajo: los nueve colores de las propiedades, como una fila de casilleros */
.loading-edge { flex: none; height: clamp(22px, 4.5vmin, 44px); border-block: 3px solid #16130d;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(100% / 9 - 3px), #16130d calc(100% / 9 - 3px) calc(100% / 9)),
    linear-gradient(90deg, #8B4A2B 0 11.11%, #9FD8F5 0 22.22%, #D63A92 0 33.33%, #F7941D 0 44.44%, #12A5A0 0 55.55%,
      #E3262E 0 66.66%, #F7E11B 0 77.77%, #1FA457 0 88.88%, #1560B0 0); }
.loading-box { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 16px 20px max(16px, env(safe-area-inset-bottom)); }
.loading-art { flex: 0 1 auto; height: min(38vh, 340px); min-height: 80px; stroke-width: 1.1; margin-bottom: -6px; }
.loading-art path { stroke-dasharray: 1; animation: loading-draw 1s cubic-bezier(.2, .8, .2, 1) both; }
.loading-art path:nth-child(2) { animation-delay: .25s; }
.loading-art path:nth-child(3) { animation-delay: .4s; }
@keyframes loading-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.loading-box .logo { width: min(380px, 86vw); border-color: #fff; outline: 3px solid #16130d; box-shadow: 0 8px 0 -2px rgba(22, 19, 13, .18); }
.loading-bar { width: min(320px, 76vw); height: 10px; border-radius: 12px; border: 2px solid #16130d; background: #F4F1E4; overflow: hidden; }
.loading-bar i { display: block; width: 40%; height: 100%; background: #d62f2f;
  animation: loading-run 1.1s ease-in-out infinite alternate; }
@keyframes loading-run { from { transform: translateX(-30%); } to { transform: translateX(180%); } }
.loading-text { font: 600 1.25rem "Barlow Condensed", "Arial Narrow", sans-serif; letter-spacing: .08em; text-transform: uppercase; }

/* Flechas sobre la vista previa: pasan al personaje libre anterior o siguiente (también se puede deslizar) */
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(10, 18, 28, .6); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.pv-nav[data-dir="-1"] { left: 10px; }
.pv-nav[data-dir="1"] { right: 10px; }
.pv-nav:active { transform: translateY(-50%) scale(.92); }
#preview { touch-action: pan-y; }

/* Íconos con vida: cada uno se mueve según lo que es (js/emoji.js elige el movimiento) */
img.emoji { animation: emo-float 3.2s ease-in-out infinite; transform-origin: 50% 60%; }
img.emoji[data-m="spin"] { animation: emo-spin 6s linear infinite; transform-origin: 50% 50%; }
img.emoji[data-m="roll"] { animation: emo-roll 2.4s ease-in-out infinite; }
img.emoji[data-m="flicker"] { animation: emo-flicker 1.3s ease-in-out infinite; transform-origin: 50% 90%; }
img.emoji[data-m="drive"] { animation: emo-drive 2.2s ease-in-out infinite; }
img.emoji[data-m="blink"] { animation: emo-blink 3.6s ease-in-out infinite; transform-origin: 50% 70%; }
img.emoji[data-m="wave"] { animation: emo-wave 2.2s ease-in-out infinite; transform-origin: 50% 90%; }
img.emoji[data-m="pulse"] { animation: emo-pulse 2s ease-in-out infinite; }
img.emoji[data-m="tilt"] { animation: emo-tilt 2.8s ease-in-out infinite; }
@keyframes emo-float { 0%, 100% { transform: translateY(3%) rotate(-3deg); } 50% { transform: translateY(-7%) rotate(3deg); } }
@keyframes emo-spin { to { transform: rotate(360deg); } }
@keyframes emo-roll { 0%, 100% { transform: translateY(0) rotate(-14deg); } 50% { transform: translateY(-12%) rotate(14deg); } }
@keyframes emo-flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 35% { transform: scale(1.14, 1.2) rotate(2deg); } 70% { transform: scale(.95, 1.04) rotate(-1deg); } }
@keyframes emo-drive { 0%, 100% { transform: translateX(-8%) rotate(-2deg); } 50% { transform: translateX(8%) rotate(2deg); } 25%, 75% { transform: translateY(-3%); } }
/* Guiño: cada tanto se achata un instante y ladea la cabeza */
@keyframes emo-blink { 0%, 38%, 50%, 100% { transform: scaleY(1) rotate(0); } 44% { transform: scaleY(.72) rotate(0); } 68% { transform: rotate(-9deg); } 84% { transform: rotate(7deg); } }
@keyframes emo-wave { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(14deg); } }
@keyframes emo-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }
@keyframes emo-tilt { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg) translateY(-4%); } }
/* Durante la partida se mueven solo los que importan (cartas y avisos, el turno, los botones de
   acción): el panel se redibuja todo el tiempo y animar cada ícono al lado del tablero 3D pesa. */
#screen-game img.emoji { animation: none; }
#screen-game #actions img.emoji, #screen-game #turn-banner img.emoji, #screen-game .board-tools img.emoji { animation: emo-float 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { img.emoji { animation: none !important; } }
@keyframes lgIn { from { transform: translateY(14px) scale(.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .log-mini .lg.new { animation: none; } }
/* Quien pidió menos movimiento: nada gira, late ni se desliza solo en el inicio y la sala */
@media (prefers-reduced-motion: reduce) {
  .loading-bar i { animation: none; width: 100%; opacity: .7; }
  .loading-art path { animation: none; }
  #home-portraits img.talk, .toast, .modal, .modal-card, #tutorial, .busy::after { animation: none; }
  .tut-glow { animation: none; box-shadow: 0 0 0 2px #2ecc71, 0 0 0 7px rgba(46, 204, 113, .35); }
  .car-track img, .btn, .play-mode, .donate, .char, .rules summary::after, .loading { transition: none; }
}

/* ---------- INICIO Y SALA: piezas del tablero ----------
   Todo lo que se toca es una pieza de papel sobre la mesa: crema con borde de tinta, una franja de color como la
   de las propiedades y los títulos en la letra del tablero. Los botones y campos vienen de la base (.btn, input);
   acá queda lo propio de estas dos pantallas. */
.home-card .btn.primary, .lobby-bar .btn.primary { font-size: 1.6rem; letter-spacing: .07em; }
.home-card .btn.ghost, .lobby .btn.ghost { font-size: 1.05rem; border-width: 2px; }
.home-card input, .field input { border-width: 3px; caret-color: var(--red); }
.home-card input::placeholder, .field input::placeholder { color: #6b6455; }
.field label, .card h2 { font: 800 1.45rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.card h2 .muted { font-weight: 600; }
.solo-head, .code { font-family: var(--board); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.solo-head { font-size: 1.5rem; }
/* Escenario del personaje y sus flechas */
.preview-wrap { border: 3px solid var(--ink); border-radius: 12px; }
#preview-name { font: 800 1.9rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; color: #fff; }
.pv-nav { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); font-weight: 700; padding: 0 0 4px; }
.pv-nav:hover { background: var(--gold); }
/* Personajes: una ficha de casillero cada uno, con la franja de su color */
.char { background: linear-gradient(var(--c) 0 14px, var(--ink) 14px 17px, var(--paper-hi) 17px); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 10px; padding: 22px 4px 6px; }
.char .n { font: 800 1.05rem / 1.02 var(--board); letter-spacing: .02em; text-transform: uppercase; }
.char .by { color: var(--ink2); font-weight: 600; }
.char.selected { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .45); transform: translateY(-2px); }
.char.taken { opacity: .4; }
/* Jugadores */
.lobby-players li { background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; padding: 5px 10px 5px 6px; }
.lobby-players li.muted { background: none; border-style: dashed; border-color: var(--line); color: var(--muted); padding: 12px; }
.lobby-players img { border: 3px solid var(--c); background: #fff; width: 40px; height: 40px; }
.lobby-players b { font-size: 1.02rem; }
.lobby-players .muted { color: var(--ink2); }
.lobby-players .tag { font: 800 .9rem / 1 var(--board); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); padding: 4px 7px; border: 2px solid var(--ink); border-radius: 6px; }
.lobby-players .tag.host { background: var(--gold); }
.lobby-players .tag.off { background: #e9b0aa; }
.lobby-players .tag + .tag { margin-left: 6px; }
/* Modo de juego: dos casilleros; el elegido queda encendido */
.mode-card { background: linear-gradient(var(--band) 0 12px, var(--ink) 12px 15px, var(--paper-hi) 15px); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 10px; padding: 24px 10px 10px; --band: #9FD8F5; opacity: .7; transition: opacity .15s, transform .12s; }
.mode-card.extreme { --band: #F7941D; }
.mode-card b { font: 800 1.5rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.mode-card small { color: var(--ink2); font-size: .82rem; }
.mode-card:hover { opacity: .85; }
.mode-card.selected, .mode-card.selected.classic, .mode-card.selected.extreme { opacity: 1; border-color: var(--ink);
  background: linear-gradient(var(--band) 0 12px, var(--ink) 12px 15px, var(--paper-hi) 15px); box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0, 0, 0, .4); }
/* Rivales y reglas */
.bots-ctrl, .rules { background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; }
.bots-ctrl > span, .rules-t { font: 800 1.25rem / 1.05 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.bots-ctrl .muted, .rules summary small, .set-t small { color: var(--ink2); }
.rules summary::after { color: var(--ink); }
.bots-ctrl .stepper b { font: 800 1.6rem / 1 var(--board); }
.settings { border-top: 3px solid var(--ink); }
.settings label + label { border-top: 1px solid rgba(22, 19, 13, .2); }
.set-t > span { font-weight: 700; }
.settings select { background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; }
.settings input[type=checkbox] { accent-color: #d62f2f; }
.set-v { color: var(--ink); font: 800 1.2rem / 1 var(--board); }
.tut-note { background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; }

/* ---------- Plata que cuenta y flota la diferencia ---------- */
.pl .money { transition: color .2s; }
.pl .money.up { color: #0f7a37; }
.pl .money.down { color: #b3261e; }
.money-delta { position: fixed; z-index: 66; transform: translate(-50%, 0); pointer-events: none; padding: 0 9px; border-radius: 999px;
  background: var(--paper); border: 3px solid var(--ink); font: 800 1.25rem / 1.25 var(--board); letter-spacing: .03em;
  font-variant-numeric: tabular-nums; box-shadow: 0 4px 10px rgba(0, 0, 0, .35); animation: moneyDelta 1.1s ease-out forwards; }
.money-delta.up { color: #0f7a37; }
.money-delta.down { color: #b3261e; }
@keyframes moneyDelta { 0% { opacity: 0; transform: translate(-50%, -6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 2px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, 30px) scale(1); } }
.pl.gain { outline: 3px solid #1FA457; outline-offset: 1px; }
.pl.loss { outline: 3px solid var(--red); outline-offset: 1px; }

/* ======================================================================
   Cartulina. Una sola familia para todo lo que se lee de golpe: cartas, arresto, fiesta y carteles de título.
   Hoja crema, borde de tinta y un aro del color del suceso (--accent); el título va en la letra del tablero.
   ====================================================================== */
:root { --m-radius: 20px; --m-shadow: 0 20px 60px rgba(0, 0, 0, .6); --m-scrim: rgba(22, 16, 8, .64); }
.modal, .ptitle, .party { background: var(--m-scrim); }

/* ---------- Cartel de título (quiebra, boda, divorcio) ---------- */
.ptitle { position: fixed; inset: 0; z-index: 62; display: grid; place-items: center; padding: 16px; cursor: pointer; transition: opacity .25s; }
.ptitle.red { --accent: #e5483a; } .ptitle.pink { --accent: #ff8ac2; } .ptitle.gray { --accent: #b9c3cf; }
.ptitle.out { opacity: 0; }
.ptitle-icon { font-size: 2.6rem; line-height: 1.1; }
.ptitle-card p { margin: 6px 0 0; font-size: 1.05rem; line-height: 1.3; }
@media (prefers-reduced-motion: reduce) { .ptitle-card, .money-delta { animation: none; } .money-delta { opacity: 1; } }

.ptitle, .card-popup, .arrest-card, .party-card { --accent: var(--gold); }
.card-popup, .arrest-card, .party-card, .ptitle-card {
  font-family: var(--fun); text-align: center; background: var(--paper); color: var(--ink); border: 3px solid var(--ink);
  border-radius: var(--m-radius); padding: 18px; width: min(320px, 100%);
  box-shadow: 0 0 0 4px var(--accent), var(--m-shadow); }
.card-popup { width: min(320px, 86vw); }
/* Des-Tino y Clandes-Tino van sin aro de color: el distintivo es el sello del mazo arriba a la izquierda, con su nombre */
.card-popup:has(.ch-logo) { box-shadow: var(--m-shadow); }
.card-popup .ch-logo { --seal: #c85a0c; display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; text-align: left; }
.card-popup .ch-logo.chest { --seal: #1f5fa8; }
.card-popup .ch-seal { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--seal); color: #fff; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink), inset 0 0 0 3px rgba(255, 255, 255, .28);
  font-size: 1.55rem; transform: rotate(-8deg); }
.card-popup .ch-seal .ico svg { width: 1em; height: 1em; stroke-width: 2.6; }
.card-popup .ch-name { display: flex; flex-direction: column; min-width: 0; }
.card-popup .ch-name b { font: 800 1.55rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase;
  color: color-mix(in srgb, var(--seal) 70%, var(--ink)); }
.card-popup .ch-name small { font-size: .78rem; color: var(--ink2); margin-top: 2px; }
.card-popup:has(.ch.news) { --accent: #6b6b6b; }
.arrest-card { --accent: #e5271f; }
.card-popup.cielo { box-shadow: 0 0 0 4px var(--accent), var(--m-shadow); }
.arrest-title, .party-title, .ptitle-t { font: 800 2rem / 1.05 var(--board); letter-spacing: .05em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 62%, #000); }
.party-card img, .ptitle-card img { width: 68px; height: 68px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--accent); background: #fff; }

/* ---------- Menú ☰ del tablero (celular): una hoja con las herramientas arriba y las secciones abajo ---------- */
.menu { position: absolute; right: 0; top: 52px; min-width: 250px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; padding: 8px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  animation: pop .15s ease-out; z-index: 20; }
.menu.hidden { display: none; }
.menu button { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: 600 1.05rem / 1.1 var(--fun); text-align: left; cursor: pointer; text-transform: none; letter-spacing: 0; }
.menu button:hover, .menu button:focus-visible { background: #FFE7A0; }
.menu button.hidden { display: none; }
.menu button span { flex: 1; }
.menu .badge { position: static; }
.menu .ico svg { width: 24px; height: 24px; }
.menu .board-tools { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 2px 2px 10px; margin-bottom: 4px; border-bottom: 2px solid var(--ink-line); }
.menu .board-tools .tool { width: 46px; height: 46px; box-shadow: none; background: var(--paper-hi); }
.menu .board-tools .tool.hidden { display: none; }
.side-tools { z-index: 20; }
.side-tools .tool .badge { position: absolute; top: -7px; right: -7px; margin: 0; }

/* ======================================================================
   Celular vertical: el tablero ocupa toda la pantalla.
   Arriba, una tira de fichas de jugadores; abajo, una bandeja de cartulina con las acciones y el botón de dados
   sobresaliendo; lo que pasa en la partida aparece como tarjetas con la cara de quien lo hizo.
   ====================================================================== */
.rg-short { display: none; }
.events { display: none; }
.rg-ico { display: inline-grid; place-items: center; vertical-align: -.2em; }
.rg-ico svg { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) and (orientation: portrait) {
  #screen-game, #screen-game.board-full { display: block; }
  #board-wrap { position: absolute; inset: 0; }
  #panel { position: absolute; inset: 0; display: block; background: none; border: 0; padding: 0; overflow: visible; pointer-events: none; }
  #panel .players, #panel .actions, body.sheet-open #panel .tab-body, body.sheet-open #panel .sheet-backdrop { pointer-events: auto; }
  .log-mini { display: none; }

  /* Tira de fichas de jugadores */
  #turn-banner { display: none; }
  .players { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 0; right: 60px; max-height: none; display: flex; gap: 6px;
    padding: 4px 8px 10px; align-items: flex-start; border: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity; }
  .players::-webkit-scrollbar { display: none; }
  .pl { position: relative; flex: 0 0 auto; flex-direction: column; align-items: center; gap: 0; min-width: 60px; max-width: 80px; padding: 4px 6px 3px;
    border-width: 2px; border-radius: 14px; scroll-snap-align: center; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
  .pl img { width: 34px; height: 34px; border-width: 3px; }
  .pl .info { width: 100%; text-align: center; flex: none; }
  .pl .name { font-size: .82rem; line-height: 1.05; }
  .pl .sub { display: block; line-height: 1.1; }
  .pl .money { font-size: .8rem; }
  .pl.out .money { font-size: .62rem; }
  /* Estados (cárcel, matrimonio, voz…) como una etiqueta sobre el retrato, así la tira no crece */
  .pl .icons, .pl .vz { position: absolute; top: -7px; right: -4px; margin: 0; padding: 0 4px; border-radius: 8px; background: var(--paper); border: 2px solid var(--ink);
    font-size: .6rem; line-height: 1.35; max-width: 76px; overflow: hidden; }
  .pl .vz { right: auto; left: -4px; }
  .pl .icons:empty, .pl .vz:empty { display: none; }
  .pl .countdown { display: block; margin-top: 1px; font: 800 .85rem / 1 var(--board); letter-spacing: .04em; color: #b3261e; }

  /* Bandeja de acciones: cartulina pegada abajo; el botón de dados sobresale por arriba */
  .actions { position: absolute; left: 0; right: 0; bottom: 0; flex: none; max-height: 52dvh; background: var(--paper); border: 0; border-top: 3px solid var(--ink);
    border-radius: 22px 22px 0 0; padding: 12px 14px calc(10px + var(--safe-b)); box-shadow: 0 -6px 22px rgba(0, 0, 0, .35); }
  .actions:has(.roll-go) { overflow: visible; }
  /* La placa va siempre primera (sube por encima de la bandeja): lo que la acompaña (cárcel, deuda) queda debajo y no tapado */
  .actions .btns:has(.roll-go) { order: -1; justify-content: center; margin-top: -68px; pointer-events: none; }
  .actions .btns .btn.roll-go { pointer-events: auto; flex: none; width: 116px; height: 116px; padding: 0; border-radius: 50%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 0; border: 4px solid #fff; outline: 3px solid var(--ink); background: var(--red);
    box-shadow: 0 10px 22px rgba(0, 0, 0, .45); animation: goPulse 1.8s ease-in-out infinite; }
  .roll-go:active { transform: scale(.95); }
  .roll-go:disabled { animation: none; background: #8d867a; }
  .roll-go .rg-ico svg { width: 46px; height: 46px; }
  .roll-go .rg-long { display: none; }
  .roll-go .rg-short { display: block; font: 800 1.4rem / 1 var(--board); letter-spacing: .08em; text-transform: uppercase; }

  /* Lo demás se acomoda arriba de la bandeja */
  #tutorial { top: calc(var(--top-h, 120px) + 6px); left: 10px; right: 10px; width: auto; }
  .dice-area { left: auto; right: 12px; bottom: calc(var(--dock-h, 100px) + 12px); transform: none; }
  .pot { bottom: calc(var(--dock-h, 100px) + 12px); }
  .toasts { top: auto; bottom: calc(var(--dock-h, 100px) + 16px); }

  /* Tarjetas de evento: chicas, de a dos y sin tapar los toques sobre el tablero */
  .events { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; position: absolute; left: 10px; right: 10px; top: calc(var(--top-h, 70px) + 2px);
    pointer-events: none; z-index: 4; }
  .ev-card { display: flex; align-items: center; gap: 6px; max-width: 88%; padding: 3px 12px 3px 3px; border-radius: 999px;
    background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
    font-family: var(--fun); font-size: .82rem; font-weight: 500; line-height: 1.15; animation: evIn .3s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .3s, transform .3s; }
  .ev-card.out { opacity: 0; transform: translateY(-6px); }
  .ev-card img { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 3px solid var(--c, var(--ink)); background: #fff; }
  .ev-ico { flex: none; width: 28px; text-align: center; font-size: 1.1rem; }
  .ev-t b { font-weight: 700; color: color-mix(in srgb, var(--c) 56%, #000); }
  .ev-t .lg-money { font-weight: 700; color: var(--gold-ink); }
}
@keyframes goPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes evIn { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .roll-go, .ev-card { animation: none !important; } }
.pl .countdown { display: none; }
@media (max-width: 900px) and (orientation: portrait) { .pl .countdown { display: block; } }

/* ---------- Tablet en vertical: todo un poco más grande ---------- */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
  .players { gap: 10px; padding: 6px 12px 12px; right: 76px; }
  .pl { min-width: 96px; max-width: 124px; padding: 6px 10px 5px; border-width: 3px; border-radius: 18px; }
  .pl img { width: 52px; height: 52px; }
  .pl .name { font-size: 1.1rem; }
  .pl .money { font-size: 1.1rem; }
  .pl .icons, .pl .vz { font-size: .8rem; top: -8px; }
  .pl .countdown { font-size: 1.1rem; }
  .actions { padding: 14px 24px calc(14px + var(--safe-b)); }
  .actions .btns:has(.roll-go) { margin-top: -86px; }
  .actions .btns .btn.roll-go { width: 150px; height: 150px; }
  .roll-go .rg-ico svg { width: 60px; height: 60px; }
  .roll-go .rg-short { font-size: 1.8rem; }
  .actions .btn { font-size: 1.4rem; padding: 12px 18px; }
  .actions .msg { font-size: 1.1rem; }
  .buy-box .t { font-size: 1.6rem; }
  .die { width: 52px; height: 52px; padding: 7px; border-radius: 18px; }
  .die i { width: 9px; height: 9px; }
  .dice-area { gap: 12px; }
  .pot { font-size: 1.05rem; padding: 8px 14px; }
  .ev-card { font-size: 1.05rem; gap: 8px; padding: 4px 16px 4px 4px; }
  .ev-card img { width: 38px; height: 38px; }
  .tool { width: 54px; height: 54px; border-radius: 14px; }
  .ico svg { width: 26px; height: 26px; }
  .menu { min-width: 300px; top: 66px; }
  .menu button { font-size: 1.15rem; min-height: 54px; }
  .menu .board-tools .tool { width: 54px; height: 54px; }
  .modal-card { width: min(540px, 100%); font-size: 1.05rem; }
  body.sheet-open .tab-body { left: 50%; right: auto; width: min(100%, 680px); transform: translateX(-50%); }
  #tutorial { font-size: 1.05rem; }
}

/* ---------- Ventanas: el botón de cerrar es una pieza de cartulina aparte, siempre visible ---------- */
.modal-card h3 { padding-right: 48px; }
.modal-close + .deed { margin-top: 42px; }

/* ---------- Intercambio: se acomoda al ancho ---------- */
.modal-card { container-type: inline-size; }
.tb-col .tb-money { display: flex; flex-direction: column; align-items: stretch; gap: 3px; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.tb-money small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.tb-col .tb-money input { margin: 0; font-size: 1rem; }
.tb-col label:not(.tb-money) { min-height: 40px; padding: 6px 4px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.tb-col label:not(.tb-money):active { background: var(--paper-hi); }
.tb-col input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--red); }
.tb-send-bar { position: sticky; bottom: 0; margin: 10px -16px -16px; padding: 12px 16px 16px; background: linear-gradient(to top, var(--paper) 70%, transparent); }
@container (max-width: 460px) { .tb-cols { grid-template-columns: 1fr; } }

/* ---------- Sin conexión ---------- */
.conn { background: #FBD9D4; color: var(--ink); border: 3px solid var(--bad); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }

/* Celular acostado: el registro corto se toca para abrir el completo */
.log-mini { position: relative; }
.log-mini::after { content: "Ver todo"; position: absolute; right: 10px; top: 4px; font: 800 .95rem / 1 var(--board); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Íconos de trazo dentro de títulos y botones de texto */
h3 .ico, .sheet-head .ico, .btn .ico { vertical-align: -.12em; margin-right: .2em; }
h3 .ico svg, .sheet-head .ico svg { width: .85em; height: .85em; }
.btn .ico svg { width: 1.05em; height: 1.05em; }

/* ======================================================================
   Segunda mano de ajustes (revisión final)
   ====================================================================== */
/* Cerrar: pieza de cartulina con la X dibujada, siempre visible */
.modal-close { top: 18px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); font-size: 0; color: transparent; padding: 0;
  background: var(--paper-hi) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316130d' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.modal-close:hover, .modal-close:focus-visible { background-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
body.sheet-open .sheet-head .modal-close { position: static; }

/* Franja de color arriba de cada hoja y ventana (como la de las propiedades): --band la cambia según el contenido */
.modal-card, body.sheet-open .tab-body {
  --band: var(--gold);
  background-image: linear-gradient(var(--band) 0 10px, var(--ink) 10px 13px, transparent 13px); background-repeat: no-repeat; }
.modal-card { padding-top: 28px; }
body.sheet-open .tab-body { border-top: 0; }
body.sheet-open .sheet-head { padding-top: 20px; }

/* Cuenta regresiva con su reloj de trazo */
.countdown { display: inline-flex; align-items: center; gap: 3px; }
.countdown .ico svg { width: .95em; height: .95em; }

/* Donar: una pieza de cartulina secundaria, centrada; no compite con las tres formas de jugar */
.donate { align-self: center; background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
  font: 800 1.15rem / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; }
.donate:hover { background: var(--gold); box-shadow: 0 6px 14px rgba(0, 0, 0, .3); }
.donate .ico svg { width: 1.2em; height: 1.2em; }
@media (max-width: 900px), (orientation: portrait) { .donate { align-self: center; } }

/* Pozo y dados de la última tirada: en PC arriba a la izquierda, sobre la mesa y no sobre el tablero */
@media (min-width: 901px) and (orientation: landscape) {
  .pot { left: 14px; top: 14px; bottom: auto; }
  .dice-area { left: 14px; top: 66px; bottom: auto; right: auto; transform: none; }
}
/* Celular y tablet verticales: los dados se ven solo cuando hay para tirar, dentro de la bandeja junto a la placa roja */
@media (max-width: 900px) and (orientation: portrait) {
  .dice-area { display: none; }
  /* A la altura de la placa (arriba de la bandeja), no al fondo: abajo puede haber botones (pagar la cárcel, usar tarjeta) */
  body.roll-tray .dice-area { display: flex; position: absolute; left: auto; right: 16px; top: auto; bottom: calc(var(--dock-h, 100px) - 54px); transform: none; z-index: 3; }
}
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
  .actions .btns .btn.roll-go { width: 164px; height: 164px; }
  .roll-go .rg-short { font-size: 1.5rem; letter-spacing: .05em; }
  body.roll-tray .dice-area { right: 28px; bottom: calc(var(--dock-h, 100px) - 74px); }
}

/* Sala: el texto del código ya no se corta a la mitad */
@media (max-width: 900px), (orientation: portrait) {
  .lobby-head .room-code .muted { white-space: normal; max-width: 100%; line-height: 1.15; overflow: visible; text-overflow: clip; }
}
.pot .ico svg { width: 1.15em; height: 1.15em; }
.pot { display: flex; align-items: center; gap: 4px; }
.pot span { display: inline-flex; align-items: center; gap: 4px; }

/* Íconos de trazo en los carteles y las cartas */
.ptitle-icon .ico svg { width: 2.8rem; height: 2.8rem; }
.arrest-title .ico svg, .party-title .ico svg { width: .85em; height: .85em; }
.card-popup .ch .ico svg { width: 1em; height: 1em; }
.card-popup .kind .ico svg { width: 1em; height: 1em; }
.donate .ico svg { width: 1.2em; height: 1.2em; }

/* ---------- Ventanas: un nivel, con Volver ---------- */
.modal { z-index: 57; }   /* por encima de la subasta; los minijuegos y los carteles grandes cierran toda ventana */
.modal-back { margin: 0 0 8px; padding: 3px 12px 3px 8px; }
.modal-back .ico svg { width: 1.1em; height: 1.1em; }
.block-note { display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 10px;
  background: #FFF1C2; font-size: .92rem; font-weight: 600; line-height: 1.25; }
.block-note .ico svg { width: 1.3em; height: 1.3em; flex: none; }
.modal-back ~ .modal-close + .deed { margin-top: 10px; }

/* ======================================================================
   Sala de juego: los minijuegos no abren ventanas, llevan a todos a una sala a pantalla completa.
   Arriba el nombre y los jugadores, en el medio el escenario (3D o la arena), abajo los controles.
   Las reglas son una franja que se retira sola; el resultado, una banda abajo.
   ====================================================================== */
.minigame { position: fixed; inset: 0; z-index: 58; background: radial-gradient(ellipse at 50% 30%, #3d2e22, var(--bg) 70%); }
.mg-room { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; max-width: 920px; margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px calc(10px + var(--safe-b)); color: var(--text); text-align: center; }
.mg-room.enter { animation: roomIn .4s cubic-bezier(.2, .8, .2, 1); }
@keyframes roomIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.mg-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding-right: 2px; }
.mg-name { flex: 1; min-width: 0; font: 800 clamp(1.25rem, 5.6vw, 1.7rem) / 1.02 var(--board); letter-spacing: .05em; text-transform: uppercase; text-align: left; }
.mg-faces { flex: none; }
.mg-faces { display: flex; align-items: center; }
.mg-faces span { margin-left: -8px; }
.mg-faces span:first-child { margin-left: 0; }
.mg-faces .mg-face { width: 38px; height: 38px; }
.mg-faces span.owner .mg-face { box-shadow: 0 0 0 3px var(--gold); }
.mg-face { width: 28px; height: 28px; border-radius: 50%; border: 3px solid; background: #fff; }
.mg-timer { flex: none; height: 12px; background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.mg-timer i { display: block; height: 100%; width: 100%; background: #1FA457; transition: width .1s linear; }
.mg-stage3d { flex: 1 1 0; min-height: 150px; width: 100%; border-radius: 14px; border: 3px solid var(--ink); overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #4a3a2a, #1e1710 75%); }
.mg-body { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.mg-room.duel .mg-body { flex: 0 0 auto; }
.mg-body.locked { pointer-events: none; opacity: .35; filter: blur(1px); }
/* El joystick sí toma el dedo durante la cuenta: el que ya lo tiene apoyado sale corriendo al arrancar */
.mg-body.locked .mg-joy { pointer-events: auto; }
.mg-room.arena .mg-body { justify-content: flex-start; }
.mg-arena { flex: 1 1 0; min-height: 160px; width: 100%; border-radius: 14px; border: 3px solid var(--ink); touch-action: none; user-select: none;
  -webkit-user-select: none; cursor: crosshair; display: block; }
canvas.mg-arena { flex: none; width: min(100%, calc(100dvh - 300px)); aspect-ratio: 1; min-height: 0; margin: 0 auto; }
.mg-room.joy .mg-arena { cursor: default; }
.mg-body.locked .mg-arena, .mg-room.arena .mg-body.locked { filter: none; opacity: 1; }
.mg-hintwrap { position: relative; flex: none; height: 0; z-index: 3; }
.mg-hint { position: absolute; left: 2px; right: 2px; top: 2px; padding: 8px 14px; pointer-events: none;
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  font-size: .98rem; line-height: 1.3; font-weight: 600; transition: opacity .5s, transform .5s; }
.mg-hint.off { opacity: 0; transform: translateY(-10px); }
.mg-count { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; font: 800 9rem / 1 var(--board); color: var(--paper-hi);
  paint-order: stroke fill; -webkit-text-stroke: 12px var(--ink); text-shadow: 0 8px 24px rgba(0, 0, 0, .5); pointer-events: none; animation: pop .3s ease-out; }
.mg-enter { position: absolute; left: 0; right: 0; bottom: calc(18px + var(--safe-b)); z-index: 3; display: flex; align-items: center; justify-content: center; gap: 8px; pointer-events: none; }
.mg-enter-t { padding: 4px 12px; border-radius: 999px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); font: 800 1.1rem / 1.2 var(--board); letter-spacing: .06em; text-transform: uppercase; }
.mg-in { opacity: .35; transition: opacity .3s; }
.mg-in.ok { opacity: 1; }
.mg-in .mg-face { width: 34px; height: 34px; }
/* Resultado: quien ganó arriba y el resumen en una banda abajo */
.mg-podium { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 18px; }
.mg-win { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1); }
.mg-win .mg-face { width: 104px; height: 104px; border-width: 5px; box-shadow: 0 0 0 5px var(--gold), 0 10px 22px rgba(0, 0, 0, .45); }
.mg-win b { font: 800 1.6rem / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; }
.mg-none { font-size: 6rem; line-height: 1; }
.mg-result { flex: none; max-height: 52%; overflow-y: auto; padding: 12px 14px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: 0 -4px 22px rgba(0, 0, 0, .4); animation: sheetUp .3s ease-out; }
.mg-summary { font: 800 1.7rem / 1.05 var(--board); letter-spacing: .03em; text-transform: uppercase; margin: 2px 0 8px; }
.mg-lines { list-style: none; padding: 0; margin: 0; text-align: left; font-size: .95rem; display: flex; flex-direction: column; gap: 4px; }
.mg-lines li { background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 10px; padding: 5px 10px; }
.mg-back { margin-top: 8px; font-size: .85rem; color: var(--ink2); font-weight: 600; }
/* Cada juego en su sala */
.mg-room.duel .mg-pad { min-height: 96px; font-size: 1.8rem; }
.mg-room.duel .mg-stage3d { cursor: default; }
.mg-room.ritmo .mg-body { justify-content: flex-start; gap: 6px; }
.mg-room.ritmo .rt-road { flex: 1 1 0; min-height: 190px; height: auto; }
.mg-room:not(.duel):not(.arena):not(.ritmo) .mg-body { flex: 1; justify-content: center; }
.mg-room .mg-pad { min-height: 34dvh; }
.mg-room.duel .mg-choices, .mg-room .mg-options { max-width: 560px; }
@media (min-width: 900px) {
  .mg-name { font-size: 2rem; }
  .mg-hint { left: 50%; right: auto; width: min(640px, 100%); transform: translateX(-50%); }
  .mg-hint.off { transform: translateX(-50%) translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) { .mg-room.enter, .mg-win, .mg-result, .mg-splash { animation: none; } }
.mg-room .mg-balloon { font-size: min(11rem, 30dvh); }
.mg-room .mg-big { font-size: 4.6rem; }

.mg-room.arena .mg-wait-body, .mg-room .mg-wait-body { justify-content: center; }
.mg-splash { font-size: 8rem; line-height: 1; animation: emo-float 3.2s ease-in-out infinite; }
body:has(#minigame:not(.hidden)) .money-delta { display: none; }

/* ---------- Sala en pantallas bajas y apaisadas (celular acostado): escenario a la izquierda, controles a la derecha ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  .mg-room { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42%); grid-template-rows: auto auto minmax(0, 1fr);
    gap: 6px 12px; padding: calc(6px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) calc(6px + var(--safe-b)) calc(12px + env(safe-area-inset-left, 0px)); }
  .mg-top { grid-area: 1 / 1 / 2 / 3; min-height: 34px; }
  .mg-name { font-size: 1.25rem; }
  .mg-faces .mg-face { width: 30px; height: 30px; }
  .mg-timer { grid-area: 2 / 1 / 3 / 3; height: 9px; }
  .mg-hintwrap { position: absolute; left: 12px; right: 12px; top: 44px; height: 0; }
  .mg-hint { font-size: .85rem; padding: 6px 12px; }
  .mg-stage3d { grid-area: 3 / 1 / 4 / 2; height: auto; min-height: 0; }
  .mg-podium { grid-area: 3 / 1 / 4 / 2; }
  .mg-win .mg-face { width: 80px; height: 80px; }
  .mg-body { grid-area: 3 / 2 / 4 / 3; }
  .mg-result { grid-area: 3 / 2 / 4 / 3; max-height: none; align-self: stretch; padding: 8px 12px; }
  .mg-summary { font-size: 1.35rem; }
  .mg-lines { font-size: .85rem; }
  .mg-enter { bottom: 8px; }
  .mg-count { font-size: 7rem; }
  /* juegos sin escenario aparte: ocupan todo el ancho */
  .mg-room:not(.duel):not(.ritmo) .mg-body { grid-area: 3 / 1 / 4 / 3; }
  .mg-room .mg-balloon { font-size: min(8rem, 38dvh); }
  .mg-room .mg-big { font-size: 3rem; }
  .mg-room .mg-pad { min-height: 0; height: 100%; max-height: 58dvh; font-size: 1.8rem; }
  .mg-room .mg-choices { gap: 6px; }
  .mg-room .mg-choice { padding: 8px 4px; }
  .mg-room .mg-choice span { font-size: 1.6rem; }
  .mg-room .mg-options { grid-template-columns: 1fr; gap: 6px; }
  .mg-room .mg-opt { padding: 8px; }
  .mg-room .mg-step, .mg-room .mg-q { font-size: 1.2rem; }
  /* arenas con joystick: joystick a la izquierda, arena en el medio, golpe a la derecha */
  .mg-room.arena .mg-body { display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(100px, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 4px 10px; align-items: end; justify-items: center; }
  .mg-room.arena .mg-hud { grid-area: 1 / 1 / 2 / 4; font-size: 1.1rem; }
  .mg-room.arena .mg-arena { grid-area: 2 / 2 / 3 / 3; align-self: stretch; height: 100%; width: auto; max-width: 100%; aspect-ratio: 1; min-height: 0; flex: none; }
  .mg-room.arena canvas.mg-arena { width: auto; }
  .mg-room.arena .mg-ctrl { display: contents; }
  .mg-room.arena .mg-joy { grid-area: 2 / 1 / 3 / 2; margin: 0; align-self: end; width: 120px; height: 120px; }
  .mg-room.arena .mg-hit, .mg-room.arena .mg-hit.round { grid-area: 2 / 3 / 3 / 4; margin: 0; align-self: end; }
  .mg-room.arena:not(.joy) .mg-arena { grid-area: 2 / 1 / 3 / 4; width: 100%; aspect-ratio: auto; }
  .mg-room.luzroja .mg-body { grid-template-columns: minmax(0, 1fr) 230px; }
  .mg-room.luzroja .mg-hud { grid-area: 1 / 1 / 2 / 3; }
  .mg-room.luzroja .mg-arena { grid-area: 2 / 1 / 3 / 2; width: 100%; aspect-ratio: auto; }
  .mg-room.luzroja .mg-run { grid-area: 2 / 2 / 3 / 3; align-self: center; height: 70%; width: 100%; }
  /* guitarra: la ruta a la izquierda, las cuatro teclas en una grilla a la derecha */
  .mg-room.ritmo .mg-body { grid-area: 3 / 1 / 4 / 3; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 36%); grid-template-rows: auto minmax(0, 1fr); gap: 6px 12px; align-items: stretch; }
  .mg-room.ritmo .rt-top { grid-area: 1 / 1 / 2 / 3; }
  .mg-room.ritmo .rt-road { grid-area: 2 / 1 / 3 / 2; min-height: 0; height: 100%; }
  .mg-room.ritmo .rt-keys { grid-area: 2 / 2 / 3 / 3; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; align-self: stretch; }
  .mg-room.ritmo .rt-key { height: auto; font-size: 2rem; }
  .mg-room.ritmo .rt-hint { display: none; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .mg-room.luzroja .mg-run { white-space: normal; min-width: 0; padding: 6px 10px; font-size: 1.15rem; line-height: 1.1; }
}

/* Tino, el anfitrión: la cara en un aro de tinta y la frase en un globo de cartulina */
.tino-face { width: 56px; height: 56px; flex: none; border-radius: 50%; border: 3px solid var(--ink); background: #f3dfb5; object-fit: cover; }
.tino-host { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.tino-host .tino-face { width: 68px; height: 68px; }
.tino-bubble { position: relative; flex: 1; padding: 8px 12px; background: var(--paper-hi); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px;
  font-size: .9rem; line-height: 1.3; }
.tino-bubble::before { content: ''; position: absolute; left: -9px; top: 50%; width: 12px; height: 12px; margin-top: -6px; background: var(--paper-hi);
  border: 3px solid var(--ink); border-width: 0 0 3px 3px; transform: rotate(45deg); }
.tut-head .tino-face { width: 36px; height: 36px; margin-right: 8px; }
.tut-head b { margin-right: auto; }
/* El comentario de Tino sobre la partida: abajo a la izquierda del tablero, sin tapar los toques */
.tino-say { position: absolute; left: 10px; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 8px; max-width: min(340px, calc(100% - 100px)); pointer-events: none;
  padding: 4px 14px 4px 4px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  font-size: .88rem; line-height: 1.25; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.tino-say.on { opacity: 1; transform: none; }
.tino-say img { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 3px solid var(--ink); background: #f3dfb5; }
.tino-say p { margin: 0; }
@media (max-width: 900px), (orientation: portrait) { .tino-say { bottom: calc(var(--dock-h, 0px) + 12px); max-width: calc(100% - 130px); } }
/* Con la placa roja de tirar asomando por encima de la bandeja, el globo va más arriba para no taparla */
@media (max-width: 900px) and (orientation: portrait) { body.roll-tray .tino-say { bottom: calc(var(--dock-h, 0px) + 70px); } }
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) { body.roll-tray .tino-say { bottom: calc(var(--dock-h, 0px) + 90px); } }
@media (prefers-reduced-motion: reduce) { .tino-say { transition: none; } }

/* Tutorial: tu personaje en 2D con una nube de diálogo; todo lo que no hay que tocar se oscurece (#tut-veil) */
body #tutorial { position: fixed; left: 10px; right: 10px; top: 58px; bottom: auto; z-index: 85; width: min(460px, calc(100% - 20px)); padding: 0; display: flex; align-items: flex-end; gap: 4px;
  background: none; border: 0; border-radius: 0; box-shadow: none; font-size: 1rem; }
body #tutorial.hidden { display: none; }
body #tutorial.low { align-items: flex-start; }
.tut-who { width: 112px; height: 112px; flex: none; object-fit: contain; filter: drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.tut-cloud { position: relative; flex: 1; padding: 10px 12px; background: var(--paper-hi); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.tut-cloud::before { content: ''; position: absolute; left: -10px; bottom: 26px; width: 14px; height: 14px; background: var(--paper-hi); border: 3px solid var(--ink); border-width: 0 0 3px 3px; transform: rotate(45deg); }
body #tutorial.low .tut-cloud::before { bottom: auto; top: 26px; }
body #tutorial p { margin: 6px 0 8px; font-size: .92rem; line-height: 1.38; }
#tut-veil { position: fixed; z-index: 84; pointer-events: none; border-radius: 16px; box-shadow: 0 0 0 200vmax rgba(10, 6, 3, .74), 0 0 0 3px #f6d046;
  box-sizing: content-box; transition: left .25s, top .25s, width .25s, height .25s; animation: tutRing 1.1s ease-in-out infinite; }
#tut-veil.hidden { display: none; }
/* la luz se agranda unos píxeles y vuelve: "tocá acá" sin decirlo */
@keyframes tutRing { 50% { padding: 7px; margin: -7px; border-radius: 22px; } }
@media (max-width: 520px) { .tut-who { width: 86px; height: 86px; margin-right: -6px; } body #tutorial p { font-size: .86rem; } }
@media (prefers-reduced-motion: reduce) { #tut-veil { animation: none; transition: none; } }
.tut-btns .primary { animation: tutRing2 1.1s ease-in-out infinite; }
@keyframes tutRing2 { 50% { box-shadow: 0 0 0 5px rgba(246, 208, 70, .75); } }
@media (prefers-reduced-motion: reduce) { .tut-btns .primary { animation: none; } }
/* el contenedor es transparente: solo la nube y Tino reciben toques, lo de abajo (dados, botones) sigue tocable */
body #tutorial { pointer-events: none; }
body #tutorial .tut-cloud { pointer-events: auto; }

/* ======================================================================
   El afiche (el mismo de la pantalla de carga) de fondo en el inicio y la sala, en todos los tamaños.
   En PC css/desktop.css lo completa con los personajes en 3D.
   ====================================================================== */
#screen-home, #screen-lobby { background: linear-gradient(135deg, #CFE8D2 0 24%, #9cc6dc 24% 41%, #e9f3ea 41% 59%, #9cc6dc 59% 76%, #CFE8D2 76%); }
.home-poster { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
#screen-home { padding-block: calc(clamp(22px, 4.5vmin, 44px) + 14px); }
#screen-home > :not(.home-poster) { position: relative; }
.home-card { box-shadow: 0 14px 34px rgba(22, 19, 13, .3); }
.about { background: var(--paper); color: var(--ink2); border: 3px solid var(--ink); border-radius: 16px; padding: 18px 20px; box-shadow: 0 10px 24px rgba(22, 19, 13, .22); }
.about h2, .about h3 { color: var(--ink); }
.about a { color: var(--red); }
.solo-head, .room-code { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 14px; box-shadow: 0 5px 12px rgba(22, 19, 13, .2); }
.room-code .code { color: var(--ink); }
.room-code .muted, .room-code:hover .muted { color: var(--ink2); }
#screen-lobby > .lobby > .muted, #screen-lobby .lobby-head .muted:not(.room-code .muted) { color: var(--ink); }

/* ¡Tu turno! Una franja cruza la pantalla y tu personaje se asoma. No frena nada ni toma toques. */
.turn-splash { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; display: none; }
.turn-splash.go { display: block; }
.ts-band { position: absolute; left: -4%; right: -4%; top: 36%; height: clamp(96px, 17vh, 168px); rotate: -3deg; display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vw, 30px);
  background: color-mix(in srgb, var(--c) 80%, #fff); border-block: 5px solid var(--ink); box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  animation: tsBand 1.5s cubic-bezier(.77, 0, .175, 1) both; }
.ts-t { font: 800 min(13vw, 19vh, 9rem) / 1 var(--board); letter-spacing: .05em; text-transform: uppercase; color: var(--paper-hi);
  -webkit-text-stroke: min(2.2vw, 3vh, 16px) var(--ink); paint-order: stroke fill; white-space: nowrap; animation: tsText 1.5s cubic-bezier(.23, 1, .32, 1) both; }
.ts-face { flex: none; align-self: flex-end; width: min(34vw, 42vh, 270px); height: min(34vw, 42vh, 270px); margin-bottom: -5px; filter: drop-shadow(0 6px 0 rgba(22, 19, 13, .35));
  animation: tsFace 1.5s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes tsBand { 0% { clip-path: inset(-300px 100% -60px 0); } 22%, 78% { clip-path: inset(-300px 0 -60px 0); } 100% { clip-path: inset(-300px 0 -60px 100%); } }
@keyframes tsText { 0% { transform: translateX(-50px); opacity: 0; } 24% { opacity: 1; } 80% { transform: none; opacity: 1; } 100% { transform: translateX(30px); opacity: 0; } }
@keyframes tsFace { 0% { transform: translateY(50px) scale(.9); opacity: 0; } 30% { transform: none; opacity: 1; } 80% { transform: none; opacity: 1; } 100% { transform: translateX(20px); opacity: 0; } }

/* El total de los dados, al lado de los dados */
.dice-sum { display: block; margin-left: 2px; font: 800 2.6rem / .8 var(--board); color: var(--paper-hi); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  font-variant-numeric: tabular-nums; animation: sumIn .4s cubic-bezier(.34, 1.4, .5, 1); }
@keyframes sumIn { from { transform: scale(1.6); opacity: 0; } }
#dice { transition: opacity .3s ease; }
#dice.fade { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .ts-band, .ts-t, .ts-face, .dice-sum { animation: none; }
}

/* ---------- Buscar partida: salas públicas ---------- */
.browse-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.browse-head h3 { margin: 0; font: 800 1.35rem / 1 var(--board); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.browse-list { display: flex; flex-direction: column; gap: 8px; max-height: min(46dvh, 380px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 4px 2px; margin: 0 -4px 0 -2px; }
.room-row { --band: #F7941D; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px 8px 14px; text-align: left; cursor: pointer;
  color: var(--ink); background: linear-gradient(90deg, var(--band) 0 6px, var(--paper-hi) 6px); border: 3px solid var(--ink); border-radius: 12px; font: inherit;
  transition: transform .16s cubic-bezier(.23, 1, .32, 1); }
.room-row.classic { --band: #9FD8F5; }
.room-row:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .room-row:hover { transform: translateX(4px); } }
.rr-faces { display: flex; }
.rr-faces img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; margin-left: -10px; }
.rr-faces img:first-child { margin-left: 0; }
.rr-faces img.bot { filter: grayscale(.6); opacity: .75; }
.rr-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rr-info b { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-info small { font-size: .8rem; color: var(--ink2); line-height: 1.25; }
.rr-n { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rr-n b { font: 800 1.3rem / 1 var(--board); font-variant-numeric: tabular-nums; }
.rr-n small { font: 800 .8rem / 1 var(--board); letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; background: var(--red); color: #fff; }
.browse-empty { margin: 4px 0; padding: 14px; border: 3px dashed var(--ink); border-radius: 12px; text-align: center; font-size: .95rem; color: var(--ink2); }
@media (max-width: 420px) { .rr-faces img:nth-child(n+4) { display: none; } }

/* ---------- Desafío del día ---------- */
.daily-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: #F7941D; color: var(--ink); border: 2px solid var(--ink);
  font: 800 .75rem / 1.2 var(--board); letter-spacing: .05em; vertical-align: .15em; font-style: normal; }
.daily-badge.done { background: #1FA457; color: #fff; }
.daily-note { background: var(--paper-hi); color: var(--ink); border: 3px solid #D63A92; }
.dn-goal { display: block; margin-top: 6px; font-size: .85rem; color: var(--ink2); }
.pot .last-round { color: var(--red); }
.daily-end { margin: 14px 0 16px; padding: 12px; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper-hi); color: var(--ink); text-align: left; }
.daily-end.won { border-color: #1FA457; box-shadow: 0 0 0 3px rgba(31, 164, 87, .25); }
.daily-end > b { display: block; text-align: center; margin-bottom: 8px; }
.daily-standings { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.daily-standings li { display: grid; grid-template-columns: 1.4em 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 9px; }
.daily-standings li.me { background: rgba(247, 225, 27, .35); }
.daily-standings .ds-n { font: 800 1.1rem / 1 var(--board); text-align: center; }
.daily-standings img { width: 30px !important; height: 30px !important; border-width: 2px !important; box-shadow: none !important; }
.daily-standings b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-standings span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Podés construir ---------- */
.build-hint { width: 100%; animation: build-pulse 1.8s cubic-bezier(.23, 1, .32, 1) infinite; }
@keyframes build-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(247, 194, 27, .7); } 60% { box-shadow: 0 0 0 9px rgba(247, 194, 27, 0); } }
#tab-props [data-pa="build"]:not(:disabled) { animation: build-pulse 1.8s cubic-bezier(.23, 1, .32, 1) infinite; }
@media (prefers-reduced-motion: reduce) { .build-hint, #tab-props [data-pa="build"]:not(:disabled) { animation: none; } }

/* ---------- Celular en vertical: lo mejor de la PC ----------
   Cada jugador es una ficha con su personaje asomando (como en la PC), tu lugar va abajo a la izquierda y
   más grande, y arriba cuelga el cartel de turno con el pozo y la ronda. */
@media (max-width: 599px) and (orientation: portrait) {
  .players { gap: 8px; padding: 22px 8px 8px; align-items: flex-end; }
  .pl { flex-direction: row; align-items: stretch; gap: 0; min-width: 0; width: 112px; max-width: none; padding: 0; min-height: 46px; border-width: 3px; border-radius: 12px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c) 78%, #fff) 0 38px, var(--ink) 38px 41px, var(--paper-hi) 41px); overflow: visible; }
  .pl img:not(.emoji) { position: absolute; left: -3px; bottom: 0; width: 50px; height: 50px; border: 0; border-radius: 0 0 0 9px; background: none; pointer-events: none;
    filter: drop-shadow(0 2px 0 rgba(22, 19, 13, .3)); }
  .pl .info { margin-left: 41px; padding: 4px 5px 3px 6px; text-align: left; flex: 1; min-width: 0; }
  .pl .name { font-size: .78rem; }
  .pl .money { font: 800 1.02rem / 1.05 var(--board); letter-spacing: .02em; }
  .pl.turn { transform: translateY(-4px); }
  .pl.out .money { font-size: .66rem; }
  /* Tu lugar: abajo a la izquierda, arriba de la bandeja, más grande (como en la PC) */
  .pl.me { position: fixed; left: 10px; bottom: calc(var(--dock-h, 100px) + 10px); z-index: 3; width: 134px; min-height: 58px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c) 78%, #fff) 0 50px, var(--ink) 50px 53px, var(--paper-hi) 53px); }
  .pl.me img:not(.emoji) { width: 70px; height: 70px; left: -6px; }
  .pl.me .info { margin-left: 53px; padding-top: 6px; }
  .pl.me .name::after { content: ""; }
  .pl.me .money { font-size: 1.4rem; }
  /* Cartel de turno colgado debajo de la tira, con el pozo y la ronda debajo */
  #turn-banner { display: flex; top: calc(var(--top-h, 80px) + 2px); max-width: calc(100% - 24px); padding: 2px 14px 2px 3px; gap: 8px;
    font-size: 1.05rem; border-radius: 999px; z-index: 3; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
  #turn-banner img { width: 30px; height: 30px; }
  .pot { left: 50%; right: auto; top: calc(var(--top-h, 80px) + 34px); bottom: auto; transform: translateX(-50%); flex-direction: row; gap: 8px;
    padding: 8px 12px 3px; border-radius: 0 0 12px 12px; font-size: .78rem; background: var(--paper-2); z-index: 2; white-space: nowrap; }
  .events { top: calc(var(--top-h, 70px) + 66px); }
  #tutorial { top: calc(var(--top-h, 120px) + 40px); }
  /* Tino y los avisos van arriba de tu lugar */
  .tino-say, body.roll-tray .tino-say { bottom: calc(var(--dock-h, 0px) + 84px); }
  .toasts { bottom: calc(var(--dock-h, 100px) + 84px); }
}
@media (max-width: 599px) and (orientation: portrait) {
  /* La mesa con la luz que cae en el centro, como en la PC */
  .vignette.pc-only { display: block; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse 95% 70% at 50% 48%, transparent 55%, rgba(16, 7, 2, .55) 100%); }
}
@media (max-width: 599px) and (orientation: portrait) {
  /* Hasta 3 rivales entran sin deslizar; con más, la tira se desliza */
  .pl:not(.me) { flex: 1 0 0; min-width: 98px; }
}

/* Abanico de escrituras al costado de una ficha (ver rivalHandHTML): en PC los rivales (desktop.css); en el celular, la tuya */
.rh { display: none; }
@media (max-width: 599px) and (orientation: portrait) {
  /* Con pocas escrituras se abren más (cada una deja más lugar para el dedo); con muchas se pisan hasta entrar */
  .pl.me .rh { --step: min(26px, (100vw - 210px) / var(--n1)); position: absolute; left: calc(100% + 8px); bottom: 4px; display: block;
    width: calc(var(--step) * (var(--n) - 1) + 34px); height: 46px; touch-action: none; }
  /* Toda la franja alrededor del abanico cuenta: se apoya el dedo y se desliza (ver paintScrub en main.js) */
  .pl.me .rh::before { content: ""; position: absolute; inset: -22px -8px -10px; }
  .pl.me .rc { position: absolute; top: 0; left: calc(var(--k) * var(--step)); width: 34px; height: 46px; display: block; color: var(--ink);
    background: linear-gradient(var(--c) 0 13px, var(--ink) 13px 15px, var(--paper-hi) 15px); border: 2px solid var(--ink); border-radius: 5px;
    box-shadow: 0 2px 0 rgba(22, 19, 13, .3); transform: rotate(var(--r)); transform-origin: 50% 160%; }
  .pl.me .rc svg { position: absolute; left: 50%; bottom: 4px; width: 20px; height: 20px; margin-left: -10px; }
  .pl.me .rc b { position: absolute; left: 0; right: 0; top: -1px; color: #fff; font: 800 .7rem / 13px var(--board); text-align: center; text-shadow: 0 0 2px #000, 0 0 2px #000; }
  .pl.me .rc b.hotel { color: #ffb3a8; }
  .pl.me .rc.full { box-shadow: 0 0 0 2px var(--gold), 0 2px 0 rgba(22, 19, 13, .3); }
  .pl.me .rc.mort { filter: grayscale(.85) brightness(.82); }
  /* Un área de toque más generosa que la carta, que es chica */
  .pl.me .rc::after { content: ""; position: absolute; inset: -8px -2px; }
  .pl.me .rc { transition: transform .14s cubic-bezier(.2, .8, .3, 1); }
  .pl.me .rc.lift { transform: translateY(-30px) scale(1.55); z-index: 50; box-shadow: 0 6px 14px rgba(22, 19, 13, .35); }
}
.scrub-tip { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; opacity: 0; max-width: 70vw;
  padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--paper-hi); font: 700 .85rem / 1.2 var(--fun);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .1s; }
.scrub-tip.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .pl.me .rc { transition: none; } }
