/* 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; min-width: 0; overflow-x: hidden; 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-auto-flow: column; grid-auto-columns: 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; }
input.qty-n { width: 4.2ch; min-width: 0; padding: 0; margin: 0; border: 0; border-bottom: 2px dashed var(--line); border-radius: 0; background: transparent; color: inherit; text-align: center; outline: none; box-shadow: none; }
input.qty-n:focus { border-bottom-color: var(--brass); }
.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; }
.usdt-card .usdt-qr { width: min(220px, 70%); aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 14px; padding: 8px; align-self: center; margin: 4px 0 8px; }
.usdt-card .kv { grid-template-columns: 80px 1fr auto; }
.usdt-card .kv b { font-size: .86rem; word-break: break-all; }
.usdt-card .usdt-net { margin: -2px 0 4px 88px; }
.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; z-index: 20; 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: flex; flex-direction: column; gap: 10px; margin-top: auto; }   /* botones de combate abajo, sobre la barra inferior */
.mode-btn { padding: 15px 18px; font-size: 1.02rem; text-align: center; }
.mode-btn.bots { background: #1d3f6e; border: 1px solid #3a75bf; color: #fff; }
.mode-note { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; margin: -4px 0 2px; text-align: center; }
.mode-note b { color: var(--brass); }
.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; max-height: 92dvh; overflow-y: auto; }
.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: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 6px 14px #0006); 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; flex-wrap: wrap; gap: 8px; margin: 8px 0; min-width: 0; max-width: 100%; }
.room-slot { flex: none; 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); } }
.dice-face.tumble { animation: dicetumble .32s linear infinite; }
@keyframes dicetumble { from { transform: rotate(0) scale(.9); } 50% { transform: rotate(180deg) scale(1.15); } to { transform: rotate(360deg) scale(.9); } }
.ludo-wrap.shake { animation: boardshake .45s ease-out; }
@keyframes boardshake { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-5px, 2px) rotate(-.6deg); } 35% { transform: translate(5px, -2px) rotate(.6deg); }
  55% { transform: translate(-3px, 1px); } 75% { transform: translate(2px, -1px); } }
.ludo-snd { display: flex; gap: 6px; }
.ludo-snd .snd { font-size: 1rem; line-height: 1; }
.ludo-snd .snd.off { opacity: .4; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -16px; width: 8px; height: 14px; border-radius: 2px; animation: confall linear infinite; }
@keyframes confall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .dice-face.tumble, .ludo-wrap.shake { animation: none; } .confetti { display: none; } }

