/* holdonquietly dominoes
   Default scene: a domino table outside a colmado at night, under one warm bulb.
   "Midnight" keeps the original purple look. */

:root {
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hand: 'Caveat', 'Segoe Print', 'Comic Sans MS', cursive;
  --radius: 16px;
  --text: #fff;
  --good: #57d49a;
  --warn: #f5b454;
  color-scheme: dark;

  /* tiles */
  --face-0: #fffdf8; --face-1: #f6f0e3; --face-2: #e6dcc7;
  --pip-0: #4a4b57; --pip-1: #1c1d24; --pip-2: #0c0c10;
  --t-edge: #b3a68d; --t-div: #a79a82; --t-div2: rgba(255, 255, 255, .75); --t-hl: rgba(255, 255, 255, .8);
  --edge-1: #d8ccb3; --edge-2: #b6a78a;
  --c1: #2f7fd8; --c2: #1f9a5a; --c3: #d8423f; --c4: #8a5a2b; --c5: #23408f; --c6: #c98a00;
  --c7: #8e44ad; --c8: #0f8c8e; --c9: #c2185b; --c10: #e0701a; --c11: #56701f; --c12: #46555f;
}

/* ---- scene themes ---- */
body.theme-colmado {
  --bg: #140e0a;
  --dim: rgba(255, 243, 228, .78); --dim2: rgba(255, 236, 214, .56); --dim3: rgba(255, 230, 200, .36);
  --panel: rgba(255, 238, 215, .06); --panel-2: rgba(255, 238, 215, .1); --panel-3: rgba(255, 238, 215, .16);
  --line: rgba(255, 232, 205, .14); --line-2: rgba(255, 232, 205, .26);
  --glass: rgba(33, 23, 16, .86); --glass-strong: rgba(36, 25, 18, .96); --chip: rgba(26, 17, 11, .8);
  --accent: #f4b860; --accent-rgb: 244, 184, 96; --accent-2: #ffe0a8;
  --btn-1: #3b7be0; --btn-2: #1d4ea8; --btn-glow: rgba(40, 95, 200, .45);
  --bad: #ef5a4f;
  --lane-bg: rgba(40, 20, 6, .16); --lane-line: rgba(40, 20, 6, .22);
  --floor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Crect width='96' height='96' fill='%23c9b594'/%3E%3Cpath d='M48 8L88 48 48 88 8 48Z' fill='%239a4f35'/%3E%3Cpath d='M48 24L72 48 48 72 24 48Z' fill='%23d8c6a4'/%3E%3Ccircle cx='48' cy='48' r='8' fill='%232f4f48'/%3E%3Cpath d='M0 0H16L0 16ZM96 0H80L96 16ZM0 96H16L0 80ZM96 96H80L96 80Z' fill='%232f4f48'/%3E%3Cpath d='M0 .5H96M.5 0V96' stroke='%236b5a45' stroke-width='2'/%3E%3C/svg%3E");
}
body.theme-midnight {
  --bg: #0b0d18;
  --dim: rgba(255, 255, 255, .76); --dim2: rgba(255, 255, 255, .54); --dim3: rgba(255, 255, 255, .36);
  --panel: rgba(255, 255, 255, .06); --panel-2: rgba(255, 255, 255, .1); --panel-3: rgba(255, 255, 255, .16);
  --line: rgba(255, 255, 255, .12); --line-2: rgba(255, 255, 255, .22);
  --glass: rgba(20, 23, 44, .8); --glass-strong: rgba(22, 25, 50, .96); --chip: rgba(16, 18, 36, .8);
  --accent: #8b7cf7; --accent-rgb: 139, 124, 247; --accent-2: #c3b8ff;
  --btn-1: #9a8cff; --btn-2: #6d5ff0; --btn-glow: rgba(109, 95, 240, .38);
  --bad: #ff6b8b;
  --lane-bg: rgba(255, 255, 255, .035); --lane-line: rgba(255, 255, 255, .08);
}

