:root {
  --bg: #14202c;
  --bg2: #1b2a3a;
  --card: #223346;
  --card2: #2a3e54;
  --line: #36506b;
  --text: #eef3f8;
  --muted: #93a8bd;
  --primary: #3d9be9;
  --primary2: #2a7fcc;
  --good: #2ecc71;
  --bad: #e74c3c;
  --gold: #f5c542;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif; -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: #ff8a80; min-height: 1.2em; text-align: center; }
.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(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--primary); }

.btn {
  background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  cursor: pointer; font-weight: 600; transition: transform .08s, background .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #34506c; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary2); }
.btn.good { background: #1e9e55; border-color: #1e9e55; color: #fff; }
.btn.bad { background: #b83227; border-color: #b83227; color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #222; }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 18px; font-size: 1.05rem; width: 100%; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.tiny { padding: 4px 8px; font-size: .78rem; border-radius: 8px; }

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

/* ---------- INICIO ---------- */
#screen-home {
  display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(circle at 30% 20%, #25507a 0, transparent 50%),
              radial-gradient(circle at 80% 90%, #6b2530 0, transparent 45%), var(--bg);
}
.home-card { width: min(440px, 100%); background: rgba(34, 51, 70, .85); border: 1px solid var(--line);
  border-radius: 20px; padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(6px); }
.logo { background: #d62f2f; color: #fff; font-weight: 900; font-size: clamp(2rem, 9vw, 2.8rem); text-align: center;
  border: 4px solid #fff; border-radius: 14px; padding: 6px 10px 4px; letter-spacing: 2px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.logo small { display: block; font-size: .42em; letter-spacing: 5px; color: #cfe6ff; margin-top: -4px; }
.portrait-row { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.portrait-row img { width: 58px; height: 58px; border-radius: 50%; background: var(--card2); border: 2px solid var(--line); }
#home-portraits img { cursor: pointer; transition: transform .12s, border-color .12s; }
#home-portraits img:hover { transform: scale(1.1); border-color: var(--gold); }
#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; }
#join-code { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 700; }
.home-modes, .home-panel { display: flex; flex-direction: column; gap: 10px; }
.home-panel h3 { margin: 2px 0 0; font-size: 1.05rem; }
.home-back { align-self: flex-start; }
.play-mode { display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer; padding: 14px 16px;
  background: var(--bg2); border: 2px solid var(--line); border-radius: 14px; transition: transform .08s, border-color .15s, background .15s; }
.play-mode:hover { transform: translateY(-1px); }
.play-mode:active { transform: scale(.98); }
.play-mode b { display: block; font-size: 1.08rem; }
.play-mode small { color: var(--muted); font-size: .85rem; line-height: 1.3; }
.play-mode .pm-icon { font-size: 2rem; width: 52px; height: 52px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--card2); }
.play-mode.friends:hover { border-color: var(--primary); background: linear-gradient(135deg, #1d3a57, var(--bg2)); }
.play-mode.bots:hover { border-color: var(--gold); background: linear-gradient(135deg, #3d3416, var(--bg2)); }
.play-mode.tutorial:hover { border-color: #2ecc71; background: linear-gradient(135deg, #17402b, var(--bg2)); }
.tut-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; 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: rgba(16, 38, 28, .95); border: 2px solid #2ecc71; border-radius: 14px; box-shadow: 0 10px 30px 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-size: .82rem; color: #8ff0b8; }
.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; } }
.donate { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 4px; padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(135deg, #3d2f16, var(--bg2)); border: 1px solid #b8862b; color: #ffd98a; font-weight: 700; text-decoration: none;
  transition: transform .08s, filter .15s; }
.donate:hover { filter: brightness(1.15); transform: translateY(-1px); }
.donate small { color: var(--muted); font-weight: 400; font-size: .78rem; text-align: center; }
/* En el celular los botones de sonido y pantalla completa flotan abajo a la derecha: el botón no llega hasta ahí */
@media (max-width: 900px), (orientation: portrait) { .donate { margin-right: 96px; } }
.solo-head { font-weight: 700; color: var(--gold); }
.bots-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; 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 small { flex-basis: 100%; }

/* ---------- LOBBY ---------- */
#screen-lobby { overflow: auto; padding: 16px; }
.lobby { max-width: 1050px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 30px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.code { font-size: 2rem; font-weight: 900; letter-spacing: 6px; color: var(--gold); }
.lobby-head > div:first-child { min-width: 0; }
#lobby-code { cursor: pointer; white-space: nowrap; }
.share-btn { flex: 0 0 auto; white-space: nowrap; }
#settings { margin-top: 8px; }
.lobby-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 1.05rem; }
.side { display: flex; flex-direction: column; gap: 10px; }
.side h3 { margin: 6px 0 0; }
.preview-wrap { position: relative; height: 240px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #3a5878, #1b2a3a 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; }
.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.char { background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; 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: .72rem; 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); }
.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; background: var(--bg2); border-radius: 10px; 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: .75rem; color: var(--muted); }
.settings { display: flex; flex-direction: column; gap: 8px; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .92rem; }
.settings select { padding: 6px 8px; }
.settings .set-hint { color: var(--muted); font-size: .8rem; line-height: 1.3; margin: -4px 0 2px; }
.settings input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- 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(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.board-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tool { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(20,32,44,.75); cursor: pointer; font-size: 1.1rem; }
.tool.active { border-color: var(--primary); }
#turn-banner { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: rgba(20,32,44,.85);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; display: flex; align-items: center; gap: 8px;
  font-weight: 700; white-space: nowrap; max-width: calc(100% - 120px); overflow: hidden; }
#turn-banner:empty { display: none; }
#turn-banner img { width: 30px; height: 30px; border-radius: 50%; background: var(--card2); }
.countdown { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 800; }
.countdown.low { color: #ff6b5b; }
.pot { position: absolute; left: 10px; bottom: 10px; background: rgba(20,32,44,.85); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font-size: .85rem; }

/* 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: 12px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 5px; box-shadow: 0 6px 16px rgba(0,0,0,.45), inset 0 -4px 0 #ddd; }
.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); } }
.dice-area.fade { opacity: .55; transition: opacity 1s; }

/* Jugadores */
.players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.pl { display: flex; align-items: center; gap: 8px; background: var(--card); border: 2px solid transparent; border-radius: 12px;
  padding: 5px 8px 5px 5px; cursor: pointer; min-width: 0; position: relative; }
.pl.turn { border-color: var(--c); box-shadow: 0 0 12px -2px var(--c); }
.pl.out { opacity: .4; filter: grayscale(1); }
.pl img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--c); background: var(--card2); flex: none; }
.pl .info { min-width: 0; flex: 1; }
.pl .name { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .money { font-size: .9rem; 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: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.actions .msg { font-size: .92rem; color: var(--muted); text-align: center; }
.actions .msg b { color: var(--text); }
.actions .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btns .btn { flex: 1; }
.debt-box { background: rgba(231, 76, 60, .15); border: 1px solid var(--bad); border-radius: 10px; padding: 8px 10px; font-size: .88rem; }
.buy-box { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: 10px; padding: 8px; }
.buy-box .chip { width: 10px; align-self: stretch; border-radius: 4px; }
.buy-box .t { flex: 1; font-weight: 700; }

/* Pestañas */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 4px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: .88rem; position: relative; }
.tabs button.active { color: var(--text); border-color: var(--primary); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; padding: 1px 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; }
#tab-log div { font-size: .84rem; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.05); color: #c9d6e3; }
#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: .9rem; background: var(--card); padding: 6px 10px; border-radius: 10px; align-self: flex-start; max-width: 90%; word-wrap: break-word; }
.chat-msg.mine { align-self: flex-end; background: #2a5a86; }
.chat-msg b { color: var(--c); }

/* Propiedades */
.prop-group { margin-bottom: 10px; }
.prop-row { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 10px; padding: 6px 8px; margin-bottom: 5px; }
.prop-row .chip { width: 8px; align-self: stretch; border-radius: 4px; flex: none; }
.prop-row .pn { flex: 1; min-width: 0; font-size: .88rem; cursor: pointer; }
.prop-row .pn small { display: block; color: var(--muted); font-size: .75rem; }
.prop-row .pb { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.prop-row.mort { 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(--card); border-radius: 12px; padding: 10px; margin-bottom: 8px; font-size: .88rem; }
.trade .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.trade .cols div { background: var(--bg2); border-radius: 8px; 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(--card); border: 1px solid var(--line); border-radius: 16px; 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; }
.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; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.deed { background: #fbfaf4; color: #111; border-radius: 10px; padding: 10px; border: 2px solid #111; }
.deed .head { border: 2px solid #111; padding: 8px; text-align: center; margin-bottom: 8px; }
.deed .head small { display: block; font-size: .7rem; letter-spacing: 1px; }
.deed .head b { font-size: 1.15rem; }
.deed table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.deed td { padding: 2px 4px; }
.deed td:last-child { text-align: right; font-weight: 700; }
.deed .icon { font-size: 2.4rem; text-align: center; }
.deed hr { border: 0; border-top: 1px solid #999; margin: 6px 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(--bg2); border-radius: 10px; padding: 8px; }
.tb-col h4 { margin: 0 0 8px; font-size: .9rem; }
.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: 16px; 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; color: #fff; font-weight: 900; padding: 10px; font-size: 1.2rem; 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: #666; }
.card-popup .meme { display: block; width: 100%; max-height: 34dvh; object-fit: contain; border-radius: 10px; margin: 2px 0 8px; background: #000; }
.card-popup .ch.heaven { background: linear-gradient(135deg, #f5c542, #e8a317); color: #3b2a00; }
.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(--card); border: 2px solid var(--gold); border-radius: 16px; padding: 16px; box-shadow: 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; }
.auction .bid { font-size: 2rem; font-weight: 900; text-align: center; color: var(--gold); }
.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: rgba(20,32,44,.95); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: toastIn .25s ease-out; text-align: center; }
.toast.err { 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(--gold); background: var(--card2); }
.winner h2 { font-size: 1.8rem; margin: 10px 0; }

/* ---------- CELULAR ---------- */
@media (max-width: 900px), (orientation: portrait) {
  #screen-game { grid-template-columns: 1fr; grid-template-rows: 48dvh 1fr; }
  #panel { border-left: 0; border-top: 1px solid var(--line); 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); }
  .preview-wrap { height: 200px; }
  .char img { width: 54px; height: 54px; }
  .lobby-head { flex-wrap: nowrap; }
  .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: rgba(245, 197, 66, .12); border: 1px solid var(--gold); border-radius: 10px; padding: 8px 10px; font-size: .88rem; }
.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: 2px solid var(--c); background: var(--card2); }
.card-popup .kind { font-weight: 900; font-size: .85rem; letter-spacing: 1px; margin: -4px 0 6px; }
.card-popup.castigo { box-shadow: 0 0 0 4px #c0392b, 0 20px 60px rgba(0,0,0,.6); }
.card-popup.castigo .kind { color: #c0392b; }
.card-popup.salvacion { box-shadow: 0 0 0 4px #27ae60, 0 20px 60px rgba(0,0,0,.6); }
.card-popup.salvacion .kind { color: #1e8449; }

/* 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 { border-color: 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); font-variant-numeric: tabular-nums; }
.vol-row input[type=range] { grid-area: range; width: 100%; height: 34px; accent-color: var(--gold); 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: 8px; right: 8px; top: 50%; height: 2px; background: #ff6b5b; transform: rotate(-40deg); }

/* ---------- Modo de juego (sala) ---------- */
.mode-select { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-card { text-align: left; background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; 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.selected.classic { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.mode-card.selected.extreme { border-color: #ff5a1f; box-shadow: 0 0 14px -4px #ff5a1f; background: linear-gradient(135deg, #3a1f16, var(--bg2)); }
.mode-card:disabled { cursor: default; opacity: .85; }
.char .pw { font-size: .68rem; color: var(--gold); text-align: center; }
#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: rgba(245, 197, 66, .08); border: 1px dashed #6b5a2a;
  border-radius: 10px; padding: 6px 10px; font-size: .84rem; }
.power-box.ready { border-style: solid; border-color: var(--gold); }
.power-box small { color: var(--muted); }
.items-row { display: flex; flex-wrap: wrap; gap: 6px; }
.item-chip { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 5px 10px; font-size: .8rem; }
.item-chip.usable { border-color: var(--good); background: #1f4a33; 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: 1rem; padding: 14px; }
.deck-btn.chance { background: #E67E22; border-color: #E67E22; }
.deck-btn.chest { background: #1f5fa8; border-color: #1f5fa8; }
.pot .fx { color: #ffb86b; font-weight: 700; }
.wallet { margin-bottom: 8px; }
.card-popup .ch.news { background: #333; }
.card-popup.noticia { box-shadow: 0 0 0 4px #555, 0 20px 60px rgba(0,0,0,.6); }
.card-popup.duelo { box-shadow: 0 0 0 4px #8e44ad, 0 20px 60px rgba(0,0,0,.6); }
.card-popup.duelo .kind { color: #8e44ad; }

/* ---------- Minijuegos ---------- */
.minigame { position: fixed; inset: 0; z-index: 58; background: rgba(8, 12, 20, .72); display: grid; place-items: center; padding: 12px; }
.mg-card { width: min(460px, 100%); max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--card); border: 2px solid #8e44ad;
  border-radius: 18px; padding: 16px; text-align: center; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: pop .2s ease-out; }
.mg-card.result { border-color: var(--gold); }
.mg-title { font-size: 1.35rem; font-weight: 900; margin-bottom: 4px; }
.mg-desc { color: var(--muted); font-size: .88rem; margin-bottom: 8px; }
.mg-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 8px; font-size: .82rem; }
.mg-players span { display: flex; align-items: center; gap: 4px; }
.mg-players span.owner { font-weight: 800; color: var(--gold); }
.mg-face { width: 28px; height: 28px; border-radius: 50%; border: 2px solid; background: var(--card2); }
.mg-timer { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.mg-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #e74c3c, #f5c542, #2ecc71); transition: width .1s linear; }
.mg-body { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.mg-body.locked { pointer-events: none; opacity: .35; filter: blur(1px); }
.mg-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 6rem; font-weight: 900; color: #fff;
  text-shadow: 0 6px 24px rgba(0,0,0,.6); pointer-events: none; animation: pop .3s ease-out; }
.mg-big { font-size: 2.4rem; font-weight: 900; 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: 16px; border: 0; font-size: 2rem; font-weight: 900; 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-weight: 800; font-size: 1.05rem; }
.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 { border-color: var(--gold); background: #4a3d12; }
.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; }
.mg-ready-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 14px; font-size: .9rem; }
.mg-ready-list span { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); opacity: .75; }
.mg-ready-list span.ok { opacity: 1; border-color: #27ae60; background: rgba(39, 174, 96, .15); }
.mg-start { width: 100%; font-size: 1.3rem; animation: pulse 1.2s ease-in-out infinite; }
.mg-ready-left { margin-top: 10px; font-size: .85rem; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.mg-summary { font-size: 1.15rem; font-weight: 800; margin: 10px 0; }
.mg-lines { list-style: none; padding: 0; margin: 0; text-align: left; font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.mg-lines li { background: var(--bg2); border-radius: 8px; padding: 6px 10px; }
.mg-card.arena { width: min(560px, 100%); }
.mg-arena { width: 100%; aspect-ratio: 1; max-height: calc(100dvh - 300px); max-width: calc(100dvh - 300px); min-width: 220px; min-height: 220px;
  border-radius: 12px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; display: block; margin: 0 auto; }
.mg-hud { font-weight: 800; font-size: 1rem; min-height: 1.4em; }
/* Joystick de los minijuegos en el celular */
.mg-card.joy .mg-arena { max-height: calc(100dvh - 420px); max-width: calc(100dvh - 420px); cursor: default; }
.mg-joy { position: relative; width: 132px; height: 132px; margin: 12px auto 4px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0 55%, rgba(255,255,255,.14) 56% 100%);
  border: 2px solid rgba(255,255,255,.28); touch-action: none; user-select: none; -webkit-user-select: none; }
.mg-joy.on { border-color: 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: 12px; border: 2px solid #ff8a65; 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(--bg2); border-radius: 16px 16px 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: 12px 14px;
    border-bottom: 1px solid var(--line); flex: none; position: relative; }
  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 { flex-wrap: wrap; }
  .prop-row .pb { width: 100%; justify-content: flex-start; }
  .prop-row .pb .btn.tiny { padding: 7px 10px; font-size: .82rem; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 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 { border-color: var(--gold); background: rgba(245, 197, 66, .2); }

/* Lista de casilleros (📋) */
.sq-list { display: flex; flex-direction: column; gap: 4px; }
.sq-side { font-size: .75rem; color: var(--muted); margin: 8px 0 2px; text-transform: uppercase; letter-spacing: 1px; }
.sq-row { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 7px 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: var(--card2); }
.sq-row.here { outline: 2px solid var(--gold); }
.mode-hint { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); text-align: center; }
.mode-hint:empty { display: none; }

/* 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; } }
.police-bar { position: absolute; top: max(28px, 7dvh); left: 50%; transform: translateX(-50%); width: min(300px, 78vw); height: 46px;
  display: flex; gap: 6px; padding: 5px; border-radius: 14px 14px 8px 8px; background: linear-gradient(#3a3f4a, #15181f);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .2); z-index: 1; }
.police-bar .lamp { flex: 1; border-radius: 10px 10px 5px 5px; position: relative; }
.police-bar .lamp.red { background: #4a0008; animation: lampA 1s linear infinite; }
.police-bar .lamp.blue { background: #001244; animation: lampB 1s linear infinite; }
@keyframes lampA {
  0%, 4%, 14%, 20% { background: #ff2a35; box-shadow: 0 0 30px 14px rgba(255, 30, 40, .9), 0 0 90px 40px rgba(255, 0, 0, .45); }
  5%, 13%, 21%, 100% { background: #4a0008; box-shadow: none; }
}
@keyframes lampB {
  0%, 49%, 55%, 63%, 71%, 100% { background: #001244; box-shadow: none; }
  50%, 54%, 64%, 70% { background: #2f7bff; box-shadow: 0 0 30px 14px rgba(40, 110, 255, .9), 0 0 90px 40px rgba(0, 70, 255, .45); }
}
.arrest-card { position: relative; z-index: 2; background: #fffdf5; color: #111; border-radius: 16px; 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-title { font-weight: 900; font-size: 1.35rem; color: #c40000; letter-spacing: 1px; margin-bottom: 6px; }
.arrest-card p { font-size: 1.1rem; line-height: 1.35; margin: 4px 0 8px; }
.arrest-card small { color: #666; }
@media (prefers-reduced-motion: reduce) { .arrest::before, .arrest::after, .police-bar .lamp { 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; }
  .log-mini { display: block; flex: 1 1 72px; min-height: 64px; overflow-y: auto; overscroll-behavior: contain;
    border-top: 1px solid var(--line); padding: 4px 10px; background: rgba(0, 0, 0, .15); }
  .log-mini div { font-size: .76rem; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.05); color: #b9c7d6; }
  .log-mini div:last-child { color: var(--text); font-weight: 600; }
}

/* ---------- Mis cartas guardadas ---------- */
.cards-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cards-label { font-size: .78rem; color: var(--muted); font-weight: 700; }
.cards-row .item-chip { cursor: pointer; }
.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-stage3d { width: 100%; height: clamp(130px, 24dvh, 200px); margin: 2px 0 6px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #2d4566, #141c28 75%); }
.mg-arena3d { position: relative; overflow: hidden; background: #0d141e; touch-action: none; }
.mg-card.duel { width: min(560px, 100%); }
.mg-card.duel .mg-stage3d { height: clamp(220px, 40dvh, 380px); }
.mg-card.duel .mg-pad { min-height: 110px; font-size: 1.6rem; }
.mg-card.duel .mg-stage3d:has(+ .mg-desc) { cursor: pointer; }
.mg-matebox { min-height: 120px; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.mg-step.hot { color: #ff8a65; 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-weight: 900; font-size: 1.1rem; color: var(--gold); }
.mg-score { font-size: 1rem; margin-bottom: 4px; }
.mg-choice.picked { border-color: var(--gold); background: #4a3d12; }
.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: #fffdf5; color: #111; border-radius: 16px; padding: 16px 18px; width: min(320px, 100%);
  text-align: center; box-shadow: 0 0 0 4px #ffd700, 0 0 70px rgba(255, 215, 0, .8); animation: partyPop .6s cubic-bezier(.2, 1.6, .4, 1); }
.party-card img { width: 72px; height: 72px; border-radius: 50%; }
.party-title { font-size: 1.7rem; font-weight: 900; color: #b8860b; 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; }

/* Generala: se juega sobre el tablero, con el panel abajo */
.minigame.onboard { background: none; pointer-events: none; place-items: end center; padding: 8px; }
.minigame.onboard .mg-card { pointer-events: auto; width: min(560px, 100%); max-height: 46dvh; padding: 10px 12px;
  background: rgba(22, 33, 46, .94); animation: slideUp .25s ease-out; }
.minigame.onboard .mg-title { font-size: 1.05rem; margin: 0; }
.minigame.onboard .mg-desc { font-size: .78rem; margin-bottom: 6px; }
.minigame.onboard .mg-timer { margin-bottom: 6px; }
.mg-card.gen .mg-body { min-height: 0; gap: 6px; }
.gen-dice { display: flex; gap: 8px; justify-content: center; min-height: 44px; align-items: center; }
.gen-dice .die { cursor: pointer; border: 0; transition: transform .12s; }
.gen-dice .die.kept { background: #ffe680; box-shadow: 0 0 0 3px var(--gold), 0 6px 16px rgba(0,0,0,.45); transform: translateY(-5px); }
.gen-dice .die:disabled { cursor: default; }
.gen-mine { font-size: .9rem; min-height: 1.2em; }
.gen-btns { width: 100%; }
.gen-btns .btn.big { flex: 2; padding: 10px 12px; }
.gen-btns .btn.gold { flex: 1; }
.gen-table { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: .8rem; text-align: left; }
.gen-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.gen-row.me { font-weight: 800; }
.gen-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.gen-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8em; }
.gen-hand { color: var(--gold); white-space: nowrap; margin-left: auto; }
.gen-state { color: var(--muted); white-space: nowrap; }
.gen-fx { position: fixed; left: 0; right: 0; top: 18%; text-align: center; font-size: clamp(1.6rem, 6vw, 3rem); font-weight: 900;
  color: #ffd700; text-shadow: 0 4px 0 #8a5a00, 0 8px 30px rgba(0,0,0,.7); pointer-events: none; opacity: 0; }
.gen-fx.show { animation: genFx 3.2s ease-out; }
@keyframes genFx { 0% { opacity: 0; transform: scale(.4); } 12% { opacity: 1; transform: scale(1.15); } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) {
  .minigame.onboard .mg-desc { display: none; }
  .gen-table { grid-template-columns: 1fr; }
  .gen-dice .die { width: 38px; height: 38px; }
}
