/* ==========================================================================
   Dutch — table styles
   ========================================================================== */
:root {
  --bg: #07110c;
  --bg2: #0c1d15;
  --felt-a: #1f7149;
  --felt-b: #0f4029;
  --felt-c: #082a1b;
  --gold: #e8c26c;
  --gold-2: #c18f32;
  --gold-3: #8a5f17;
  --ink: #f4ebd5;
  --ink-dim: #c4bba3;
  --ink-faint: #9b9581;
  --red: #cf3a40;
  --red-2: #8f1a22;
  --card: #fbf7ee;
  --card-edge: #e6dcc6;
  --suit-red: #c42733;
  --suit-black: #1b1c26;
  --line: rgba(232, 194, 108, 0.24);
  --line-strong: rgba(232, 194, 108, 0.5);
  --panel: #0c1c14;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  --display: 'Playfair Display', Georgia, serif;
  --body: 'Crimson Pro', Georgia, serif;
  --cw: 80px;
  --cs: 1;
  --ui: 1; /* interface scale for big screens, set from app.js */
  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: inherit; }
.hidden { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* scrollbars: slim translucent gold thumb, no track (WebKit/Blink get the rounded inset thumb, Firefox the standard thin one) */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: rgba(232, 194, 108, 0.4) transparent; }
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(232, 194, 108, 0.32) padding-box; border: 3px solid transparent; border-radius: 99px; min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(232, 194, 108, 0.55); }
::-webkit-scrollbar-thumb:active { background-color: rgba(232, 194, 108, 0.7); }
::-webkit-scrollbar-button { display: none; }
/* keep the thumb clear of rounded corners */
.modal-body::-webkit-scrollbar-track, .results::-webkit-scrollbar-track { margin: 14px 0; }
.score-wrap::-webkit-scrollbar-track { margin: 0 6px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ---------- ambient background ---------- */
#bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 800px at 50% 35%, rgba(31, 113, 73, 0.32), transparent 70%),
    radial-gradient(900px 600px at 10% 100%, rgba(143, 26, 34, 0.16), transparent 70%),
    var(--bg);
}
#bg::after {
  content: ''; position: absolute; inset: 0; opacity: 0.35; mix-blend-mode: overlay;
  background-image: 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='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#bg .suits { position: absolute; inset: 0; overflow: hidden; }
#bg .suits span {
  position: absolute; bottom: -60px; font-size: 34px; color: rgba(232, 194, 108, 0.06);
  font-family: 'Apple Symbols', 'Segoe UI Symbol', 'DejaVu Sans', sans-serif;
  animation: rise linear infinite;
}
@keyframes rise {
  from { transform: translateY(0) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  to { transform: translateY(-115vh) rotate(160deg); opacity: 0; }
}
body.in-game #bg .suits { display: none; }

.screen { position: fixed; inset: 0; z-index: 1; display: flex; }

/* ---------- typography & controls ---------- */
.logo {
  font-family: var(--display); font-weight: 900; margin: 0; line-height: 1;
  font-size: clamp(64px, 16vw, 116px); letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fbe7ae 0%, #e8c26c 45%, #b6852b 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(50, 28, 4, 0.75));
}
.logo.small { font-size: 32px; filter: drop-shadow(0 2px 0 rgba(50, 28, 4, 0.75)); }
.tagline { font-style: italic; font-size: 20px; color: var(--ink-dim); margin: 8px 0 24px; text-align: center; text-wrap: balance; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); }

.btn {
  font-family: var(--body); font-weight: 700; font-size: 18px; letter-spacing: 0.01em; line-height: 1.1;
  padding: 12px 22px; border-radius: 10px; position: relative; white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, color 0.2s, filter 0.2s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: default; }
