/* RPS Arena — tema "fieltro de dominó": mesa verde profundo, fichas marfil, corazón rojo, premios en latón.
   Elemento memorable: las fichas de jugada y la barra de tiempo de latón del combate. */
:root {
  --felt: #0e264f;
  --felt-deep: #09153d;
  --felt-raise: #17386d;
  --line: #2b5795;
  --tile: #f3ecdc;
  --tile-edge: #cdbf9f;
  --ink: #1d252f;
  --text: #e9edf3;
  --muted: #8fa5b7;
  --heart: #ef3b55;
  --brass: #e8b04a;
  --ok: #5fd6a0;
  --bad: #ff7a7a;
  --tabbar-h: 66px;
  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--felt-deep); color: var(--text);
  font: 400 16px/1.45 var(--font-body); -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.1; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); }
.center { text-align: center; display: block; margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.row.gap > .btn { flex: 1; }
.ico { display: inline-flex; vertical-align: middle; }
.ico.heart { color: var(--heart); }

/* ---------- layout principal ---------- */
#app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto;
  background: var(--felt); box-shadow: 0 0 0 1px #0000003a; position: relative; }
.view { flex: 1; overflow-y: auto; padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.view.has-composer { padding-bottom: 0; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-head.row { flex-direction: row; gap: 8px; }
.section-title { margin-top: 6px; }
.empty { color: var(--muted); text-align: center; padding: 22px 12px; }
.offline { background: var(--brass); color: var(--ink); text-align: center; font-weight: 700; padding: 4px; font-size: .85rem; }

/* ---------- barra inferior ---------- */
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--felt-deep); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted);
  font-size: .72rem; font-weight: 500; position: relative; }
