:root {
  --bg: #050d0a;
  --ink: #f3ecd9;
  --ink-dim: #a9b5ab;
  --gold: #d4af5f;
  --gold-hi: #f2d98f;
  --gold-lo: #8d6f2c;
  --felt-1: #148a4e;
  --felt-2: #0d6a3c;
  --felt-3: #07432a;
  --wood: #1a0f0a;
  --panel: rgba(8, 20, 15, 0.82);
  --line: rgba(212, 175, 95, 0.28);
  --red: #c0392b;
  --cw: clamp(36px, min(5.6vw, 8.4vh), 76px);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --display: 'Cinzel', 'Trajan Pro', 'Cormorant Garamond', Georgia, serif;
  --banner: #e6bf58;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #0d2a1e 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 0.12s, filter 0.15s, background 0.15s, box-shadow 0.2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); background: rgba(255, 255, 255, 0.08); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.gold {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  color: #2a1d05;
  border-color: rgba(255, 240, 190, 0.6);
  box-shadow: 0 6px 20px rgba(212, 175, 95, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn.gold:hover:not(:disabled) { filter: brightness(1.06); background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); }
.btn.ghost { background: transparent; }
.btn.big { padding: 16px 30px; font-size: 1.05rem; }
.link { background: none; border: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; padding: 0 6px; font-size: 0.85rem; }
input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 13px 16px;
  border-radius: 12px;
  outline: none;
  width: 100%;
}
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 95, 0.15); }
input::placeholder { color: #71806f; }

/* ---------- name screen ---------- */
#screen-name { align-items: center; justify-content: center; padding: 24px; }
.hero { text-align: center; max-width: 420px; width: 100%; animation: rise 0.8s cubic-bezier(.2, .8, .2, 1) both; }
.crest {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 46px; color: var(--gold-hi);
  background: radial-gradient(circle at 35% 30%, #16392a, #07160f 70%);
  border: 1px solid var(--gold); box-shadow: 0 0 0 6px rgba(212, 175, 95, 0.08), 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(212, 175, 95, 0.15);
}
.crest.sm { width: 34px; height: 34px; font-size: 19px; margin: 0; box-shadow: none; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.3rem, 7vw, 3.2rem); margin: 0 0 6px; letter-spacing: 0.02em; }
.tag { color: var(--ink-dim); margin: 0 0 28px; }
#name-form { display: flex; flex-direction: column; gap: 12px; }
#name-input { text-align: center; font-size: 1.1rem; }
.fine { color: #5d6d62; font-size: 0.78rem; margin-top: 22px; letter-spacing: 0.1em; text-transform: uppercase; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- lobby ---------- */
#screen-lobby { overflow-y: auto; }
.lobby-top { display: flex; justify-content: space-between; align-items: center; padding: 16px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.who { font-size: 0.9rem; color: var(--ink-dim); }
.who #lobby-name { color: var(--ink); font-weight: 600; }
.lobby { width: 100%; max-width: 860px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 32px) 60px; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(160deg, rgba(15, 90, 60, 0.35), rgba(6, 40, 26, 0.35)); }
.join { display: flex; gap: 10px; flex: 1; min-width: 230px; max-width: 360px; }
#code-input { text-transform: uppercase; letter-spacing: 0.25em; text-align: center; font-weight: 600; }
.section { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; margin: 34px 0 14px; color: var(--gold-hi); }
.table-list { display: flex; flex-direction: column; gap: 10px; }
.t-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.t-row.fresh { animation: rise 0.4s both; }
.t-row .n { font-weight: 600; font-size: 1.05rem; }
.t-row .m { color: var(--ink-dim); font-size: 0.82rem; margin-top: 3px; }
.dots { display: flex; gap: 5px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--gold); }
.dots i.on { background: var(--gold); box-shadow: 0 0 8px rgba(212, 175, 95, 0.6); }
.empty { color: #66756b; text-align: center; padding: 38px 10px; border: 1px dashed var(--line); border-radius: 16px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.card-modal { width: 100%; max-width: 440px; background: linear-gradient(180deg, #10251b, #08150f); border: 1px solid var(--gold-lo); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7); animation: rise 0.3s both; }
.card-modal h3 { font-family: var(--serif); font-size: 1.8rem; margin: 0 0 16px; font-weight: 600; }
.card-modal label, .field-label { display: block; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); margin: 14px 0 7px; }
.card-modal label input { margin-top: 7px; text-transform: none; letter-spacing: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg button { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.seg button small { font-weight: 400; color: var(--ink-dim); font-size: 0.68rem; }
.seg button.on { border-color: var(--gold); background: rgba(212, 175, 95, 0.12); box-shadow: inset 0 0 0 1px var(--gold); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- table chrome ---------- */
.table-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px clamp(10px, 2.5vw, 26px); padding-top: max(10px, env(safe-area-inset-top)); z-index: 5; }
.icon-btn { white-space: nowrap; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.t-title { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
#t-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
.t-sub { font-size: 0.7rem; color: var(--ink-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.t-right { display: flex; gap: 8px; align-items: center; }
.code-chip { display: flex; align-items: center; gap: 8px; background: rgba(212, 175, 95, 0.1); border: 1px solid var(--gold-lo); border-radius: 999px; padding: 6px 6px 6px 14px; font-weight: 600; letter-spacing: 0.2em; font-size: 0.85rem; }
.code-chip .copy { background: var(--gold); color: #2a1d05; border-radius: 999px; padding: 3px 10px; letter-spacing: 0.05em; font-size: 0.72rem; }

/* ---------- felt ---------- */
.felt-wrap { flex: 1; min-height: 0; padding: 0 clamp(6px, 2vw, 24px); display: flex; container-type: size; }
.felt {
  --cw: clamp(34px, min(6.2cqw, 11.5cqh), 84px);
  --spot: clamp(42px, min(7cqw, 11cqh), 68px);
  --hh: calc(var(--cw) * 1.4 + 34px);
  position: relative; flex: 1; min-height: 0;
  border: 14px solid transparent;
  border-radius: 26px 26px 50% 50% / 26px 26px 42% 42%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") padding-box,
    radial-gradient(ellipse at 50% 30%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%) padding-box,
    linear-gradient(160deg, #4a2e1f 0%, #1d1009 45%, #3a2316 100%) border-box;
  box-shadow: 0 0 0 2px var(--gold-lo), 0 0 0 5px #24150d, 0 30px 80px rgba(0, 0, 0, 0.75), inset 0 0 90px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(212, 175, 95, 0.35);
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
}
.felt-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.felt-art .band { fill: none; stroke: var(--banner); stroke-opacity: 0.92; stroke-width: 2.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.felt-art .band.strip { stroke-width: 2; stroke-opacity: 0.85; }
.felt-art text { fill: var(--banner); fill-opacity: 0.95; font-family: var(--display); font-weight: 800; }
.felt-art .t-big { font-size: 30px; letter-spacing: 3px; }
.felt-art .t-small { font-size: 11px; letter-spacing: 3.5px; font-weight: 700; fill: #f3ecd9; fill-opacity: 0.9; }
.felt-art .t-ins { font-size: 14px; letter-spacing: 4px; font-weight: 700; }
.felt-art .art-p { display: none; }
.felt-print { display: none; position: absolute; inset: 0; pointer-events: none; flex-direction: column; align-items: center; justify-content: center; color: var(--banner); font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.22em; text-align: center; gap: 4px; }
.felt-print .a1 { font-size: 0.95rem; }
.felt-print .a2, .felt-print .a3 { font-size: 0.6rem; letter-spacing: 0.26em; }
.chip-tray { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(36%, 420px); height: clamp(28px, 6.5cqh, 46px); padding: 4px 8px 5px; display: flex; align-items: center; justify-content: space-between; gap: 3px; border-radius: 0 0 10px 10px; background: linear-gradient(#0b0705, #1a0f09); border: 3px solid #c9a24b; border-top: 0; box-shadow: 0 5px 12px rgba(0, 0, 0, 0.6), inset 0 6px 10px rgba(0, 0, 0, 0.8); z-index: 1; }
.ct { flex: 1; max-width: 34px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--c) 0 50%, transparent 52%), conic-gradient(#fff 0 12.5%, var(--c) 0 25%, #fff 0 37.5%, var(--c) 0 50%, #fff 0 62.5%, var(--c) 0 75%, #fff 0 87.5%, var(--c) 0); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.ct.red { --c: #c0392b; } .ct.green { --c: #1f8a4c; } .ct.black { --c: #1c1c1f; } .ct.purple { --c: #6a3a93; } .ct.blue { --c: #2f6db5; } .ct.white { --c: #d9d3c0; } .ct.gold { --c: #c69a2c; }

.dealer-zone { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; padding-top: clamp(30px, 7cqh, 48px); z-index: 2; }
.dealer-label { font-family: var(--serif); letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.7rem; color: var(--banner); margin-bottom: 3px; display: flex; align-items: center; gap: 10px; }
.shoe { position: absolute; right: clamp(8px, 3.5%, 56px); top: clamp(26px, 6cqh, 44px); width: calc(var(--cw) * 2.3); aspect-ratio: 150 / 104; z-index: 2; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.55)); }
.shoe-svg { width: 100%; height: 100%; display: block; overflow: visible; transform: scaleX(-1); }
.shoe span { position: absolute; bottom: -14px; left: 0; right: 0; text-align: center; font-size: 0.6rem; color: rgba(243, 236, 217, 0.6); letter-spacing: 0.1em; }
.shoe.kick { animation: kick 0.3s ease-out; }
@keyframes kick { 0% { transform: translate(0, 0); } 30% { transform: translate(-4px, 1px) rotate(-1deg); } 100% { transform: none; } }

.status { position: absolute; left: clamp(12px, 3%, 40px); top: 38px; z-index: 3; max-width: 26%; }
.status-msg { font-family: var(--serif); font-size: clamp(1rem, 1.9cqw, 1.5rem); font-weight: 600; color: var(--gold-hi); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); line-height: 1.2; }
.timer { width: clamp(90px, 14cqw, 170px); height: 4px; margin: 8px 0 0; background: rgba(0, 0, 0, 0.4); border-radius: 4px; overflow: hidden; opacity: 0; transition: opacity 0.2s; }
.timer.on { opacity: 1; }
.timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transform-origin: left; }
.timer.low i { background: linear-gradient(90deg, #8c2a1e, #ff7a5c); }

.seats { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.seat { position: absolute; left: var(--x); top: var(--y); width: 19%; display: flex; flex-direction: column; align-items: center; pointer-events: auto;
  transform: translate(-50%, calc(-1 * (var(--hh) + 6px + var(--spot) / 2))); }
.seat:nth-child(1) { --x: 12.5%; --y: 64%; }
.seat:nth-child(2) { --x: 31%; --y: 72%; }
.seat:nth-child(3) { --x: 50%; --y: 75%; }
.seat:nth-child(4) { --x: 69%; --y: 72%; }
.seat:nth-child(5) { --x: 87.5%; --y: 64%; }
.seat-hands { display: flex; gap: clamp(2px, 0.6cqw, 10px); justify-content: center; align-items: flex-end; height: var(--hh); width: 100%; }
.seat-hands.multi { --cw: clamp(28px, min(4.6cqw, 8.6cqh), 62px); }

/* portrait / narrow: straight print, tighter seats */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  .felt-art .art-l { display: none; }
  .felt-art .art-p { display: inline; }
  .felt-print { display: flex; }
  .felt-print { justify-content: flex-start; padding-top: 43%; }
  .badge .lbl { display: none; }
  .badge .long { display: none; }
  .badge .short { display: inline; }
  .plate .avatar { display: none; }
  .plate { padding: 3px 8px; justify-content: center; }
  .status { position: relative; left: auto; top: auto; max-width: none; text-align: center; margin: 4px auto 0; z-index: 3; }
  .status-msg { font-size: 1.05rem; }
  .timer { margin: 6px auto 0; }
  .shoe { width: 58px; right: 6px; top: 34px; }
  .shoe span { display: none; }
  .seat { width: 20%; }
  .seat:nth-child(1) { --x: 12%; --y: 68%; }
  .seat:nth-child(2) { --x: 30.5%; --y: 76%; }
  .seat:nth-child(3) { --x: 50%; --y: 80%; }
  .seat:nth-child(4) { --x: 69.5%; --y: 76%; }
  .seat:nth-child(5) { --x: 88%; --y: 68%; }
}

/* ---------- cards ---------- */
.hand { display: flex; justify-content: center; position: relative; padding-top: 4px; }
.hand .card + .card { margin-left: calc(var(--cw) * -0.5); }
.hand .card:nth-child(n+2) { margin-top: calc(var(--cw) * -0.08); }
.hand .card:nth-child(n+3) { margin-top: calc(var(--cw) * -0.16); }
.hand .card:nth-child(n+4) { margin-top: calc(var(--cw) * -0.24); }
.hand .card:nth-child(n+5) { margin-top: calc(var(--cw) * -0.32); }
.phand { display: flex; flex-direction: column; align-items: center; position: relative; padding: 2px 3px; border-radius: 12px; transition: box-shadow 0.25s, background 0.25s; }
.phand.turn { background: rgba(242, 217, 143, 0.08); box-shadow: 0 0 0 1.5px var(--gold-hi), 0 0 24px rgba(242, 217, 143, 0.35); }
.card {
  position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * 0.1);
  background: linear-gradient(160deg, #fffdf6, #efe7d2); color: #14110c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-family: var(--serif); font-weight: 700; flex: none; user-select: none;
  backface-visibility: hidden;
}
.card { isolation: isolate; }
.card.face { background: #fff; overflow: hidden; isolation: isolate; }
.card.face > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-shade { position: absolute; inset: 0; border-radius: inherit; z-index: 3; background: repeating-linear-gradient(45deg, rgba(212, 175, 95, 0.25) 0 2px, transparent 2px 7px), repeating-linear-gradient(-45deg, rgba(212, 175, 95, 0.25) 0 2px, transparent 2px 7px), linear-gradient(145deg, #6d1626, #36080f); box-shadow: inset 0 0 0 calc(var(--cw) * 0.06) #f3ecd9; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(212, 175, 95, 0.22) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(212, 175, 95, 0.22) 0 2px, transparent 2px 7px),
    linear-gradient(145deg, #6d1626, #36080f);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 0 0 calc(var(--cw) * 0.06) #f3ecd9, inset 0 0 0 calc(var(--cw) * 0.085) rgba(0, 0, 0, 0.25);
}
.card.flip { animation: flipIn 0.55s ease both; }
@keyframes dealIn { from { transform: translate(var(--dx, 0), -60vh) rotate(-18deg) scale(0.9); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes flipIn { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }

.badge { display: inline-block; min-width: 2.1em; padding: 3px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.78); border: 1.5px solid var(--gold); font-family: var(--sans); font-weight: 700; font-size: clamp(1rem, 1.7cqw, 1.35rem); letter-spacing: 0; color: #fff; text-align: center; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55); }
.badge.bust { background: #7a1d14; border-color: #ff7a5c; }
.badge.bj { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #2a1d05; border-color: var(--gold-hi); }
.phand .badge { margin-top: 6px; }
.dealer-row { position: relative; }
.dealer-row .badge { position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); font-size: clamp(1.1rem, 1.9cqw, 1.5rem); }
.dealer-hand { --cw: clamp(32px, min(5.6cqw, 10.4cqh), 76px); }
.badge .short { display: none; }
.badge .lbl { font-weight: 500; font-size: 0.72em; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; margin-right: 5px; }
.tag-res { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; z-index: 4; animation: pop 0.35s cubic-bezier(.3, 1.6, .5, 1) both; }
.tag-res.win, .tag-res.blackjack { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #2a1d05; }
.tag-res.lose, .tag-res.bust { background: #5d1812; color: #ffd2c8; }
.tag-res.push { background: #2e3b35; color: var(--ink); }
@keyframes pop { from { transform: translateX(-50%) scale(0.4); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ---------- bet spot & chips ---------- */
.bet-spot { position: relative; width: var(--spot); height: var(--spot); margin-top: 6px; border-radius: 50%; border: 2.5px solid var(--banner); display: grid; place-items: center; background: radial-gradient(circle, rgba(0, 0, 0, 0.1) 0 62%, rgba(0, 0, 0, 0.22) 63%); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(0, 0, 0, 0.3); transition: box-shadow 0.3s, border-color 0.3s; }
.bet-spot.mine { box-shadow: 0 0 0 3px rgba(230, 191, 88, 0.22), inset 0 0 12px rgba(0, 0, 0, 0.3); }
.bet-spot.pending { border-style: dashed; }
.bet-spot.locked { border-color: var(--gold-hi); box-shadow: 0 0 0 3px rgba(242, 217, 143, 0.28), 0 0 18px rgba(242, 217, 143, 0.35), inset 0 0 12px rgba(0, 0, 0, 0.3); }
.bet-spot .lock { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #2a1d05; font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; z-index: 4; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6); animation: pop2 0.3s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop2 { from { transform: scale(0); } to { transform: scale(1); } }
.bet-spot .amt { position: absolute; bottom: -12px; background: rgba(0, 0, 0, 0.85); border: 1px solid var(--gold); border-radius: 999px; padding: 2px 10px; font-size: clamp(0.72rem, 1.05cqw, 0.9rem); font-weight: 700; z-index: 3; white-space: nowrap; }
.stack { position: relative; width: 84%; height: 84%; }
.stack .chip { position: absolute; left: 0; width: 100%; }
.stack .chip.new { animation: chipDrop 0.5s cubic-bezier(.3, 1.3, .5, 1) both; }
@keyframes chipDrop { 0% { transform: translateY(-90px) scale(1.15); opacity: 0; } 55% { opacity: 1; } 78% { transform: translateY(2px) scale(1); } 100% { transform: none; } }
.chipnote { position: absolute; left: 50%; transform: translateX(-50%); z-index: 7; font-weight: 700; font-size: 0.85rem; color: var(--gold-hi); background: rgba(0, 0, 0, 0.75); border: 1px solid var(--gold); border-radius: 999px; padding: 1px 9px; white-space: nowrap; animation: floatUp 1.6s ease-out both; pointer-events: none; }

.chip {
  --c: #e9e3d0; --e: #b9b39c; --t: #2a2a2a;
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 50%, var(--c) 0 52%, transparent 53%), conic-gradient(var(--e) 0 12.5%, var(--c) 0 25%, var(--e) 0 37.5%, var(--c) 0 50%, var(--e) 0 62.5%, var(--c) 0 75%, var(--e) 0 87.5%, var(--c) 0);
  border: 2px solid var(--c);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 4px 4px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  display: grid; place-items: center; color: var(--t); font-weight: 700; font-size: 0.72em;
}
.chip::after { content: ''; position: absolute; inset: 16%; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.55); }
.chip b { position: relative; z-index: 1; font-size: 0.95em; }
.chip.v10 { --c: #ece7d6; --e: #5b7fb8; --t: #22304a; }
.chip.v50 { --c: #c0392b; --e: #f3ecd9; --t: #fff; }
.chip.v100 { --c: #1c1c1f; --e: #d4af5f; --t: #f2d98f; }
.chip.v500 { --c: #6a3a93; --e: #e6d6f2; --t: #fff; }
.chip.v1000 { --c: #c69a2c; --e: #fff1c2; --t: #2a1d05; }

.plate { margin-top: 10px; display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.plate.mine { border-color: var(--gold); box-shadow: 0 0 18px rgba(212, 175, 95, 0.25); }
.plate.off { opacity: 0.55; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; color: #2a1d05; background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo)); }
.plate .who-n { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.plate .nm { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .bal { font-size: 0.7rem; color: var(--gold-hi); }
.delta { position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%); font-weight: 700; font-size: clamp(0.85rem, 1.8vw, 1.15rem); padding: 2px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.7); z-index: 6; animation: floatUp 2.6s ease-out both; white-space: nowrap; }
.delta.pos { color: #8ef0a8; border: 1px solid #3bb35f; }
.delta.neg { color: #ffa597; border: 1px solid #b5463a; }
.delta.zero { color: var(--ink-dim); border: 1px solid var(--line); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 8px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -22px); } }

.sit-btn { width: var(--spot); aspect-ratio: 1; margin-top: 6px; border-radius: 50%; border: 1.5px dashed rgba(212, 175, 95, 0.6); background: rgba(0, 0, 0, 0.18); color: var(--gold); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; transition: all 0.2s; }
.sit-btn:hover { background: rgba(212, 175, 95, 0.15); border-color: var(--gold-hi); transform: scale(1.06); }
.sit-btn.dim { opacity: 0.4; pointer-events: none; }
.seat-empty-wrap { display: flex; flex-direction: column; align-items: center; }

/* ---------- controls ---------- */
.controls { min-height: 92px; padding: 10px clamp(8px, 2vw, 24px); padding-bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; z-index: 5; }
.chip-rack { display: flex; gap: clamp(6px, 1.6vw, 14px); }
.rack-chip { width: clamp(44px, 10vw, 62px); background: none; border: 0; padding: 0; transition: transform 0.12s; font-size: clamp(0.7rem, 2.4vw, 0.95rem); }
.rack-chip:hover:not(:disabled) { transform: translateY(-5px); }
.rack-chip:active:not(:disabled) { transform: translateY(0) scale(0.94); }
.rack-chip:disabled { opacity: 0.25; cursor: not-allowed; }
.bet-readout { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; min-width: 92px; text-align: center; color: var(--gold-hi); line-height: 1; }
.bet-readout small { display: block; font-family: var(--sans); font-size: 0.62rem; color: var(--ink-dim); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 4px; }
.actions { display: flex; gap: clamp(6px, 1.5vw, 12px); flex-wrap: wrap; justify-content: center; }
.act-btn { min-width: clamp(74px, 18vw, 120px); padding: 14px 10px; font-size: 0.95rem; text-transform: uppercase; }
.ctl-msg { color: var(--ink-dim); font-size: 0.95rem; text-align: center; }
.ctl-msg b { color: var(--gold-hi); font-weight: 600; }
.ctl-msg .big-total { font-family: var(--serif); font-size: 2rem; margin-left: 6px; vertical-align: -3px; }
.ctl-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 24px); }
.toast { background: #111b16; border: 1px solid var(--gold-lo); padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); animation: rise 0.25s both; max-width: 420px; text-align: center; }
.toast.bad { border-color: #b5463a; }
.toast.out { opacity: 0; transition: opacity 0.4s; }

@media (max-width: 640px) {
  .t-row { grid-template-columns: 1fr auto; }
  .t-row .dots { display: none; }
  .code-chip .copy { display: none; }
  .code-chip { padding: 6px 12px; }
  .plate { padding: 3px 6px 3px 3px; gap: 4px; }
  .avatar { width: 22px; height: 22px; font-size: 0.66rem; }
  .plate .nm { font-size: 0.66rem; }
  .plate .bal { font-size: 0.6rem; }
  .felt { border-width: 8px; }
  #t-name { max-width: 30vw; font-size: 1.1rem; }
  .sit-btn { font-size: 0.55rem; }
}
@media (max-height: 560px) and (orientation: landscape) {
  :root { --cw: clamp(30px, 7.5vh, 52px); }
  .controls { min-height: 70px; padding-top: 4px; }
  .table-top { padding-top: 4px; padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; } }

/* ---------- turn timer, decision pop-up, flying chips ---------- */
.seat[data-swept] .bet-spot .stack, .seat[data-swept] .bet-spot .amt { opacity: 0; transition: opacity 0.25s; }
.chip.fly { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6); }
.chipnote { top: calc(var(--hh) - 30px); bottom: auto; }
.tt { display: none; position: absolute; top: -16px; right: -12px; width: 36px; height: 36px; border-radius: 50%; z-index: 8; place-items: center;
  background: conic-gradient(var(--gold-hi) var(--p, 360deg), rgba(0, 0, 0, 0.65) 0); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6); }
.tt.on { display: grid; }
.tt span { width: 28px; height: 28px; border-radius: 50%; background: #0b1410; display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; color: #fff; }
.tt.low { background: conic-gradient(#ff7a5c var(--p, 360deg), rgba(0, 0, 0, 0.65) 0); animation: throb 0.6s ease-in-out infinite alternate; }
.tt.low span { color: #ffb3a3; }
@keyframes throb { to { transform: scale(1.12); } }

.controls { min-height: 104px; }
.decide { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px clamp(12px, 3vw, 26px) 14px; border-radius: 22px; background: linear-gradient(180deg, rgba(20, 44, 32, 0.96), rgba(8, 20, 15, 0.96)); border: 1px solid var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 95, 0.12), 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 34px rgba(242, 217, 143, 0.18); max-width: 100%; }
.decide.enter { animation: popUp 0.4s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes popUp { from { transform: translateY(40px) scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.decide-head { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 0.92rem; color: var(--ink-dim); text-align: center; }
.decide-head .big-total { font-family: var(--serif); font-size: 2rem; color: var(--gold-hi); margin-left: 6px; vertical-align: -3px; }
.decide-timer { display: inline-flex; align-items: center; gap: 8px; }
.dt-secs { min-width: 1.6em; font-weight: 700; font-size: 1.15rem; color: #fff; text-align: right; }
.dt-track { width: clamp(70px, 16vw, 140px); height: 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
.dt-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transform-origin: left; }
.dt-track.low i { background: linear-gradient(90deg, #8c2a1e, #ff7a5c); }
.decide .actions { gap: clamp(8px, 1.6vw, 14px); }
.decide .act-btn { position: relative; min-width: clamp(72px, 19vw, 132px); padding: 15px 10px; font-size: 1.02rem; }
.decide .act-btn kbd { display: block; font-family: var(--sans); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.1em; opacity: 0.55; margin-top: 2px; }
@media (hover: none) { .decide .act-btn kbd { display: none; } }

@media (max-width: 700px) {
  .decide { width: 100%; padding: 10px 10px 12px; }
  .decide .actions { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; gap: 6px; }
  .decide .act-btn { min-width: 0; padding: 14px 2px; font-size: 0.8rem; letter-spacing: 0.02em; }
  .decide-head .big-total { font-size: 1.7rem; }
}

/* ---------- flags & chat ---------- */
.country-row { display: flex; align-items: center; gap: 10px; }
.country-row select { flex: 1; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); color: var(--ink); padding: 13px 12px; border-radius: 12px; font: inherit; outline: none; min-width: 0; }
.country-row select:focus { border-color: var(--gold); }
.country-row option { background: #0b1712; color: var(--ink); }
.flag-slot { width: 36px; height: 26px; display: grid; place-items: center; flex: none; }
.flag { width: 1.35em; height: 1em; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); vertical-align: -0.12em; margin-right: 0.4em; flex: none; }
.flag-slot .flag { width: 36px; height: 26px; margin: 0; border-radius: 3px; }
.flag-code { font-size: 0.7em; font-weight: 700; letter-spacing: 0.05em; color: var(--gold); margin-right: 0.4em; }
.plate .nm { display: flex; align-items: center; }
.plate .nm .flag { width: 15px; height: 11px; margin-right: 5px; }
.unread { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 7px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: #2a1d05; font-size: 0.7rem; font-weight: 800; }
.chat { position: fixed; top: 64px; right: 12px; bottom: 122px; width: min(340px, calc(100vw - 24px)); z-index: 45; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(16, 37, 27, 0.97), rgba(7, 18, 13, 0.97)); border: 1px solid var(--gold-lo); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); transform: translateX(120%); opacity: 0; pointer-events: none; transition: transform 0.28s cubic-bezier(.2, .9, .3, 1), opacity 0.2s; }
.chat.open { transform: none; opacity: 1; pointer-events: auto; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.chat-head .icon-btn { padding: 4px 10px; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.cm { font-size: 0.9rem; line-height: 1.35; word-break: break-word; }
.cm b { color: var(--gold-hi); font-weight: 600; }
.cm.mine b { color: #fff; }
.cm.sys { color: #7f8f84; font-size: 0.78rem; text-align: center; font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { padding: 10px 12px; }
.chat-form .btn { padding: 10px 16px; }
.chat-pill { position: fixed; left: 16px; bottom: 120px; z-index: 40; max-width: min(300px, 70vw); background: rgba(8, 20, 15, 0.92); border: 1px solid var(--gold-lo); border-radius: 14px; padding: 8px 12px; font-size: 0.85rem; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); animation: rise 0.25s both; cursor: pointer; }
.chat-pill b { color: var(--gold-hi); }
@media (max-width: 700px) {
  .chat { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 62vh; }
  .t-sub { display: none; }
  .chat-pill { left: 10px; bottom: 140px; }
}

/* ---------- timer under the chips, premium action buttons ---------- */
.status .timer { display: none; }
.rack-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bet-timer { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; }
.bet-timer .dt-track { flex: 1; max-width: 300px; height: 7px; }
.bet-timer .dt-secs { min-width: 1.4em; font-size: 0.95rem; color: var(--gold-hi); }
.decide .actions { gap: clamp(8px, 1.4vw, 16px); }
.abtn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: clamp(74px, 12vw, 128px); padding: 13px 14px 10px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, 0.35); color: #fff; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.9rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); cursor: pointer; transition: transform 0.12s, filter 0.15s, box-shadow 0.2s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -10px 18px rgba(0, 0, 0, 0.25), 0 8px 18px rgba(0, 0, 0, 0.45), 0 0 22px var(--glow); }
.abtn::before { content: ''; position: absolute; left: 6%; right: 6%; top: 3%; height: 42%; border-radius: 14px 14px 40px 40px / 14px 14px 18px 18px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)); pointer-events: none; }
.abtn:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.1); }
.abtn:active:not(:disabled) { transform: translateY(1px) scale(0.97); }
.abtn:disabled { filter: grayscale(0.9) brightness(0.55); box-shadow: none; cursor: not-allowed; }
.abtn .ico { width: 30px; height: 30px; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.abtn .ico svg { width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.abtn kbd { font-family: var(--sans); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.1em; opacity: 0.7; }
.abtn.hit { --glow: rgba(58, 208, 127, 0.35); background: linear-gradient(180deg, #46dc8c, #1fa35a 55%, #127a41); }
.abtn.stand { --glow: rgba(240, 90, 76, 0.35); background: linear-gradient(180deg, #f5766b, #cc382d 55%, #98211a); }
.abtn.double { --glow: rgba(70, 140, 255, 0.4); background: linear-gradient(180deg, #5aa6ff, #2c6fe2 55%, #1c4db2); }
.abtn.split { --glow: rgba(60, 190, 255, 0.4); background: linear-gradient(180deg, #55cdfb, #2293d8 55%, #1a68aa); }
.decide { padding: 14px clamp(14px, 3vw, 30px) 16px; border-radius: 26px; }
@media (hover: none) { .abtn kbd { display: none; } }
@media (max-width: 700px) {
  .decide .actions { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; gap: 7px; }
  .abtn { min-width: 0; padding: 11px 2px 9px; font-size: 0.68rem; letter-spacing: 0.04em; border-radius: 14px; }
  .abtn .ico { width: 24px; height: 24px; }
  .rack-col { width: 100%; }
}

/* ---------- chat: floating button bottom-right ---------- */
.chat-fab { position: fixed; right: 18px; bottom: 18px; z-index: 46; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(255, 240, 190, 0.6); background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: #2a1d05; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(212, 175, 95, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.55); transition: transform 0.15s; }
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab svg { width: 26px; height: 26px; fill: none; stroke: #2a1d05; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
.chat-fab .ic-x { display: none; }
.chat-fab.open .ic-msg { display: none; }
.chat-fab.open .ic-x { display: block; }
.chat-fab .unread { position: absolute; top: -4px; right: -4px; margin: 0; background: #d8402f; color: #fff; border: 2px solid #0b1712; }
.chat { top: auto; right: 18px; bottom: 86px; height: min(480px, calc(100vh - 170px)); }
.chat-pill { left: auto; right: 18px; bottom: 86px; }
@media (min-width: 701px) { .controls { padding-right: 84px; padding-left: 84px; } }
@media (max-width: 700px) {
  .chat-fab { width: 46px; height: 46px; right: 10px; bottom: calc(var(--ctl-h, 110px) + 12px); }
  .chat-fab svg { width: 22px; height: 22px; }
  .chat-fab.open { display: none; }
  .chat { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 62vh; }
  .chat-pill { right: 10px; bottom: calc(var(--ctl-h, 110px) + 66px); }
}

/* action panel floats over the table so the felt never resizes */
.controls { position: relative; }
.decide { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0 auto; width: max-content; max-width: calc(100% - 20px); z-index: 7; }
@media (max-width: 700px) { .decide { width: calc(100% - 16px); bottom: 6px; } }

/* ---------- big result announcement ---------- */
.result-banner { position: absolute; left: 50%; top: 37%; z-index: 9; transform: translate(-50%, -50%); text-align: center; pointer-events: none; opacity: 0; padding: clamp(14px, 3cqh, 30px) clamp(28px, 6cqw, 90px); background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.38) 55%, rgba(0, 0, 0, 0) 75%); }
.result-banner.show { animation: resultIn 3.6s ease both; }
@keyframes resultIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); } 9% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 14% { transform: translate(-50%, -50%) scale(1); } 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -56%) scale(1.04); } }
.rb-title { font-family: var(--display); font-weight: 800; font-size: clamp(2.1rem, 7.2cqw, 5.4rem); line-height: 1; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; background: linear-gradient(180deg, var(--g1), var(--g2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 14px var(--glow)) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)); }
.rb-sub { margin-top: 10px; font-family: var(--serif); font-weight: 700; font-size: clamp(1.3rem, 3.6cqw, 2.6rem); color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); letter-spacing: 0.04em; }
.result-banner.win { --g1: #8ff5b4; --g2: #22b765; --glow: rgba(58, 208, 127, 0.75); }
.result-banner.blackjack { --g1: #fff2b8; --g2: #e0a92c; --glow: rgba(242, 217, 143, 0.9); }
.result-banner.blackjack .rb-title { animation: shimmer 1.2s ease-in-out infinite alternate; }
@keyframes shimmer { to { filter: drop-shadow(0 4px 26px rgba(255, 226, 140, 1)) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)); } }
.result-banner.lose { --g1: #ff9a8d; --g2: #d23a2c; --glow: rgba(240, 90, 76, 0.7); }
.result-banner.push { --g1: #f4f1e8; --g2: #a9b5ab; --glow: rgba(220, 230, 220, 0.5); }
@media (max-width: 700px) { .result-banner { top: 42%; } .rb-title { font-size: clamp(1.8rem, 11cqw, 3rem); } }


/* =====================================================================
   Phones. Portrait: a flowing layout (dealer / banner / seats) instead of
   fixed percentages, so it holds up on any screen shape.
   ===================================================================== */
.plate { max-width: 100%; }
.plate .who-n { min-width: 0; }
.plate .nmt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  .felt { --cw: clamp(36px, 9.6cqw, 58px); --spot: clamp(38px, 10.5cqw, 56px); }
  .felt-art { display: none; }
  .dealer-zone { order: 1; }
  .dealer-hand { --cw: clamp(32px, 8.6cqw, 52px); }
  .status { order: 2; position: relative; left: auto; top: auto; max-width: none; text-align: center; margin: 2px auto 0; }
  .felt-print { order: 3; position: static; inset: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; justify-content: center; margin: auto; width: min(86%, 360px); padding: 10px 12px 26px; border: 2px solid var(--banner); border-radius: 14px 14px 50% 50% / 14px 14px 46px 46px; gap: 3px; }
  .felt-print .a1 { font-size: clamp(0.8rem, 4.6cqw, 1.15rem); }
  .felt-print .a2, .felt-print .a3 { font-size: clamp(0.5rem, 2.6cqw, 0.66rem); }
  .seats { order: 4; position: relative; inset: auto; flex: 0 0 auto; width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; gap: 2px; padding: 0 3px 10px; }
  .seat { position: relative; left: auto; top: auto; transform: none; width: auto; min-width: 0; }
  .seat:nth-child(1), .seat:nth-child(5) { margin-bottom: max(calc(var(--spot) * 1.1 + 12px), 23cqh); }
  .seat:nth-child(2), .seat:nth-child(4) { margin-bottom: max(calc(var(--spot) * 0.5 + 6px), 7cqh); }
  .seat:nth-child(3) { margin-bottom: 0; }
  .seat-hands.multi { --cw: clamp(26px, 6.4cqw, 42px); }
  .plate .avatar { display: none; }
  .plate { padding: 3px 6px; justify-content: center; gap: 4px; }
  .plate .nm { font-size: 0.66rem; }
  .plate .bal { font-size: 0.62rem; }
  .plate .nm .flag { width: 13px; height: 9px; margin-right: 3px; }
  .result-banner { top: 40%; }
}
/* short portrait screens: drop the printed banner so nothing collides */
@media (max-height: 720px) and (max-aspect-ratio: 1/1), (max-height: 720px) and (max-width: 700px) {
  .felt-print, .dealer-label { display: none; }
}

/* =====================================================================
   Phones in landscape (very little height): compact everything.
   ===================================================================== */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .table-top { padding: 4px 12px; }
  .t-sub { display: none; }
  #t-name { font-size: 1rem; }
  .icon-btn { padding: 5px 11px; font-size: 0.75rem; }
  .code-chip { padding: 3px 3px 3px 10px; font-size: 0.7rem; }
  .felt { --cw: clamp(22px, min(4.8cqw, 9cqh), 38px); --spot: clamp(26px, 13cqh, 38px); --hh: calc(var(--cw) * 1.4 + 6px); border-width: 7px; }
  .felt-art, .felt-print, .chip-tray, .dealer-label, .shoe span { display: none; }
  .dealer-zone { padding-top: 6px; }
  .dealer-hand { --cw: clamp(20px, min(4.2cqw, 8cqh), 34px); }
  .shoe { width: 64px; top: 6px; right: 16px; }
  .status { top: 8px; left: 16px; max-width: 30%; }
  .status-msg { font-size: 0.95rem; }
  .seat:nth-child(1) { --y: 66%; } .seat:nth-child(2) { --y: 74%; } .seat:nth-child(3) { --y: 77%; } .seat:nth-child(4) { --y: 74%; } .seat:nth-child(5) { --y: 66%; }
  .plate .avatar { display: none; }
  .plate { padding: 2px 8px; margin-top: 4px; }
  .plate .nm { font-size: 0.66rem; } .plate .bal { font-size: 0.62rem; }
  .bet-spot .amt { font-size: 0.6rem; padding: 0 6px; bottom: -9px; }
  .badge { font-size: 0.8rem; padding: 1px 8px; }
  .phand .badge { margin-top: 3px; }
  .controls { min-height: 62px; padding: 4px 70px 6px; gap: 8px; }
  .rack-chip { width: 38px; }
  .chip-rack { gap: 6px; }
  .bet-timer { display: none; }
  .bet-readout { font-size: 1.15rem; min-width: 58px; }
  .bet-readout small { display: none; }
  .btn { padding: 8px 14px; font-size: 0.78rem; }
  .ctl-msg { font-size: 0.85rem; }
  .decide-head { display: none; }
  .decide { padding: 8px 12px; border-radius: 16px; bottom: 4px; }
  .abtn { flex-direction: row; min-width: 0; padding: 8px 16px; gap: 8px; font-size: 0.75rem; border-radius: 12px; }
  .abtn .ico { width: 20px; height: 20px; }
  .abtn kbd { display: none; }
  .chat-fab { width: 42px; height: 42px; right: 12px; bottom: 10px; }
  .chat { bottom: 60px; height: calc(100vh - 80px); top: auto; }
  .result-banner { top: 42%; }
  .rb-title { font-size: clamp(1.5rem, 9cqh, 2.6rem); }
  .rb-sub { font-size: 1rem; margin-top: 4px; }
  .tt { top: -12px; width: 28px; height: 28px; }
  .tt span { width: 22px; height: 22px; font-size: 0.75rem; }
}

/* ---------- ads, consent, legal ---------- */
.ad-slot { width: 100%; max-width: 728px; margin: 18px auto 0; min-height: 50px; text-align: center; position: relative; }
.ad-slot[hidden] { display: none; }
.ad-label { display: block; font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: #6f7f74; margin-bottom: 3px; }
.ad-preview { border: 1px dashed var(--line); border-radius: 10px; padding: 18px 10px; color: var(--ink-dim); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
/* the table strip only appears where there is genuinely spare height (tall desktop windows) */
.ad-table { display: none; position: relative; z-index: 4; margin: 0 auto 8px; max-width: 728px; max-height: 90px; overflow: hidden; }
@media (min-width: 701px) and (min-height: 860px) { .ad-table:not([hidden]) { display: block; } }
.legal-links { font-size: 0.74rem; color: #6f7f74; margin-top: 10px; }
.legal-links a { color: var(--gold); text-decoration: none; }
.legal-links a:hover { text-decoration: underline; }
.lobby-legal { text-align: center; margin-top: 34px; }
.consent { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 90; width: min(560px, calc(100vw - 20px)); padding: 14px 16px; border-radius: 16px; background: linear-gradient(180deg, #10251b, #08150f); border: 1px solid var(--gold-lo); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); }
.consent p { margin: 0 0 12px; font-size: 0.86rem; line-height: 1.45; color: var(--ink-dim); }
.consent-actions { display: flex; gap: 10px; justify-content: flex-end; }
.consent-actions .btn { padding: 9px 18px; font-size: 0.82rem; }
.doc { max-width: 720px; margin: 0 auto; padding: 32px 20px 60px; line-height: 1.6; color: var(--ink); }
.doc h1 { font-family: var(--serif); font-size: 2.2rem; margin: 0 0 4px; }
.doc h2 { font-family: var(--serif); font-size: 1.4rem; color: var(--gold-hi); margin: 28px 0 6px; }
.doc p, .doc li { color: var(--ink-dim); font-size: 0.95rem; }
.doc a { color: var(--gold); }
.doc .note { border: 1px solid var(--gold-lo); background: rgba(212, 175, 95, 0.08); padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; color: var(--ink); }

.abtn .why { font-family: var(--sans); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.04em; text-transform: none; color: #ffd9a8; opacity: 0.95; white-space: nowrap; }
@media (max-width: 700px) { .abtn .why { font-size: 0.5rem; letter-spacing: 0; } }

/* ---------- Soft 17 branding ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero-logo { width: min(340px, 82vw); height: auto; display: block; margin: 0 auto 10px; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55)); }
.brand { text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 1.15rem; }
.brand-mark { width: 36px; height: 36px; display: block; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
.brand span { background: linear-gradient(180deg, #fff2b8, #e6bf58 60%, #9a7420); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; letter-spacing: 0.08em; text-decoration: none; text-transform: uppercase; }

.flag-slot:empty { display: none; }

/* ---------- quick play, house tables, bots ---------- */
.lobby-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.t-row.house { border-color: var(--gold-lo); background: linear-gradient(160deg, rgba(212, 175, 95, 0.1), rgba(8, 20, 15, 0.82)); }
.house-tag { display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; background: var(--gold); color: #2a1d05; vertical-align: 2px; }
.bot-tag { margin-left: 5px; padding: 1px 5px; border-radius: 4px; font-size: 0.5rem; font-weight: 800; letter-spacing: 0.1em; color: #a9d7ff; border: 1px solid rgba(120, 180, 255, 0.55); background: rgba(40, 90, 160, 0.3); }
@media (max-width: 700px) { .lobby-buttons { width: 100%; } .lobby-buttons .btn { flex: 1; padding: 14px 10px; } }

/* phones: keep name plates inside their seat, even with a BOT tag; keep the banner on one line */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  .plate-wrap { width: 100%; display: flex; justify-content: center; }
  .plate { width: 100%; min-width: 0; }
  .plate .who-n { flex: 1; min-width: 0; align-items: stretch; }
  .plate .nm { min-width: 0; }
  .bot-tag { font-size: 0.42rem; padding: 0 3px; margin-left: 3px; flex: none; }
  .felt-print .a1 { font-size: clamp(0.7rem, 4cqw, 1.05rem); letter-spacing: 0.14em; white-space: nowrap; }
}

.plate .bal { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.plate .bal .bot-tag { margin-left: 2px; }

/* ---------- crawlable content: landing about block and info pages ---------- */
#screen-name { justify-content: flex-start; overflow-y: auto; padding: 0; align-items: center; }
#screen-name .hero { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.about { max-width: 640px; padding: 10px 24px 70px; color: var(--ink-dim); line-height: 1.6; text-align: left; }
.about h2 { font-family: var(--serif); font-size: 1.7rem; color: var(--gold-hi); margin: 0 0 10px; font-weight: 600; }
.about p, .about li { font-size: 0.95rem; }
.about a { color: var(--gold); }
.seo-nav { max-width: 720px; margin: 0 auto; padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seo-nav nav { display: flex; align-items: center; gap: 16px; font-size: 0.85rem; }
.seo-nav nav a { color: var(--ink-dim); text-decoration: none; }
.seo-nav nav a:hover { color: var(--gold-hi); }
.seo-nav .seo-play { padding: 8px 18px; font-size: 0.8rem; color: #2a1d05; }
.doc .lead { font-size: 1.05rem; color: var(--ink); }
.doc h3 { font-size: 1.02rem; color: var(--ink); margin: 18px 0 2px; }
.doc .btn { display: inline-block; text-decoration: none; margin: 10px 0; }
.doc ol li, .doc ul li { margin-bottom: 6px; }
.doc-foot { max-width: 720px; margin: 0 auto; padding: 10px 20px 50px; text-align: center; font-size: 0.78rem; color: #6f7f74; }
.doc-foot a { color: var(--gold); text-decoration: none; }
.seo-nav .doc-brand, .doc-brand { color: var(--gold-hi); }

/* ---------- guide pages ---------- */
.crumbs { font-size: 0.78rem; color: #6f7f74; margin: 0 0 4px; }
.crumbs a { color: var(--gold); text-decoration: none; }
.cmp { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.9rem; }
.cmp th, .cmp td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--ink-dim); vertical-align: top; }
.cmp th { color: var(--gold-hi); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.cmp td:first-child { color: var(--ink); font-weight: 500; }
.gloss dt { font-weight: 700; color: var(--gold-hi); margin-top: 16px; font-family: var(--serif); font-size: 1.2rem; }
.gloss dd { margin: 2px 0 0; color: var(--ink-dim); font-size: 0.95rem; }
.gloss a { color: var(--gold); }
.guide-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.guide-list li { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--panel); }
.guide-list a { color: var(--gold-hi); text-decoration: none; font-size: 1.05rem; }
.guide-list span { color: var(--ink-dim); font-size: 0.88rem; }
.calc { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.calc label { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); flex: 1; min-width: 160px; }
.calc input, .calc select { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); color: var(--ink); padding: 11px 12px; border-radius: 10px; font: inherit; text-transform: none; letter-spacing: 0; }
.fine-print { font-size: 0.8rem !important; color: #6f7f74 !important; }