.btn.gold {
  color: #2a1904;
  background: linear-gradient(180deg, #f3d792, #dcae52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -2px 0 rgba(120, 78, 12, 0.3), 0 0 0 1px #8a5f17, 0 6px 16px rgba(0, 0, 0, 0.35);
}
.btn.gold:hover:not(:disabled) { filter: brightness(1.06); }
.btn.gold:disabled { color: var(--ink-faint); background: rgba(232, 194, 108, 0.08); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost { color: var(--gold); background: rgba(232, 194, 108, 0.04); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: rgba(232, 194, 108, 0.12); }
.btn.ghost:disabled { color: var(--ink-faint); box-shadow: inset 0 0 0 1px var(--line); }
.btn.big { font-size: 19px; padding: 15px 28px; width: 100%; }
.btn.round { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.btn.round .ico { width: 24px; height: 24px; }
.btn.dutch {
  color: #fff4e0;
  background: linear-gradient(180deg, #d9454c, #a01d27);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(60, 4, 10, 0.35), 0 0 0 1px #5a0a12, 0 6px 16px rgba(0, 0, 0, 0.35);
  font-family: var(--display); font-weight: 900; font-style: italic; letter-spacing: 0.01em; font-size: 19px;
}
.btn.dutch.on { animation: dutchPulse 1.1s ease-in-out infinite; box-shadow: 0 0 0 2px #ffd98a, 0 0 22px rgba(255, 90, 90, 0.5); }
@keyframes dutchPulse { 50% { transform: scale(1.05); } }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  color: var(--gold); background: rgba(232, 194, 108, 0.05); box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(232, 194, 108, 0.14); }
#soundBtn .off, #soundBtn.muted .on { display: none; }
#soundBtn.muted .off { display: block; }
.link-btn { margin-top: 20px; padding: 4px 6px; color: var(--ink-dim); font-size: 17px; font-style: italic; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(232, 194, 108, 0.45); }
.link-btn:hover { color: var(--gold); }
.home-links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 20px; }
.home-links .link-btn { margin-top: 0; }
.credit { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.4; color: var(--ink-faint); text-align: center; text-wrap: balance; }
.credit span { white-space: nowrap; }
.credit a { font-weight: 600; color: var(--ink-dim); letter-spacing: 0.02em; text-decoration: underline; text-decoration-color: rgba(232, 194, 108, 0.35); text-underline-offset: 3px; transition: color 0.2s, text-decoration-color 0.2s; }
.credit a:hover { color: var(--gold); text-decoration-color: var(--gold); }
.credit i { font-style: normal; }
/* the studio line leads; the personal credit sits quieter beside / below it */
.credit span:last-child { font-size: 13px; color: rgba(155, 149, 129, 0.75); }
.credit span:last-child a { font-weight: 500; color: var(--ink-faint); letter-spacing: 0; text-decoration-color: rgba(232, 194, 108, 0.2); }
.credit span:last-child a:hover { color: var(--gold); text-decoration-color: var(--gold); }
@media (max-width: 520px) { .credit span { display: block; } .credit i { display: none; } .credit span:last-child::first-letter { text-transform: uppercase; } }
/* language picker: a native select (best on phones) dressed as a small pill with a globe */
.lang-pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 99px; color: var(--ink-dim); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: color 0.2s, box-shadow 0.2s; }
.lang-pick:hover, .lang-pick:focus-within { color: var(--gold); box-shadow: inset 0 0 0 1px var(--line-strong); }
.lang-pick .ico { width: 18px; height: 18px; flex: none; }
/* as wide as the chosen language, not the longest option (app.js measures it where field-sizing is missing) */
.lang-select { field-sizing: content; appearance: none; -webkit-appearance: none; background: none; border: 0; outline: none; color: inherit; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; padding: 0; }
.lang-select option { color: var(--ink); background: #10241a; }
.modal-body > .lang-pick { float: right; margin: 3px 46px 8px 12px; }

.panel {
  background: linear-gradient(180deg, #102419, #0a1811);
  border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.panel-title { font-family: var(--display); font-weight: 700; font-size: 21px; color: var(--gold); margin: -2px 0 14px; display: flex; justify-content: space-between; align-items: baseline; }
.panel-title #playerCount { font-family: var(--body); font-weight: 600; font-size: 16px; color: var(--ink-dim); }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }
input#nameInput, input.code-in {
  width: 100%; padding: 13px 16px; border-radius: 10px; font-size: 21px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(232, 194, 108, 0.3); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; user-select: text; -webkit-user-select: text;
}
input:focus, input:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 194, 108, 0.16); }
input::placeholder { color: rgba(244, 235, 213, 0.36); }
input.code-in { text-transform: uppercase; letter-spacing: 0.3em; font-family: var(--display); font-weight: 700; font-size: 19px; text-align: center; }
input.code-in::placeholder { letter-spacing: 0.2em; font-weight: 600; }

/* ---------- home ---------- */
#home { flex-direction: column; align-items: center; overflow-y: auto; scroll-behavior: smooth; padding: 24px 16px calc(24px + var(--safe-b)); }
/* the app fills the first screen; the about section waits below the fold */
.home-hero { flex: none; width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; }
.about-cue { margin-top: 18px; padding: 4px 8px; font-size: 15px; font-style: italic; color: var(--ink-faint); text-decoration: none; transition: color 0.2s; }
.about-cue::after { content: ''; display: block; width: 8px; height: 8px; margin: 4px auto 0; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.about-cue:hover { color: var(--gold); }
.about {
  flex: none; width: 100%; max-width: 640px; margin: 32px 0 8px; padding: 26px 24px 22px; zoom: var(--ui);
  background: linear-gradient(180deg, #102419, #0a1811); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04); user-select: text; -webkit-user-select: text;
}
.about > h2 { margin-right: 0; }
#aboutRules { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
#aboutRules h2 { font-size: 26px; }
.home-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; margin: auto; zoom: var(--ui); }
.home-panel { width: 100%; animation: popIn 0.6s 0.2s var(--ease) both; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--ink-faint); font-style: italic; font-size: 17px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; min-width: 0; }
.join-row .btn { padding-left: 24px; padding-right: 24px; }
/* public / private picker (home screen and lobby) */
.vis-pick { margin: 0 0 16px; }
.vis-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 6px; }
.vis-seg .ico { width: 17px; height: 17px; flex: none; }
.vis-hint { margin: 7px 2px 0; font-size: 15px; line-height: 1.3; color: var(--ink-faint); text-align: center; text-wrap: balance; }
.lobby-vis { max-width: 340px; margin: 16px auto 0; }

/* room browser */
.rooms-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 11px; border-radius: 99px; font-size: 16px; font-weight: 700;
  color: var(--gold); background: rgba(232, 194, 108, 0.07); box-shadow: inset 0 0 0 1px var(--line-strong); transition: background 0.2s;
}
.rooms-pill:hover { background: rgba(232, 194, 108, 0.15); }
.rooms-pill .ico { width: 18px; height: 18px; flex: none; }
.rooms-pill b { min-width: 21px; padding: 1px 6px; border-radius: 99px; font-size: 13px; line-height: 18px; text-align: center; color: #2a1904; background: linear-gradient(180deg, #f0d189, #d3a447); }
.rooms-head h2 { margin-right: 92px; margin-bottom: 14px; }
/* sits beside the close button, centred on the same line */
#refreshRooms { position: absolute; top: 14px; right: 58px; z-index: 1; }
.modal .room-list { padding: 0; margin: 0; }
.rooms-name { margin-bottom: 14px; }
.rooms-name input { width: 100%; padding: 10px 14px; border-radius: 10px; font-size: 19px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(232, 194, 108, 0.3); user-select: text; -webkit-user-select: text; }
.back-link { display: block; margin: -4px 0 10px; padding: 2px 0; font-size: 16px; font-weight: 600; color: var(--ink-dim); }
.back-link:hover { color: var(--gold); }
.modal.mid .modal-card { width: min(100%, 500px); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm .ico { width: 17px; height: 17px; }
.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-list:empty { display: none; }
.room {
  display: flex; align-items: center; gap: 11px; padding: 8px 8px 8px 9px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06);
}
.room .av { width: 34px; height: 34px; font-size: 19px; }
.rm-main { flex: 1; min-width: 0; }
.rm-name { font-size: 18px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; font-size: 14px; color: var(--ink-faint); }
.rm-meta .ico { width: 14px; height: 14px; stroke-width: 2; }
.rm-n, .rm-priv { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.rm-priv { color: var(--gold); }
.rm-st { white-space: nowrap; }
.rm-st.live { color: #9fdc85; }
.rm-st.live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #8bd06b; margin-right: 5px; vertical-align: 2px; }
.rm-go { flex: none; padding: 8px 14px; font-size: 16px; display: inline-flex; align-items: center; gap: 6px; }
.rm-go .ico { width: 15px; height: 15px; }
.rm-go.watch { color: var(--ink-dim); box-shadow: inset 0 0 0 1px var(--line); }
.modal .room-empty { margin: 0; padding: 10px 4px 4px; font-size: 16px; font-style: italic; color: var(--ink-faint); text-align: center; text-wrap: balance; }
.modal.narrow .modal-card { width: min(100%, 420px); }
.modal h2 .ico { display: inline-block; width: 24px; height: 24px; margin-right: 8px; vertical-align: -2px; }
.priv-row { margin-top: 16px; }

.invite-note { text-align: center; margin: -4px 0 16px; font-size: 19px; color: var(--ink-dim); }
.invite-note b { font-family: var(--display); color: var(--gold); letter-spacing: 0.16em; }

.hero-fan { position: relative; width: 260px; height: 150px; margin-bottom: -2px; }
.hero-fan .card { position: absolute; left: 50%; bottom: 0; margin-left: calc(var(--cw) / -2); transform-origin: 50% 230%; animation: fanIn 0.9s var(--ease) both; }
.hero-fan .card .lift { animation: bob 5s ease-in-out infinite; }
@keyframes fanIn { from { transform: rotate(0) translateY(40px); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------- lobby ---------- */
#lobby { overflow-x: hidden; overflow-y: auto; justify-content: center; padding: 16px 16px 0; }
.lobby-wrap { width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 16px; margin: 0 auto auto; zoom: var(--ui); }
.lobby-head { display: flex; align-items: center; justify-content: space-between; }
.code-panel { text-align: center; animation: popIn 0.5s var(--ease) both; }
.big-code {
  font-family: var(--display); font-weight: 800; font-size: clamp(44px, 12vw, 72px); letter-spacing: 0.2em; margin: 4px 0 14px 0.2em; line-height: 1.15;
  color: var(--gold); text-shadow: 0 3px 0 rgba(50, 28, 4, 0.8);
  user-select: text; -webkit-user-select: text;
}
.share-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; align-items: start; }
.lobby-grid .panel { animation: popIn 0.5s 0.1s var(--ease) both; }
@media (max-width: 700px) { .lobby-grid { grid-template-columns: 1fr; } }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 8px; border-radius: 10px; min-height: 52px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06);
  animation: slideIn 0.4s var(--ease) both; font-size: 19px; font-weight: 600;
}
.player-list li.off { opacity: 0.5; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } }
.player-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .tag { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); padding: 3px 9px; border-radius: 99px; background: rgba(232, 194, 108, 0.12); }
.player-list .tag.bot { color: #a8dcf0; background: rgba(88, 194, 227, 0.14); }
.player-list .kick { color: var(--ink-dim); font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 8px; flex: none; }
.player-list .kick:hover { color: #ff9d92; background: rgba(255, 110, 100, 0.12); }
.add-bot {
  width: 100%; margin-top: 8px; padding: 11px; border-radius: 10px; font-weight: 700; font-size: 17px;
  color: var(--ink-dim); border: 1px dashed rgba(232, 194, 108, 0.4); transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.add-bot:hover { color: var(--gold); border-color: var(--gold); background: rgba(232, 194, 108, 0.06); }
.solo-hint { margin: 12px 4px 0; color: var(--ink-faint); font-size: 16px; text-align: center; line-height: 1.35; }
.spec-list { margin-top: 10px; color: var(--ink-faint); font-style: italic; font-size: 16px; }
.spec-list:empty { display: none; }
.av {
  --c: #e8b84f; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; flex: none; position: relative;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, white), var(--c) 55%, color-mix(in srgb, var(--c) 60%, black));
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.35);
}
.settings { display: flex; flex-direction: column; gap: 16px; }
.setting .lbl { font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 7px; display: block; }
.setting .hint { font-size: 15px; color: var(--ink-faint); margin-top: 6px; line-height: 1.3; }
.seg { display: flex; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line); background: rgba(0, 0, 0, 0.25); padding: 2px; }
.seg button {
  flex: 1 1 0; min-width: 0; padding: 7px 4px; border-radius: 7px; font-weight: 600; font-size: 16px;
  color: var(--ink-dim); transition: background 0.2s, color 0.2s;
}
.seg button:hover:not(.on) { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.seg button.on { background: linear-gradient(180deg, #f0d189, #d3a447); color: #2a1904; font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.seg.ro button { cursor: default; }
.seg.ro button:hover:not(.on) { background: none; color: var(--ink-dim); }
.seg.ro button:not(.on) { opacity: 0.55; }
.lobby-foot { text-align: center; max-width: 420px; width: 100%; margin: 4px auto 0; position: sticky; bottom: 0; padding: 12px 0 calc(10px + var(--safe-b)); z-index: 3; }
/* fade pinned to the bottom edge of the window, so it never ends in a visible line when the content is short */
.lobby-foot::before { content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: calc(96px + var(--safe-b)); background: linear-gradient(180deg, transparent, rgba(7, 17, 12, 0.92) 55%); z-index: -1; pointer-events: none; }
.lobby-foot .wait-note { margin: 6px 0; }
.wait-note { font-style: italic; color: var(--ink-dim); font-size: 19px; }
.wait-note::after { content: '…'; animation: dots 1.4s steps(4) infinite; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; }

/* ---------- game layout ---------- */
#game { flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  position: relative; z-index: 5; zoom: var(--ui);
}
.topbar .spacer { flex: 1; }
.chip {
  font-weight: 600; font-size: 15px; padding: 7px 12px; border-radius: 99px; white-space: nowrap; line-height: 1.2;
  color: var(--ink-dim); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
#codeChip { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.14em; color: var(--gold); background: rgba(232, 194, 108, 0.06); box-shadow: inset 0 0 0 1px var(--line-strong); }
#codeChip:hover { background: rgba(232, 194, 108, 0.14); }

#table { position: relative; flex: 1; min-height: 0; margin: 0 8px; isolation: isolate; z-index: 1; } /* keep card z-indexes inside the table */
.felt {
  position: absolute; inset: 0; border-radius: 44px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(ellipse at 50% 50%, var(--felt-a) 0%, var(--felt-b) 62%, var(--felt-c) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(232, 194, 108, 0.35), inset 0 0 0 9px rgba(20, 10, 2, 0.55), inset 0 0 0 10px rgba(232, 194, 108, 0.16),
    inset 0 0 80px rgba(0, 0, 0, 0.55), 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.felt::before {
  content: ''; position: absolute; inset: 0; opacity: 0.5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#actions {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 12px calc(10px + var(--safe-b)); position: relative; z-index: 6; min-height: 68px; zoom: var(--ui);
}
#actions .act { min-width: 104px; padding: 12px 18px; }
#matchBtn.armed { background: rgba(207, 58, 64, 0.22); color: #ffe0d6; box-shadow: inset 0 0 0 1px #ff8a7a; animation: dutchPulse 0.9s infinite; }
.react-wrap { position: absolute; left: 12px; bottom: calc(11px + var(--safe-b)); }
#reactBtn { color: var(--ink-dim); }
#reactBtn:hover { color: var(--gold); }
.react-tray {
  position: absolute; bottom: 56px; left: 0; display: grid; grid-template-columns: repeat(4, 44px); gap: 4px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); animation: popIn 0.2s var(--ease);
}
.react-tray button { font-size: 26px; height: 44px; border-radius: 8px; transition: transform 0.15s; }
.react-tray button:hover { transform: scale(1.15); background: rgba(255, 255, 255, 0.06); }
@media (max-width: 520px) {
  #actions { justify-content: flex-end; padding-left: 66px; }
  /* longer translations wrap onto two lines instead of overflowing; same 44px height either way */
  #actions .act { min-width: 0; flex: 1 1 auto; min-height: 44px; padding: 4px 8px; font-size: 17px; white-space: normal; text-wrap: balance; line-height: 1.05; }
  .btn.dutch { font-size: 18px; }
}

/* ---------- slots & deck ---------- */
#table.instant .slot, #table.instant .deck, #table.instant .plate, #table.instant .banner, #table.instant .held-label, #table.instant .clock { transition: none !important; }
#slots > * { position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4); transform-origin: 50% 50%; }
.slot {
  border-radius: calc(var(--cw) * 0.09); border: calc(1.5px / var(--cs)) dashed rgba(232, 194, 108, 0.3); display: grid; place-items: center;
  transition: transform 0.5s var(--ease), opacity 0.3s;
}
/* slots are scaled down with the centre row; divide by --cs so the label stays a readable size */
.slot span { font-size: calc(12px * var(--ui) / var(--cs)); font-weight: 600; font-style: italic; color: rgba(232, 194, 108, 0.55); }
.slot.held { border: 0; opacity: 0; pointer-events: none; }
.held-label {
  position: absolute; left: 0; top: 0; z-index: 350; pointer-events: none; white-space: nowrap;
  font-size: calc(14px * var(--ui)); font-weight: 600; font-style: italic; color: var(--gold); text-shadow: 0 1px 2px #000, 0 0 8px rgba(0, 0, 0, 0.6);
  opacity: 0; transition: opacity 0.3s, transform 0.5s var(--ease);
}
.held-label.on { opacity: 1; }
.deck { border-radius: calc(var(--cw) * 0.09); transition: transform 0.5s var(--ease); cursor: default; }
.deck::before, .deck::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.deck::before {
  background: var(--back);
  box-shadow: 1px 1px 0 #d8ccb2, 2px 2px 0 #b9ad94, 3px 3px 0 #d8ccb2, 4px 4px 0 #b9ad94, 5px 5px 0 #d8ccb2, 6px 7px 12px rgba(0, 0, 0, 0.5);
}
.deck.thin::before { box-shadow: 1px 1px 0 #d8ccb2, 2px 2px 0 #b9ad94, 3px 4px 8px rgba(0, 0, 0, 0.5); }
.deck.empty::before { opacity: 0.15; box-shadow: none; }
.deck.empty::after { opacity: 0.25; }
/* same face as a card back: cream border, gold inner rule, monogram */
.deck::after {
  content: 'D'; display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; font-size: calc(var(--cw) * 0.3); color: #f6d58a; text-shadow: 0 1px 0 #4a0814, 0 0 10px rgba(255, 200, 100, 0.5);
  border: calc(var(--cw) * 0.045) solid var(--card);
  outline: 1px solid rgba(232, 194, 108, 0.75); outline-offset: calc(var(--cw) * -0.07 - 1px);
}
.deck.sel { cursor: pointer; }
.deck.sel::before { animation: glowPulse 1.3s ease-in-out infinite; }
.deck-count {
  --k: calc(var(--ui) / var(--cs)); /* readable size regardless of how far the centre row is scaled */
  position: absolute; top: calc(-9px * var(--k)); left: calc(-9px * var(--k)); z-index: 2;
  min-width: calc(24px * var(--k)); height: calc(24px * var(--k)); padding: 0 calc(6px * var(--k)); border-radius: 99px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: calc(12px * var(--k)); color: #2a1904;
  background: linear-gradient(180deg, #f3d792, #d0a046); box-shadow: 0 0 0 calc(1px / var(--cs)) #8a5f17, 0 2px 6px rgba(0, 0, 0, 0.5);
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 220, 130, 0.9), 0 0 16px 3px rgba(255, 210, 110, 0.5); }
  50% { box-shadow: 0 0 0 3px rgba(255, 236, 170, 1), 0 0 26px 7px rgba(255, 210, 110, 0.75); }
}

/* ---------- cards ---------- */
:root {
  --back:
    radial-gradient(circle at 50% 50%, rgba(255, 214, 130, 0.35) 0 12%, transparent 13%),
    radial-gradient(circle at 50% 50%, transparent 0 20%, rgba(255, 214, 130, 0.25) 21% 22%, transparent 23%),
    repeating-linear-gradient(45deg, rgba(255, 220, 160, 0.12) 0 1.5px, transparent 1.5px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 220, 160, 0.12) 0 1.5px, transparent 1.5px 9px),
    radial-gradient(ellipse at 50% 40%, #a22134, #6c0f1f 70%, #4a0814);
}
#cards { position: absolute; inset: 0; pointer-events: none; }
.card {
  position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4);
  transition: transform 0.55s var(--ease), opacity 0.4s; will-change: transform; pointer-events: auto;
  transform-origin: 50% 50%;
}
.card.instant, .card.instant .flip { transition: none !important; }
.card .lift { position: absolute; inset: 0; transition: transform 0.25s var(--ease); }
.card .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.55s var(--ease); }
.card.up .flip { transform: rotateY(180deg); }
.card .face {
  position: absolute; inset: 0; border-radius: calc(var(--cw) * 0.09); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 calc(var(--cw) * 0.05) calc(var(--cw) * 0.12) rgba(0, 0, 0, 0.35);
}
.card .back {
  background: var(--back); border: calc(var(--cw) * 0.045) solid var(--card);
}
.card .back::before {
  content: ''; position: absolute; inset: calc(var(--cw) * 0.025); border-radius: calc(var(--cw) * 0.05);
  border: 1px solid rgba(232, 194, 108, 0.75);
}
.card .back::after {
  content: 'D'; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; font-size: calc(var(--cw) * 0.3); color: #f6d58a; text-shadow: 0 1px 0 #4a0814, 0 0 10px rgba(255, 200, 100, 0.5);
}
.card .front { transform: rotateY(180deg); background: linear-gradient(160deg, #fffdf6, var(--card) 60%, #f1e8d4); }

.cf { position: absolute; inset: 0; font-family: var(--display); }
.cf.red { color: var(--suit-red); }
.cf.black { color: var(--suit-black); }
/* rank-over-suit stacks are SVGs laid out from measured glyph ink (see rankStack in app.js) */
.cf .stack { display: block; height: auto; overflow: visible; }
.cf .stack text { font-family: var(--display); font-weight: 800; font-variant-numeric: normal; }
/* corner index: a narrow column in the very corner (≈ 4–25% of the width) */
.cf .idx { position: absolute; width: calc(var(--cw) * 0.21); }
.cf .idx.tl { left: calc(var(--cw) * 0.04); top: calc(var(--cw) * 0.05); }
.cf .idx.br { right: calc(var(--cw) * 0.04); bottom: calc(var(--cw) * 0.05); transform: rotate(180deg); }
/* centre panel (number + court cards) sits between the index columns with clear space on both sides */
.cf .frame, .cf .court { position: absolute; left: 30%; right: 30%; top: 13%; bottom: 13%; border-radius: calc(var(--cw) * 0.05); }
.cf .frame { display: grid; place-items: center; }
.cf .frame .sym { width: calc(var(--cw) * 0.3); height: calc(var(--cw) * 0.3); }
.cf .ace { position: absolute; inset: 0; display: grid; place-items: center; }
.cf .ace .sym { width: calc(var(--cw) * 0.34); height: calc(var(--cw) * 0.34); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.08)); }
.cf .court {
  background:
    repeating-linear-gradient(45deg, rgba(193, 143, 50, 0.1) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #fff6dc, #f3dfae);
  box-shadow: inset 0 0 0 1.5px currentColor, inset 0 0 0 calc(var(--cw) * 0.025) #fff6dc, inset 0 0 0 calc(var(--cw) * 0.033) rgba(193, 143, 50, 0.8);
  display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
}
.cf .court .crown { width: 52%; height: auto; margin-bottom: 4%; fill: #c99636; }
.cf .court .court-stack { width: calc(var(--cw) * 0.24); }
.cf .tag {
  position: absolute; left: 50%; bottom: calc(var(--cw) * 0.03); transform: translateX(-50%);
  font-family: var(--body); font-weight: 700; font-size: calc(var(--cw) * 0.1); line-height: 1.2; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0 calc(var(--cw) * 0.05); border-radius: 99px; background: rgba(193, 143, 50, 0.2); color: #6e4a0e; white-space: nowrap;
}

.card .memo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: calc(var(--cw) * 0.03) calc(var(--cw) * 0.07);
  border-radius: calc(var(--cw) * 0.06); background: rgba(251, 247, 238, 0.95); font-family: var(--display); font-weight: 800;
  font-size: calc(var(--cw) * 0.22); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap;
}
.card .memo.red { color: var(--suit-red); }
.card .memo.black { color: var(--suit-black); }
.card .memo.show { opacity: 1; }
.card.up .memo { opacity: 0; }

/* card states */
.card.sel { cursor: pointer; }
.card.sel .face { animation: glowPulse 1.3s ease-in-out infinite; }
@media (hover: hover) { .card.sel:hover .lift { transform: translateY(-8%) scale(1.04); } }
.card.picked .lift { transform: translateY(-12%) scale(1.06); }
.card.picked .face { box-shadow: 0 0 0 3px #7fe0ff, 0 0 24px 6px rgba(127, 224, 255, 0.7) !important; animation: none; }
.card.peeking .lift { transform: translateY(-14%) scale(1.08); }
.card.peeked .lift { animation: peeked 1.6s var(--ease); }
@keyframes peeked { 20%, 70% { transform: translateY(-14%) rotate(-6deg); } }
.card.wrong .lift { animation: shake 0.6s; }
.card.wrong .front { box-shadow: 0 0 0 3px var(--red), 0 0 24px rgba(255, 60, 60, 0.7); }
@keyframes shake { 15%, 55% { transform: translateX(-9%) rotate(-5deg); } 35%, 75% { transform: translateX(9%) rotate(5deg); } }
#table.matching .card.mine .lift { animation: wiggle 0.5s ease-in-out infinite; }
@keyframes wiggle { 25% { transform: rotate(-3deg) translateY(-3%); } 75% { transform: rotate(3deg) translateY(-3%); } }
/* another player's move: the card about to leave lifts and glows, then everything travels a bit slower */
.card.slow { transition-duration: 0.85s; }
.card.slow .flip { transition-duration: 0.85s; }
.card.aim .lift { transform: translateY(-20%) scale(1.1); transition-duration: 0.3s; }
.card.aim .face { box-shadow: 0 0 0 3px #ffe7a0, 0 0 30px 8px rgba(255, 210, 110, 0.75), 0 14px 26px rgba(0, 0, 0, 0.55); }
.card.dim { filter: brightness(0.7) saturate(0.7); }
.card.held-glow .face { box-shadow: 0 0 0 2px rgba(255, 230, 160, 0.9), 0 0 26px 5px rgba(255, 210, 110, 0.45), 0 10px 22px rgba(0, 0, 0, 0.5); }

/* ---------- seats ---------- */
/* plates draw above cards so a lifted or peeking card never hides a name or the turn timer */
#seats { position: absolute; inset: 0; pointer-events: none; z-index: 320; }
.plate {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 7px; padding: 3px 12px 3px 3px; border-radius: 99px;
  background: rgba(5, 15, 10, 0.82); box-shadow: inset 0 0 0 1px rgba(232, 194, 108, 0.22), 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.5s var(--ease), box-shadow 0.3s, opacity 0.3s; white-space: nowrap; pointer-events: auto; max-width: calc(46vw / var(--ui));
}
.plate .av { width: 26px; height: 26px; font-size: 15px; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.4); z-index: 1; } /* above the timer outline, bot mark included */
/* small robot mark on bot avatars */
.plate.bot .av::after {
  content: ''; position: absolute; right: -4px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%;
  background: #12303d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='%23a8dcf0' stroke-width='1.6' stroke-linecap='round'%3E%3Crect x='3.5' y='6' width='9' height='6.5' rx='2'/%3E%3Cpath d='M8 6V3.5'/%3E%3C/g%3E%3Ccircle cx='6.3' cy='9.2' r='1' fill='%23a8dcf0'/%3E%3Ccircle cx='9.7' cy='9.2' r='1' fill='%23a8dcf0'/%3E%3C/svg%3E") center / 11px no-repeat;
  box-shadow: 0 0 0 1.5px rgba(5, 15, 10, 0.9);
}
.plate .nm { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; max-width: 130px; min-width: 0; flex: 0 1 auto; }
.plate .sc { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--gold); padding-left: 2px; }
.plate .bd { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.plate .bd:empty { display: none; }
.plate .bd .ico { width: 14px; height: 14px; }
.plate .bd .lock { color: #ff9d92; }
.plate .bd .fx { color: var(--gold); font-size: 14px; line-height: 1; }
.plate .bd .away { font-style: italic; color: var(--ink-faint); font-size: 14px; }
.plate .bd .dutch-b { font-family: var(--display); font-weight: 900; font-style: italic; font-size: 12px; line-height: 1.3; color: #fff; background: var(--red); padding: 0 7px; border-radius: 99px; }
.plate .clock { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
.plate .clock path { fill: none; stroke-width: 3; }
.plate .clock .trk { stroke: rgba(232, 194, 108, 0.22); }
.plate .clock .arc { stroke: var(--gold); stroke-dasharray: 100 100; filter: drop-shadow(0 0 3px rgba(232, 194, 108, 0.6)); }
.plate.turn { box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 0 3px rgba(232, 194, 108, 0.22), 0 0 22px rgba(232, 194, 108, 0.45); background: rgba(38, 28, 6, 0.9); }
/* with a turn timer, the draining outline replaces the static gold rim */
.plate.turn.timed { box-shadow: 0 0 22px rgba(232, 194, 108, 0.35), 0 4px 12px rgba(0, 0, 0, 0.35); }
.plate.timed .clock { opacity: 1; }
.plate.off { opacity: 0.55; }
.plate.target { cursor: pointer; animation: glowPulse 1.3s infinite; }
.plate.me .nm::after { content: ' (' attr(data-you) ')'; font-weight: 500; font-style: italic; color: var(--ink-dim); }
.plate.small .nm { font-size: 15px; max-width: 84px; }
.plate.small .av { width: 22px; height: 22px; font-size: 13px; }
.plate.me { max-width: calc(80vw / var(--ui)); }
.plate.me .nm { max-width: 180px; }

/* ---------- banner ---------- */
/* anchored by its top edge (just under the centre row) so a wrapped two-line message grows away from the cards */
.banner {
  position: absolute; left: 0; top: 0; transform: translate(-50%, 0) scale(var(--ui)); transform-origin: 50% 0; z-index: 400; pointer-events: none;
  padding: 7px 18px; border-radius: 18px; width: max-content; max-width: min(calc((100% - 24px) / var(--ui)), 660px); text-align: center;
  font-family: var(--display); font-style: italic; font-weight: 600; font-size: clamp(15px, 2vw, 18px); line-height: 1.3; text-wrap: balance;
  background: rgba(5, 15, 10, 0.86); box-shadow: inset 0 0 0 1px rgba(232, 194, 108, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s, left 0.4s var(--ease), top 0.4s var(--ease);
}
.banner.hot { color: #fff3cf; box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 20px rgba(232, 194, 108, 0.35); animation: bannerIn 0.45s var(--ease); }
.banner.alert { box-shadow: inset 0 0 0 1.5px #ff7d72, 0 0 20px rgba(255, 90, 80, 0.4); }
.banner b { font-style: normal; font-weight: 700; color: var(--gold); }
.banner:empty { opacity: 0; }
@keyframes bannerIn { from { transform: translate(-50%, 0) scale(calc(var(--ui) * 0.9)); opacity: 0; } }

/* ---------- floating fx ---------- */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 900; overflow: visible; }
.float {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 800; font-size: calc(18px * var(--ui)); white-space: nowrap;
  padding: 0.17em 0.78em; border-radius: 99px; background: rgba(5, 15, 10, 0.88); box-shadow: inset 0 0 0 1px var(--line-strong), 0 6px 16px rgba(0, 0, 0, 0.4);
  color: #fff3cf; animation: floatUp 1.8s var(--ease) forwards;
}
.float.bad { color: #ffc2b8; box-shadow: inset 0 0 0 1px rgba(255, 125, 114, 0.7), 0 6px 16px rgba(0, 0, 0, 0.4); }
.float.emoji { font-size: calc(44px * var(--ui)); padding: 0; background: none; box-shadow: none; animation-duration: 2.4s; text-shadow: 0 6px 14px rgba(0, 0, 0, 0.4); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -80%) scale(1.08); }
  30% { transform: translate(-50%, -90%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -200%) scale(0.95); }
}
.ring {
  position: absolute; width: 20px; height: 20px; border-radius: 50%; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(255, 225, 150, 0.9); animation: ring 0.7s ease-out forwards;
}
@keyframes ring { to { width: 180px; height: 180px; opacity: 0; box-shadow: 0 0 0 1px rgba(255, 225, 150, 0); } }

/* ---------- Dutch stamp ---------- */
.stamp { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(120, 10, 20, 0.35), transparent 60%); animation: fadeOut 2.2s forwards; }
.stamp span {
  font-family: var(--display); font-weight: 900; font-size: clamp(70px, 20vw, calc(190px * var(--ui))); color: #ffefd2; padding: 0.05em 0.35em; border-radius: 0.12em;
  border: 0.05em solid #ffefd2; background: rgba(170, 20, 32, 0.9); transform: rotate(-12deg);
  text-shadow: 0 4px 0 #5a0710; box-shadow: 0 0 0 0.03em #5a0710, 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: stampIn 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.stamp small { display: block; text-align: center; font-family: var(--body); font-weight: 700; font-size: 0.2em; letter-spacing: 0.06em; margin-top: -0.15em; text-shadow: 0 2px 0 #5a0710; }
@keyframes stampIn { from { transform: rotate(-12deg) scale(3); opacity: 0; } }
@keyframes fadeOut { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- results ---------- */
.results {
  position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 1500; zoom: var(--ui);
  width: min(calc(94vw / var(--ui)), 560px); max-height: calc(88vh / var(--ui)); overflow: auto;
  background: linear-gradient(180deg, #13291d, #08140e); border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 24px 20px 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: resultsIn 0.6s var(--ease);
}
@keyframes resultsIn { from { opacity: 0; transform: translateY(24px); } }
.results h3 { font-family: var(--display); font-weight: 900; font-size: 32px; text-align: center; margin: 0; color: var(--gold); line-height: 1.15; }
.results .sub { text-align: center; font-style: italic; color: var(--ink-dim); margin: 6px 0 18px; font-size: 19px; }
.results .sub b { color: var(--ink); font-style: normal; }
.res-row {
  display: grid; grid-template-columns: 26px 32px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.035); margin-bottom: 6px; animation: slideIn 0.5s var(--ease) both;
}
.res-row.best { background: linear-gradient(90deg, rgba(232, 194, 108, 0.18), rgba(232, 194, 108, 0.04)); box-shadow: inset 0 0 0 1px rgba(232, 194, 108, 0.45); }
.res-row .rk { font-family: var(--display); font-weight: 800; font-size: 16px; color: var(--ink-faint); text-align: center; display: grid; place-items: center; }
.res-row .rk .crown { width: 22px; height: auto; fill: var(--gold); }
.res-row .av { width: 30px; height: 30px; font-size: 17px; }
.res-row .nm { font-weight: 700; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.res-row .nm small { display: block; font-weight: 500; font-style: italic; color: var(--ink-dim); font-size: 15px; }
.res-row .pts { font-size: 16px; color: var(--ink-dim); text-align: right; line-height: 1.25; }
.res-row .pts .pen { color: #ff9b8f; font-weight: 700; }
.res-row .pts small { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.res-row .pts b { color: var(--ink); font-family: var(--display); font-weight: 700; }
.res-row .tot { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--gold); min-width: 48px; text-align: right; }
.res-actions { display: flex; gap: 10px; margin-top: 16px; }
.res-actions .btn { flex: 1; }
.results .trophy { display: grid; place-items: center; margin: 2px 0 10px; }
.results .trophy .crown { width: 72px; height: auto; fill: var(--gold); filter: drop-shadow(0 3px 0 rgba(50, 28, 4, 0.8)); animation: bob 2.4s ease-in-out infinite; }
.results-pill {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(84px + var(--safe-b)); z-index: 1400; zoom: var(--ui);
  font-weight: 700; font-size: 18px; padding: 11px 24px; border-radius: 99px; color: #2a1904;
  background: linear-gradient(180deg, #f3d792, #d0a046); box-shadow: 0 0 0 1px #8a5f17, 0 10px 30px rgba(0, 0, 0, 0.5);
}
@media (max-width: 520px) {
  .results { padding: 20px 12px 14px; }
  .results h3 { font-size: 27px; }
  .res-row { grid-template-columns: 20px 28px minmax(0, 1fr) auto auto; gap: 8px; padding: 7px 10px 7px 6px; }
  .res-row .av { width: 28px; height: 28px; font-size: 15px; }
  .res-row .pts { font-size: 15px; }
  .res-row .tot { font-size: 20px; min-width: 34px; }
  .res-row .nm { font-size: 17px; }
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: rgba(2, 8, 5, 0.72); padding: 16px; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  position: relative; width: min(100%, 620px); max-height: calc(86vh / var(--ui)); display: flex; zoom: var(--ui); flex-direction: column; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #13281d, #0a1811); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: popIn 0.3s var(--ease); user-select: text; -webkit-user-select: text;
}
/* the body scrolls; the close button stays put */
.modal-body { overflow: auto; padding: 24px 24px 26px; min-height: 0; overscroll-behavior: contain; }
.modal-x { position: absolute; right: 10px; top: 10px; z-index: 1; font-size: 28px; line-height: 1; color: var(--ink-dim); width: 40px; height: 40px; border-radius: 10px; background: #12271b; box-shadow: inset 0 0 0 1px var(--line), 0 4px 12px rgba(0, 0, 0, 0.4); }
.modal-x:hover { color: var(--gold); background: rgba(232, 194, 108, 0.12); }
.modal h2, .prose h2 { font-family: var(--display); font-weight: 900; color: var(--gold); margin: 0 44px 10px 0; font-size: 30px; line-height: 1.15; }
.modal h4, .prose h4 { font-family: var(--display); font-weight: 700; color: var(--gold); font-size: 19px; margin: 22px 0 6px; }
.modal p, .modal li, .prose p, .prose li { font-size: 18px; line-height: 1.5; color: #e9e0c9; margin: 6px 0; }
.modal b, .prose b { color: var(--ink); font-weight: 700; }
.modal ul, .prose ul { padding-left: 20px; margin: 6px 0; }
.modal .fx-list, .prose .fx-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; margin-top: 10px; }
.modal .fx-list .k, .prose .fx-list .k { font-family: var(--display); font-weight: 800; font-size: 20px; width: 40px; height: 54px; border-radius: 6px; background: var(--card); display: grid; place-items: center; color: var(--suit-black); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.modal .fx-list .k.r, .prose .fx-list .k.r { color: var(--suit-red); }
.suit-t { font-family: 'Apple Symbols', 'Segoe UI Symbol', 'DejaVu Sans', sans-serif; font-weight: 400; }
.suit-t.r { color: #ff8a8f; }
.score-table { width: 100%; border-collapse: collapse; font-size: 17px; margin-top: 12px; }
.score-table th, .score-table td { padding: 9px 6px; text-align: center; border-bottom: 1px solid rgba(232, 194, 108, 0.14); white-space: nowrap; }
.score-table th { color: var(--ink-faint); font-weight: 600; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
.score-table td { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink-dim); }
.score-table td:first-child, .score-table th:first-child { text-align: left; }
.score-table td:first-child { font-family: var(--body); font-weight: 700; font-size: 18px; color: var(--ink); }
.score-table td.tot { color: var(--gold); font-weight: 800; font-size: 17px; }
.score-wrap { overflow-x: auto; }
.kick-sm { margin-left: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: #ffb4a8; padding: 2px 9px; border-radius: 99px; box-shadow: inset 0 0 0 1px rgba(255, 140, 120, 0.5); vertical-align: 1px; }
.kick-sm:hover { background: rgba(255, 110, 100, 0.15); }
.bot-sm { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #a8dcf0; }

/* ---------- toasts & misc ---------- */
#toasts { position: fixed; top: calc(60px * var(--ui) + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 2500; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  padding: 9px 18px; border-radius: 10px; background: rgba(8, 20, 14, 0.96); border: 1px solid var(--line-strong);
  font-size: 18px; line-height: 1.3; box-shadow: var(--shadow); animation: toastIn 0.3s var(--ease); text-align: center; zoom: var(--ui);
}
.toast.err { border-color: rgba(255, 110, 100, 0.6); color: #ffd6cf; }
.toast.out { animation: toastOut 0.3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
.conn { position: fixed; bottom: calc(80px + var(--safe-b)); left: 0; right: 0; margin: 0 auto; width: fit-content; z-index: 2600; zoom: var(--ui); padding: 7px 16px; border-radius: 99px; background: #6d1a1f; font-size: 16px; font-weight: 600; box-shadow: var(--shadow); }
.conn::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff9b8f; margin-right: 8px; vertical-align: 1px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
@keyframes dots { to { width: 1.2em; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1600; }

@media (max-width: 520px) {
  .plate .nm { font-size: 15px; max-width: 80px; }
  .plate .sc { font-size: 13px; }
  .plate { gap: 5px; padding-right: 9px; }
  .felt { border-radius: 28px; }
  .chip { padding: 6px 10px; font-size: 14px; }
  #codeChip { font-size: 13px; }
  .topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .icon-btn { width: 36px; height: 36px; }
  .chip .wide { display: none; }
  .banner { font-size: 15px; padding: 7px 14px; }
  .panel { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