.tab.on { color: var(--text); }
.tab.on::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brass); }
.tab-ico { position: relative; display: inline-flex; }
.tab.center .tab-ico { background: var(--tile); color: var(--ink); width: 54px; height: 54px; border-radius: 16px; align-items: center;
  justify-content: center; margin-top: -22px; box-shadow: 0 3px 0 var(--tile-edge), 0 8px 18px #0006; transition: transform .12s; }
.tab.center.on .tab-ico { background: var(--brass); box-shadow: 0 3px 0 #b9852a, 0 8px 18px #0006; }
.tab.center:active .tab-ico { transform: translateY(2px); }
.tab.center .tab-label { margin-top: -2px; }
.tab-badge { position: absolute; top: -6px; right: -10px; }
.badge { background: var(--heart); color: #fff; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
body.in-game .tabbar { display: none; }

/* ---------- botones y formularios ---------- */
.btn { border: 0; cursor: pointer; border-radius: 14px; padding: 12px 18px; font-weight: 700; background: var(--felt-raise);
  color: var(--text); border: 1px solid var(--line); text-align: center; display: inline-block; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn.primary { background: var(--tile); color: var(--ink); border-color: var(--tile-edge); box-shadow: 0 3px 0 var(--tile-edge); }
.btn.primary:active { box-shadow: 0 1px 0 var(--tile-edge); transform: translateY(2px); }
.btn.danger { background: transparent; color: var(--bad); border-color: #7a3b3b; }
.btn.block { display: block; width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brass); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { background: var(--felt-raise); border: 1px solid var(--line); color: var(--text); width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.3rem; flex: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .85rem; color: var(--muted); font-weight: 500; }
input, textarea, select { background: var(--felt-deep); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; }
input::placeholder, textarea::placeholder { color: #8499ae; }
input[type=file] { padding: 10px; }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; }
.form-error { color: var(--bad); font-size: .9rem; min-height: 0; }
.form-error:empty { display: none; }
.card { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }

/* ---------- avatares y chips de usuario ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; flex: none;
  color: #fff; font-weight: 800; font-family: var(--font-display); background: var(--felt-raise); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
[data-profile] { cursor: pointer; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- acceso ---------- */
.auth { padding: 36px 20px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; height: 100%; justify-content: center; }
.auth-hero { display: flex; flex-direction: column; gap: 10px; }
.auth-hero p { color: var(--muted); max-width: 34ch; }
.auth-tiles { display: flex; gap: 10px; margin-bottom: 8px; }
.tile { width: 64px; height: 88px; background: var(--tile); border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; box-shadow: 0 4px 0 var(--tile-edge), 0 10px 20px #0005; position: relative; }
.tile::after { content: ''; position: absolute; left: 10px; right: 10px; top: 50%; height: 2px; background: var(--tile-edge); }
.tile:nth-child(2) { transform: translateY(-8px) rotate(-3deg); }
.tile:nth-child(3) { transform: rotate(4deg); }
.auth-switch { text-align: center; color: var(--muted); }

/* ---------- lobby ---------- */
.wallet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat small { color: var(--muted); }
.stat.hearts { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.stat.hearts small { grid-column: 1 / -1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats.two { width: 100%; }
.mode { border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); }
.mode p { color: #c6d5dd; }
.mode p b { color: var(--brass); }
.mode.real { background: linear-gradient(160deg, #214c87, var(--felt-raise)); border-color: #3a75bf; }
.mode.practice { background: var(--felt-raise); }
.mode .btn { align-self: flex-start; }

/* ---------- chats ---------- */
.chat-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.chat-wrap { overflow: hidden; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; min-width: 0; }
.msg.mine .bubble { background: var(--tile); color: var(--ink); border-color: var(--tile-edge); border-radius: 16px 16px 4px 16px; }
.bubble .who { display: block; font-size: .8rem; font-weight: 700; color: var(--brass); margin-bottom: 1px; }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; font-size: .68rem; opacity: .6; text-align: right; margin-top: 2px; }
.msg.mine .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.msg-menu { display: flex; align-items: center; gap: 6px; margin: 6px 0 2px auto; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--danger, #e5484d);
  background: transparent; color: var(--danger, #e5484d); font-weight: 700; font-size: .85rem; cursor: pointer; }
.composer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 0 12px; background: var(--felt); position: sticky; bottom: 0; }
.composer textarea { flex: 1; min-width: 0; width: auto; border-radius: 22px; resize: none; max-height: 120px; line-height: 1.35; padding: 11px 14px; overflow-y: auto; }
.composer .attach, .composer .send { flex: none; height: 46px; width: 46px; border-radius: 50%; }
.composer .send.busy { opacity: .6; }
.attach-preview { flex: 0 0 100%; display: flex; align-items: center; gap: 10px; background: var(--felt-raise); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; }
.attach-preview[hidden] { display: none; }
.attach-preview img, .attach-preview video { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.attach-preview span { flex: 1; font-size: .85rem; }
.attach-preview.uploading { opacity: .6; }
.attach-preview.uploading span::after { content: ' · enviando…'; }
.chat-media { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 2px 0 4px; background: #0003; cursor: zoom-in; }
.video-thumb { position: relative; display: inline-block; max-width: 100%; cursor: pointer; }
.video-thumb video { pointer-events: none; }
.play-badge { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%; background: #000a; color: #fff; display: grid; place-items: center; font-size: 1.3rem; pointer-events: none; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: #000d; display: flex; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; border-radius: 8px; cursor: default; }
.lightbox-x { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #000a; color: #fff; font-size: 1.1rem; cursor: pointer; }
.composer .send { background: var(--tile); color: var(--ink); border-radius: 50%; width: 46px; height: 46px; }
.thread-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--felt-deep); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; }
.searchbar input { border: 0; background: transparent; padding-left: 0; }
.conv-list { display: flex; flex-direction: column; }
.conv { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #20457b; }
.conv-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.conv-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .72rem; color: var(--muted); }

/* ---------- historial ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--felt-deep); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 500; }
.chip.on { background: var(--tile); color: var(--ink); border-color: var(--tile-edge); font-weight: 700; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.match { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--felt-raise); border: 1px solid var(--line);
  border-left: 5px solid var(--line); border-radius: 14px 18px 18px 14px; padding: 10px 12px; }
.match.win { border-left-color: var(--ok); }
.match.loss { border-left-color: var(--heart); }
.match-opp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.match-name { display: flex; flex-direction: column; min-width: 0; }
.match-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-name small, .tx small { color: var(--muted); }
.match-result { display: flex; flex-direction: column; align-items: flex-end; font-size: .85rem; }
.match-result b { font-family: var(--font-display); }
.match.win .match-result b { color: var(--ok); }
.match.loss .match-result b { color: var(--bad); }
.score { font-variant-numeric: tabular-nums; color: var(--muted); }
.delta { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--brass); }
.delta.down { color: var(--bad); }

/* ---------- perfil ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar-edit { position: relative; background: none; border: 0; padding: 0; cursor: pointer; }
.avatar-edit .cam { position: absolute; right: -2px; bottom: -2px; background: var(--tile); color: var(--ink); width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
.tx-list { display: flex; flex-direction: column; }
.tx { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid #20457b; }
.tx > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.tx-amt { font-weight: 700; white-space: nowrap; }
.tx-amt.pending { color: var(--brass); }
.tx-amt.rejected { color: var(--bad); text-decoration: line-through; }
.public-profile { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.about { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; width: 100%; text-align: left; }
.about h3 { color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.about p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- modales y avisos ---------- */
.modal-back { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal { background: var(--felt); width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 22px 22px 0 0; border: 1px solid var(--line);
  display: flex; flex-direction: column; animation: sheet .22s ease-out; }
.modal > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 8px; }
.modal-body { overflow-y: auto; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--felt-deep); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented button { border: 0; background: transparent; border-radius: 9px; padding: 9px; cursor: pointer; font-weight: 700; color: var(--muted); }
.segmented button.on { background: var(--tile); color: var(--ink); }
.stepper { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.qty { display: flex; align-items: center; gap: 16px; }
.qty-box { display: inline-flex; align-items: center; gap: 8px; min-width: 96px; justify-content: center; }
.qty-n { font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; font-variant-numeric: tabular-nums; }
.total { background: var(--felt-deep); border: 1px dashed var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.total b { font-family: var(--font-display); font-size: 1.6rem; color: var(--brass); }
.total small { color: var(--muted); }
.pm-card { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.kv { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 8px; }
.kv span { color: var(--muted); font-size: .88rem; }
.kv b { overflow-wrap: anywhere; }
.choice { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.balance-line { display: flex; justify-content: space-between; align-items: baseline; }
.balance-line b { font-family: var(--font-display); font-size: 1.4rem; color: var(--brass); }
#toasts { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
.toast { background: var(--tile); color: var(--ink); padding: 10px 16px; border-radius: 14px; font-weight: 500; max-width: min(92vw, 420px);
  box-shadow: 0 8px 24px #0007; animation: drop .25s ease-out; }
.toast.error { background: #ffd9d9; border-left: 5px solid var(--heart); }
.toast.success { background: #dcf7e8; border-left: 5px solid #1f9d65; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .4s; }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }

/* ---------- búsqueda de rival ---------- */
.queue-overlay { position: fixed; inset: 0; background: #030c27d9; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.queue-card { background: var(--felt); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 340px); }
.pulse { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--brass); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }

/* ---------- COMBATE ---------- */
.game { position: fixed; inset: 0; z-index: 70; background: radial-gradient(120% 80% at 50% 0%, #1c4277, var(--felt-deep)); display: flex; flex-direction: column;
  max-width: 560px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); gap: 14px; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.side b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); }
.side .avatar { border: 3px solid var(--line); }
.side.you .avatar { border-color: var(--brass); }
.pips { display: inline-flex; gap: 5px; }
.pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); display: block; transition: background .2s, transform .2s; }
.pips i.on { background: var(--brass); border-color: var(--brass); transform: scale(1.15); }
.side.opp .pips i.on { background: var(--heart); border-color: var(--heart); }
.ready { font-size: .72rem; color: var(--ok); opacity: 0; transition: opacity .2s; }
.ready.on { opacity: 1; }
.mid { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; }
.mid .tag { font-size: .72rem; background: var(--felt-raise); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.mid .round { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.mid .count { font-family: var(--font-display); font-weight: 800; font-size: 3rem; line-height: 1; min-height: 1em; color: var(--brass); font-variant-numeric: tabular-nums; }
.game.urgent .count { color: var(--heart); animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.12); } }
.timer-track { height: 10px; background: #0007; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.timer-fill { height: 100%; background: var(--brass); transform-origin: left; transform: scaleX(0); border-radius: 6px; }
.game.urgent .timer-fill { background: var(--heart); }
.arena { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; }
.slot { aspect-ratio: 3/4; max-height: 100%; width: 100%; max-width: 190px; margin: 0 auto; border-radius: 20px; background: #0c1f41; border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center; transition: border-color .2s, background .2s; }
.slot .move { font-size: clamp(3.4rem, 18vw, 5.4rem); line-height: 1; }
.game.won .slot.you { border: 2px solid var(--ok); background: #16335b; }
.game.lost .slot.opp { border: 2px solid var(--heart); background: #3a1d28; }
.game.won .slot.opp, .game.lost .slot.you { opacity: .55; }
.banner { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
.game.won .banner { color: var(--ok); }
.game.lost .banner { color: var(--bad); }
.moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile-btn { background: var(--tile); color: var(--ink); border: 0; border-radius: 16px; padding: 14px 6px 10px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 4px; box-shadow: 0 5px 0 var(--tile-edge), 0 12px 20px #0005; position: relative; transition: transform .08s, box-shadow .08s, opacity .15s; }
.tile-btn::after { content: ''; position: absolute; left: 14px; right: 14px; top: 62%; height: 2px; background: var(--tile-edge); }
.tile-btn .emoji { font-size: 2.6rem; line-height: 1; }
.tile-btn .lbl { font-weight: 700; font-size: .9rem; margin-top: 8px; }
.tile-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--tile-edge); }
.tile-btn:disabled { cursor: default; }
.tile-btn.dim { opacity: .35; }
.tile-btn.picked { outline: 4px solid var(--brass); transform: translateY(3px); box-shadow: 0 2px 0 var(--tile-edge); }
.tile-btn:disabled:not(.picked):not(.dim) { opacity: .6; }
.final { position: absolute; inset: 0; background: #030c27f0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 28px; animation: fade .3s; }
.final h2 { font-size: 2.6rem; }
.final.win h2 { color: var(--brass); }
.final.lose h2 { color: var(--bad); }
.final-score { font-family: var(--font-display); font-size: 2rem; font-variant-numeric: tabular-nums; }
.final p { max-width: 30ch; }
.final small { color: var(--muted); }
@keyframes fade { from { opacity: 0; } }

@media (max-height: 640px) { .slot { max-width: 130px; } .mid .count { font-size: 2.4rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* =====================================================================================================
   Ampliaciones: accesos directos, comprobante opcional, racha destacada, retos, donaciones
   ===================================================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- contadores tocables (corazones y saldo) ---- */
.stat.tap { font: inherit; color: inherit; text-align: left; cursor: pointer; position: relative; width: 100%;
  transition: border-color .15s, transform .1s, background .15s; }
.stat.tap:hover { border-color: var(--brass); background: #1c4583; }
.stat.tap:active { transform: translateY(1px); }
.stat-plus { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 8px; background: var(--tile); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; line-height: 1; box-shadow: 0 2px 0 var(--tile-edge); }
.stat .frozen { color: var(--brass); }
.frozen-note { background: #3b2e10; border: 1px solid #7a5d1c; color: #ffe3a6; border-radius: 12px; padding: 8px 12px; font-size: .88rem; }
.balance-line.sub { font-size: .9rem; color: var(--muted); }
.balance-line.sub b { font-size: 1.05rem; color: var(--text); }
.donate-to { display: flex; align-items: center; gap: 12px; }
.donate-to div { display: flex; flex-direction: column; }
.donate-to b { font-family: var(--font-display); font-size: 1.2rem; }

/* ---- selector del comprobante (opcional) ---- */
.dropzone { display: flex; align-items: center; gap: 14px; padding: 14px; border: 2px dashed var(--line); border-radius: 18px; background: var(--felt-deep);
  cursor: pointer; position: relative; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brass); background: #192954; }
.sr-only:focus-visible + .dropzone { outline: 3px solid var(--brass); outline-offset: 2px; }
.dropzone.has-file { border-style: solid; border-color: #3a75bf; background: #16335b; }
.dz-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--tile); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--tile-edge); flex: none; }
.dz-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dz-text small { color: var(--muted); }
.dz-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 2px solid var(--tile); flex: none; background: #0007; }
.dz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-text .dz-ok { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.dz-remove { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--felt); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dz-remove:hover { border-color: var(--bad); color: var(--bad); }

/* ---- perfil público: la racha es la protagonista ---- */
.streak-hero { width: 100%; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 20px; border-radius: 24px;
  background: var(--felt-raise); border: 1px solid var(--line); color: var(--muted); position: relative; overflow: hidden; }
.streak-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.streak-label { font-weight: 700; font-size: .95rem; }
.streak-n { font-family: var(--font-display); font-weight: 800; font-size: 3.8rem; line-height: 1; font-variant-numeric: tabular-nums; }
.streak-text small { font-weight: 700; font-size: .95rem; }
.streak-hero .flame { color: #889aa9; }
.streak-hero.warm, .streak-hero.hot, .streak-hero.blaze { color: #2a1604; border-color: #ffd98a; }
.streak-hero.warm { background: linear-gradient(135deg, #f6cf6b, #f0993f); }
.streak-hero.hot { background: linear-gradient(135deg, #ffc53d, #ff7a2b); box-shadow: 0 6px 22px #ff7a2b55; }
.streak-hero.blaze { background: linear-gradient(135deg, #ffe066, #ff4d2e); box-shadow: 0 8px 30px #ff4d2e88; }
.streak-hero.warm .flame, .streak-hero.hot .flame, .streak-hero.blaze .flame { color: #b3300c; filter: drop-shadow(0 2px 0 #fff4);
  transform-origin: 50% 90%; }
.streak-hero.hot .flame, .streak-hero.blaze .flame { animation: flicker 1.8s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08) rotate(2deg); } }
.total-wins { color: var(--muted); }
.total-wins b { color: var(--text); font-family: var(--font-display); font-size: 1.15rem; }
.profile-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.profile-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.profile-actions .row > .btn { flex: 1; }

/* ---- reto directo dentro del chat privado ---- */
.msg.challenge { max-width: 100%; align-self: stretch; }
.challenge-card { width: 100%; background: linear-gradient(160deg, #214c87, var(--felt-raise)); border: 1px solid #3a75bf; border-radius: 18px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px; }
.challenge-card.mine { background: linear-gradient(160deg, #2e4870, var(--felt-raise)); }
.ch-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); color: var(--brass); }
.ch-stake { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.ch-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.ch-actions .btn { padding: 9px 16px; flex: 1; }
.ch-actions small { flex: 1 1 100%; }
.ch-result { margin-top: 2px; font-weight: 700; color: var(--muted); }
.challenge-card.accepted { border-color: var(--ok); }
.challenge-card.accepted .ch-result { color: var(--ok); }
.challenge-card.declined, .challenge-card.canceled, .challenge-card.expired { opacity: .7; border-color: var(--line); background: var(--felt-raise); }

/* ===== LOBBY tipo hub de juegos ===== */
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lobby-head h1 { margin: 0; }
.game-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; text-align: center; padding: 12px 0; }   /* título e info arriba; las figuras se centran en el espacio libre */
.game-title { font-family: var(--font-display); font-size: 1.5rem; margin: 0; }
.game-art { width: 100%; flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.game-hands { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 3.4rem; min-height: 170px; }
.game-hands span:nth-child(2) { font-size: 4.6rem; animation: wave 1.6s ease-in-out infinite; }
/* Iconos de los juegos: flotan suavemente arriba y abajo sin moverse del centro */
.game-hands.has-icons { gap: 6px; font-size: inherit; min-height: 190px; }
.game-icon { width: min(22vw, 92px); height: auto; display: block; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .35)); animation: gp-float 3.2s ease-in-out infinite; will-change: transform; }
.game-hands.single .game-icon { width: min(52vw, 200px); }
@keyframes gp-float { 0%, 100% { transform: translateY(7px); } 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) { .game-icon { animation: none; } }
@keyframes wave { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.game-arrow { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--felt-raise);
  color: var(--text); font-size: 1.4rem; cursor: pointer; }
.game-arrow:disabled { opacity: .35; cursor: default; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }   /* botones de combate abajo, sobre la barra inferior */
.mode.compact { padding: 14px; gap: 8px; text-align: center; align-items: center; }
.mode.compact h2 { font-size: 1rem; margin: 0; }
.mode.compact .btn { align-self: center; }
.mode .reward { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }

/* ===== Hoja Compartir / Instalar ===== */
.lobby-head .btn { white-space: nowrap; }
.sheet-overlay { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 60; }
.sheet { width: 100%; max-width: 520px; background: var(--felt-raise); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; }
.sheet h2 { margin: 0; font-family: var(--font-display); }
.sheet-note { color: var(--muted); font-size: .9rem; margin: 0; }

/* ===== Minijuegos ===== */
.game-desc { margin: 0; color: var(--muted); font-size: .85rem; max-width: 34ch; }
.mg .mg-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.mg .versus .mid .tag { max-width: 18ch; text-align: center; }

/* Busca los números */
.mg-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.mg-chip { min-width: 38px; padding: 4px 8px; border-radius: 10px; background: var(--felt-raise); border: 2px solid var(--line);
  font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; transition: transform .15s; }
.mg-chip.cur { background: var(--brass); color: var(--ink); border-color: var(--brass); transform: scale(1.14); }
.mg-chip.done { opacity: .45; text-decoration: line-through; }
.mg-board { position: relative; flex: 1; min-height: 0; border-radius: 14px; border: 3px solid var(--line); overflow: hidden;
  background-color: #eaf6fb; touch-action: manipulation;
  background-image: linear-gradient(#a9d8ea 1px, transparent 1px), linear-gradient(90deg, #a9d8ea 1px, transparent 1px); background-size: 20px 20px; }
.mg-board.lock { opacity: .65; animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.mg-num { position: absolute; background: none; border: 0; padding: 7px; line-height: 1; cursor: pointer; color: #14213a;
  font: 700 clamp(14px, 4.4vw, 21px) var(--font-display); -webkit-tap-highlight-color: transparent; }
.mg-num.found { outline: 3px solid var(--c, #e0a31a); outline-offset: -2px; border-radius: 12px; }
.mg-opp { text-align: center; color: var(--muted); }

/* Busca el número */
.mg-target { text-align: center; line-height: 1; }
.mg-target small { display: block; color: var(--muted); margin-bottom: 4px; }
.mg-target b { font: 800 2.8rem var(--font-display); color: var(--brass); }

/* Tres en línea: casillas de tamaño fijo (minmax(0,1fr)) y figuras dibujadas en SVG */
.mg-ttt { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 10px; width: min(100%, 360px); aspect-ratio: 1 / 1; margin: auto; padding: 10px; box-sizing: border-box;
  background: #1e5fb8; border-radius: 18px; }
.mg-cell { min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 14px; background: #0c2150;
  display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; transition: background .15s; }
.mg-cell:disabled { cursor: default; }
.mg-cell.turn { background: #123071; }
.mg-cell.win { background: #e0b92e; }
.mg-sym { width: 72%; height: 72%; display: block; }
.mg-sym path, .mg-sym circle { fill: none; stroke: #16c8ff; stroke-width: 13; stroke-linecap: round; }

/* Cuchillos */
.mg-knives { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mg-knives-svg { flex: 1 1 auto; min-height: 280px; width: 100%; max-width: 380px; touch-action: manipulation; }
.mg-knives-svg .ready { opacity: .45; transition: transform .12s ease-in, opacity .2s; }
.mg-knives-svg.my-turn .ready { opacity: 1; filter: drop-shadow(0 0 7px #ffd25c); }
.mg-klabel { fill: #cfe0ff; font: 700 14px var(--font-display); }
.mg-knives-svg.hit { animation: shake .3s; }
.kn.bad .kn-blade, .kn.bad .kn-handle { fill: #ff4d6d; }
.mg-throw { width: 100%; max-width: 380px; font-size: 1.1rem; padding: 14px; }

/* Selector de juego al retar */
.game-pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--felt-raise); border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: var(--text); }
.game-pick .gp-art { font-size: 1.6rem; min-width: 3.4rem; text-align: center; }
.game-pick .gp-art.has-img { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; width: 84px; min-width: 84px; }
.game-pick .gp-art img { width: 38px; height: 38px; object-fit: contain; display: block; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); }
.game-pick .gp-art.single img { width: 56px; height: 56px; }
.game-pick .gp-txt { display: flex; flex-direction: column; gap: 2px; }
.game-pick small { color: var(--muted); }

/* ===== Bienvenida (login / registro) ===== */
.auth { background: radial-gradient(ellipse at 50% -5%, #2b5fb566, transparent 62%); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.auth-logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: 0 0 0 3px #2b5795, 0 0 28px #3f7fd666; animation: float 4s ease-in-out infinite; }
.auth-name { font: 800 2.5rem var(--font-display); letter-spacing: .5px; line-height: 1;
  background: linear-gradient(90deg, #ffffff, #9ec9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero h1 { font-size: 1.5rem; margin: 6px 0 0; }
.auth-hero p { font-size: 1.02rem; line-height: 1.45; }
.auth form.stack { background: #ffffff0d; border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
@keyframes float { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .auth-logo { animation: none; } }

/* ===== Menú ☰ y aviso de actualización ===== */
.menu-btn { font-size: 1.35rem; line-height: 1; padding: 6px 14px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; position: relative;
  background: var(--felt); border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: var(--text); }
.menu-item:disabled { opacity: .6; cursor: default; }
.mi-ico { font-size: 1.5rem; width: 2.5rem; flex: none; display: grid; place-items: center; text-align: center; }
.mi-img { width: 40px; height: 40px; object-fit: contain; display: block; }
.mi-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.mi-txt small { color: var(--muted); }
.mi-badge:not(:empty) { background: var(--brass); color: var(--ink); border-radius: 999px; padding: 2px 9px; font-weight: 800; font-size: .75rem; }
.update-banner { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 70;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  background: var(--felt-raise); border: 1px solid var(--brass); border-radius: 14px; box-shadow: 0 8px 24px #0008; }

a.menu-item { text-decoration: none; box-sizing: border-box; }

/* Editor de fotos y videos */
.editor { position: fixed; inset: 0; z-index: 110; background: var(--felt, #0b2a1f); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 12px calc(env(safe-area-inset-bottom, 0px) + 14px); overflow-y: auto; }
.editor h3 { margin: 4px 0; }
.ed-stage { position: relative; overflow: hidden; touch-action: none; border-radius: 8px; flex: none; }
.ed-canvas { display: block; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px #000a; touch-action: none; cursor: move; }
.crop-h { position: absolute; width: 26px; height: 26px; background: #fff; border-radius: 50%; touch-action: none; }
.crop-h.nw { left: -13px; top: -13px; } .crop-h.ne { right: -13px; top: -13px; }
.crop-h.sw { left: -13px; bottom: -13px; } .crop-h.se { right: -13px; bottom: -13px; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: inherit; font-weight: 700; cursor: pointer; }
.chip.on { background: var(--accent, #f5c542); color: #1a1a1a; border-color: transparent; }
.ed-actions { display: flex; gap: 10px; width: 100%; max-width: 420px; margin-top: auto; }
.ed-actions .btn { flex: 1; }
.ed-video { width: 100%; max-width: 560px; max-height: 45vh; border-radius: 10px; background: #000; }
.ed-range { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; width: 100%; max-width: 560px; }
.ed-range input { width: 100%; }
.ed-progress { width: 100%; max-width: 420px; height: 14px; }

/* Editor a pantalla completa */
.editor.full { background: #000; padding: 0; gap: 0; overflow: hidden; align-items: stretch; }
.editor.full.busy { justify-content: center; align-items: center; gap: 12px; padding: 20px; }
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px; }
.ed-top h3 { margin: 0; font-size: 1rem; }
.ed-top .btn { padding: 8px 16px; }
.ed-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.ed-bottom { flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 14px); }
.ed-bottom p { margin: 0; text-align: center; }
.ed-video-full { width: 100%; height: 100%; object-fit: contain; background: #000; }
.crop-h.n, .crop-h.s { left: 50%; width: 46px; height: 12px; margin-left: -23px; border-radius: 6px; }
.crop-h.e, .crop-h.w { top: 50%; width: 12px; height: 46px; margin-top: -23px; border-radius: 6px; }
.crop-h.n { top: -6px; } .crop-h.s { bottom: -6px; } .crop-h.e { right: -6px; } .crop-h.w { left: -6px; }
.tl { position: relative; width: 100%; max-width: 640px; height: 58px; touch-action: none; user-select: none; }
.tl-thumbs { position: absolute; inset: 0; display: flex; overflow: hidden; border-radius: 8px; background: #1b2a44; }
.tl-thumbs canvas { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; }
.tl-dim { position: absolute; top: 0; bottom: 0; background: #000b; pointer-events: none; }
.tl-sel { position: absolute; top: 0; bottom: 0; box-sizing: border-box; border-top: 3px solid var(--brass, #f5c542); border-bottom: 3px solid var(--brass, #f5c542); pointer-events: none; }
.tl-h { position: absolute; top: -4px; bottom: -4px; width: 22px; background: var(--brass, #f5c542); border-radius: 6px; touch-action: none; display: flex; align-items: center; justify-content: center; cursor: ew-resize; }
.tl-h::after { content: ''; width: 3px; height: 22px; background: #1a1a1a; border-radius: 2px; }
.tl-h::before { content: ''; position: absolute; inset: -8px -10px; }
.tl-ph { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; pointer-events: none; box-shadow: 0 0 3px #000; }

/* Perfil público: Escribir al privado y Donar corazones del mismo tamaño */
.pa-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pa-pair .btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 56px; text-align: center; box-sizing: border-box; width: 100%; }

.total-wins { text-align: center; }

/* Foto de perfil en pantalla completa */
.lightbox.photo { padding: 0; background: #000; }
.lightbox.photo img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; border-radius: 0; cursor: zoom-out; }
.avatar-edit .avatar-view { background: none; border: 0; padding: 0; cursor: zoom-in; display: block; }
.avatar-edit button.cam { border: 0; cursor: pointer; font-size: 1rem; padding: 0; }

/* Contraseña con ojo */
.pass-wrap { position: relative; display: flex; }
.pass-wrap input { width: 100%; padding-right: 92px; }
.pass-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--brass, #f5c542); font-weight: 600; font-size: .9rem; padding: 8px 10px; cursor: pointer; }

.notif-box [hidden] { display: none !important; }
.notif-box p { margin: 0; }

/* ===================== Salas de espera, apuestas, grupos y Ludo ===================== */
.grow { flex: 1; }
.small { font-size: .82rem; }
.page-head.row { justify-content: space-between; align-items: center; }
.new-group { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; }

/* Selector de cantidad de jugadores (Ludo) */
.size-picker { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* Botón "Salir" dentro de un combate */
.leave-btn { display: inline-flex; align-items: center; gap: 6px; align-self: center; margin: 8px auto calc(12px + env(safe-area-inset-bottom));
  background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .85rem; cursor: pointer; }
.leave-btn:hover { color: var(--bad); border-color: #7a3b3b; }
.leave-btn:disabled { opacity: .5; }

/* Sala de espera con los perfiles */
.wait-room { width: min(100%, 380px); }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 6px 0; }
.slot-user { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 78px; }
.slot-user b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.slot-user.in .avatar { border: 3px solid var(--brass); animation: pop .35s ease-out; }
.slot-user.empty b { color: var(--muted); font-weight: 500; }
.slot-empty { width: 54px; height: 54px; border-radius: 50%; border: 2px dashed var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-family: var(--font-display); font-size: 1.4rem; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Tarjeta de sala dentro del chat grupal */
.challenge-card.room .room-slots { display: flex; gap: 8px; margin: 8px 0; }
.room-slot { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.room-slot.empty { border: 2px dashed var(--line); color: var(--muted); font-weight: 700; }
.room-slot.in .avatar { border: 2px solid var(--brass); }

/* Grupos y chats fijados */
.avatar-stack { display: inline-flex; flex: none; }
.avatar-stack .avatar { border: 2px solid var(--felt); margin-left: -10px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack.lg { width: 64px; justify-content: center; }
.group-title { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; flex: 1; min-width: 0; text-align: left; color: inherit; }
.group-name { display: flex; flex-direction: column; min-width: 0; }
.group-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-name small { color: var(--muted); }
.pin-btn { color: var(--muted); }
.pin-btn.on { color: var(--brass); }
.pin-mark { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--brass); }
.conv.pinned { background: #ffffff08; }
.pick-results { max-height: 220px; overflow: auto; }
.pick-results .conv { width: 100%; background: none; border-top: 0; border-left: 0; border-right: 0; color: inherit; cursor: pointer; text-align: left; }

/* ---- LUDO ---- */
.game.ludo { align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom)); overflow: auto; }
.ludo-top { width: 100%; display: flex; align-items: center; justify-content: space-between; max-width: 520px; }
.ludo-top .leave-btn { margin: 0; }
.lp-bar { display: flex; gap: 8px; justify-content: center; width: 100%; max-width: 520px; flex-wrap: wrap; }
.lp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; min-width: 70px; border-radius: 14px;
  border: 2px solid transparent; background: #ffffff0d; transition: border-color .2s, transform .2s, opacity .2s; }
.lp .avatar { border: 3px solid var(--c); }
.lp b { font-size: .78rem; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp small { color: var(--muted); font-size: .72rem; }
.lp.turn { border-color: var(--c); transform: translateY(-2px); background: #ffffff1c; }
.lp.left { opacity: .35; }
.lp-time { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--brass); color: var(--ink);
  font: 800 .78rem/22px var(--font-display); text-align: center; padding: 0 5px; }
.lp-time:empty { display: none; }
.game.ludo.urgent .lp.turn .lp-time { background: var(--heart); color: #fff; animation: beat .5s ease-in-out infinite; }
.ludo-wrap { width: min(100%, 520px, calc(100dvh - 330px)); min-width: 280px; aspect-ratio: 1; flex: none; }
.ludo-board { width: 100%; height: 100%; display: block; border-radius: 14px; box-shadow: 0 6px 24px #0008; }
.tok { transition: transform .38s cubic-bezier(.3, .7, .3, 1); }
.tok.hopping { transition: transform .2s linear; }
.tok-body { filter: drop-shadow(0 .06px .06px #0006); }
.tok.legal { cursor: pointer; }
.tok.legal .tok-body { stroke: var(--ink); animation: tokpulse .7s ease-in-out infinite alternate; }
.tok.gone { opacity: 0; pointer-events: none; }
@keyframes tokpulse { from { r: .36; } to { r: .5; } }
.ludo-dice { display: flex; justify-content: center; }
.dice { display: flex; flex-direction: column; align-items: center; gap: 0; width: 96px; background: var(--tile); color: var(--ink); border: 0; border-radius: 18px;
  padding: 6px 10px 8px; cursor: pointer; box-shadow: 0 4px 0 var(--tile-edge); }
.dice:disabled { opacity: .7; cursor: default; box-shadow: 0 2px 0 var(--tile-edge); }
.dice.can-roll { animation: dicepulse .9s ease-in-out infinite; }
.dice-face { font-size: 3.4rem; line-height: 1.05; }
.dice-face.spin { animation: dicespin .55s ease-out; }
.dice small { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes dicespin { from { transform: rotate(-540deg) scale(.5); } to { transform: rotate(0) scale(1); } }
@keyframes dicepulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* Cabecera con 3 jugadores (Busca el número) */
.versus.multi { grid-template-columns: 1fr; gap: 6px; }
.versus.multi .mid { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.mp-row { display: flex; justify-content: center; gap: 12px; }
.mp-row .side { flex: 1; max-width: 108px; }