/* 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; }

/* ---- ARENA 2D ---- */
.game.ar2d { gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom)); }
.ar-top { display: flex; align-items: center; justify-content: space-between; }
.ar-top .leave-btn { margin: 0; }
.ar-hud { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ar-p { display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--felt-raise); border: 2px solid var(--c); min-width: 0; }
.ar-p b { max-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.ar-p .ar-k { color: var(--c); font-weight: 800; font-variant-numeric: tabular-nums; }
.ar-p.dead { opacity: .5; }
.ar-p.gone { opacity: .25; text-decoration: line-through; }
.ar-field { position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 24px #0008; background: #0b0e14; }
.ar-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.ar-banner { position: absolute; left: 0; right: 0; top: 42%; margin: 0; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem;
  text-shadow: 0 2px 8px #000; pointer-events: none; opacity: 0; transition: opacity .15s; padding: 0 12px; }
.ar-banner.on { opacity: 1; }
.ar-help { margin: 0; text-align: center; color: var(--muted); font-size: .8rem; transition: opacity .4s; }
.ar-help.off { opacity: 0; }

/* ───────────── UNO (2 a 6 jugadores) · static/js/views/uno.js ───────────── */
.game.uno { align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom)); overflow: hidden; }
.game.uno .ludo-top { width: 100%; display: flex; align-items: center; justify-content: space-between; max-width: 560px; }
.game.uno .ludo-top .leave-btn { margin: 0; }
.uno .lp-bar { display: flex; gap: 6px; justify-content: center; width: 100%; max-width: 560px; flex-wrap: wrap; }
.uno .lp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 6px; min-width: 58px; border-radius: 12px;
  border: 2px solid transparent; background: #ffffff10; transition: transform .15s, background .15s, border-color .15s; }
.uno .lp .avatar { border: 3px solid var(--c); }
.uno .lp b { font-size: .72rem; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uno .lp small { color: var(--muted); font-size: .7rem; }
.uno .lp.turn { border-color: var(--c); transform: translateY(-2px); background: #ffffff1c; }
.uno .lp.left { opacity: .35; }
.uno .lp.one small { color: var(--brass); font-weight: 800; }
.uno .lp.vuln { animation: unoVuln .6s ease-in-out infinite; border-color: var(--heart); }
@keyframes unoVuln { 50% { transform: scale(1.08); background: #ef3b5540; } }
.uno .lp-time { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--brass); color: var(--ink);
  font-weight: 800; font-size: .75rem; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.uno .lp-time:empty { display: none; }
.game.uno.urgent .lp.turn .lp-time { background: var(--heart); color: #fff; animation: beat .5s ease-in-out infinite; }
.uno .banner { font-size: 1rem; min-height: 1.5em; margin: 2px 0 0; padding: 0 6px; }
.uno .ulog { margin: 0; min-height: 2.4em; max-width: 560px; text-align: center; color: var(--muted); font-size: .8rem; padding: 0 8px; }

/* Cartas */
.ucard { --cc: #e5484d; --ct: #d02b31; position: relative; width: 56px; height: 84px; border-radius: 9px; border: 3px solid #fff; background: var(--cc); color: #fff;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 900; box-shadow: 0 3px 8px #0007; flex: none; user-select: none; -webkit-user-select: none; }
.ucard.c-R { --cc: #e5484d; --ct: #d02b31; }
.ucard.c-Y { --cc: #f5c542; --ct: #c28f00; }
.ucard.c-G { --cc: #30a46c; --ct: #1f8a56; }
.ucard.c-B { --cc: #3e8ef7; --ct: #2a6fd6; }
.ucard.c-W, .ucard.back { --cc: #17171f; --ct: #17171f; }
.ucard .uc-mid { width: 78%; height: 58%; border-radius: 50%; background: #fff; color: var(--ct); display: flex; align-items: center; justify-content: center;
  transform: rotate(-26deg); box-shadow: inset 0 0 0 1px #0002; }
.ucard .uc-mid b { transform: rotate(26deg); font-size: 1.45rem; line-height: 1; font-weight: 900; }
.ucard .uc-mid.wide b { font-size: 1.05rem; letter-spacing: -.04em; }
.ucard .uc-tl, .ucard .uc-br { position: absolute; font-style: normal; font-size: .6rem; font-weight: 800; line-height: 1; text-shadow: 0 1px 2px #0006; }
.ucard .uc-tl { top: 4px; left: 5px; }
.ucard .uc-br { bottom: 4px; right: 5px; transform: rotate(180deg); }
.ucard.c-W .uc-mid { background: conic-gradient(#e5484d 0 25%, #f5c542 0 50%, #30a46c 0 75%, #3e8ef7 0 100%); color: #fff; }
.ucard.c-W .uc-mid b { text-shadow: 0 1px 3px #000c; }
.ucard.back .uc-mid { background: #e5484d; color: #f5c542; }
.ucard.back .uc-mid b { font-size: .95rem; letter-spacing: -.02em; text-shadow: 0 1px 0 #000a; }
.ucard.big { width: 84px; height: 126px; border-radius: 12px; border-width: 4px; }
.ucard.big .uc-mid b { font-size: 2.1rem; }
.ucard.big .uc-mid.wide b { font-size: 1.55rem; }
.ucard.big .uc-tl, .ucard.big .uc-br { font-size: .8rem; }
.ucard.big .uc-tl { top: 6px; left: 7px; }
.ucard.big .uc-br { bottom: 6px; right: 7px; }
.ucard.back.big .uc-mid b { font-size: 1.3rem; }

/* Mesa */
.uno .utable { position: relative; display: flex; align-items: center; justify-content: center; gap: 26px; width: 100%; max-width: 560px; flex: 0 0 auto; padding: 4px 0; margin-top: auto; }
.uno .upile { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: var(--text); cursor: default; }
.uno .upile .ucard { width: 84px; height: 126px; border-radius: 12px; border-width: 4px; box-shadow: 0 1px 0 #fff3, 0 4px 0 #0007, 0 8px 0 #fff2, 0 10px 12px #0006; }
.uno .upile .ucard .uc-mid b { font-size: 1.3rem; }
.uno .upile small { color: var(--muted); font-size: .75rem; font-weight: 700; }
.uno .upile.can { cursor: pointer; }
.uno .upile.can .ucard { animation: uPile 1.1s ease-in-out infinite; }
.uno .upile.can small { color: var(--brass); }
@keyframes uPile { 50% { transform: translateY(-4px); box-shadow: 0 0 0 3px #ffd54f, 0 1px 0 #fff3, 0 4px 0 #0007, 0 10px 14px #0006; } }
.uno .udiscard { position: relative; padding: 8px; border-radius: 50%; --ring: transparent; }
.uno .udiscard.has-color { box-shadow: 0 0 0 5px var(--ring), 0 0 26px 4px var(--ring); transition: box-shadow .25s; border-radius: 20px; }
.uno .udiscard::after { content: attr(data-color); position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; background: var(--ring); color: #111; padding: 1px 8px; border-radius: 999px; display: none; white-space: nowrap; }
.uno .udiscard.has-color::after { display: block; }
.u-pop { animation: uPop .28s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes uPop { from { transform: scale(1.35) rotate(-8deg); opacity: .2; } to { transform: scale(1) rotate(0); opacity: 1; } }
.uno .udir { position: absolute; right: 6%; top: 8px; font-size: 1.7rem; color: var(--muted); animation: uSpin 6s linear infinite; }
@keyframes uSpin { to { transform: rotate(360deg); } }
.uno .upend { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); background: var(--heart); color: #fff; font-family: var(--font-display); font-weight: 900;
  font-size: 1.25rem; padding: 2px 14px; border-radius: 999px; box-shadow: 0 3px 10px #0008; animation: beat .6s ease-in-out infinite; z-index: 2; }
.uno .upend[hidden] { display: none; }

/* Acciones */
.uno .uactions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 64px; width: 100%; max-width: 560px; }
.uno .uactions .btn { padding: 10px 16px; font-size: .95rem; }
.uno .uactions [hidden] { display: none; }
.uno .u-uno { background: #8a2430; color: #fff; border: 2px solid #ffffff55; letter-spacing: .02em; padding: 15px 34px; min-width: 150px; font-size: 1.3rem; border-radius: 18px; }
.uno .u-uno.u-hot { background: var(--heart); border-color: #fff; animation: beat .55s ease-in-out infinite; }
.uno .u-uno.u-said { background: var(--ok); color: #0b2b1c; animation: none; }
.uno .u-warn { background: var(--brass); color: var(--ink); }
.uno .u-catch { background: var(--heart); color: #fff; animation: beat .5s ease-in-out infinite; }

/* Mano */
.uno .uhand { display: flex; align-items: flex-end; width: 100%; max-width: 640px; margin-top: auto; padding: 28px 14px calc(18px + env(safe-area-inset-bottom) * .3); overflow-x: auto; overflow-y: hidden; min-height: 150px; }
.uno .uhand .ucard { width: 74px; height: 111px; border-radius: 11px; cursor: default; transition: transform .15s, box-shadow .15s, filter .15s; }
.uno .uhand .ucard .uc-mid b { font-size: 1.9rem; }
.uno .uhand .ucard .uc-mid.wide b { font-size: 1.4rem; }
.uno .uhand .ucard .uc-tl, .uno .uhand .ucard .uc-br { font-size: .78rem; }
.uno .uhand .ucard + .ucard { margin-left: var(--ov, -32px); }
.uno .uhand .ucard:first-child { margin-left: auto; }
.uno .uhand .ucard:last-child { margin-right: auto; }
.uno .uhand .u-ok { transform: translateY(-14px); box-shadow: 0 0 0 3px #ffd54f, 0 8px 16px #000a; cursor: pointer; }
.uno .uhand .u-ok:hover, .uno .uhand .u-ok:focus-visible { transform: translateY(-22px); outline: none; z-index: 3; }
.uno .uhand .u-dim { filter: brightness(.55) saturate(.7); }
.uno .uhand .u-fresh { box-shadow: 0 0 0 3px var(--ok), 0 8px 16px #000a; }
.uno .uhand .u-new { animation: uDeal .35s ease-out; }
@keyframes uDeal { from { transform: translateY(-90px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Selector de color */
.uno .upicker { position: absolute; inset: 0; z-index: 5; background: #030c27d9; display: flex; align-items: center; justify-content: center; }
.uno .upicker[hidden] { display: none; }
.uno .upicker-box { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.uno .upicker-box p { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; margin: 0; }
.uno .upicker-row { display: grid; grid-template-columns: repeat(2, 92px); gap: 12px; }
.uno .upick { width: 92px; height: 92px; border-radius: 22px; border: 4px solid #fff; background: var(--cc); cursor: pointer; box-shadow: 0 6px 16px #0008; transition: transform .12s; }
.uno .upick:hover, .uno .upick:focus-visible { transform: scale(1.08); outline: none; }
.uno .upick:active { transform: scale(.96); }
@media (max-height: 640px) {
  .uno .ucard.big, .uno .upile .ucard { width: 68px; height: 102px; }
  .uno .uhand { min-height: 128px; }
  .uno .uhand .ucard { width: 64px; height: 96px; }
  .uno .uhand .ucard .uc-mid b { font-size: 1.6rem; }
  .uno .uhand .ucard .uc-mid.wide b { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .uno .udir, .uno .upile.can .ucard, .uno .lp.vuln, .uno .upend, .uno .u-uno.u-hot, .uno .u-catch { animation: none; }
}

/* ───────────── BOMBA ROYALE (2 a 10 jugadores) · static/js/views/bomb.js ───────────── */
.game.bomb { align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom)); overflow: hidden; }
.bomb-top { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; }
.bomb-top .leave-btn { margin: 0; }
.btimer { position: relative; width: 100%; max-width: 560px; height: 22px; border-radius: 11px; background: #ffffff14; overflow: hidden; flex: none; }
.btimer-fill { position: absolute; inset: 0 auto 0 0; background: var(--brass); transition: width .25s linear; }
.btimer-n { position: relative; display: block; text-align: center; font: 800 .85rem/22px var(--font-display); color: var(--ink); }
.btimer.idle { opacity: .35; }
.game.bomb.urgent .btimer-fill { background: var(--heart); }
.game.bomb.urgent .btimer-n { color: #fff; animation: beat .5s ease-in-out infinite; }
.bstrip { display: flex; gap: 4px; width: 100%; max-width: 560px; justify-content: center; flex: none; }
.bp { flex: 1 1 0; min-width: 0; max-width: 56px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 1px; border-radius: 10px; background: #ffffff0d; border: 2px solid transparent; }
.bp .avatar { border: 3px solid var(--c); }
.bp b { font-size: .6rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp small { font-size: .65rem; min-height: 1em; line-height: 1; }
.bp.me { border-color: #fff8; }
.bp.out { opacity: .4; filter: grayscale(.8); }
.bp.left { opacity: .2; }
.bbanner { margin: 0; min-height: 2.6em; max-width: 560px; text-align: center; font-size: .92rem; font-weight: 700; padding: 0 6px; flex: none; display: flex; align-items: center; justify-content: center; }
.bboard { flex: 1; min-height: 0; width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: center; }
.bfield { position: relative; flex: none; padding: 0; border-radius: 10px; }
.bgrid { display: grid; grid-template-columns: repeat(var(--cols), var(--cs)); grid-auto-rows: var(--cs); gap: var(--gap); }
.bcell { position: relative; width: var(--cs); height: var(--cs); padding: 0; border: 0; border-radius: 6px; cursor: default; touch-action: manipulation;
  background: linear-gradient(145deg, #4f9a3c, #3f8230); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bcell.alt { background: linear-gradient(145deg, #5aa646, #468a36); }
.bface { font-size: calc(var(--cs) * .62); line-height: 1; filter: drop-shadow(0 2px 1px #0006); transition: transform .2s; }
.bcell.hurt .bface { filter: saturate(.55) drop-shadow(0 2px 1px #0006); }
.bcell.hurt::after { content: '🔥'; position: absolute; top: 1px; right: 2px; font-size: calc(var(--cs) * .3); }
.bcell.burnt { background: radial-gradient(circle at 50% 50%, #120c0a 0 30%, #2e2119 75%); box-shadow: inset 0 0 0 1px #0006; }
.bcell.burnt::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; background: radial-gradient(#ff7a2a55, transparent 70%); animation: bEmber 2.2s ease-in-out infinite alternate; }
@keyframes bEmber { from { opacity: .15; } to { opacity: .8; } }
.bcell.can-move { cursor: pointer; box-shadow: inset 0 0 0 3px #5fd6a0; animation: bPulse .9s ease-in-out infinite alternate; }
.bcell.can-bomb { cursor: pointer; box-shadow: inset 0 0 0 2px #ef3b5577; }
.bcell.can-land { cursor: pointer; box-shadow: inset 0 0 0 2px #ffffff66; }
.bcell.sel-move { box-shadow: inset 0 0 0 3px #5fd6a0; }
.bcell.sel-bomb { box-shadow: inset 0 0 0 3px var(--heart); background-color: #5a1a22; }
.bcell.sel-land { box-shadow: inset 0 0 0 3px var(--brass); }
.bcell.mine { box-shadow: inset 0 0 0 2px #fff; }
@keyframes bPulse { to { box-shadow: inset 0 0 0 5px #5fd6a099; } }
.bmark { position: absolute; right: 0; bottom: 0; font-size: calc(var(--cs) * .38); line-height: 1; }
.btokens, .bfx { position: absolute; inset: 0; pointer-events: none; }
.btok { position: absolute; left: 0; top: 0; width: var(--cs); height: var(--cs); display: grid; place-items: center; transition: transform .55s cubic-bezier(.3, .7, .3, 1); z-index: 2; }
.btok-in { transition: transform .3s; }
.btok .avatar { border: 3px solid var(--c); box-shadow: 0 2px 6px #000a; }
.btok.me .avatar { box-shadow: 0 0 0 2px #fff, 0 2px 8px #000a; }
.btok.dead { transition: opacity .5s, filter .5s; opacity: 0; filter: grayscale(1); }
.btok.dead::after { content: '💀'; position: absolute; font-size: calc(var(--cs) * .6); }
.btok.drop .btok-in { animation: bDrop .6s cubic-bezier(.3, .8, .4, 1); }
@keyframes bDrop { from { transform: translateY(-60px) scale(2.2); opacity: 0; } }
.bdrop { position: absolute; font-size: calc(var(--cs) * .75); filter: drop-shadow(0 0 6px var(--c)); z-index: 3; }
.bboom { position: absolute; font-size: calc(var(--cs) * 1.2); z-index: 4; line-height: 1; }
.bboom.small { font-size: calc(var(--cs) * .8); }
.bfield.shake { animation: boardshake .45s ease-out; }
.bcontrols { display: flex; gap: 8px; width: 100%; max-width: 560px; flex: none; }
.bcontrols .btn { flex: 1; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.15; }
.bcontrols .btn small { font-size: .68rem; opacity: .75; font-weight: 500; }
.bmode.on { background: var(--felt-raise); border-color: var(--brass); box-shadow: 0 0 0 2px var(--brass) inset; }
.bready { flex: 1.3 !important; font-weight: 800; }
.bspec { text-align: center; color: var(--muted); font-weight: 700; padding: 10px; flex: none; }
@media (prefers-reduced-motion: reduce) { .bcell.can-move, .bcell.burnt::after, .game.bomb.urgent .btimer-n, .bfield.shake { animation: none; } }


/* ---- Galería del perfil y suscripciones ---- */
.gallery-public { width: 100%; text-align: left; }
.gallery-public h3 { margin: 0; }
.sub-box { background: var(--felt-raise); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sub-box p { margin: 0; }
.g-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
.g-grid .empty { grid-column: 1 / -1; }
.g-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--felt-deep); border: 1px solid var(--line); cursor: pointer; }
.g-item img, .g-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-item.locked { background: repeating-linear-gradient(45deg, var(--felt-deep), var(--felt-deep) 8px, var(--felt-raise) 8px, var(--felt-raise) 16px); }
.g-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--brass); }
.g-lock small { font-size: .7rem; color: var(--text); }
.g-play { position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 50%; background: #000a; color: #fff; font-size: .6rem; display: flex; align-items: center; justify-content: center; }
.g-badge { position: absolute; left: 4px; bottom: 4px; border: 0; border-radius: 999px; padding: 3px 8px; font-size: .68rem; font-weight: 700; cursor: pointer; }
.g-badge.pub { background: var(--ok); color: #0b2a1c; }
.g-badge.priv { background: var(--brass); color: #2a1c05; }
.g-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #000b; color: #fff; font-size: .8rem; cursor: pointer; }


/* ---- Estadísticas pequeñas del perfil (victorias totales + racha) ---- */
.win-stats { width: 100%; display: flex; gap: 8px; }
.ws-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 6px; border-radius: 14px; background: var(--felt-raise); border: 1px solid var(--line); text-align: center; }
.ws-top { display: inline-flex; align-items: center; gap: 4px; }
.ws-item b { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; line-height: 1; font-variant-numeric: tabular-nums; }
.ws-item small { font-size: .68rem; line-height: 1.15; color: var(--muted); }
.ws-item .flame { color: #889aa9; }
.ws-item.warm .flame { color: #f0993f; }
.ws-item.hot .flame { color: #ff7a2b; animation: flicker 1.8s ease-in-out infinite; }
.ws-item.blaze .flame { color: #ff4d2e; animation: flicker 1.8s ease-in-out infinite; }
.ws-item.legend .flame { color: #ffd166; filter: drop-shadow(0 0 5px #ff4d2e); animation: flicker 1.4s ease-in-out infinite; }
/* Racha más alta del mes: mientras más alta, más bonita */
.ws-item.month.warm { border-color: #e8b04a88; }
.ws-item.month.hot { border-color: #ffb347; background: linear-gradient(160deg, #17386d, #4a3a2a); }
.ws-item.month.blaze { border-color: #ff7a2b; background: linear-gradient(160deg, #17386d, #6b2f1d); box-shadow: 0 0 14px #ff4d2e44; }
.ws-item.month.legend { border-color: #ffd166; background: linear-gradient(160deg, #3a2a5c, #8a2a1d); box-shadow: 0 0 18px #ffb34777; }
.ws-item.month.legend b, .ws-item.month.blaze b { color: #ffe9b0; }

/* ---- Contenido protegido de la galería ---- */
.g-item, .lightbox.protected { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.g-item img, .g-item video { pointer-events: none; }
.lightbox.protected img { pointer-events: none; -webkit-touch-callout: none; }
.lightbox.protected .lightbox-x { z-index: 3; }

/* Inicio: publicaciones */
.messages.feed { gap: 14px; align-items: center; }
.post { width: 100%; max-width: 560px; background: var(--felt-raise); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-av { cursor: pointer; display: inline-flex; }
.post-who { display: flex; flex-direction: column; min-width: 0; flex: 1; cursor: pointer; }
.post-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-who time { color: var(--muted); font-size: .78rem; }
.post-text { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 1.02rem; }
.post .chat-media { width: 100%; max-height: 70dvh; object-fit: cover; border-radius: 14px; margin: 0; }
.post .video-thumb { display: block; width: 100%; }
.post .video-thumb video { width: 100%; max-height: 70dvh; object-fit: cover; border-radius: 14px; }
.messages.feed .msg.challenge { max-width: 560px; width: 100%; min-width: 0; align-self: center; }
.match-faces { display: inline-flex; }
.match-face { display: inline-flex; margin-left: -10px; border-radius: 50%; box-shadow: 0 0 0 2px var(--felt-raise); cursor: pointer; }
.match-face:first-child { margin-left: 0; }

/* Inicio: barra superior delgada (solo juegos a la izquierda y menú a la derecha) */
.view.feed-view { padding-top: 6px; gap: 4px; }
.page-head.feed-bar { padding: 0; min-height: 0; }
/* Inicio: los dos botones de arriba (juegos y menú) del mismo tamaño y a la misma altura */
.page-head.feed-bar { align-items: center; }
.icon-btn.feed-btn { width: 40px; height: 40px; padding: 0; border-radius: 11px; line-height: 1; align-self: center; }
.icon-btn.feed-btn .ico { display: grid; place-items: center; }

/* Menú: icono de cerrar sesión (imagen sin fondo) */
.mi-img.mi-salir { width: 40px; height: 40px; }

/* ===== Opciones de mensajes y chats: pulsación larga, responder deslizando, tres puntitos ===== */
.composer[hidden], .reply-bar[hidden], .block-bar[hidden] { display: none; }
.msg, .post { position: relative; touch-action: pan-y; }
.bubble, .post, .conv { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.msg::before, .post::before { content: '↩'; position: absolute; left: -26px; top: 50%; transform: translateY(-50%); font-size: 1.3rem;
  color: var(--muted); opacity: 0; transition: opacity .12s, color .12s; pointer-events: none; }
.reply-pull::before { opacity: .55; }
.reply-armed::before { opacity: 1; color: var(--brass); }
.msg.flash .bubble, .post.flash { animation: flashbg 1.3s ease-out; }
@keyframes flashbg { 0%, 35% { box-shadow: 0 0 0 3px var(--brass); } 100% { box-shadow: 0 0 0 0 transparent; } }

.reply-quote { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: #00000026; border: 0; border-left: 3px solid var(--brass); border-radius: 8px; padding: 5px 9px; margin: 2px 0 6px; min-width: 0; }
.msg.mine .reply-quote { background: #0000001a; border-left-color: #8a6d1f; }
.reply-quote b { font-size: .78rem; color: var(--brass); }
.msg.mine .reply-quote b { color: #7a5c10; }
.reply-quote span { font-size: .85rem; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.post .reply-quote { margin: 0; }

.reply-bar { flex: 0 0 100%; display: flex; align-items: center; gap: 10px; background: var(--felt-raise); border: 1px solid var(--line);
  border-left: 3px solid var(--brass); border-radius: 12px; padding: 6px 8px 6px 10px; }
.reply-bar .rb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reply-bar .rb-text b { font-size: .8rem; color: var(--brass); }
.reply-bar .rb-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.block-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0 14px; color: var(--muted); }

.action-sheet { gap: 8px; }
.sheet-act { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: #ffffff0d; border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px; }
.sheet-act:active { background: #ffffff18; }
.sheet-act.danger { color: #ff8f8f; border-color: #7a3a46; }