/* ---- table tops ---- */
body { --table-top:
  radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 214, 150, .2), transparent 72%),
  linear-gradient(90deg, rgba(45, 22, 8, .38) 0 2px, transparent 2px) 0 0 / 116px 100%,
  repeating-linear-gradient(90deg, rgba(255, 236, 205, .05) 0 2px, rgba(70, 35, 12, .06) 2px 7px, transparent 7px 17px),
  repeating-linear-gradient(1.2deg, rgba(70, 35, 12, .08) 0 1px, transparent 1px 8px),
  linear-gradient(180deg, #c48d58, #a8733f 55%, #8f5b2e); }
body.table-azul { --table-top:
  radial-gradient(ellipse 72% 62% at 50% 44%, rgba(255, 245, 220, .18), transparent 72%),
  radial-gradient(ellipse 96% 90% at 50% 50%, transparent 55%, rgba(6, 22, 34, .45) 100%),
  radial-gradient(40% 50% at 24% 30%, rgba(255, 255, 255, .07), transparent 70%),
  linear-gradient(90deg, rgba(4, 30, 44, .26) 0 2px, transparent 2px) 0 0 / 116px 100%,
  linear-gradient(180deg, #2e87a8, #1f6b8a 55%, #145169); }
body.table-coral { --table-top:
  radial-gradient(ellipse 72% 62% at 50% 44%, rgba(255, 240, 215, .2), transparent 72%),
  radial-gradient(ellipse 96% 90% at 50% 50%, transparent 55%, rgba(40, 12, 8, .42) 100%),
  radial-gradient(40% 50% at 70% 28%, rgba(255, 255, 255, .07), transparent 70%),
  linear-gradient(90deg, rgba(60, 16, 10, .24) 0 2px, transparent 2px) 0 0 / 116px 100%,
  linear-gradient(180deg, #d06a52, #b1523e 55%, #8e3c2c); }
body.table-felt { --table-top:
  radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 240, 190, .12), transparent 72%),
  radial-gradient(120% 90% at 50% 40%, #25774f 0%, #15573a 55%, #0b3524 100%); }
body.table-walnut { --table-top:
  radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 214, 150, .14), transparent 72%),
  linear-gradient(90deg, rgba(0, 0, 0, .35) 0 2px, transparent 2px) 0 0 / 132px 100%,
  repeating-linear-gradient(92deg, rgba(0, 0, 0, .1) 0 3px, rgba(255, 255, 255, .025) 3px 8px, rgba(0, 0, 0, .05) 8px 14px),
  linear-gradient(180deg, #6e4629, #4b2e19 60%, #33200f); }
body.table-slate { --table-top:
  radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 255, 255, .08), transparent 72%),
  radial-gradient(120% 90% at 50% 38%, #3d4452 0%, #272c36 55%, #161a21 100%); }
/* The printed laminate top: playa art under the glass, washed down so the
   dominoes still read against it. */
body.table-playa { --table-top:
  radial-gradient(ellipse 66% 56% at 50% 44%, rgba(255, 244, 214, .16), transparent 72%),
  radial-gradient(ellipse 96% 92% at 50% 50%, transparent 48%, rgba(8, 26, 40, .42) 100%),
  linear-gradient(rgba(10, 26, 40, .16), rgba(10, 26, 40, .16)),
  url(mesa.svg) center / cover no-repeat,
  #1a86ac; }
/* Painted flag table: white cross, blue and red quarters, wood grain showing through. */
body.table-flag { --table-top:
  radial-gradient(ellipse 72% 62% at 50% 44%, rgba(255, 232, 195, .18), transparent 72%),
  radial-gradient(ellipse 96% 90% at 50% 50%, transparent 55%, rgba(26, 14, 6, .42) 100%),
  radial-gradient(38% 55% at 22% 32%, rgba(255, 250, 240, .05), transparent 70%),
  radial-gradient(42% 48% at 78% 70%, rgba(20, 10, 4, .07), transparent 72%),
  radial-gradient(30% 40% at 64% 20%, rgba(20, 10, 4, .05), transparent 70%),
  linear-gradient(90deg, rgba(30, 14, 4, .26) 0 2px, transparent 2px) 0 0 / 116px 100%,
  linear-gradient(rgba(48, 28, 10, .12), rgba(48, 28, 10, .12)),
  linear-gradient(90deg, transparent 0 43.5%, #e6dfcf 43.5% 56.5%, transparent 56.5%),
  linear-gradient(180deg, transparent 0 41%, #e6dfcf 41% 59%, transparent 59%),
  conic-gradient(from 0deg at 50% 50%, #9e2430 0 90deg, #17376d 90deg 180deg, #9e2430 180deg 270deg, #17376d 270deg 360deg); }
body.table-midnight { --table-top:
  radial-gradient(120% 90% at 50% 38%, #3d3886 0%, #1f2150 55%, #11132c 100%); }

/* ---- tile themes ---- */
body.tiles-onyx {
  --face-0: #4b4c59; --face-1: #2c2d37; --face-2: #18191f;
  --pip-0: #ffffff; --pip-1: #f3eee3; --pip-2: #c9c0ad;
  --t-edge: #0b0c10; --t-div: #5d5f6e; --t-div2: rgba(255, 255, 255, .1); --t-hl: rgba(255, 255, 255, .13);
  --edge-1: #24252d; --edge-2: #101115;
  --c1: #7cb6ff; --c2: #62d99a; --c3: #ff7b73; --c4: #e0a46a; --c5: #9fb2ff; --c6: #ffd25e;
  --c7: #d49bff; --c8: #4fe0d9; --c9: #ff79b0; --c10: #ffa45a; --c11: #b7e26a; --c12: #c6d3dc;
}
body.tiles-jade {
  --face-0: #e9fff6; --face-1: #bfe8d6; --face-2: #86c4aa;
  --pip-0: #2c4a3f; --pip-1: #0f2a21; --pip-2: #06170f;
  --t-edge: #5f9d84; --t-div: #5b917b; --t-div2: rgba(255, 255, 255, .55); --t-hl: rgba(255, 255, 255, .6);
  --edge-1: #93c8b1; --edge-2: #5f9580;
}
/* Dominican flag dominoes: white bone, navy pips on one half, red on the other. */
body.tiles-flag {
  --face-0: #fffefb; --face-1: #f7f4ec; --face-2: #e7e2d5;
  --t-edge: #17376d; --t-div: #9e2430; --t-div2: rgba(255, 255, 255, .7); --t-hl: rgba(255, 255, 255, .85);
  --edge-1: #d7d2c4; --edge-2: #17376d;
}
body.tiles-flag .pip.h0:not([class*=" c"]) { fill: #17376d; }
body.tiles-flag .pip.h1:not([class*=" c"]) { fill: #9e2430; }
body.tiles-wood {
  --face-0: #d9ab74; --face-1: #c18e55; --face-2: #a3713c;
  --pip-0: #5b3a1c; --pip-1: #35200c; --pip-2: #1d1206;
  --t-edge: #6d4522; --t-div: #7d5229; --t-div2: rgba(255, 235, 200, .45); --t-hl: rgba(255, 235, 200, .35);
  --edge-1: #b07f45; --edge-2: #7a5027;
  --c1: #1f4f8f; --c2: #1c6b3a; --c3: #a52a22; --c4: #4a2c10; --c5: #16305e; --c6: #8a5a00;
  --c7: #5d2e7a; --c8: #0a5a5c; --c9: #8a1140; --c10: #a34c10; --c11: #3c4d14; --c12: #2c3940;
}
body.tiles-bone {
  --face-0: #f4ecd8; --face-1: #e6d9bb; --face-2: #cbb992;
  --pip-0: #5a4a33; --pip-1: #35291a; --pip-2: #1f1710;
  --t-edge: #a58f68; --t-div: #9c8760; --t-div2: rgba(255, 252, 240, .6); --t-hl: rgba(255, 252, 240, .65);
  --edge-1: #d8c9a6; --edge-2: #a08a63;
}
body.tiles-neon {
  --face-0: #2b3348; --face-1: #171c2c; --face-2: #0c0f19;
  --pip-0: #b9fbff; --pip-1: #46f0ff; --pip-2: #16b8d6;
  --t-edge: #0a0d16; --t-div: #3affe4; --t-div2: rgba(70, 240, 255, .25); --t-hl: rgba(70, 240, 255, .3);
  --edge-1: #1b2233; --edge-2: #090c14;
  --c1: #4fd2ff; --c2: #52ffa8; --c3: #ff5c7a; --c4: #ffa94f; --c5: #8b9bff; --c6: #ffe45c;
  --c7: #d07bff; --c8: #3affe4; --c9: #ff6ad5; --c10: #ff8a3a; --c11: #b6ff5c; --c12: #cfe2ff;
}
.face-0 { stop-color: var(--face-0); }
.face-1 { stop-color: var(--face-1); }
.face-2 { stop-color: var(--face-2); }
.pip-0 { stop-color: var(--pip-0); }
.pip-1 { stop-color: var(--pip-1); }
.pip-2 { stop-color: var(--pip-2); }
.t-face { fill: url(#hq-face); stroke: var(--t-edge); stroke-width: 1.5; }
.t-hl { fill: none; stroke: var(--t-hl); stroke-width: 1.3; }
.t-div { stroke: var(--t-div); stroke-width: 2.6; stroke-linecap: round; }
.t-div2 { stroke: var(--t-div2); stroke-width: 1.2; stroke-linecap: round; }
.t-back-line { fill: none; stroke: var(--t-div); stroke-opacity: .35; stroke-width: 1.6; }
.pip { fill: url(#hq-pip); }
.pip.c1 { fill: var(--c1); } .pip.c2 { fill: var(--c2); } .pip.c3 { fill: var(--c3); } .pip.c4 { fill: var(--c4); }
.pip.c5 { fill: var(--c5); } .pip.c6 { fill: var(--c6); } .pip.c7 { fill: var(--c7); } .pip.c8 { fill: var(--c8); }
.pip.c9 { fill: var(--c9); } .pip.c10 { fill: var(--c10); } .pip.c11 { fill: var(--c11); } .pip.c12 { fill: var(--c12); }

/* ---- base ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
/* Home + lobby backdrop: the floor fading into the night. */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body.theme-colmado::before {
  background:
    radial-gradient(ellipse 75% 50% at 50% -8%, rgba(255, 186, 110, .3), transparent 72%),
    radial-gradient(ellipse 90% 70% at 50% 30%, rgba(16, 10, 6, .55), rgba(16, 10, 6, .9) 100%),
    linear-gradient(rgba(16, 10, 6, .45), rgba(16, 10, 6, .45)),
    var(--floor) 0 0 / 96px 96px, #2b2019;
}
body.theme-midnight::before {
  inset: -20%;
  background:
    radial-gradient(38% 46% at 18% 18%, rgba(139, 124, 247, .34), transparent 62%),
    radial-gradient(40% 48% at 86% 12%, rgba(109, 139, 242, .28), transparent 62%),
    radial-gradient(48% 54% at 70% 92%, rgba(167, 139, 250, .22), transparent 64%),
    radial-gradient(40% 46% at 8% 88%, rgba(64, 176, 232, .18), transparent 62%);
}
[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; letter-spacing: .01em; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: var(--line-2); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.primary {
  background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); border-color: rgba(255, 255, 255, .26);
  box-shadow: 0 6px 22px var(--btn-glow), inset 0 1px 0 rgba(255, 255, 255, .32);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.big { min-height: 50px; font-size: 15px; padding: 0 24px; border-radius: 14px; }
.btn.wide { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.pulse { animation: btnPulse 1.4s ease-in-out infinite; }
@keyframes btnPulse { 50% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb), .25), 0 6px 22px var(--btn-glow); } }

.icon-btn {
  position: relative; width: 42px; height: 42px; flex: none; border-radius: 13px;
  display: grid; place-items: center; color: var(--dim);
  background: var(--chip); border: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--glass-strong); color: #fff; }
.icon-btn .dot {
  position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; font-style: normal;
}
input.text, textarea.text {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line-2);
  font-size: 16px; font-weight: 600; outline: none; transition: border-color .15s, background .15s;
}
input.text:focus, textarea.text:focus { border-color: var(--accent); background: rgba(0, 0, 0, .38); }
input.text::placeholder, textarea.text::placeholder { color: var(--dim3); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  min-height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 700; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  transition: background .15s, border-color .15s, color .15s;
}
.seg button:hover:not(:disabled) { background: var(--panel-2); color: #fff; }
.seg button.on { background: rgba(var(--accent-rgb), .2); border-color: rgba(var(--accent-rgb), .75); color: #fff; }
.seg button:disabled:not(.on) { opacity: .5; }
.toggle { width: 46px; height: 28px; border-radius: 14px; background: var(--panel-3); position: relative; border: 1px solid var(--line); transition: background .15s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(18px); }
.toggle:disabled { opacity: .5; }
.glass {
  background: var(--glass); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.av {
  --c: var(--accent); position: relative;
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #14100c;
  background: var(--c); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.av.sm { width: 22px; height: 22px; font-size: 10px; }
button.av { cursor: pointer; border: 0; }
button.av:hover { outline: 2px solid rgba(255, 255, 255, .5); outline-offset: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--panel-2); color: var(--dim);
}
.tag.host, .tag.win { color: #ffe39b; background: rgba(245, 180, 84, .16); }
.tag.you { color: var(--accent-2); background: rgba(var(--accent-rgb), .18); }
.tag.off { color: #ffc0b8; background: rgba(239, 90, 79, .16); }
.tag.team0 { color: var(--accent-2); background: rgba(var(--accent-rgb), .2); }
.tag.team1 { color: #9fe6d4; background: rgba(79, 209, 181, .18); }
.tag.win svg { width: 11px; height: 11px; stroke-width: 2.4; }

/* ---- home ---- */
.home { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 400px); justify-content: center; place-items: center; align-content: center; gap: 16px; padding: 24px 16px 28px; }
.home-card { width: 100%; padding: 30px 24px 26px; text-align: center; }
.home h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.home .lead { color: var(--dim); margin: 6px 0 22px; font-size: 14.5px; }
.home form { display: grid; gap: 12px; }
.home label { display: grid; gap: 6px; text-align: left; font-size: 12px; font-weight: 700; color: var(--dim2); letter-spacing: .06em; text-transform: uppercase; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--dim3); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex !important; gap: 8px; }
.join-row input { text-align: center; letter-spacing: .3em; text-transform: uppercase; font-weight: 800; }
.err { min-height: 20px; margin-top: 12px; color: #ffc0b8; font-size: 13.5px; font-weight: 600; }
.panel { width: 100%; padding: 18px 20px; text-align: left; }
.panel h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.panel h3 { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--dim2); margin: 16px 0 6px; }
.panel p, .panel li, .panel dd { color: var(--dim); font-size: 14px; }
.panel ul, .panel ol { padding-left: 18px; display: grid; gap: 5px; }
.panel li b { color: #fff; }
.panel dt { font-weight: 700; font-size: 14px; margin-top: 10px; }
.panel dd { margin-top: 2px; }
.top-list { list-style: none; padding: 0; display: grid; gap: 4px; counter-reset: rank; }
.top-list li { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px; background: var(--panel); font-size: 14px; counter-increment: rank; }
.top-list li::before { content: counter(rank); width: 18px; color: var(--dim3); font-weight: 800; font-size: 12px; }
.top-list li span { flex: 1; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list li b { color: var(--accent-2); }
.linky { color: var(--accent-2); font-weight: 700; text-decoration: underline; }
.scoretable.board td:nth-child(2) { text-align: left; color: #fff; }
.scoretable.board tr.me td { color: var(--accent-2); font-weight: 800; }
.foot { text-align: center; font-size: 12px; color: var(--dim3); font-weight: 600; letter-spacing: .04em; }

/* a row of dominoes knocking each other over */
.topple {
  display: flex; justify-content: center; align-items: flex-end; gap: min(13px, 2.4vw); height: 92px; margin: 0 auto 20px;
  perspective: 560px; perspective-origin: 50% -40%;
}
.topple .dom { width: min(26px, 5vw); height: min(52px, 10vw); display: block; transform-style: preserve-3d; transform: rotateY(-50deg); }
.topple .dom-in {
  display: block; width: 100%; height: 100%; border-radius: 4px; transform-origin: 50% 100%;
  box-shadow: 0 2px 0 var(--edge-1), 0 4px 0 var(--edge-2), 0 10px 14px rgba(0, 0, 0, .45);
  animation: topple 8s infinite; animation-delay: calc(var(--i) * 110ms);
}
.topple svg { width: 100%; height: 100%; display: block; }
@keyframes topple {
  0%, 16% { transform: rotateX(0deg); opacity: 1; animation-timing-function: cubic-bezier(.55, 0, .85, .35); }
  24% { transform: rotateX(70deg); animation-timing-function: ease-out; }
  27% { transform: rotateX(64deg); animation-timing-function: ease-in; }
  30%, 72% { transform: rotateX(67deg); opacity: 1; }
  80% { transform: rotateX(67deg); opacity: 0; }
  82% { transform: rotateX(0deg) translateY(-14px); opacity: 0; animation-timing-function: cubic-bezier(.3, 1.4, .5, 1); }
  92%, 100% { transform: rotateX(0deg) translateY(0); opacity: 1; }
}

/* ---- lobby ---- */
.lobby { max-width: 760px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 120px; display: grid; gap: 14px; }
.lb-top { display: flex; align-items: center; gap: 10px; }
.lb-top .brand { font-weight: 800; font-size: 15px; margin-right: auto; display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.lb-top .brand img { width: 26px; height: 26px; border-radius: 7px; }
.card { padding: 18px; }
.card h2 { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim2); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .count { color: var(--dim3); }
.invite { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.invite .code { font-size: 40px; font-weight: 800; letter-spacing: .14em; line-height: 1; }
.invite .link { color: var(--dim2); font-size: 13px; word-break: break-all; margin-top: 6px; }
.invite .btns { display: flex; gap: 8px; margin-left: auto; }
.plist { display: grid; gap: 6px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid transparent; }
.prow.me { border-color: rgba(var(--accent-rgb), .38); }
.prow .nm { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .tags { display: flex; gap: 4px; margin-left: auto; align-items: center; flex: none; }
.prow .x { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--dim2); }
.prow .x:hover { background: var(--panel-2); color: #fff; }
.prow.off { opacity: .6; }
.prow .seatno { width: 18px; text-align: center; color: var(--dim3); font-size: 12px; font-weight: 700; flex: none; }
.prow.enter { animation: rowIn .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d, 0ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.watch { margin-top: 10px; font-size: 13px; color: var(--dim2); }
.vgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.vcard { text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); transition: background .15s, border-color .15s; }
.vcard:hover:not(:disabled) { background: var(--panel-2); }
.vcard b { display: block; font-size: 14.5px; }
.vcard span { display: block; font-size: 12.5px; color: var(--dim2); margin-top: 3px; line-height: 1.35; }
.vcard.on { background: rgba(var(--accent-rgb), .16); border-color: rgba(var(--accent-rgb), .75); }
.vcard.on span { color: var(--dim); }
.vcard:disabled:not(.on) { opacity: .55; }
.vcard.wide { grid-column: 1 / -1; }
.opts { display: grid; gap: 14px; margin-top: 16px; }
.opt { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opt > label { font-weight: 700; font-size: 13.5px; min-width: 104px; color: var(--dim); }
.opt .note { font-size: 12.5px; color: var(--dim3); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: var(--dim); }
.stepper button:hover:not(:disabled) { background: var(--panel-2); color: #fff; }
.stepper button:disabled { opacity: .35; }
.stepper b { min-width: 36px; text-align: center; font-size: 15px; }
.hint { font-size: 12.5px; color: var(--dim2); }
.startbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.startbar .in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.startbar .hint { flex: 1; }

/* ---- game: the scene ---- */
.game { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.scene { position: absolute; inset: 0; overflow: hidden; }
body.theme-colmado .scene {
  background:
    radial-gradient(ellipse 58% 52% at 50% 47%, rgba(255, 180, 100, .16), rgba(255, 180, 100, 0) 72%),
    radial-gradient(ellipse 80% 72% at 50% 48%, rgba(12, 7, 4, .42) 18%, rgba(12, 7, 4, .95) 100%),
    linear-gradient(rgba(20, 12, 7, .38), rgba(20, 12, 7, .38)),
    var(--floor) 0 0 / 88px 88px, #2b2019;
}
body.theme-midnight .scene {
  background:
    radial-gradient(38% 46% at 18% 18%, rgba(139, 124, 247, .3), transparent 62%),
    radial-gradient(40% 48% at 86% 12%, rgba(109, 139, 242, .25), transparent 62%),
    radial-gradient(48% 54% at 70% 92%, rgba(167, 139, 250, .2), transparent 64%), #0b0d18;
}
.tablewrap { position: absolute; inset: 0; transform-origin: 50% 64%; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.tablewrap.tilt { transform: perspective(1250px) rotateX(15deg) translateY(-1.2%); }

.chair {
  position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none;
  width: var(--D); height: calc(var(--D) * 1.167); color: var(--chair, #f4f2ec);
  transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot));
}
.chair svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 6px 7px rgba(0, 0, 0, .42)); }

/* Built like the real thing: four pine boards around a printed top under
   glass, a groove on each rail for standing your fichas, holes for the cups. */
.table {
  --rim: 17px;
  --pine-1: #f0d6a8; --pine-2: #ddba86; --pine-3: #c09761; --pine-4: #9d7442;
  position: absolute; z-index: 2; border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 78, 34, .1) 0 1px, transparent 1px 7px, rgba(255, 240, 214, .12) 7px 8px, transparent 8px 23px) 0 0 / 100% var(--rim),
    repeating-linear-gradient(90deg, rgba(120, 78, 34, .1) 0 1px, transparent 1px 9px, rgba(255, 240, 214, .12) 9px 10px, transparent 10px 27px) 0 100% / 100% var(--rim),
    repeating-linear-gradient(0deg, rgba(120, 78, 34, .1) 0 1px, transparent 1px 8px, rgba(255, 240, 214, .12) 8px 9px, transparent 9px 25px) 0 0 / var(--rim) 100%,
    repeating-linear-gradient(0deg, rgba(120, 78, 34, .1) 0 1px, transparent 1px 7px, rgba(255, 240, 214, .12) 7px 8px, transparent 8px 21px) 100% 0 / var(--rim) 100%,
    linear-gradient(152deg, var(--pine-1), var(--pine-2) 38%, var(--pine-3) 72%, var(--pine-4));
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
  box-shadow:
    inset 0 2px 0 rgba(255, 245, 224, .5), inset 0 -3px 0 rgba(60, 32, 8, .4),
    0 3px 0 var(--pine-3), 0 7px 0 var(--pine-4), 0 11px 0 #825e34, 0 15px 0 #644626,
    0 20px 24px rgba(0, 0, 0, .5), 0 38px 58px rgba(0, 0, 0, .6);
  transition: box-shadow .45s;
}
/* Cup holes drilled through the corners of the frame. */
.table::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  --hole: radial-gradient(circle closest-side,
    rgba(58, 34, 12, .9) 0 62%, rgba(92, 60, 26, .55) 62% 78%, rgba(255, 240, 214, .35) 80% 92%, transparent 94%);
  background:
    var(--hole) left calc(var(--rim) * .5 - 8px) top calc(var(--rim) * .5 - 8px) / 16px 16px no-repeat,
    var(--hole) right calc(var(--rim) * .5 - 8px) top calc(var(--rim) * .5 - 8px) / 16px 16px no-repeat,
    var(--hole) left calc(var(--rim) * .5 - 8px) bottom calc(var(--rim) * .5 - 8px) / 16px 16px no-repeat,
    var(--hole) right calc(var(--rim) * .5 - 8px) bottom calc(var(--rim) * .5 - 8px) / 16px 16px no-repeat;
}
/* The groove the tiles stand in, all the way round. */
.table::after {
  content: ''; position: absolute; inset: calc(var(--rim) - 5px); border-radius: 9px; pointer-events: none; z-index: 4;
  box-shadow:
    inset 0 0 0 1.5px rgba(74, 44, 16, .5), inset 0 1.5px 2px rgba(48, 28, 8, .45),
    0 1px 0 rgba(255, 246, 226, .45);
}
body.theme-midnight .table {
  --pine-1: #4b4f8e; --pine-2: #383c72; --pine-3: #272a56; --pine-4: #191b3c;
}
.table .top {
  position: absolute; inset: var(--rim, 17px); border-radius: 7px; overflow: hidden;
  background: var(--table-top);
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .45), inset 0 12px 22px rgba(0, 0, 0, .3), inset 0 -2px 8px rgba(255, 220, 170, .1);
}
/* Glass laid over the print: two soft streaks, nothing you can't read through. */
.table .top::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 6;
  background:
    linear-gradient(114deg, transparent 10%, rgba(255, 255, 255, .11) 15%, rgba(255, 255, 255, .03) 23%, transparent 28%),
    linear-gradient(114deg, transparent 44%, rgba(255, 255, 255, .06) 48%, transparent 55%),
    radial-gradient(130% 70% at 16% -14%, rgba(255, 255, 255, .12), transparent 58%);
}
.table.myturn {
  box-shadow:
    inset 0 2px 0 rgba(255, 245, 224, .5), inset 0 -3px 0 rgba(60, 32, 8, .4),
    0 3px 0 var(--pine-3), 0 7px 0 var(--pine-4), 0 11px 0 #825e34, 0 15px 0 #644626,
    0 20px 24px rgba(0, 0, 0, .5), 0 38px 58px rgba(0, 0, 0, .6),
    0 0 0 2px rgba(var(--accent-rgb), .8), 0 0 46px rgba(var(--accent-rgb), .3);
}
.table.thud { animation: thud .26s ease-out; }
.table.slam { animation: slam .5s cubic-bezier(.3, .8, .3, 1); }
@keyframes thud { 35% { translate: 0 1px; } }
@keyframes slam { 14% { translate: 0 3px; scale: .997; } 34% { translate: -2px -1px; } 56% { translate: 1px 1px; } }

.board { position: absolute; touch-action: manipulation; pointer-events: none; }
.board > * { pointer-events: auto; }
.board > .lead-slot, .board > .hub { pointer-events: none; }
#ontable { position: absolute; inset: 0; }
.table .empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  color: rgba(255, 244, 228, .7); font-weight: 700; font-size: 14px; pointer-events: none; text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}

/* players around the table */
.seat { position: absolute; left: 0; top: 0; z-index: 5; width: 0; height: 0; transform: translate(var(--x), var(--y)); }
.seat .body {
  position: absolute; left: 0; top: 0; width: calc(var(--D) * .76); height: calc(var(--D) * .4); border-radius: 50%;
  transform: translate(-50%, -50%) rotate(var(--rot));
  background: var(--shirt, #444); box-shadow: 0 8px 14px rgba(0, 0, 0, .45), inset 0 3px 0 rgba(255, 255, 255, .16), inset 0 -4px 0 rgba(0, 0, 0, .18);
}
.seat .av {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  width: calc(var(--D) * .42); height: calc(var(--D) * .42); font-size: calc(var(--D) * .19);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5), inset 0 -3px 0 rgba(0, 0, 0, .2), inset 0 2px 0 rgba(255, 255, 255, .25);
}
.seat .plate {
  position: absolute; left: 0; top: calc(var(--D) * .27); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 200px;
  padding: 3px 9px 3px 8px; border-radius: 10px; background: var(--chip); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--dim); box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.seat .plate .meta { display: inline-flex; align-items: center; gap: 6px; }
.seat.compact .plate { display: none; }
.seat .badge { display: none; }
.seat.compact .badge {
  display: grid; place-items: center; position: absolute; left: calc(var(--D) * .12); top: calc(var(--D) * .06);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; font-size: 10px; font-weight: 800; color: #1a1410;
  background: linear-gradient(135deg, var(--face-0), var(--face-2)); box-shadow: 0 2px 5px rgba(0, 0, 0, .45);
}
.seat .plate .nm { color: #fff; overflow: hidden; text-overflow: ellipsis; min-width: 3.2em; flex: 0 1 auto; }
.seat .plate > :not(.nm) { flex: none; }
/* Name tags sit beside the head for people across the table, and lean inward at the sides. */
.seat.s-top .plate, .seat.s-tl .plate, .seat.s-tr .plate { top: 0; left: calc(var(--D) * .3); transform: translateY(-50%); }
.seat.s-tr .plate { left: auto; right: calc(var(--D) * .3); }
/* Desktop: side players' tags hang under their chair, off the table. */
.seat.side:not(.narrow) .plate { flex-direction: column; gap: 1px; top: calc(var(--D) * .56); padding: 3px 10px 4px; border-radius: 12px; max-width: 132px; }
.seat.side:not(.narrow) .plate .nm { max-width: 112px; }
/* Phones: the side chairs are off-screen, so the tag leans in over the table edge. */
.seat.side.narrow .plate { transform: none; }
.seat.s-left.narrow .plate, .seat.s-l1.narrow .plate, .seat.s-l2.narrow .plate { left: calc(var(--D) * -.12); }
.seat.s-right.narrow .plate, .seat.s-r1.narrow .plate, .seat.s-r2.narrow .plate { left: auto; right: calc(var(--D) * -.12); }
.seat .plate .cnt { display: inline-flex; align-items: center; gap: 3px; }
.seat .plate .cnt i { width: 6px; height: 11px; border-radius: 2px; background: linear-gradient(135deg, #f4ece0, #cdc2ab); display: inline-block; box-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.seat .plate .sc { color: var(--accent-2); }
.seat .plate .tag { font-size: 9px; padding: 0 5px; }
.seat .marker { color: var(--warn); display: inline-flex; }
.seat .marker svg { width: 12px; height: 12px; }
.seat.off .av, .seat.off .body { filter: grayscale(.8) brightness(.7); }
.seat.turn .av::before, .me-chip.turn .av::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(var(--accent-rgb), 0), var(--accent-2) 25%, rgba(var(--accent-rgb), 0) 50%, var(--accent) 75%, rgba(var(--accent-rgb), 0));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: spin 1.3s linear infinite;
}
.seat.turn .plate { border-color: rgba(var(--accent-rgb), .7); color: #fff; }
.seat.partner .plate { border-style: dashed; }
.seat .bubble { top: calc(var(--D) * -.24); }
.seat.s-top .bubble, .seat.s-tl .bubble, .seat.s-tr .bubble { top: calc(var(--D) * .62); transform: translate(-50%, 0) scale(.9); }
.seat.s-top .bubble.show, .seat.s-tl .bubble.show, .seat.s-tr .bubble.show { transform: translate(-50%, 0) scale(1); }
.seat.s-top .bubble::after, .seat.s-tl .bubble::after, .seat.s-tr .bubble::after { bottom: auto; top: -5px; }

/* their tiles, face down in front of them */
.rack {
  position: absolute; left: 0; top: 0; z-index: 3; display: flex; gap: 2px; pointer-events: none;
  transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot));
}
.rack.col { flex-direction: column; }
.rb, .pb {
  position: relative;
  width: var(--s); height: calc(var(--s) * 2); border-radius: calc(var(--s) * .24); flex: none;
  background: linear-gradient(148deg, var(--face-0), var(--face-1) 52%, var(--face-2));
  box-shadow:
    0 1px 0 var(--edge-1), 0 2px 0 var(--edge-2), 0 3px 0 rgba(40, 24, 10, .35),
    1px 5px 7px rgba(0, 0, 0, .45);
}
/* the ridge down the back of a face-down tile */
.rb::after, .pb::after {
  content: ""; position: absolute; inset: 14% 22%; border-radius: calc(var(--s) * .12);
  background: linear-gradient(148deg, rgba(255, 255, 255, .34), rgba(30, 18, 8, .12));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.rack.col .rb::after { inset: 22% 14%; }
.rack.col .rb { width: calc(var(--s) * 2); height: var(--s); }

/* the boneyard: a messy pile */
.heap { position: absolute; left: 0; top: 0; z-index: 3; transform: translate(var(--x), var(--y)); }
.heap .pb { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%) translate(var(--px), var(--py)) rotate(var(--pr)); }
.heap .count {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); z-index: 40;
  min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center;
  background: var(--chip); border: 1px solid var(--line-2); font-size: 12px; font-weight: 800; pointer-events: none;
}
.heap.can { cursor: pointer; }
.heap.can .count { background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); border-color: rgba(255, 255, 255, .4); animation: btnPulse 1.4s ease-in-out infinite; }

/* score sheet on the table */
.pad {
  position: absolute; left: 0; top: 0; z-index: 3; cursor: pointer;
  width: var(--pw, 112px); padding: 7px 9px 8px 16px; border-radius: 3px;
  transform: translate(var(--x), var(--y)) rotate(-5deg);
  background:
    linear-gradient(90deg, transparent 11px, rgba(210, 60, 60, .45) 11px 12.5px, transparent 12.5px),
    repeating-linear-gradient(180deg, transparent 0 17px, rgba(60, 110, 190, .22) 17px 18px),
    #f8f3e5;
  color: #22304e; font-family: var(--hand); line-height: 18px;
  box-shadow: 0 1px 0 #ddd3bd, 0 2px 0 #cfc4ab, 0 10px 18px rgba(0, 0, 0, .4);
}
.pad .ph, .pad .pr { display: grid; grid-template-columns: var(--cols, 1fr 1fr); column-gap: 6px; }
.pad .ph { font-size: 17px; font-weight: 700; border-bottom: 1.5px solid #22304e; }
.pad .ph span, .pad .pr span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center; }
.pad .pr { font-size: 17px; font-weight: 600; color: #34456e; }
.pad .pr.rank { grid-template-columns: 1fr auto; }
.pad .pr.rank span:first-child { text-align: left; }
.pad .pr.old { opacity: .55; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.pad .goal { font-size: 14px; font-weight: 600; color: #7a3a2a; text-align: right; margin-top: 1px; }
.pencil { position: absolute; left: 0; top: 0; z-index: 3; width: 92px; height: 11px; pointer-events: none; transform: translate(var(--x), var(--y)) rotate(var(--rot)); }
.pencil svg, .prop svg { width: 100%; height: 100%; display: block; overflow: visible; }
.prop { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot, 0deg)); }

/* ---- tiles on the table ---- */
/* --drop is how far off the table a tile still is: 1 while it is coming down,
   0 once it has settled. It only moves the shadow, never the tile. */
@property --drop { syntax: '<number>'; inherits: false; initial-value: 0; }
.bt {
  --u: 30px;
  position: absolute; left: 0; top: 0; z-index: 2; isolation: isolate;
  box-shadow:
    0 calc(var(--u) * .035) 0 var(--edge-1),
    0 calc(var(--u) * .075) 0 var(--edge-2),
    0 calc(var(--u) * .1) calc(var(--u) * .04) rgba(30, 16, 6, .3),
    calc(var(--u) * .045 + var(--drop) * 7px) calc(var(--u) * .18 + var(--drop) * 13px) calc(var(--u) * .26 + var(--drop) * 16px) rgba(0, 0, 0, calc(.44 - var(--drop) * .2));
  transition: transform .42s cubic-bezier(.2, .8, .2, 1), width .42s cubic-bezier(.2, .8, .2, 1), height .42s cubic-bezier(.2, .8, .2, 1);
}
/* the light in here comes from over your left shoulder */
.bt:not(.ghost)::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: linear-gradient(148deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 38%, rgba(20, 10, 4, .14));
  mix-blend-mode: soft-light;
}
.bt.fresh { transition: none; }
.bt svg, .ht svg { width: 100%; height: 100%; display: block; }
.bt.last::after {
  content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255, 227, 155, .9), 0 0 14px rgba(255, 210, 120, .55);
  animation: lastGlow 2.4s ease-out forwards;
}
@keyframes lastGlow { 0%, 70% { opacity: 1; } 100% { opacity: .35; } }
.bt.ghost {
  z-index: 3; cursor: pointer; box-shadow: none; opacity: .66;
  outline: 2px dashed rgba(var(--accent-rgb), .95); outline-offset: 2px;
  animation: ghost 1.1s ease-in-out infinite;
}
.bt.ghost::before { content: ""; position: absolute; inset: -14px; }
.bt.ghost:hover { opacity: .88; }
.bt.ghost.hot { opacity: .95; scale: 1.08; outline-color: #fff; }
@keyframes ghost { 50% { opacity: .92; outline-color: #fff; } }
.bt .pts {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 2px 7px; border-radius: 8px; background: var(--good); color: #062a1a; font-size: 12px; font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3); white-space: nowrap;
}
.bt.incoming { opacity: 0; }
.bt.land { animation: land .44s cubic-bezier(.22, .74, .3, 1); }
@keyframes land { 0% { scale: 1.035; --drop: 1; } 100% { scale: 1; --drop: 0; } }
.lead-slot { position: absolute; left: 0; top: 0; border: 2px dashed rgba(255, 244, 228, .22); border-radius: 8px; z-index: 1; }

.float-pts {
  position: absolute; z-index: 8; pointer-events: none; font-weight: 800; font-size: 22px; color: var(--good);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6); animation: floatUp 1.4s ease-out forwards;
}
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 0) scale(.85); } 18% { opacity: 1; transform: translate(-50%, -8px) scale(1.02); } 100% { opacity: 0; transform: translate(-50%, -38px) scale(1); } }

/* Mexican Train lanes */
.hub { position: absolute; left: 0; top: 0; z-index: 1; background: var(--lane-bg); border: 1px solid var(--lane-line); }
.bt.engine { z-index: 2; }
.lane { position: absolute; left: 0; top: 0; z-index: 1; background: var(--lane-bg); border: 1px solid var(--lane-line); transition: background .2s, border-color .2s; }
.lane .rail { position: absolute; left: 0; right: 10px; top: 50%; height: 2px; margin-top: -1px; background: repeating-linear-gradient(90deg, rgba(255, 244, 228, .16) 0 10px, transparent 10px 16px); z-index: -1; }
.lane-label { position: absolute; left: 0; top: 0; bottom: 0; display: flex; align-items: center; gap: 7px; padding: 0 8px 0 10px; min-width: 0; font-size: 12.5px; font-weight: 700; color: rgba(255, 244, 228, .85); text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.lane.stacked .lane-label { bottom: auto; padding-top: 2px; font-size: 11.5px; }
.lane-label .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lane-label svg { width: 15px; height: 15px; flex: none; }
.lane-label .flag { color: var(--warn); display: inline-flex; }
.lane.me { background: rgba(var(--accent-rgb), .14); border-color: rgba(var(--accent-rgb), .4); }
.lane.me .lane-label { color: #fff; }
.lane.mex .lane-label { color: #ffe39b; }
.lane.open { border-color: rgba(245, 180, 84, .5); }
.lane.pending { border-color: rgba(239, 90, 79, .85); box-shadow: 0 0 0 2px rgba(239, 90, 79, .2); }
.lane.legal { cursor: pointer; background: rgba(var(--accent-rgb), .2); border-color: rgba(var(--accent-rgb), .8); }
.lane.hot { background: rgba(var(--accent-rgb), .32); }
.lane.turn .lane-label .nm::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.more { position: absolute; left: 0; top: 0; z-index: 2; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); }

/* ---- HUD over the scene ---- */
.topbar {
  position: absolute; z-index: 20; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .title {
  min-width: 0; line-height: 1.2; padding: 6px 13px; border-radius: 13px; background: var(--chip); border: 1px solid var(--line);
}
.topbar .title b { display: block; font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { display: block; font-size: 11.5px; color: var(--dim2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }

.bottom {
  position: absolute; z-index: 15; left: 0; right: 0; bottom: 0; pointer-events: none;
  padding: 0 max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
.bottom > * { pointer-events: auto; }
.status { display: flex; align-items: center; gap: 8px; min-height: 44px; max-width: 980px; margin: 0 auto; pointer-events: none; }
.status > * { pointer-events: auto; }
.status .msg {
  min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 13px; border-radius: 13px;
  background: var(--chip); border: 1px solid var(--line); margin-right: auto;
}
.status .msg b { font-size: 14.5px; font-weight: 800; white-space: nowrap; }
.status .msg span { font-size: 12.5px; color: var(--dim2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status .msg.mine { border-color: rgba(var(--accent-rgb), .6); }
.status .msg.mine b { color: var(--accent-2); text-shadow: 0 0 16px rgba(var(--accent-rgb), .7); }
.status .acts { display: flex; gap: 8px; flex: none; }
.me-chip {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 11px 4px 4px; border-radius: 20px;
  background: var(--chip); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; flex: none;
}
.me-chip.turn { border-color: rgba(var(--accent-rgb), .8); }
.me-chip .av { width: 28px; height: 28px; font-size: 12px; }
.me-chip .sc { color: var(--accent-2); }
.clock { font-style: normal; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 14px; color: var(--warn); }
.clock.low { color: var(--bad); }
.clock:empty { display: none; }

.hand { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-end; gap: var(--hg, 8px); padding: 14px 4px 2px; min-height: 60px; position: relative; }
.ht {
  --lift: 0px;
  position: relative; width: var(--tw, 48px); height: calc(var(--tw, 48px) * 2); border-radius: calc(var(--tw, 48px) * .13);
  transform: translateY(calc(var(--arc, 0px) + var(--lift))) rotate(var(--fan, 0deg)) perspective(700px) rotateX(calc(var(--rx0, 9deg) + var(--rx, 0deg))) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  box-shadow: 0 3px 0 var(--edge-1), 0 5px 0 var(--edge-2), 0 12px 18px rgba(0, 0, 0, .45);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .2s, filter .2s, box-shadow .2s;
  touch-action: none;
}
.ht .face, .ht .back { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ht .back { transform: rotateY(180deg); }
.ht .face::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 22%), rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 58%);
}
@media (hover: hover) {
  .ht:hover .face::after { opacity: 1; }
  .ht:hover { --lift: -7px; }
}
.hand.myturn .ht:not(.ok) { filter: brightness(.62) saturate(.7); }
.hand.myturn .ht.ok { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .75), 0 3px 0 var(--edge-1), 0 5px 0 var(--edge-2), 0 12px 24px rgba(0, 0, 0, .5); }
.ht.sel { --lift: -20px; --rx0: 0deg; box-shadow: 0 0 0 3px #fff, 0 0 24px rgba(var(--accent-rgb), .85), 0 3px 0 var(--edge-1), 0 5px 0 var(--edge-2), 0 24px 30px rgba(0, 0, 0, .5) !important; }
.ht.new::before { content: ""; position: absolute; left: 50%; top: -9px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.ht.shake { animation: shake .32s; }
@keyframes shake { 22% { translate: -2.5px 0; } 45% { translate: 2.5px 0; } 70% { translate: -1.5px 0; } }
.ht.drag { opacity: .25; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; border-radius: 8px; transform: rotate(-4deg) scale(1.06); box-shadow: 0 3px 0 var(--edge-1), 0 5px 0 var(--edge-2), 0 22px 36px rgba(0, 0, 0, .5); }
.drag-ghost svg { width: 100%; height: 100%; display: block; }
.watching { text-align: center; color: var(--dim); font-size: 13px; font-weight: 600; padding: 10px; background: var(--chip); border-radius: 12px; max-width: 420px; margin: 0 auto 6px; }
.hand.turnstart::after {
  content: ""; position: absolute; inset: -12px 0 0; pointer-events: none; z-index: 3;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 236, 200, .3) 50%, transparent 62%);
  background-size: 260% 100%; animation: sweep .95s ease-out forwards;
}
@keyframes sweep { from { background-position: 130% 0; } to { background-position: -30% 0; } }

.bubble {
  position: absolute; left: 0; top: -6px; transform: translate(-50%, -100%) scale(.9); opacity: 0;
  padding: 4px 10px; border-radius: 10px; background: #fff; color: #1a1410; font-size: 12.5px; font-weight: 800;
  white-space: nowrap; pointer-events: none; z-index: 30; transition: opacity .18s, transform .18s;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.me-chip .bubble { left: 50%; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.bubble.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.bubble.pts { background: var(--good); color: #062a1a; }
.bubble.pass { background: #ffd9a0; }
.knock { animation: knock .5s ease-out; }
@keyframes knock { 18% { translate: -2.5px 0; rotate: -1deg; } 40% { translate: 2px 0; rotate: .5deg; } 62% { translate: -1px 0; rotate: 0deg; } }
.sc.bump { display: inline-block; color: #d8ffea; animation: bump .5s ease-out; }
@keyframes bump { 35% { scale: 1.18; } }

/* ---- flying tiles, banners, confetti ---- */
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 35; }
.flyer { position: absolute; transform-style: preserve-3d; will-change: transform; }
.flyer .face, .flyer .back { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flyer .back { transform: rotateY(180deg); }
.flyer svg { width: 100%; height: 100%; display: block; }
.flyer.small { box-shadow: 0 6px 10px rgba(0, 0, 0, .4); }
.banner {
  position: absolute; left: 50%; top: 46%; z-index: 9; pointer-events: none; text-align: center;
  width: max-content; max-width: 92%; animation: banner 1.9s cubic-bezier(.2, .9, .25, 1) forwards;
}
.banner::before { content: ""; position: absolute; inset: -40% -18%; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, rgba(12, 7, 4, .78), rgba(12, 7, 4, 0)); }
.banner b {
  display: block; font-size: clamp(34px, 7.4vw, 68px); font-weight: 800; letter-spacing: -.03em; line-height: 1.04;
  color: #fff7e8; text-shadow: 0 0 16px rgba(var(--accent-rgb), .45), 0 5px 14px rgba(0, 0, 0, .6);
}
.banner.big b { font-size: clamp(38px, 8.4vw, 80px); }
.banner span { display: block; margin-top: 10px; font-size: 15px; font-weight: 700; color: var(--dim); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.14); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(.99); }
  26%, 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(.99); }
}
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* the glossary on the front page */
.copy dl.vocab { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; align-items: baseline; }
.copy dl.vocab dt { font-weight: 800; color: var(--accent-2); margin: 0; }
.copy dl.vocab dd { margin: 0; color: var(--dim2); }
@media (max-width: 560px) {
  .copy dl.vocab { grid-template-columns: 1fr; gap: 2px; }
  .copy dl.vocab dd { margin-bottom: 8px; }
}

/* ---- bug report ---- */
.report { display: grid; gap: 10px; }
.text.area { width: 100%; min-height: 96px; resize: vertical; font-family: inherit; line-height: 1.45; padding: 10px 12px; }
.shotrow { display: flex; gap: 8px; flex-wrap: wrap; }
.shotprev { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.shotprev img { display: block; width: 100%; max-height: 220px; object-fit: contain; background: rgba(0, 0, 0, .35); }
.shotprev .icon-btn { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; background: var(--glass-strong); }

/* ---- overlays ---- */
.scrim { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(10, 6, 4, .66); animation: fadeIn .2s ease-out; }
body.theme-midnight .scrim { background: rgba(6, 7, 16, .66); }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; padding: 22px 20px 20px; background: var(--glass-strong); animation: popIn .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes popIn { from { opacity: 0; transform: translateY(7px) scale(.985); } }
.modal .eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--dim2); }
.modal h2 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin: 4px 0; }
.modal .lead { color: var(--dim); font-size: 14px; margin-bottom: 14px; }
.modal .btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal .btns .btn { flex: 1; }
.results { display: grid; gap: 6px; }
.res { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--panel); }
.res.win { background: rgba(87, 212, 154, .12); box-shadow: inset 0 0 0 1px rgba(87, 212, 154, .35); }
.res .nm { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.res .nm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .tiles { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.res .num { text-align: right; font-weight: 800; font-size: 15px; white-space: nowrap; }
.res .num small { display: block; font-size: 11px; color: var(--dim2); font-weight: 700; }
.res .gain { color: var(--good); }
.mini { display: inline-block; width: 30px; height: 15px; vertical-align: middle; }
.mini svg { width: 100%; height: 100%; display: block; }
.winner-art { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.winner-art .av { width: 54px; height: 54px; font-size: 22px; box-shadow: 0 0 0 4px rgba(255, 227, 155, .35), 0 10px 30px rgba(0, 0, 0, .4); }
.sheet { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; background: var(--glass-strong); }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h3 { flex: 1; font-size: 17px; font-weight: 800; }
.menu { display: grid; gap: 4px; }
.menu button, .menu .mi { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: 12px; font-weight: 700; font-size: 14.5px; color: var(--dim); }
.menu button:hover { background: var(--panel); color: #fff; }
.menu .mi { cursor: pointer; }
.menu .mi span { flex: 1; }
.menu .mi.opts-row { cursor: default; flex-wrap: wrap; }
.menu .mi.opts-row .seg { flex: 1 1 100%; margin-top: 8px; }
.menu .seg button { width: auto; display: inline-flex; justify-content: center; padding: 0 12px; min-height: 34px; font-size: 12.5px; border-radius: 9px; }
.menu .danger { color: #ffc0b8; }
.rules { color: var(--dim); font-size: 14px; display: grid; gap: 8px; }
.rules h4 { color: #fff; font-size: 15px; margin-top: 6px; }
.rules ul { padding-left: 18px; display: grid; gap: 5px; }
.kbd-hint { color: var(--dim3); }
.scoretable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.scoretable th, .scoretable td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.scoretable th:first-child, .scoretable td:first-child { text-align: left; color: var(--dim2); }
.scoretable thead th { font-size: 12px; color: var(--dim2); font-weight: 700; }
.scoretable tfoot td { font-weight: 800; border-bottom: 0; color: #fff; }
.scoretable td.w { color: var(--good); font-weight: 800; }
.scroll-x { overflow-x: auto; }

/* chat */
.chat {
  position: fixed; z-index: 45; right: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); height: min(520px, calc(100dvh - 90px));
  display: flex; flex-direction: column; padding: 12px; background: var(--glass-strong); animation: popIn .22s cubic-bezier(.2, .8, .2, 1);
}
.chat .msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 8px; }
.chat .m { font-size: 14px; line-height: 1.35; word-wrap: break-word; }
.chat .m b { font-weight: 800; margin-right: 6px; }
.chat .empty { color: var(--dim3); font-size: 13px; text-align: center; margin: auto; }
.chat form { display: flex; gap: 8px; }
.chat input.text { min-height: 42px; font-size: 15px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 8px; }
.quick button { padding: 6px 11px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--dim); }
.quick button:hover { background: var(--panel-3); color: #fff; }

/* toasts, connection */
#toasts { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; display: grid; gap: 6px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  padding: 9px 14px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line-2);
  font-size: 13.5px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  animation: toastIn .22s cubic-bezier(.2, .8, .2, 1); transition: opacity .3s, transform .3s; max-width: 100%;
}
.toast.bad { border-color: rgba(239, 90, 79, .6); color: #ffd0c8; }
.toast.good { border-color: rgba(87, 212, 154, .6); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
.conn {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  padding: 9px 16px; border-radius: 20px; background: #2e1f14; border: 1px solid rgba(255, 180, 84, .5); color: #ffe0b0;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* turn clock: a ring that drains around the avatar */
@property --p { syntax: '<number>'; inherits: true; initial-value: 1; }
.seat.timed .av::after, .me-chip.timed .av::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--clock, #f5b454) calc(var(--p) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  transition: --p 1s linear;
}
.seat.timed.low .av::after, .me-chip.timed.low .av::after { --clock: #ef5a4f; }
.seat.timed .av::before, .me-chip.timed .av::before { display: none; }

/* ---- responsive ---- */
@media (max-width: 640px) {
  .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .topbar .title { padding: 5px 11px; }
  .topbar .title b { font-size: 13.5px; }
  .status .msg { padding: 5px 11px; }
  .status .msg span { display: none; }
  .status .msg.mine span { display: inline; }
  .me-chip .lbl { display: none; }
  .seat .plate { font-size: 11px; padding: 2px 7px; gap: 4px; max-width: 124px; }
  .seat .plate .tag.bot, .seat .plate .tag.team0 { display: none; }
  .seat.partner .plate { border-color: rgba(var(--accent-rgb), .55); }
  .pad .ph, .pad .pr { font-size: 15px; }
  .vgrid { grid-template-columns: 1fr; }
  .invite .code { font-size: 34px; }
  .invite .btns { margin-left: 0; width: 100%; }
  .invite .btns .btn { flex: 1; }
  .opt > label { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .tablewrap.tilt { transform: none; }
  .topple .dom-in { animation: none; }
}
