/* Play Dominó RD — v0.2.0 — mobile-first, dark navy + gold, green felt
   v0.2.1 restyle: menu + table match the approved sample (domino-rd-muestra) */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --navy: #071633; --navy2: #0c2653; --navy3: #123a7d;
  --gold: #f2c14e; --gold2: #c9931b; --gold-soft: #ffe9a8;
  --red: #e0393e; --green: #2fe07a; --panel: #0d2450;
  --felt: #0e7a41; --felt2: #095c2f;
  --felt0: #129a52; --rail1: #8a5a24; --rail2: #6d4218; --rail3: #593310;
  --ink: #f5f8ff; --muted: #a9bce0; --line: rgba(242,193,78,.35);
  --cream: #fdf6e3; --teal: #0e7d7b; --purple: #6a3fb5;
}
/* ---------- table themes (v0.2.2) — felt + rail per country flag ----------
   RD is the v0.2.1 default; the :root values above ARE the RD theme. */
:root[data-theme="pr"] { --felt0: #2a6bc4; --felt: #1b4f9e; --felt2: #0e3266; --rail1: #7d1f2b; --rail2: #5a1420; --rail3: #42101a; }
:root[data-theme="cu"] { --felt0: #c62f38; --felt: #a01e28; --felt2: #6b141b; --rail1: #1d3f7d; --rail2: #142c5c; --rail3: #0e2148; }
:root[data-theme="mx"] { --felt0: #149a82; --felt: #0e7a6b; --felt2: #084a42; --rail1: #8a2f1e; --rail2: #642015; --rail3: #4a160e; }
:root[data-theme="co"] { --felt0: #c9a227; --felt: #9a7b14; --felt2: #6b5410; --rail1: #1e3a8a; --rail2: #152a66; --rail3: #0f1f4d; }
:root[data-theme="ve"] { --felt0: #4a44b8; --felt: #2e2a7d; --felt2: #1d1a52; --rail1: #8a6d1f; --rail2: #6b5410; --rail3: #4f3d0c; }
:root[data-theme="es"] { --felt0: #a8324f; --felt: #7d1f33; --felt2: #4f1226; --rail1: #9a7b1e; --rail2: #6e5410; --rail3: #4f3d0c; }
:root[data-theme="us"] { --felt0: #2a4a8f; --felt: #16294f; --felt2: #0b1830; --rail1: #7d1f2b; --rail2: #5a1420; --rail3: #42101a; }
/* Navy felt luxury (store): while equipped it overrides the country felt
   colour. Same specificity as the theme rules above, placed AFTER them so
   it wins. The rail keeps the country colours; the flag stays on the felt. */
:root.lux-navy-felt { --felt0: #2a5db0; --felt: #16386e; --felt2: #0b2148; }
/* Colombia (co) legibility fix (v0.2.2): the amber felt washes out gold
   text — gold #f2c14e measured 2.40 vs felt #9a7b14 and 1.44 vs felt0
   #c9a227 (threshold 3.0); the white chain label was 2.31 too. Dark-navy
   #14264d text on the felt instead: 3.69 vs #9a7b14, 6.14 vs #c9a227
   (end-target badge bg blend: 4.68). Felt/rail colors UNCHANGED. */
:root[data-theme="co"] .end-val,
:root[data-theme="co"] .end-val.end-target,
:root[data-theme="co"] .chain-label,
:root[data-theme="co"] .chain-empty { color: #14264d; text-shadow: 0 1px 2px rgba(255,255,255,.4); }
html, body { height: 100%; }
body {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(47,127,224,.28), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(224,57,62,.14), transparent 55%),
    linear-gradient(180deg,#04102a 0%, #071633 45%, #050f27 100%);
  min-height: 100dvh; overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; min-height: 44px; }
input { font-family: inherit; }
/* App-wide scrolling (Alan 16-nov): the app is a fixed-height shell —
   #app is exactly one viewport tall, every screen is a flex child that
   scrolls INTERNALLY, and the bottom nav is a pinned flex sibling.
   Before this, #app only had min-height:100dvh, so a tall screen
   stretched the whole page and pushed the static nav below the fold
   with nothing scrollable to reach it (Alan's Tournaments screenshot:
   the 8th card and the nav were cut off and the page would not slide).
   The table screen keeps its own rules (landscape: height 100dvh +
   overflow hidden, declared later, so it still never scrolls). */
#app { max-width: 480px; margin: 0 auto; height: 100dvh; overflow: hidden; position: relative; display: flex; flex-direction: column; }

/* ---------- screens ---------- */
.screen { display: none; padding: 10px 14px 16px; position: relative; }
.screen.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- shared bits ---------- */
.flag { display: inline-block; width: 26px; height: 18px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.35); vertical-align: middle; flex: none; }
.coin-ico { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a8, #f2c14e 55%, #b9821c); color: #7a5200; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 2px rgba(122,82,0,.35); flex: none; }
.crown { position: absolute; top: -13px; right: -8px; font-size: 15px; color: var(--gold); filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd75e, #b97f00); color: #231303; font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: 19px; border: 2px solid var(--gold); flex: none; position: relative; }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar.lg { width: 64px; height: 64px; font-size: 23px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-left: 4px; vertical-align: middle; }

/* ---------- menu top bar (v0.2.2 final) ----------
   ONE row: hamburger left + profile strip compacted into the same row
   (avatar with crown + name/level + coins pill). No center circle, no
   "...", no full-width profile card below — its content lives here. */
.topbar { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; position: relative; }
.topbar-btn { width: 52px; height: 52px; min-height: 52px; border-radius: 50%; background: #d9e2f2; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,.35); flex: none; }
.topbar-btn svg { width: 24px; height: 24px; }
.topbar-profile { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; background: linear-gradient(180deg, rgba(18,58,125,.85), rgba(10,32,74,.9)); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px 4px 4px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.tp-avatar { padding: 0; min-height: 0; flex: none; }
.tp-avatar .avatar { width: 40px; height: 40px; font-size: 15px; background: linear-gradient(160deg,#2f7fe0,#123a7d); color: #fff; }
.tp-who { flex: 1; min-width: 0; text-align: left; padding: 0; min-height: 0; display: flex; flex-direction: column; gap: 1px; }
.tp-who .p-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-who .p-level { font-size: 11.5px; }
.topbar-profile .coins-pill { padding: 5px 6px 5px 8px; font-size: 14px; gap: 6px; flex: none; }
.topbar-profile .coins-plus { width: 24px; height: 24px; min-height: 24px; font-size: 15px; }
.p-name { font-weight: 800; font-size: 16px; line-height: 1.1; }
.p-level { font-size: 12px; color: var(--gold-soft); font-weight: 700; margin-top: 2px; }
.xp { height: 8px; background: rgba(255,255,255,.14); border-radius: 99px; margin-top: 6px; overflow: hidden; width: 118px; }
.xp i { display: block; height: 100%; width: 68%; background: linear-gradient(90deg,var(--gold2),var(--gold)); border-radius: 99px; }
.xp.profile-xp { width: 100%; margin: 2px 0 6px; }
.xp-label { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.coins-pill { display: flex; align-items: center; gap: 7px; background: rgba(0,0,0,.35); border: 1px solid var(--line); padding: 6px 8px 6px 10px; border-radius: 99px; font-weight: 800; font-size: 15px; }
.coins-plus { width: 26px; height: 26px; min-height: 26px; border-radius: 50%; border: none; background: #22b45e; color: #fff; font-size: 17px; font-weight: 900; line-height: 1; display: flex; align-items: center; justify-content: center; }
.reward { margin-top: 6px; font-size: 11px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 5px; justify-content: flex-end; min-height: 0; padding: 0; white-space: nowrap; }
.reward .dot { width: 8px; height: 8px; margin-left: 0; }
/* daily reward, now inside the Perfil modal (moved from the old profile card) */
.reward.profile-reward { width: 100%; justify-content: center; font-size: 14px; color: var(--ink); background: rgba(242,193,78,.14); border: 1px solid var(--line); border-radius: 12px; padding: 11px; margin: 0 0 12px; min-height: 44px; }
.reward.profile-reward .dot { width: 9px; height: 9px; }

/* ---------- menu: logo ---------- */
.logo-zone { text-align: center; padding: 6px 0 0; }
.menu-logo { display: block; width: 148px; height: auto; margin: 0 auto 8px; border-radius: 48px; box-shadow: 0 14px 34px rgba(0,0,0,.55), 0 0 0 2px rgba(242,193,78,.55), 0 0 34px rgba(242,193,78,.22); }
h1.logo { margin: 0; font-size: 38px; font-weight: 900; font-style: italic; letter-spacing: .5px; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 10px 24px rgba(0,0,0,.5); }
h1.logo .play { color: #fff; }
h1.logo .rd { color: #38bdf8; }
h1.logo .rd-r { color: #ff4d55; }
.logo-sub { display: flex; align-items: center; gap: 10px; justify-content: center; color: #dbe7ff; font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.logo-sub::before, .logo-sub::after { content: ""; height: 2px; width: 44px; background: linear-gradient(90deg,transparent,var(--gold)); border-radius: 2px; }
.logo-sub::after { background: linear-gradient(90deg,var(--gold),transparent); }
.flag-wave { display: flex; justify-content: center; margin-top: 4px; }

/* ---------- menu: buttons ---------- */
.menu-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-bottom: 4px; }
.mbtn { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border-radius: 18px; padding: 12px 16px; border: 1px solid var(--line); color: var(--ink); box-shadow: 0 8px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.15); position: relative; }
.mbtn:active { transform: scale(.985); }
.mbtn .ic { width: 52px; height: 52px; flex: none; display: flex; align-items: center; justify-content: center; }
.mbtn .ic svg { width: 46px; height: 46px; }
.mbtn .t { font-size: 21px; font-weight: 800; line-height: 1.1; }
.mbtn .s { font-size: 12.5px; color: #cfe0ff; font-weight: 600; margin-top: 2px; }
.mbtn .chev { margin-left: auto; font-size: 26px; color: rgba(255,255,255,.75); font-weight: 700; }
.mbtn.hero { background: linear-gradient(120deg,#0d7a5c,#0a5c46 60%,#083f31); border-color: var(--gold); }
.mbtn.blue { background: linear-gradient(120deg,#1c56b8,#123a7d); }
.mbtn.teal { background: linear-gradient(120deg,#0e7d8c,#0a5570); }
.mbtn.purple { background: linear-gradient(120deg,#5b3bb8,#3a2478); }
.mbtn.cyan { background: linear-gradient(120deg,#0e7d8c,#0b5a72); }
.mbtn .crown-top { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); color: var(--gold); font-size: 20px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }

/* ---------- menu: table dropdown (v0.2.3, moved v0.2.4) ----------
   ONE compact control (flag + name + chevron) replacing the scattered
   8-chip grid; the list opens below its button. Locked rows are
   greyed out with 🔒 + "Nivel/Level X". The picker lives ONLY inside
   the hamburger dropdown menu #topmenu (Alan 05:39) — never on the
   home/menu screen, never in Settings. */
.theme-picker { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 2px; padding-bottom: 2px; }
.tp-title { flex: none; font-size: 13px; font-weight: 800; letter-spacing: .4px; }
.theme-dd { position: relative; }
.theme-dd-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.25); background: rgba(255,255,255,.07); font-size: 14px; font-weight: 800; color: var(--ink); min-height: 44px; text-align: left; }
.theme-dd-btn .flag { width: 26px; height: 18px; }
.theme-dd-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-dd-chev { color: var(--gold); font-size: 13px; transition: transform .15s; }
.theme-dd.open .theme-dd-chev { transform: rotate(180deg); }
.theme-dd-list { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: linear-gradient(180deg,#10295c,#081a3e); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 30px rgba(0,0,0,.55); padding: 6px; max-height: 264px; overflow-y: auto; }
.theme-dd.open .theme-dd-list { display: block; }
.theme-dd-opt { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border-radius: 10px; font-weight: 800; font-size: 14px; text-align: left; min-height: 44px; }
.theme-dd-opt:hover { background: rgba(255,255,255,.08); }
.theme-dd-opt.selected { background: rgba(242,193,78,.18); }
.theme-dd-opt .flag { width: 26px; height: 18px; }
.theme-dd-opt-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-dd-lock { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.theme-dd-opt.locked { opacity: .55; }
.theme-dd-check { color: var(--gold); }
.setting-label { display: block; font-size: 15px; font-weight: 800; padding: 12px 0 8px; }

/* ---------- language picker (v0.2.2) — segmented ES / EN in Ajustes ---------- */
.lang-seg { display: flex; gap: 6px; }
.lang-btn { flex: 1; padding: 10px; border-radius: 10px; background: #ffffff10; border: 1px solid #ffffff22; font-weight: 800; font-size: 14px; min-height: 44px; }
.lang-btn.selected { background: var(--gold); color: #231303; border-color: var(--gold); }

/* ---------- headers / nav ---------- */
.sub-header { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.sub-header h2 { font-size: 22px; flex: 1; }
.spacer { width: 40px; }
.icon-btn { width: 40px; height: 40px; min-height: 40px; border-radius: 12px; background: #ffffff14; border: 1px solid #ffffff22; font-size: 22px; display: flex; align-items: center; justify-content: center; flex: none; }
#bottomnav { margin-top: auto; position: static; flex: none; display: grid; grid-template-columns: repeat(5,1fr); background: rgba(6,18,44,.96); border-top: 1px solid var(--line); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); backdrop-filter: blur(6px); }
/* (v0.2.3) the play screen has NO bottom nav — header + score + felt +
   hand + Pass/Chat/Exit only, like the 05-mesa-grande.jpg target. The
   nav returns on every other screen. (showScreen() also toggles it in
   JS for browsers without :has support.) */
#app:has(#screen-table.active) #bottomnav { display: none; }
#bottomnav button { background: none; border: none; color: #c7d6f5; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; min-height: 52px; justify-content: center; border-radius: 12px; }
#bottomnav button svg { width: 24px; height: 24px; }
#bottomnav button.active { color: var(--gold); background: rgba(242,193,78,.1); }
#bottomnav .badge-dot { position: relative; }
#bottomnav .badge-dot::after { content: ""; position: absolute; top: 2px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); }

/* ---------- lists / rooms / tournaments / friends ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.room-card, .tourney-card, .friend-row { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--navy3), var(--navy2)); border: 1px solid #ffffff22; border-radius: 16px; padding: 13px; }
.room-emoji { font-size: 30px; flex: none; }
.room-info { flex: 1; min-width: 0; }
.room-info b { display: block; font-size: 16px; }
.room-info i { font-style: normal; font-size: 12.5px; color: #b9c8e8; }
.join-btn { background: var(--gold); color: #231303; font-weight: 800; border-radius: 10px; padding: 9px 14px; font-size: 14px; flex: none; }
.tourney-card.registered { border-color: rgba(47,224,122,.6); }
.tourney-card.registered .join-btn { background: var(--green); color: #062b16; }
.room-tools { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.tool-btn { width: 100%; padding: 12px; border-radius: 12px; background: var(--teal); font-weight: 800; font-size: 15px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; padding: 12px; border-radius: 12px; border: 1px solid #ffffff33; background: #ffffff10; color: #fff; font-size: 15px; text-transform: uppercase; }
.code-row input::placeholder { color: #9db1d8; text-transform: none; }
.code-row .tool-btn { width: auto; padding: 12px 18px; }
.soon-note { margin-top: 16px; text-align: center; color: #9db1d8; font-size: 13.5px; line-height: 1.5; }
.rooms-live { margin-top: 12px; }
.rooms-live:empty { display: none; }
.create-choice { width: 100%; text-align: left; cursor: pointer; }

/* ---------- lobby ---------- */
.lobby-card { text-align: center; background: linear-gradient(135deg, var(--navy3), var(--navy2)); border: 1px solid rgba(242,193,78,.45); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.lobby-card > b { font-size: 20px; }
.lobby-card #lobby-entry { color: #b9c8e8; font-size: 13.5px; margin-top: 2px; }
.lobby-code-label { color: #b9c8e8; font-size: 12.5px; margin-top: 12px; }
.lobby-code-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 8px; }
.lobby-code-row b { font-size: 30px; letter-spacing: 3px; color: var(--gold-soft); }
.lobby-code-row .tool-btn { width: auto; padding: 9px 14px; font-size: 13.5px; }
.lobby-hint { color: #9db1d8; font-size: 13px; line-height: 1.5; }
.lobby-seat div { flex: 1; min-width: 0; }
.lobby-seat b { display: block; font-size: 15px; }
.lobby-seat i { font-style: normal; font-size: 12.5px; color: #b9c8e8; }
.lobby-start { width: 100%; margin-top: 14px; }
.lobby-start:disabled { opacity: .45; }
.lobby-leave { margin-top: 10px; background: #8f1d27; }
.invite-card { text-align: center; background: linear-gradient(135deg, var(--navy3), var(--navy2)); border: 1px solid rgba(242,193,78,.45); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.invite-card p { color: #b9c8e8; font-size: 13px; }
.invite-card b { display: block; font-size: 30px; letter-spacing: 3px; margin: 6px 0 12px; color: var(--gold-soft); }
.invite-card .tool-btn { width: auto; padding: 10px 18px; }

/* share & invite rewards (modal-referral) */
.ref-label { color: #b9c8e8; font-size: 13px; margin: 12px 0 0; }
.ref-link-row { display: flex; gap: 8px; margin: 6px 0; }
.ref-link-row input { flex: 1; min-width: 0; background: #ffffff14; border: 1px solid #ffffff2a; border-radius: 10px; color: #fff; padding: 10px 12px; font-size: 13px; }
.ref-link-row .primary-btn { padding: 10px 16px; }
.ref-code-line { text-align: center; color: #b9c8e8; font-size: 14px; }
.ref-code-line b { color: var(--gold-soft); letter-spacing: 2px; font-size: 17px; }
.ref-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.ref-stats > div { background: #ffffff10; border: 1px solid #ffffff1f; border-radius: 12px; padding: 10px; text-align: center; }
.ref-stats b { display: block; font-size: 20px; color: var(--gold-soft); }
.ref-stats span { font-size: 12px; color: #b9c8e8; }
.share-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.share-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; font-weight: 800; font-size: 15px; color: #fff; text-decoration: none; }
.share-btn.fb { background: #1877f2; }
.share-btn.wa { background: #25d366; color: #062b16; }
.share-btn.sms { background: #0e7490; }
.ref-share-note { color: #b9c8e8; font-size: 13px; text-align: center; }
.ref-share-state { text-align: center; color: #b9c8e8; font-size: 13px; margin-top: 10px; min-height: 18px; }
.friend-row div { flex: 1; min-width: 0; }
.friend-row b { display: block; font-size: 15px; }
.friend-row i { font-style: normal; font-size: 12.5px; color: #b9c8e8; }

/* ---------- store ---------- */
.store-balance { text-align: center; font-size: 18px; background: #ffffff10; border: 1px solid #ffffff22; border-radius: 12px; padding: 10px; margin-bottom: 12px; }
.store-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.store-tab { padding: 10px; border-radius: 10px; background: #ffffff10; border: 1px solid #ffffff22; font-weight: 700; font-size: 14px; }
.store-tab.active { background: var(--gold); color: #231303; }
.store-pane { display: none; flex-direction: column; gap: 10px; }
.store-pane.active { display: flex; }
.pack { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, var(--navy3), var(--navy2)); border: 1px solid #ffffff22; border-radius: 14px; padding: 14px; cursor: pointer; }
.pack.best-value { border: 2px solid var(--gold); background: linear-gradient(135deg, #4a2d00, var(--navy2)); }
.pack.best-value .tag { background: var(--gold); color: #231303; }
#coin-packs { display: flex; flex-direction: column; gap: 10px; }
.pack-coins { flex: 1; font-size: 17px; font-weight: 800; }
.pack b { font-size: 17px; color: var(--gold-soft); }
.pack .tag { background: var(--red); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 99px; }
.store-note { text-align: center; color: #9db1d8; font-size: 13px; line-height: 1.5; }
.vip-card { text-align: center; background: linear-gradient(160deg, #4a2d00, #7a4d00); border: 2px solid var(--gold); border-radius: 18px; padding: 20px 16px; }
.vip-crown { font-size: 40px; }
.vip-card h3 { font-size: 22px; margin: 4px 0; }
.vip-price { font-size: 30px; font-weight: 900; color: var(--gold-soft); }
.vip-price span { font-size: 15px; color: #fff; font-weight: 600; }
.vip-card ul { list-style: none; text-align: left; margin: 14px auto; max-width: 260px; line-height: 2; font-size: 15px; }
.buy-btn, .primary-btn { background: var(--gold); color: #231303; font-weight: 900; border-radius: 12px; padding: 13px 22px; font-size: 16px; }
.cos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cos-item { background: linear-gradient(135deg, var(--navy3), var(--navy2)); border: 1px solid #ffffff22; border-radius: 14px; padding: 14px 10px; text-align: center; cursor: pointer; }
.cos-item.owned { border-color: rgba(242,193,78,.55); }
.cos-item.equipped { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(242,193,78,.35); }
.cos-state { display: block; margin-top: 8px; font-size: 12.5px; font-weight: 800; color: var(--gold); min-height: 15px; }
.cos-item.equipped .cos-state { color: var(--green); }
/* Store luxury previews — real mini-previews rendered in CSS, not
   emoji glyphs: a golden tile, a navy felt swatch, a neon tile, a
   golden frame sample, a victory burst, the reaction sticker. */
.cos-preview { display: flex; align-items: center; justify-content: center; height: 48px; margin-bottom: 6px; }
.cos-item.skin-active { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(242,193,78,.45); }
.cos-item.skin-active .cos-state { color: var(--green); }
.pv-tile { width: 26px; height: 44px; border-radius: 5px; position: relative; }
.pv-tile::after { content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 1px; background: rgba(0,0,0,.35); }
.pv-tile i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #1a1a1a; }
.pv-tile i:nth-child(1) { left: 4px; top: 4px; }
.pv-tile i:nth-child(2) { left: 50%; top: 9px; margin-left: -2.5px; }
.pv-tile i:nth-child(3) { right: 4px; top: 14px; }
.pv-tile i:nth-child(4) { left: 4px; top: 26px; }
.pv-tile i:nth-child(5) { right: 4px; top: 34px; }
.pv-gold { background: linear-gradient(180deg,#ffe9a8,#f2c14e 55%,#c9931b); border: 1.5px solid #6b4d0c; box-shadow: 0 2px 5px rgba(0,0,0,.45); }
.pv-neon { background: linear-gradient(180deg,#123a6e,#0b2148 55%,#071633); border: 1.5px solid #00e5ff; box-shadow: 0 0 8px rgba(0,229,255,.55), 0 0 16px rgba(0,229,255,.25); }
.pv-neon::after { background: rgba(125,249,255,.7); }
.pv-neon i { background: #7df9ff; box-shadow: 0 0 4px rgba(0,229,255,.9); }
.pv-felt { width: 44px; height: 34px; border-radius: 8px; background: linear-gradient(135deg,#2a5db0,#16386e 60%,#0b2148); border: 1px solid #ffffff2a; box-shadow: inset 0 2px 6px rgba(0,0,0,.4); }
.pv-frame { width: 44px; height: 34px; border-radius: 8px; background: #0e2a1e; border: 3px solid var(--gold); box-shadow: 0 0 10px rgba(242,193,78,.5); }
.pv-burst { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle, #fff7cc 0%, #f2c14e 32%, rgba(242,193,78,0) 62%), repeating-conic-gradient(from 0deg, rgba(242,193,78,.9) 0deg 6deg, transparent 6deg 18deg); }
.pv-reaction { flex-direction: column; gap: 1px; }
.pv-reaction .pv-rx-emoji { font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.pv-reaction .pv-rx-text { background: rgba(5,16,40,.93); border: 1.5px solid var(--gold); color: #fff; font-weight: 900; font-size: 10px; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.cos-item b { display: block; font-size: 14px; }
.cos-item i { font-style: normal; font-size: 12.5px; color: var(--gold-soft); }

/* ---------- table ---------- */
#screen-table { padding: 10px 10px 6px; }
.table-top { display: flex; align-items: center; gap: 10px; }
.table-title { flex: 1; min-width: 0; }
.table-title b { display: block; font-size: 17px; }
.table-title span { font-size: 12px; color: #b9c8e8; }

.scorebar { display: flex; align-items: stretch; gap: 8px; margin-top: 6px; }
.score-card { flex: 1; display: flex; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0,0,0,.35); font-weight: 800; }
.score-side { flex: 1; padding: 5px 10px; display: flex; align-items: center; gap: 8px; }
.score-side .lbl { font-size: 12.5px; }
.score-side .num { font-size: 22px; margin-left: auto; }
.score-side.us { background: linear-gradient(120deg,#1c56b8,#123a7d); }
.score-side.them { background: linear-gradient(120deg,#7d1f3d,#571430); justify-content: flex-end; }
.score-side.them .num { margin-left: 0; margin-right: auto; }
.score-vs { display: flex; align-items: center; font-style: italic; color: var(--gold); font-weight: 900; font-size: 14px; }

.meta-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.meta-chip { font-size: 11px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); padding: 4px 7px; border-radius: 99px; white-space: nowrap; }
.timer-box { margin-left: auto; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; padding: 4px 8px; }
.timer-box .t-lbl { font-size: 10.5px; color: var(--muted); font-weight: 700; line-height: 1.05; text-align: right; }
.timer-num { font-size: 18px; font-weight: 900; color: var(--gold); min-width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
.timer-num.low { color: #ff5d5d; animation: tpulse .5s infinite alternate; }
@keyframes tpulse { from { transform: scale(1); } to { transform: scale(1.12); } }
.timer-track { height: 6px; background: rgba(255,255,255,.12); border-radius: 99px; margin-top: 7px; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg,var(--gold2),var(--gold)); border-radius: 99px; transition: width .12s linear; }
.timer-fill.low { background: linear-gradient(90deg,#b91c1c,#ef4444); }

.mesa-wrap { position: relative; margin-top: 12px; }
.mesa { background: linear-gradient(160deg,var(--rail1),var(--rail2) 55%,var(--rail3)); border-radius: 26px; padding: 12px; box-shadow: 0 14px 30px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,220,150,.35); }
.felt { background: radial-gradient(ellipse at 50% 42%, var(--felt0) 0%, var(--felt) 55%, var(--felt2) 100%); border-radius: 18px; min-height: 232px; position: relative; padding: 36px 30px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), inset 0 10px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.felt .watermark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; }
.felt .watermark img { width: 110px; height: 110px; border-radius: 26px; opacity: .16; }
/* Country flag on the table itself (Alan 16-nov): the picked table's flag
   sits top-left on the felt, next to the logo watermark. The default
   (Dominican Republic) table keeps the same green felt. */
.felt-flag { position: absolute; top: 10px; left: 12px; z-index: 2; pointer-events: none; line-height: 0; }
.felt-flag svg { width: 54px; height: 36px; border-radius: 5px; border: 1px solid rgba(255,255,255,.4); box-shadow: 0 2px 8px rgba(0,0,0,.45); display: block; }
.chain-label { text-align: center; color: rgba(255,255,255,.55); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; position: relative; z-index: 2; text-shadow: 0 1px 3px rgba(0,0,0,.65); }
.chain-row { display: flex; flex: 1; align-items: center; justify-content: center; gap: 10px; width: 100%; position: relative; z-index: 2; }
.end-val { flex: none; font-size: 20px; font-weight: 900; color: var(--gold); min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.end-val.end-target { color: #fff; background: rgba(242,193,78,.25); border: 2px solid var(--gold); border-radius: 10px; padding: 1px 4px; cursor: pointer; animation: endglow .8s infinite alternate; }
@keyframes endglow { from { box-shadow: 0 0 8px rgba(242,193,78,.3); } to { box-shadow: 0 0 20px rgba(242,193,78,.7); } }
/* ---------- snake chain (v0.2.2 rules fix) ----------
   ONE single chain, boustrophedon: rows alternate direction; the tile
   that turns the corner is vertical. Rows hug the edge the previous row
   ended on, so the sequence reads continuously down the felt.
   ROWS ARE SPREAD (Alan 21:37-21:38 — "todo muy agrupado", sample 09):
   the row pitch is THREE half-tiles (3 x H_h), so the chain breathes
   across the felt instead of bunching into a tight block. The gap
   between row boxes is 2 x H_h (44px base, 36px compact, var(--ctw)
   in landscape). */
.chain { flex: 0 1 auto; min-width: 0; max-width: calc(100% - 64px); display: flex; flex-direction: column; gap: 44px; position: relative; z-index: 2; }
/* Rows are ONE HALF-TILE tall (the horizontal tile height): vertical
   tiles (doubles, turn-column tiles) are twice as tall, so they stick
   out above/below their row — like real dominoes. */
.snake-row { display: flex; gap: 1px; align-items: center; justify-content: flex-start; height: 22px; }
/* Turn COLUMN (Alan 21:38 — sample 09's left/right turns): the first
   TWO tiles of every row after the first stack vertically in one
   column at the row's head, bridging the spread rows. Tile A (top)
   has its matched half flush with the previous row; tile B (bottom)
   has its open half flush with its own row; the next tile butts tile
   B's lower half. Rows are 3 half-tiles apart, so the column shifts up
   by 1.5 x H_h (minus half the 1px inter-tile gap): 32.5px base.
   A single-tile column (chain just turned) shifts up by 2.5 x H_h
   so its top half still sits at the previous row. Mid-row doubles
   stay centered — correct in real play, Alan has not complained
   about them. */
.turn-col { display: flex; flex-direction: column; gap: 1px; transform: translateY(-32.5px); }
.turn-col.single { transform: translateY(-55px); }
.snake-row.reverse { justify-content: flex-end; }
.chain .tile.h { width: 44px; height: 22px; padding: 2px 3px; }
.chain .tile.h .divider { margin: -2px 2px; width: 1.5px; }
.chain .tile.v, .chain .tile.mini { width: 22px; height: 44px; padding: 2px; }
.chain .tile.v .divider, .chain .tile.mini .divider { margin: 2px -2px; height: 1.5px; }
/* Compact snake tiles: used when the side seats are wide (e.g. a
   "Pensando…" badge) and the clear band between them is narrow — same
   2:1 proportions and pip sizes, just smaller, so 5 tiles still fit a
   row and a 20+ tile chain still snakes in 3-4 rows. */
.chain.compact { gap: 36px; }
.chain.compact .tile.h { width: 36px; height: 18px; }
.chain.compact .tile.v, .chain.compact .tile.mini { width: 18px; height: 36px; }
.chain.compact .snake-row { height: 18px; }
.chain.compact .turn-col { transform: translateY(-26.5px); }
.chain.compact .turn-col.single { transform: translateY(-45px); }
.chain-empty { color: #ffffff88; font-size: 13px; text-align: center; width: 100%; text-shadow: 0 1px 3px rgba(0,0,0,.65); }
/* (v0.2.3) the old .chain:empty::after "The chain starts here" is gone:
   it was hardcoded English with no translation path; the .chain-empty
   div above (rendered through tr('table.emptyChain')) covers it. */

.seat { position: absolute; z-index: 5; display: flex; align-items: center; gap: 7px; background: rgba(5,16,40,.88); border: 1.5px solid rgba(255,255,255,.22); border-radius: 99px; padding: 4px 10px 4px 4px; box-shadow: 0 6px 14px rgba(0,0,0,.45); max-width: 46%; }
.seat .seat-avatar { width: 38px; height: 38px; font-size: 13px; flex: none; }
.seat-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.seat-name { font-size: 12px; font-weight: 800; line-height: 1.15; white-space: nowrap; }
.seat-name .lvl { color: var(--gold-soft); font-weight: 700; }
.seat-tiles { display: flex; gap: 1px; }
.seat-tiles .mini-back { width: 7px; height: 14px; background: linear-gradient(180deg,#ffffff,#f6f4ec); border: 1px solid #3a352e; border-radius: 2px; box-shadow: inset 0 1px 0 rgba(255,255,255,.9); }
.seat-turn { font-size: 10.5px; font-weight: 800; color: #baffd2; background: #17a34a; border-radius: 99px; padding: 2px 8px; width: fit-content; }
.seat-turn:empty { display: none; }
.seat.active-turn { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242,193,78,.5), 0 0 18px rgba(242,193,78,.55); }
.seat-top { top: -16px; left: 50%; transform: translateX(-50%); }
.seat-left { left: -4px; top: 50%; transform: translateY(-50%); flex-direction: column; border-radius: 18px; padding: 6px 7px; text-align: center; max-width: 30%; }
.seat-right { right: -4px; top: 50%; transform: translateY(-50%); flex-direction: column; border-radius: 18px; padding: 6px 7px; text-align: center; max-width: 30%; }
.seat-left .seat-meta, .seat-right .seat-meta { align-items: center; }
.seat-left .seat-tiles, .seat-right .seat-tiles { flex-wrap: wrap; max-width: 51px; justify-content: center; }
.seat-left .seat-name, .seat-right .seat-name { font-size: 11px; white-space: normal; }
.seat-left .seat-name .lvl, .seat-right .seat-name .lvl { display: block; }
.seat-left .seat-turn, .seat-right .seat-turn { margin: 0 auto; }
.seat-bottom { position: static; margin: 6px auto 0; max-width: none; width: fit-content; }
.seat-avatar { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fb8ff, #274b9f); border: 2px solid #ffffff88; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; position: relative; }
/* Presence dot on player avatars (online): green = connected, grey =
   dropped (60s grace running). ::after so the turn ring and the
   speaking glow (box-shadows on .seat-avatar) keep working. Bots and
   empty seats get no dot. ~10px on the 38px seat avatars, bottom-right,
   thin light border so it reads on any felt colour. */
.seat-avatar.presence-on::after, .seat-avatar.presence-off::after,
.avatar.sm.presence-on::after, .avatar.sm.presence-off::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,.85); z-index: 3; pointer-events: none;
}
.seat-avatar.presence-on::after, .avatar.sm.presence-on::after { background: #2fe07a; box-shadow: 0 0 5px rgba(47,224,122,.8); }
.seat-avatar.presence-off::after, .avatar.sm.presence-off::after { background: #8a94a6; }
/* Owner crown (Alan): a small 👑 badge on the owner's seat avatar, top-right
   (the presence dot is bottom-right, so they never overlap). The seat
   avatar is 40px (30px in landscape); the crown sits just above it. */
.seat-avatar.owner-crown::before {
  content: '👑';
  position: absolute;
  top: -10px;
  right: -8px;
  font-size: 15px;
  line-height: 1;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
}
/* VIP card while the owner is VIP: Subscribe becomes a disabled gold
   status line instead of a purchase button. */
.vip-card .buy-btn.vip-active {
  background: linear-gradient(120deg, #ffd75e, #b97f00);
  border-color: var(--gold);
  color: #231303;
  opacity: 1;
  cursor: default;
}
.seat-avatar.me { background: radial-gradient(circle at 35% 30%, #ffd75e, #b97f00); color: #231303; }
.seat.active-turn .seat-avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 14px var(--gold); }
/* ---------- voice chat (online rooms) ----------
   The mic lives in Settings (Ajustes) as the 🎙️ Microphone toggle —
   the table header stays clean (Alan 16-nov). Speaking ring: green
   glow on the seat avatar while that player talks — same specificity
   slot as the turn ring, declared after it so speaking wins when both
   apply. #voice-audio holds one hidden <audio> per remote peer;
   off-screen, never display:none (some browsers pause audio in
   display:none subtrees). #mic-status is the persistent mic-state
   line under the Settings toggle (waiting / on / denial). */
#voice-audio { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.setting-note { font-size: 12.5px; font-weight: 700; color: #ffd75e; margin: 2px 0 0; min-height: 16px; }
.setting-note:empty { display: none; }
.seat.speaking .seat-avatar { box-shadow: 0 0 0 3px #22c55e, 0 0 16px #22c55e; border-color: #4ade80; }

.msg-line { min-height: 22px; text-align: center; font-size: 13.5px; font-weight: 700; color: #dbe7ff; margin-top: 6px; }
.msg-line b { color: var(--gold); }
.hand-lbl { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .4px; }
.hand-lbl .hand-lbl-title { white-space: nowrap; }
.hand-lbl span { font-weight: 600; text-transform: none; letter-spacing: 0; }

/* domino tiles — ivory / cream GLOSSY, matched to Alan's photo of a real
   double-6 set (double6-set-real.jpg): warm off-white base with a vertical
   sheen (lighter toward the top), rounded corners, THIN DARK divider line
   across the middle (full width/height of the tile), BLACK pips. Each half
   is a square; the whole tile is a 2:1 rectangle. */
/* Tiles redesigned like Alan's sample 09 (Alan 21:42 — "la de nosotros
   estan mal diseñada"): FLAT near-white faces (the old ivory/cream
   gradient is gone), a thin dark neutral edge, slightly rounded corners,
   subtle shadow. Chain/hand/backs all share the look. */
.tile { flex: none; background: linear-gradient(180deg,#ffffff 0%,#fdfdf9 55%,#f6f4ec 100%); border: 1px solid #3a352e; border-radius: 7px; box-shadow: 0 2px 5px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.95), inset 0 -2px 4px rgba(0,0,0,.08); position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 55%); pointer-events: none; }
/* Store luxuries — tile skins + golden frame (cosmetic only: colours,
   borders and glows; tile size, pips and geometry are untouched). */
:root.lux-golden-tiles .tile { background: linear-gradient(180deg,#ffe9a8 0%,#f2c14e 55%,#c9931b 100%); border-color: #6b4d0c; }
:root.lux-golden-tiles .tile::after { background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 55%); }
:root.lux-neon-tiles .tile { background: linear-gradient(180deg,#123a6e 0%,#0b2148 55%,#071633 100%); border-color: #00e5ff; box-shadow: 0 0 10px rgba(0,229,255,.55), 0 0 22px rgba(0,229,255,.25), inset 0 1px 0 rgba(125,249,255,.4); }
:root.lux-neon-tiles .tile .pip i { background: #7df9ff; box-shadow: 0 0 6px rgba(0,229,255,.9); }
:root.lux-neon-tiles .tile .divider { background: #7df9ff; }
:root.lux-golden-frame .mesa { border: 3px solid var(--gold); box-shadow: 0 0 22px rgba(242,193,78,.5), 0 14px 30px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,220,150,.35); }
/* Domino reactions luxury: big animated taunts over the table. Anchored
   to the sender's seat in VIEW coords inside .mesa-wrap (positioned in
   both portrait and landscape): seat 2 top, seat 1 right, seat 3 left,
   seat 0 (me) bottom. Pops, floats, fades in ~2.6 s; pointer-events none,
   never blocks play. One sticker per seat at a time (JS removes the old
   one before adding a new one). */
.reaction-sticker { position: absolute; z-index: 8; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; transform: translate(-50%, -50%); animation: reaction-pop 2.6s ease forwards; }
.reaction-sticker .rx-emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
.reaction-sticker .rx-text { background: rgba(5,16,40,.93); border: 2px solid var(--gold); color: #fff; font-weight: 900; font-size: 15px; padding: 4px 12px; border-radius: 99px; white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,.5); }
.reaction-sticker.seat-2 { left: 50%; top: 16%; }
.reaction-sticker.seat-1 { left: 80%; top: 50%; }
.reaction-sticker.seat-3 { left: 20%; top: 50%; }
.reaction-sticker.seat-0 { left: 50%; top: 84%; }
@keyframes reaction-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-8deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}
/* Reaction buttons in the Quick chat panel: emoji + domino slang, same
   pill style as the free phrases, gold-tinted so the luxury reads. */
.phrases button.reaction-btn { border-color: rgba(242,193,78,.55); background: rgba(242,193,78,.14); font-weight: 800; }
/* Victory effect luxury: emoji rain over the table when you win a hand
   or match with the effect equipped. pointer-events none: never blocks play. */
#victory-fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; display: none; overflow: hidden; }
#victory-fx.show { display: block; }
#victory-fx span { position: absolute; top: -8%; font-size: 34px; animation: lux-fx-fall 2.6s ease-in forwards; }
#victory-fx span:nth-child(1) { left: 8%; animation-delay: 0s; }
#victory-fx span:nth-child(2) { left: 24%; animation-delay: .15s; }
#victory-fx span:nth-child(3) { left: 42%; animation-delay: .3s; }
#victory-fx span:nth-child(4) { left: 58%; animation-delay: .1s; }
#victory-fx span:nth-child(5) { left: 74%; animation-delay: .25s; }
#victory-fx span:nth-child(6) { left: 88%; animation-delay: .05s; }
@keyframes lux-fx-fall { 0% { transform: translateY(0) rotate(0deg); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(110vh) rotate(340deg); opacity: .9; } }
/* Pips are ABSOLUTE-positioned (Alan 21:42, crop 10 — the sample's 6):
   the 3x3 grid put the 6's two columns at the half's outer edges (1/6
   and 5/6) with small dots, leaving a wide empty middle — "los punto
   mal" (crop 11). The sample's columns sit at 1/4 and 3/4 with BIG
   bold dots (30% of the half) filling each half, rows at 16/50/84%.
   The PIPS map in app.js (positions 1-9) is CORRECT and unchanged —
   only the rendering moves. Dots stay perfectly circular. */
.tile .half { position: relative; }
.tile .pip { position: absolute; width: 30%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.tile .pip i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #000; }
.tile .pip:nth-child(1) { left: 10%; top: 1%; }
.tile .pip:nth-child(2) { left: 35%; top: 1%; }
.tile .pip:nth-child(3) { left: 60%; top: 1%; }
.tile .pip:nth-child(4) { left: 10%; top: 35%; }
.tile .pip:nth-child(5) { left: 35%; top: 35%; }
.tile .pip:nth-child(6) { left: 60%; top: 35%; }
.tile .pip:nth-child(7) { left: 10%; top: 69%; }
.tile .pip:nth-child(8) { left: 35%; top: 69%; }
.tile .pip:nth-child(9) { left: 60%; top: 69%; }
.tile .divider { background: #2e2a26; }
.tile.v { width: 46px; height: 92px; display: flex; flex-direction: column; padding: 4px; }
.tile.v .half { flex: 1; }
.tile.v .divider { height: 1.5px; margin: 3px -4px; }
.tile.h { width: 44px; height: 22px; display: flex; flex-direction: row; padding: 3px 4px; align-items: stretch; border-radius: 4px; }
.tile.h .half { flex: 1; }
.tile.h .divider { width: 1.5px; margin: -3px 3px; }
.tile.mini { width: 18px; height: 36px; padding: 2px; }
.tile.mini.v { width: 18px; height: 36px; }
.tile.playable { box-shadow: 0 0 0 3px #22ff88, 0 0 14px #22ff88; cursor: pointer; }
.tile.selected { box-shadow: 0 0 0 3px var(--gold), 0 0 16px var(--gold); transform: translateY(-6px); }
.tile.disabled { opacity: .55; }
.tile.end-target { box-shadow: 0 0 0 3px var(--gold), 0 0 12px var(--gold); cursor: pointer; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px #ffd75e88, 0 0 18px var(--gold); } }
.hand { display: flex; gap: 6px; margin-top: 6px; background: rgba(4,12,32,.65); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 8px; justify-content: center; align-items: center; min-height: 96px; overflow-x: auto; }
.hand .tile { flex: 1 1 0; min-width: 0; max-width: 58px; width: auto; height: auto; aspect-ratio: 1/2; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.hand .tile:not(.playable):not(.selected) { cursor: default; }

.actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; margin-top: 10px; }
.act-btn { border-radius: 14px; border: 1px solid rgba(255,255,255,.2); color: #fff; font-weight: 800; font-size: 14.5px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.act-btn svg { width: 18px; height: 18px; }
.act-btn small { font-size: 9px; font-weight: 700; opacity: .85; white-space: nowrap; }
.act-btn.pass { background: linear-gradient(180deg,#274b8f,#16295a); }
.act-btn.cantar { background: linear-gradient(180deg,#d9a521,#9a6f08); border-color: var(--gold-soft); color: #fff8e1; }
.act-btn.chat { background: linear-gradient(180deg,#274b8f,#16295a); position: relative; }
.act-btn.chat .dot { position: absolute; top: 8px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-left: 0; }
.act-btn.salir { background: linear-gradient(180deg,#a02c30,#6e1a1e); }
.act-btn:disabled { opacity: .38; filter: grayscale(.4); box-shadow: none; }

/* ---------- modals / toast ---------- */
.modal { display: none; position: fixed; inset: 0; background: #000a; z-index: 60; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-box { background: linear-gradient(160deg, var(--navy3), var(--navy)); border: 1px solid rgba(242,193,78,.5); border-radius: 18px; padding: 20px; width: min(420px, 100%); max-height: 82dvh; overflow-y: auto; }
.modal-box h3 { margin-bottom: 12px; font-size: 19px; }
.modal-box p { color: #dbe7ff; font-size: 14.5px; line-height: 1.55; }
.close-modal, .danger-btn { display: block; width: 100%; margin-top: 14px; padding: 12px; border-radius: 12px; background: #ffffff14; border: 1px solid #ffffff2a; font-weight: 800; }
.danger-btn { background: #8f1d27; border-color: #ff6b6b66; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .close-modal, .modal-actions .danger-btn { flex: 1; }
/* The hamburger dropdown opens on the LEFT, directly below the three
   lines (Alan 05:41) — the button sits top-left of the topbar, so the
   menu anchors to the topbar's left edge, not the right. */
.topmenu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; background: linear-gradient(180deg,#10295c,#081a3e); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 30px rgba(0,0,0,.55); min-width: 190px; padding: 6px; display: none; }
.topmenu.open { display: block; }
.topmenu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; font-weight: 800; font-size: 15px; min-height: 44px; }
.topmenu button:hover { background: rgba(255,255,255,.08); }
/* Legal links in the hamburger dropdown — same look as the menu buttons,
   but real links so the pages open from the home screen. */
.topmenu a.topmenu-link { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; font-weight: 800; font-size: 15px; min-height: 44px; color: inherit; text-decoration: none; }
.topmenu a.topmenu-link:hover { background: rgba(255,255,255,.08); }
.topmenu-sep { height: 1px; background: rgba(255,255,255,.12); margin: 6px 4px; }
/* Table picker inside the hamburger dropdown (Alan 05:39 — the ONLY
   place the picker lives). It sits FIRST so its list drops downward
   into the open viewport: in landscape the button ends ~135px from the
   top, leaving room for the full list; the cap keeps it inside the
   viewport on the shortest screens (390px tall). */
.topmenu .theme-picker { padding: 2px 6px 4px; }
.topmenu .theme-dd-list { max-height: min(264px, calc(100dvh - 170px)); }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #ffffff1a; font-size: 15px; }
.toggle { min-width: 58px; padding: 7px 12px; border-radius: 99px; font-weight: 800; font-size: 13px; background: #334155; }
.toggle.on { background: #22c55e; }
.version { margin-top: 14px; text-align: center; color: #9db1d8; font-size: 12px; }
/* Legal links row in the Settings modal (Privacy Policy · Delete My Data). */
.settings-legal { margin-top: 10px; text-align: center; font-size: 13.5px; }
.settings-legal a { color: var(--gold-soft); font-weight: 700; }
.profile-big { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.profile-big p { font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats-grid div { background: #ffffff0d; border-radius: 10px; padding: 10px 2px; }
.stats-grid b { display: block; font-size: 17px; color: var(--gold-soft); }
.stats-grid span { font-size: 11px; color: #b9c8e8; }
.ranking-list { list-style: none; line-height: 2.2; font-size: 15px; }
.ranking-list span { float: right; color: var(--gold-soft); font-weight: 700; }
.help-text { line-height: 1.6; }
.hand-score { text-align: center; font-size: 18px; margin-top: 8px; }
#toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px); background: #111d33; border: 1px solid var(--gold); color: #fff; padding: 11px 18px; border-radius: 99px; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: 92vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#chat-bubble { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); background: #fff; color: #111; padding: 9px 14px; border-radius: 14px; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 70; max-width: 86vw; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
#chat-bubble.show { opacity: 1; }
.phrases { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.phrases button { background: #ffffff12; border: 1px solid #ffffff2a; border-radius: 99px; padding: 9px 13px; font-size: 14px; }
/* free-text chat (v0.2.3): type your own message, 140 chars max (the
   server enforces the same cap). Send shows it as your bubble; online
   it goes to the whole room, offline a CPU answers like the presets. */
.chat-free { display: flex; gap: 8px; margin-top: 10px; }
.chat-free input { flex: 1; min-width: 0; padding: 11px 12px; border-radius: 12px; border: 1px solid #ffffff33; background: #ffffff10; color: #fff; font-size: 14px; }
.chat-free input::placeholder { color: #9db1d8; }
.chat-free .chat-send { width: auto; padding: 11px 18px; }

@media (max-width: 360px) {
  h1.logo { font-size: 33px; }
  .menu-logo { width: 148px; border-radius: 41px; }
  .felt { min-height: 272px; padding: 36px 22px; }
  .seat .seat-name { font-size: 11px; }
  .topbar { gap: 8px; }
  .topbar-profile { gap: 7px; padding-right: 8px; }
  .tp-who .p-name { font-size: 14px; }
  .topbar-profile .coins-pill { font-size: 13px; }
}
@media (min-width: 480px) {
  .felt { min-height: 380px; }
  .tile.v { width: 52px; height: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01s !important; transition-duration: .01s !important; }
}

/* ---------- rotate hint (v0.2.3) ----------
   Portrait table entry: a friendly, dismissible overlay suggesting
   landscape. It never blocks play — "Play anyway" dismisses it and
   portrait keeps working. No orientation lock is attempted anywhere
   (iOS Safari does not support screen.orientation.lock()). */
.rotate-hint { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(3,8,20,.72); align-items: center; justify-content: center; padding: 24px; }
.rotate-hint.show { display: flex; }
.rotate-hint-card { background: linear-gradient(160deg, var(--navy3), var(--navy)); border: 1px solid rgba(242,193,78,.5); border-radius: 18px; padding: 22px 18px; width: min(340px, 100%); text-align: center; box-shadow: 0 14px 34px rgba(0,0,0,.6); }
.rotate-hint-icon { font-size: 40px; margin-bottom: 10px; }
.rotate-hint-icon .rotate-arrow { display: inline-block; animation: rotspin 1.8s ease-in-out infinite; }
@keyframes rotspin { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(90deg); } }
.rotate-hint-card p { font-size: 16px; font-weight: 700; line-height: 1.5; margin-bottom: 14px; }
.rotate-hint-card .primary-btn { width: 100%; }

/* ---------- landscape-first layouts (v0.2.3) ----------
   THE WHOLE GAME is landscape (Alan: "de lao pa no tar virando el
   teléfono a cada rato"). Every screen gets a landscape composition at
   844x390; portrait stays a usable fallback. NOTE: every grid display
   here is scoped to .active — an unscoped #id rule would beat
   .screen{display:none} and leak the screen into other screens.
   The table screen is the primary design: wide felt, long chain rows
   of BIG tiles, hand in one full row, no bottom nav anywhere on it. */
@media (orientation: landscape) and (max-height: 500px) {
  #app { max-width: none; }
  .screen.active { padding: 8px 16px 10px; }

  /* ----- menu: two columns, logo left, buttons right ----- */
  #screen-menu.active {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "top top" "logo btns";
    column-gap: 18px;
    align-items: start;
  }
  #screen-menu.active .topbar { grid-area: top; }
  #screen-menu.active .logo-zone { grid-area: logo; padding-top: 2px; }
  #screen-menu.active .menu-logo { width: 72px; margin-bottom: 4px; border-radius: 26px; }
  #screen-menu.active h1.logo { font-size: 26px; }
  #screen-menu.active .logo-sub { font-size: 12px; margin-top: 2px; }
  #screen-menu.active .flag-wave { margin-top: 2px; }
  #screen-menu.active .menu-btns { grid-area: btns; margin-top: 0; gap: 6px; }
  #screen-menu.active .mbtn { padding: 6px 12px; border-radius: 14px; }
  #screen-menu.active .mbtn .ic { width: 32px; height: 32px; }
  #screen-menu.active .mbtn .ic svg { width: 30px; height: 30px; }
  #screen-menu.active .mbtn .t { font-size: 17px; }
  #screen-menu.active .mbtn .s { font-size: 11.5px; }
  #screen-menu.active .mbtn .crown-top { font-size: 15px; top: -10px; }
  /* Shorter bottom nav in landscape: 405px measured before this trim. */
  #bottomnav button { min-height: 44px; }
  #bottomnav { padding: 4px 6px 6px; }

  /* ----- rooms: cards left, tools right ----- */
  #screen-rooms.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    grid-template-areas: "head head" "list tools" "live tools";
    column-gap: 16px;
    align-items: start;
  }
  #screen-rooms.active .sub-header { grid-area: head; margin-bottom: 6px; }
  #screen-rooms.active .list { grid-area: list; }
  #screen-rooms.active .rooms-live { grid-area: live; margin-top: 8px; }
  #screen-rooms.active .room-tools { grid-area: tools; margin-top: 0; }
  #screen-rooms.active .room-card { padding: 8px 12px; }
  #screen-rooms.active .room-emoji { font-size: 24px; }
  #screen-rooms.active .room-info b { font-size: 15px; }
  #screen-rooms.active .tool-btn { padding: 9px; font-size: 14px; }

  /* ----- lobby: card left, seats + buttons right ----- */
  #screen-lobby.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "head head" "card seats" "card start" "card leave";
    column-gap: 16px;
    align-items: start;
  }
  #screen-lobby.active .sub-header { grid-area: head; margin-bottom: 8px; }
  #screen-lobby.active .lobby-card { grid-area: card; margin-bottom: 0; padding: 12px; }
  #screen-lobby.active .lobby-code-row b { font-size: 24px; }
  #screen-lobby.active .list { grid-area: seats; }
  #screen-lobby.active .lobby-start { grid-area: start; margin-top: 10px; }
  #screen-lobby.active .lobby-leave { grid-area: leave; margin-top: 8px; }

  /* ----- tournaments: 3 cards in a row ----- */
  #screen-tournaments.active .sub-header { margin-bottom: 8px; }
  #screen-tournaments.active .list { display: grid; grid-template-columns: repeat(3, 1fr); }
  #screen-tournaments.active .tourney-card { flex-direction: column; text-align: center; gap: 6px; padding: 12px 8px; }
  #screen-tournaments.active .tourney-card .room-emoji { font-size: 26px; }
  #screen-tournaments.active .tourney-card .room-info b { font-size: 14px; }
  #screen-tournaments.active .tourney-card .room-info i { font-size: 11.5px; }
  #screen-tournaments.active .soon-note { margin-top: 10px; }

  /* ----- store: compact header, packs in 2 columns, luxuries in 3 ----- */
  #screen-store.active .sub-header { margin-bottom: 8px; }
  #screen-store.active .store-balance { padding: 6px; font-size: 16px; margin-bottom: 8px; }
  #screen-store.active .store-tabs { margin-bottom: 8px; }
  #screen-store.active .store-tab { padding: 8px; }
  #screen-store.active .store-pane.active { display: grid; grid-template-columns: 1fr 1fr; }
  #screen-store.active .store-pane.active .store-note { grid-column: 1 / -1; }
  /* coin packs: container passes through so the 8 packs are direct grid items */
  #screen-store.active #coin-packs { display: contents; }
  #screen-store.active .pack { padding: 10px 12px; }
  /* VIP was 504px tall as a stacked card (target ≤390): in landscape it
     becomes a two-column grid — title/price/button left, perks right. */
  #screen-store.active .vip-card { grid-column: 1 / -1; display: grid; grid-template-columns: 170px 1fr; column-gap: 16px; align-items: center;
    grid-template-areas: "crown perks" "title perks" "price perks" "btn perks"; text-align: left; padding: 10px 14px; max-width: none; margin: 0; width: 100%; }
  #screen-store.active .vip-crown { grid-area: crown; font-size: 26px; margin: 0; }
  #screen-store.active .vip-card h3 { grid-area: title; font-size: 18px; margin: 0; }
  #screen-store.active .vip-price { grid-area: price; font-size: 24px; margin: 0; }
  #screen-store.active .vip-card ul { grid-area: perks; margin: 0; line-height: 1.6; font-size: 14px; text-align: left; }
  #screen-store.active .vip-card .buy-btn { grid-area: btn; margin: 6px 0 0; }
  #screen-store.active .cos-grid { grid-column: 1 / -1; grid-template-columns: repeat(6, 1fr); }
  #screen-store.active .cos-item { padding: 6px 8px; }
  #screen-store.active .cos-preview { height: 36px; margin-bottom: 4px; }

  /* ----- friends: invite card left, list right ----- */
  #screen-friends.active {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-areas: "head head" "invite list";
    column-gap: 16px;
    align-items: start;
  }
  #screen-friends.active .sub-header { grid-area: head; margin-bottom: 8px; }
  #screen-friends.active .invite-card { grid-area: invite; margin-bottom: 0; padding: 12px; }
  #screen-friends.active .invite-card b { font-size: 24px; margin: 4px 0 8px; }
  #screen-friends.active .list { grid-area: list; }
  #screen-friends.active .friend-row { padding: 10px 12px; }

  /* ----- table: THE TABLE IS THE SCREEN (Alan's 06-mesa-grande-3d.jpg)
     The felt fills the whole viewport; chrome becomes slim overlays:
     a slim top bar (back / title / timer / sound), the score as small
     stacked text top-left (like the reference), Table/Hand chips tiny
     top-right, the message as a pill above the hand, Pass/Shout/Chat/
     Exit as SMALL icon buttons in a bottom-right cluster, and the hand
     as a rack bottom-center. No bottom nav (already hidden by the
     :has() rule). The felt keeps the selected country theme. */
  #screen-table.active {
    display: block;
    position: relative;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }
  /* Felt = the screen: the rail runs edge to edge, the felt fills it. */
  #screen-table .mesa-wrap { position: absolute; inset: 0; margin: 0; }
  #screen-table .mesa { height: 100%; padding: 8px; border-radius: 16px; }
  #screen-table .felt {
    height: 100%; min-height: 0;
    /* top clears the slim bar + top seat pill, sides clear the side
       seats (the chain JS pads the clear band on top of this), bottom
       clears the hand rack + message pill. */
    padding: 44px 34px 128px;
    border-radius: 10px;
  }
  #screen-table .felt .watermark img { width: 150px; height: 150px; }
  /* The "CHAIN" label is decorative — hidden in landscape so the felt
     gives its height to the tiles instead. */
  #screen-table .chain-label { display: none; }
  /* Chain tiles scale with the felt: JS sets --ctw on #chain (see
     renderChain); the CSS var keeps JS row math and tile paint in
     agreement. Base 44px is the no-JS fallback. */
  #screen-table .chain { --ctw: 44px; }
  #screen-table .chain .tile.h { width: var(--ctw); height: calc(var(--ctw) / 2); }
  #screen-table .chain .tile.v, #screen-table .chain .tile.mini {
    width: calc(var(--ctw) / 2); height: var(--ctw);
  }
  /* Turn COLUMN spans the spread rows (Alan 21:38 — see base rule):
     rows are 3 half-tiles apart, so the column shifts up by 1.5 x H_h
     (0.75 x --ctw, minus half the 1px gap); a single-tile column by
     2.5 x H_h (1.25 x --ctw). The row gap is 2 x H_h = --ctw. */
  #screen-table .chain { gap: var(--ctw); }
  #screen-table .chain .snake-row { height: calc(var(--ctw) / 2); }
  #screen-table .chain .turn-col { transform: translateY(calc(var(--ctw) * -0.75 + 0.5px)); }
  #screen-table .chain .turn-col.single { transform: translateY(calc(var(--ctw) * -1.25)); }
  /* The spread chain is TALL, so its top would slide under the top-seat
     pill (seat-2, 60px tall when "Thinking…", bottom y90). The chain-row
     reserves 40px at its top so the chain starts below the pill; JS
     budgets the tile size from the remaining content height. */
  #screen-table .chain-row { padding-top: 40px; }
  /* Seats ride the felt edges, like the reference's side racks. The top
     seat hangs just inside the top rail, below the slim bar. */
  #screen-table .seat-top { top: 30px; }
  #screen-table .seat .seat-avatar { width: 30px; height: 30px; font-size: 11px; }
  /* Smaller presence dot on the 30px table avatars. */
  #screen-table .seat .seat-avatar.presence-on::after, #screen-table .seat .seat-avatar.presence-off::after { width: 8px; height: 8px; border-width: 1px; }
  #screen-table .seat-left, #screen-table .seat-right { max-width: 24%; padding: 4px 5px; }
  #screen-table .seat-left .seat-name, #screen-table .seat-right .seat-name { font-size: 10px; }
  #screen-table .seat-bottom { display: none; }
  /* Slim top bar: transparent, overlays the felt's top edge. */
  #screen-table .table-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 6;
    height: 34px; padding: 2px max(10px, env(safe-area-inset-left)) 2px max(10px, env(safe-area-inset-right));
    background: linear-gradient(180deg, rgba(4,10,26,.6), rgba(4,10,26,0));
  }
  #screen-table .table-top .icon-btn { width: 28px; height: 28px; min-height: 28px; font-size: 17px; }
  #screen-table .table-top .table-title { margin-right: auto; }
  #screen-table .table-title b { font-size: 14px; line-height: 1.1; }
  #screen-table .table-title span { font-size: 10.5px; line-height: 1.1; }
  /* Turn-timer bar REMOVED in landscape (Alan 20:33, after approving the
     preview: "solo la rralla amarilla que sale arriba"): at turn start the
     gold fill sat at 100% width and read as a stray yellow line across
     the top of the screen. The numeric timer (00:18, top-right) still
     shows the countdown, so nothing is lost. Portrait keeps the bar. */
  #screen-table .timer-track { display: none; }
  /* Score as small stacked text top-left, like the reference. */
  #screen-table .scorebar {
    position: absolute; top: 40px; left: max(10px, env(safe-area-inset-left)); z-index: 6; margin-top: 0;
  }
  #screen-table .score-card { flex-direction: column; align-items: flex-start; gap: 3px; background: none; border: 0; box-shadow: none; }
  #screen-table .score-vs { display: none; }
  #screen-table .score-side { flex: none; padding: 2px 8px; border-radius: 8px; }
  #screen-table .score-side .lbl { font-size: 11px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
  #screen-table .score-side .num { font-size: 14px; margin-left: 6px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
  #screen-table .score-side.them { justify-content: flex-start; }
  #screen-table .score-side.them .num { margin-left: 6px; margin-right: 0; }
  /* Table/Hand chips + timer: tiny, top-right under the bar. */
  #screen-table .meta-row {
    position: absolute; top: 40px; right: max(10px, env(safe-area-inset-right)); z-index: 6; margin-top: 0;
  }
  #screen-table .meta-chip { font-size: 10px; padding: 2px 6px; }
  #screen-table .timer-box { padding: 2px 6px; }
  #screen-table .timer-box .t-lbl { display: none; }
  #screen-table .timer-num { font-size: 14px; min-width: 0; }
  /* Message as a centered pill floating above the hand rack. */
  #screen-table .msg-line {
    position: absolute; bottom: 128px; left: 50%; transform: translateX(-50%); z-index: 6;
    margin-top: 0; min-height: 0; padding: 3px 12px; white-space: nowrap;
    max-width: calc(100vw - 20px); overflow: hidden; text-overflow: ellipsis;
    font-size: 12.5px; background: rgba(5,16,40,.72); border-radius: 99px;
  }
  /* Hand = a rack at the bottom center, tiles standing up. The "YOUR
     TILES" label is hidden in landscape — the rack speaks for itself
     and the message pill carries the hint. */
  #screen-table .hand-lbl { display: none; }
  #screen-table .hand {
    position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 6;
    width: min(392px, 47%); margin-top: 0; min-height: 0; padding: 6px 8px;
  }
  /* Explicit tile height: max-width alone does NOT shrink the height —
     the aspect-ratio is computed from the pre-clamp width. 48x96 keeps
     the 2:1 tile and the rack in ~108px; the felt takes the rest. */
  #screen-table .hand .tile { max-width: 48px; height: 96px; }
  /* Actions = SMALL icon buttons in a bottom-right cluster (Alan:
     "los botones se ponen como pequeñitos en algún lado"). Icons +
     tiny labels, 48px tap targets so they stay usable. */
  #screen-table .actions {
    position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); right: max(10px, env(safe-area-inset-right)); z-index: 6;
    display: flex; gap: 6px; margin-top: 0;
  }
  #screen-table .act-btn { width: 48px; height: 50px; padding: 3px 2px; font-size: 9.5px; gap: 1px; border-radius: 12px; }
  #screen-table .act-btn svg { width: 19px; height: 19px; }
  #screen-table .act-btn small { display: none; }
  #screen-table .act-btn.chat .dot { top: 5px; right: 7px; }
}
