/* Cambio v0.1.8 – landscape-only mobile card room (premium redesign) */
/* Layout (v0.1.7): every screen = a STAGE plus that screen's dedicated ad zones (js/ads.js planZones()).
   The stage is the rectangle the game UI, modals, the zoom view, the emoji drawer, sheets and toasts are
   confined to; the zones are columns / bands outside it (#ad-layer), so an ad can never sit on the table, a
   card, a button, the timer or the drawer. app.js writes the stage insets (--st-l/t/r/b, safe areas included)
   for the current screen: table (left + right gutters), lobby (top banner + side 300x250), scoreboard and
   pass-and-play cover (side 300x250), settings / room (top banner). No zones -> the stage is the safe area.
   Room styles: <html data-room="casino|family"> swap colour tokens, room art and the card back only. */
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-latin.woff2') format('woff2');
  font-weight: 400 800; font-style: normal; font-display: swap;
}
:root, :root[data-room="casino"] {
  /* safe areas + stage insets (overridden inline by app.js from CambioAds.planZones) */
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --sat: env(safe-area-inset-top, 0px);  --sab: env(safe-area-inset-bottom, 0px);
  --ad-label-h: 16px;
  --st-l: var(--sal); --st-r: var(--sar); --st-t: var(--sat); --st-b: var(--sab);
  --stage-w: calc(100vw - var(--st-l) - var(--st-r));
  --stage-h: calc(100vh - var(--st-t) - var(--st-b));
  /* Table screen: play area on the left of the stage, one labelled action column on the right. */
  --col-w: clamp(86px, calc(var(--stage-w) * .17), 112px);
  --play-l: 12px;
  --play-r: calc(var(--col-w) + 28px);
  --play-w: calc(var(--stage-w) - var(--play-l) - var(--play-r));
  --play-cx: calc(var(--play-l) + var(--play-w) / 2);
  --gap: 8px;
  /* palette */
  --room: #101315;
  --felt-a: #2a6c5b; --felt-b: #1f5a4c; --felt-c: #143f35; --felt-d: #0e2c25;
  --rail-a: #2c2520; --rail-b: #15110e; --rail-line: rgba(212, 175, 95, .38);
  --accent: #d4af5f; --accent-2: #b8913f; --accent-ink: #1b1508;
  --accent-soft: rgba(212, 175, 95, .14);
  --text: #eef1ef; --muted: #9aa4a0; --faint: rgba(238, 241, 239, .08);
  --panel: rgba(22, 25, 28, .78); --panel-solid: #16191c; --panel-line: rgba(255, 255, 255, .08);
  --input: rgba(255, 255, 255, .06);
  --danger: #c4524a;
  --card-face: #f6f4ef; --card-ink: #1b1d1f; --card-red: #b3263a;
  --room-art: url('../assets/images/room.svg');
  --card-back: url('../assets/images/card-back.svg');
  --runner: none;
  /* type scale (px): 11 · 12 · 13 · 15 · 18 · 22 */
  --fs-xs: 11px; --fs-s: 12px; --fs-m: 13px; --fs-l: 15px; --fs-xl: 18px; --fs-xxl: 22px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --card-h-medium: 17vh;
  font-family: var(--font);
  font-feature-settings: 'cv11', 'ss01';
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
/* Family Room: dark walnut dining table with a linen runner; brass accent. Same geometry. */
:root[data-room="family"] {
  --room: #17120f;
  --felt-a: #6a4a33; --felt-b: #573b28; --felt-c: #432d1f; --felt-d: #2f2016;
  --rail-a: #3a2a1f; --rail-b: #1c140e; --rail-line: rgba(201, 166, 107, .35);
  --accent: #c9a66b; --accent-2: #a9864e; --accent-soft: rgba(201, 166, 107, .14);
  --room-art: url('../assets/images/room-family.svg');
  --card-back: url('../assets/images/card-back-family.svg');
  --runner: linear-gradient(90deg, rgba(236, 226, 205, 0), rgba(236, 226, 205, .16) 12%, rgba(236, 226, 205, .16) 88%, rgba(236, 226, 205, 0));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--room); overscroll-behavior: none; touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Layer 0: room + ad zones (never above or beside-into the table) ---------- */
#bg-layer { position: fixed; inset: 0; z-index: 0; }
#room-bg { position: absolute; inset: 0; background: var(--room) var(--room-art) center / cover no-repeat; transition: background-color .25s var(--ease); }
#safe-probe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
/* Ad zones. Plain, clearly labelled boxes (no button/menu look). Containers ignore pointer events; the
   AdSense <ins> inside keeps them, so a real ad is clickable and nothing else is. */
.ad-slot { position: absolute; display: flex; flex-direction: column; pointer-events: none; }
.ad-slot .ad-label { flex: none; height: var(--ad-label-h); display: flex; align-items: center; justify-content: center;
  font: 600 9px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: rgba(238, 241, 239, .55); }
.ad-slot .ad-fill { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; }
.ad-slot .ad-fill ins { pointer-events: auto; }
/* Placeholder zone (placeholder IDs + SHOW_AD_PLACEHOLDERS): subtle dashed outline, size note. */
.ad-slot.ad-placeholder-on .ad-fill { border: 1px dashed rgba(238, 241, 239, .22); background: rgba(255, 255, 255, .025); }
.ad-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 8px; text-align: center; color: rgba(238, 241, 239, .5); }
.ad-placeholder b { font: 600 var(--fs-xs)/1.2 var(--font); letter-spacing: .02em; }
.ad-placeholder span { font: 400 10px/1.3 var(--font); opacity: .8; }
/* Dedicated zones (#ad-layer): left / top / unit size set inline by app.js from planZones(); fixed sizes, never
   scaled. The layer sits above the game layers but zones are outside the stage, so they never cover anything. */
#ad-layer { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
.ad-zone { left: 0; top: 0; }
.ad-zone .ad-fill { flex: none; }
.ad-zone:not(.ad-on) { display: none !important; }
/* Wall-screen banner: left/top/width/height set by app.js to match the room art's screen; hard cap 16vh. */
.wall-slot { left: 0; top: 0; width: 0; height: 0; max-height: 16vh; }
.wall-slot .ad-label { justify-content: flex-start; padding-left: 2px; }
/* Placement guard verdict (app.js): failing zones are removed from layout and never filled. */
.ad-slot.ad-off { display: none !important; }
/* Short landscape screens: the wall slot disappears entirely. */
@media (max-height: 499px) { .wall-slot { display: none !important; } }
/* Ad zones stay hidden in portrait (rotate screen) and behind the 18+ gate. */
@media (orientation: portrait) { .ad-slot { display: none !important; } }
html.gate-open .ad-slot { display: none !important; }
/* Panel screens (lobby, scoreboard, settings, room): the table is not shown behind them. */
html.panel-screen #table-layer, html.panel-screen #ui-layer { visibility: hidden; }

/* ---------- Layer 1: the table (isometric, stadium-shaped, no chips) ---------- */
/* v0.1.8: the perspective scales with the felt height and is centred on the felt, so the tilted felt's near edge
   widens by the same factor (--felt-k ~ 1.063) on every screen size; the felt's width is divided by it, so its
   projected outline always fits the play area of the planned stage (phones and 1280x800 / 1920x1080 desktops). */
#table-layer { position: fixed; top: var(--st-t); bottom: var(--st-b); left: var(--st-l); right: var(--st-r); z-index: 1; pointer-events: none;
  --felt-h: 76vh; --felt-k: 1.063; perspective: calc(var(--felt-h) * 3.7); perspective-origin: var(--play-cx) 47%; }
#felt { position: absolute; left: var(--play-cx); top: 47%; width: calc((var(--play-w) - 48px) / var(--felt-k)); height: var(--felt-h);
  transform: translate(-50%, -50%) rotateX(26deg); transform-style: preserve-3d; }
#felt-rim { position: absolute; inset: 0; border-radius: 50vh;
  background: linear-gradient(180deg, var(--rail-a), var(--rail-b));
  box-shadow: 0 2.8vh 5vh rgba(0, 0, 0, .55), 0 .6vh 1.2vh rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 -1px 0 rgba(0, 0, 0, .5); }
#felt-rim::after { content: ''; position: absolute; inset: 2.1vh; border-radius: 50vh; box-shadow: 0 0 0 1px var(--rail-line); }
#felt-inner { position: absolute; inset: 2.6vh; border-radius: 50vh; overflow: hidden;
  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 .5 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 70% 75% at 50% 42%, var(--felt-a) 0%, var(--felt-b) 40%, var(--felt-c) 78%, var(--felt-d) 100%);
  box-shadow: inset 0 0 4vh rgba(0, 0, 0, .55), inset 0 .4vh .6vh rgba(0, 0, 0, .35); }
/* Betting-line style hairline and a quiet wordmark (no chips, no logos). */
#felt-inner::before { content: ''; position: absolute; inset: 11% 7%; border-radius: 50vh; border: 1px solid rgba(255, 255, 255, .07); background: var(--runner); }
#felt-inner::after { content: 'CAMBIO'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 700 3.4vh/1 var(--font);
  letter-spacing: .9em; padding-left: .9em; color: rgba(255, 255, 255, .055); }

/* ---------- Layer 2: game UI (the stage) ---------- */
#ui-layer { position: fixed; top: var(--st-t); bottom: var(--st-b); left: var(--st-l); right: var(--st-r); z-index: 2; pointer-events: none;
  /* Own hand: as large as fits (24vh), shared with the avatar tag inside the play area. */
  --hand-card-h: min(24vh, calc(36vh / var(--hand-rows, 1)), calc((var(--play-w) - 84px - (var(--hand-cols, 4) - 1) * 8px) * 7 / (5 * var(--hand-cols, 4)))); }
#ui-layer > * { pointer-events: auto; }
#fx-layer { position: fixed; inset: 0; pointer-events: none !important; z-index: 20; }

/* Dead corner: timer + version + 18+ (small type) */
#corner-info { position: absolute; left: 12px; top: 8px; display: flex; flex-direction: column; gap: 3px;
  font-size: var(--fs-s); line-height: 1.2; pointer-events: none !important; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .02em; color: var(--text); padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .28); align-self: flex-start; }
.timer.low { color: #f0a59a; }
.timer.room { color: var(--accent); }
.timer.warn { animation: warn 1s ease 2; }
@keyframes warn { 0%, 100% { background: rgba(0, 0, 0, .28); } 25%, 75% { background: var(--danger); color: #fff; } }
#version-tag { font-size: 10px; color: var(--muted); padding-left: 6px; }
#age-badge { padding-left: 4px; }
.corner-btn { position: absolute; right: 12px; top: 8px; width: 36px; height: 32px; border-radius: 999px; border: 1px solid var(--panel-line);
  background: var(--panel); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 15px; line-height: 1; color: var(--text); }

/* Action columns: labelled pill buttons on an 8px grid */
.margin { position: absolute; top: 50%; transform: translateY(-50%); width: var(--col-w); display: flex; flex-direction: column; gap: var(--gap); }
.margin.right { right: 12px; }
.act { height: clamp(30px, 9.6vh, 40px); border-radius: 999px; border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(24, 28, 31, .82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--text); font: 600 var(--fs-s)/1.1 var(--font); letter-spacing: .01em; padding: 0 8px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28); transition: background-color .15s var(--ease), opacity .15s var(--ease), transform .15s var(--ease); }
.act.primary:not(:disabled) { background: var(--text); color: #121416; border-color: transparent; }
.act.ghost { background: transparent; border-color: rgba(255, 255, 255, .16); box-shadow: none; }
.act:disabled { opacity: .36; box-shadow: none; }
.act:not(:disabled):active { transform: scale(.97); }
.act.cambio { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; font-weight: 700; letter-spacing: .04em; }
.act.cambio:disabled { background: rgba(212, 175, 95, .16); color: var(--accent); }
.act.armed { box-shadow: 0 0 0 2px var(--accent); }

/* Status banner: frosted pill above the hand */
#banner { position: absolute; left: var(--play-cx); transform: translateX(-50%); bottom: calc(22px + var(--hand-rows, 1) * var(--hand-card-h) + (var(--hand-rows, 1) - 1) * 8px);
  width: max-content; max-width: calc(var(--play-w) * .8); text-align: center; font: 500 var(--fs-s)/1.35 var(--font);
  background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--panel-line);
  padding: 6px 12px; border-radius: 12px; pointer-events: auto; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
#banner:empty { display: none; }
#banner.mine { border-color: rgba(212, 175, 95, .45); }
#banner.power { border-color: rgba(170, 150, 220, .45); }
#banner b { color: #fff; }
#banner a { color: var(--accent); }

/* ---------- Cards: crisp backs, clean faces, lift + glow selection ---------- */
.card { --h: 8vh; position: relative; height: var(--h); aspect-ratio: 5 / 7; flex: none; border-radius: calc(var(--h) * .075);
  background: var(--card-face); color: var(--card-ink);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .25), 0 calc(var(--h) * .05) calc(var(--h) * .12) rgba(0, 0, 0, .32);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.card.large { --h: var(--hand-card-h, 24vh); }
.card.medium { --h: var(--card-h-medium); }
.card.small { --h: min(8vh, calc(17vh / var(--rows, 2))); }
.card.tiny { --h: 4.6vh; display: inline-block; margin-right: 2px; vertical-align: middle; }
.card.zoom { --h: min(72vh, 520px); }
.card.back { background: var(--card-back) center / 100% 100% no-repeat; }
.card.empty { background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.card.face.red { color: var(--card-red); }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; font-weight: 700; line-height: .92;
  font-size: calc(var(--h) * .17); letter-spacing: -.03em; font-variant-numeric: lining-nums; }
.card .corner i { font-style: normal; font-size: .82em; margin-top: .08em; }
.card .tl { left: 7%; top: 5%; }
.card .br { right: 7%; bottom: 5%; transform: rotate(180deg); }
.card .pip { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: calc(var(--h) * .36); line-height: 1; }
.card .court { position: absolute; inset: 20% 20%; border-radius: calc(var(--h) * .04); border: 1px solid currentColor; opacity: .9;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2%;
  background: linear-gradient(180deg, rgba(0, 0, 0, .025), rgba(0, 0, 0, .06)); }
.card .court b { font-size: calc(var(--h) * .27); font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.card .court i { font-style: normal; font-size: calc(var(--h) * .15); line-height: 1; }
.card .pts { position: absolute; left: 0; right: 0; bottom: -1.7em; text-align: center; font-size: 10px; color: var(--text); opacity: 0; }
/* Small (opponents) and tiny (score tables): one centred index, nothing else. */
.card.small .pip, .card.small .court, .card.small .br, .card.tiny .pip, .card.tiny .court, .card.tiny .br { display: none; }
.card.small .tl, .card.tiny .tl { left: 0; right: 0; top: 50%; transform: translateY(-50%); font-size: calc(var(--h) * .3); }
.card.small { border-radius: calc(var(--h) * .09); }
.card.zoom .pts { opacity: .85; font-size: var(--fs-m); bottom: -2em; }
.card.selectable { cursor: pointer; box-shadow: 0 0 0 1.5px rgba(212, 175, 95, .85), 0 calc(var(--h) * .05) calc(var(--h) * .12) rgba(0, 0, 0, .32); }
.card.selected { transform: translateY(-9%); box-shadow: 0 0 0 2px var(--accent), 0 0 calc(var(--h) * .22) rgba(212, 175, 95, .45), 0 calc(var(--h) * .1) calc(var(--h) * .2) rgba(0, 0, 0, .4); }
.card.flash { animation: cardflash 1.1s var(--ease); }
.card.nudge { animation: nudge .6s var(--ease) 2; }
.card.locked { filter: saturate(.55) brightness(.88); }
@keyframes cardflash { 0%, 100% { box-shadow: 0 0 0 .5px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .25); }
  30%, 70% { box-shadow: 0 0 0 2px var(--accent), 0 0 calc(var(--h) * .3) rgba(212, 175, 95, .6); } }
@keyframes nudge { 50% { transform: translateY(-5%); } }
/* Deal (slide in from the deck side) and flip: 150–250ms ease, never bouncy. */
.card.deal { animation: deal .22s var(--ease) both; }
@keyframes deal { from { opacity: 0; transform: translateY(-14%) scale(.94); } }
.card.flip { animation: flip .2s var(--ease); }
@keyframes flip { 0% { transform: perspective(600px) rotateY(90deg); } 100% { transform: perspective(600px) rotateY(0); } }

.hand { display: grid; grid-template-columns: repeat(var(--cols, 2), auto); gap: 4px; justify-content: center; }
.hand.mine { gap: 8px; }

/* Seats (inner region between the action columns) */
#seats { position: absolute; top: 0; bottom: 0; left: calc(var(--play-l) + 16px); right: calc(var(--play-r) + 16px); pointer-events: none !important; }
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: auto; }
.avatar { position: relative; width: clamp(30px, 10vh, 40px); height: clamp(30px, 10vh, 40px); display: grid; place-items: center; border-radius: 50%;
  font-size: clamp(16px, 5.4vh, 22px); line-height: 1; background: radial-gradient(circle at 50% 35%, #30363a, #15181b 75%);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .16), 0 3px 8px rgba(0, 0, 0, .45); }
.seat .name, #my-tag .name { font: 500 var(--fs-xs)/1.5 var(--font); background: rgba(14, 16, 18, .72); border: 1px solid var(--panel-line);
  padding: 0 8px; border-radius: 999px; white-space: nowrap; max-width: 104px; overflow: hidden; text-overflow: ellipsis; }
.seat .hand { margin-top: 2px; }
.seat-id { display: flex; flex-direction: column; align-items: center; gap: 3px; }
/* Top-rim seats sit sideways (avatar beside the cards) so they never crowd the piles or the screen edge. */
.seat.top { flex-direction: row; align-items: center; gap: 6px; }
.seat.top .hand { margin-top: 0; }
.seat.active .avatar, #my-area.active #my-tag .avatar { animation: turn-ring 1.8s ease-in-out infinite; }
.seat.active .name, #my-area.active #my-tag .name { color: var(--accent); border-color: rgba(212, 175, 95, .35); }
@keyframes turn-ring { 0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(212, 175, 95, .0), 0 3px 8px rgba(0, 0, 0, .45); }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px rgba(212, 175, 95, .18), 0 3px 8px rgba(0, 0, 0, .45); } }
.seat.targetable .avatar { cursor: pointer; box-shadow: 0 0 0 1.5px rgba(212, 175, 95, .8), 0 3px 8px rgba(0, 0, 0, .45); }
.avatar.hit { animation: hit .4s var(--ease); }
@keyframes hit { 40% { transform: scale(1.12); } }
.cambio-badge { background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 0 4px; font-size: .82em; font-weight: 700; letter-spacing: .04em; }
.bot-mark { position: absolute; right: -4px; bottom: -3px; font-size: 10px; line-height: 1; padding: 2px; border-radius: 50%;
  background: #1b1f22; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); pointer-events: none; }

/* Centre piles (medium cards) */
#center { position: absolute; left: var(--play-cx); top: 44%; transform: translate(-50%, -50%); display: flex; gap: 16px; align-items: center; pointer-events: none !important; }
#center > * { pointer-events: auto; }
.pile { position: relative; }
.pile.selectable .card { box-shadow: 0 0 0 1.5px rgba(212, 175, 95, .85), 0 4px 12px rgba(0, 0, 0, .35); }
#deck-pile .card { box-shadow: 1.5px 1.5px 0 #d9d5cc, 3px 3px 0 #b9b4aa, 0 6px 14px rgba(0, 0, 0, .45); }
.pile-count { position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); font: 500 10px/1 var(--font); color: var(--muted); font-variant-numeric: tabular-nums; }
#drawn-slot { position: relative; margin-left: 8px; touch-action: none; animation: pop .2s var(--ease); }
#drawn-slot .card { transform: rotate(3deg); box-shadow: 0 0 0 2px rgba(238, 241, 239, .9), 0 8px 20px rgba(0, 0, 0, .5); }
.drawn-label { position: absolute; left: 50%; bottom: -17px; transform: translateX(-50%); white-space: nowrap; font: 500 10px/1 var(--font); color: var(--muted); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } }

/* Own hand: one row of large cards along the bottom edge, avatar tag to its left */
#my-area { position: absolute; left: var(--play-cx); bottom: 8px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 12px; pointer-events: none !important; }
#my-area > * { pointer-events: auto; }
#my-tag { order: -1; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; white-space: nowrap; }
#my-tag .name { max-width: 72px; }

/* FX */
.fly-emoji { position: fixed; font-size: 30px; z-index: 30; pointer-events: none; will-change: transform; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .45)); }
.toast { position: fixed; left: calc(var(--st-l) + var(--stage-w) / 2); top: calc(var(--st-t) + 10px); transform: translateX(-50%);
  background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--panel-line);
  padding: 6px 14px; border-radius: 999px; font: 500 var(--fs-s)/1.3 var(--font); animation: toast 2.4s var(--ease) forwards;
  white-space: nowrap; max-width: calc(var(--stage-w) - 48px); overflow: hidden; text-overflow: ellipsis; }
.toast + .toast { top: calc(var(--st-t) + 46px); }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -6px); } 8%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* Emoji drawer: frosted bottom sheet across the stage only */
.drawer { position: fixed; left: calc(var(--st-l) + 8px); right: calc(var(--st-r) + 8px); bottom: var(--st-b); z-index: 40;
  background: rgba(20, 23, 26, .86); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--panel-line); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 8px 12px 10px; box-shadow: 0 -8px 24px rgba(0, 0, 0, .45); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-s); color: var(--muted); margin-bottom: 6px; }
.x { border: 0; background: rgba(255, 255, 255, .06); width: 28px; height: 28px; border-radius: 50%; font-size: 13px; color: var(--text); }
.emoji-list { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.emoji { flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid transparent; border-radius: 12px;
  background: rgba(255, 255, 255, .05); padding: 6px 8px; min-width: 64px; }
.emoji span { font-size: 26px; line-height: 1.15; }
.emoji small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.emoji.targeted { border-color: rgba(212, 175, 95, .3); }
.emoji.targeted small::before { content: '→ '; color: var(--accent); }
.emoji { position: relative; }
/* v0.1.7 emoji economy: packs side by side, remaining-uses badges, a subtle locked state, refill sheet */
.emoji-pack { flex: none; display: flex; flex-direction: column; gap: 4px; padding-right: 8px; border-right: 1px solid var(--panel-line); }
.emoji-pack:last-child { border-right: 0; }
.pack-head { display: flex; align-items: center; gap: 6px; min-height: 22px; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.pack-name { text-transform: uppercase; font-weight: 600; }
.pack-row { display: flex; gap: 6px; }
.uses-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: rgba(212, 175, 95, .16); color: var(--accent); font-variant-numeric: tabular-nums; }
.uses-badge.out { background: rgba(255, 255, 255, .06); color: var(--muted); }
.emoji .uses { position: absolute; top: 2px; right: 3px; font-style: normal; font-size: 9px; color: var(--accent); font-variant-numeric: tabular-nums; }
.emoji .uses.free { color: var(--muted); }
.emoji.locked span { filter: grayscale(1); opacity: .38; }
.emoji.locked small { opacity: .6; }
.emoji-pack.locked .pack-row { opacity: .9; }
.refill-btn, .refill-link { font: inherit; font-size: 10px; font-style: normal; border: 1px solid rgba(212, 175, 95, .45); background: transparent; color: var(--accent);
  border-radius: 999px; padding: 1px 8px; min-height: 0; cursor: pointer; }
.refill-sheet { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--panel-line); }
.refill-sheet .refill-title { margin: 0 0 4px; font-size: var(--fs-s); }
.refill-sheet .row { margin-top: 6px; }
.refill-sheet .small { font-size: var(--fs-xs); color: var(--muted); margin: 0; line-height: 1.4; }
.refill-sheet .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.refill-sheet .row.end { justify-content: flex-end; }
.refill-sheet button { height: 30px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); background: var(--input); padding: 0 14px; color: var(--text); font: 500 var(--fs-s)/1 var(--font); cursor: pointer; }
.refill-sheet button.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.refill-sheet button:disabled { opacity: .42; cursor: default; }
/* Saved room presets + admin emoji stats */
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.preset-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--panel-line); border-radius: 999px; padding: 0 2px 0 10px; }
.preset-chip .x { width: 22px; height: 22px; font-size: 10px; }
#preset-reward { flex-basis: 100%; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.stat-block h4 { margin: 6px 0 2px; font-size: var(--fs-s); }
table.stats { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
table.stats th, table.stats td { padding: 2px 4px; text-align: right; border-bottom: 1px solid var(--panel-line); }
table.stats th:first-child, table.stats td:first-child { text-align: left; }

/* Zoom (stage only) */
#zoom { position: fixed; top: var(--st-t); bottom: var(--st-b); left: var(--st-l); right: var(--st-r); z-index: 60; background: rgba(8, 10, 11, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
#zoom p { font-size: var(--fs-xs); color: var(--muted); margin: 28px 0 0; }

/* ---------- Modals: frosted dark panels, centred on the stage ---------- */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(6, 8, 9, .55);
  display: flex; align-items: center; justify-content: center; padding: calc(var(--st-t) + 8px) calc(var(--st-r) + 8px) calc(var(--st-b) + 8px) calc(var(--st-l) + 8px); }
#modal-box { background: rgba(20, 23, 26, .86); -webkit-backdrop-filter: blur(20px) saturate(1.2); backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--panel-line); border-radius: 16px; --mpy: 16px; --mpx: 20px; padding: var(--mpy) var(--mpx); width: min(100%, 860px); max-height: 100%; overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); font-size: var(--fs-m); line-height: 1.45; user-select: text; scrollbar-width: thin; }
#modal-box h1, #modal-box h2 { margin: 0 0 8px; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
#modal-box h1 small { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
#modal-box h3 { margin: 0 0 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
#modal-box p { margin: 0 0 8px; }
#modal-box section { background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .05); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#modal-box .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#modal-box .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#modal-box .row.end { justify-content: flex-end; margin-top: 12px; }
#modal-box button, #modal-box input, #modal-box select { height: 32px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); background: var(--input);
  padding: 0 14px; color: var(--text); font: 500 var(--fs-m)/1 var(--font); }
#modal-box input, #modal-box select { border-radius: 10px; padding: 0 10px; }
#modal-box input:focus, #modal-box select:focus, #modal-box button:focus-visible { outline: 2px solid rgba(212, 175, 95, .6); outline-offset: 1px; }
#modal-box input { min-width: 0; flex: 1; }
#modal-box select option { background: var(--panel-solid); }
#modal-box button.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
#modal-box button.danger { background: rgba(196, 82, 74, .22); border-color: rgba(196, 82, 74, .5); }
#modal-box button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 8px; }
#modal-box button:disabled { opacity: .42; }
#modal-box .small { font-size: var(--fs-xs); color: var(--muted); margin: 0; line-height: 1.4; }
#modal-box .note { background: var(--accent-soft); border-left: 2px solid var(--accent); padding: 6px 10px; font-size: var(--fs-s); border-radius: 6px; }
#modal-box a { color: var(--accent); }
.avatar-pick { width: 40px; padding: 0 !important; font-size: 20px !important; border-radius: 50% !important; height: 40px !important; }
.guest { font-size: var(--fs-m); line-height: 1.3; }
.guest small { color: var(--muted); font-size: var(--fs-xs); }
details { margin-top: 10px; font-size: var(--fs-s); color: var(--muted); }
details summary { cursor: pointer; color: var(--text); font-weight: 500; }
.howto { padding-left: 18px; margin: 6px 0; }
.howto li { margin: 2px 0; }

/* Lobby */
#modal-box.lobby { --mpy: 12px; --mpx: 14px; width: min(100%, 640px); }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.wordmark { font-size: var(--fs-xxl); font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.wordmark::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: var(--accent); vertical-align: .2em; }
.brand .ver { font-size: var(--fs-xs); color: var(--muted); }
.head-right { display: flex; align-items: center; gap: 8px; }
#modal-box .adults-line { margin: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lobby-grid section { padding: 8px 10px; gap: 6px; }
.lobby-grid .row { flex-wrap: nowrap; }
#modal-box .room #join-code { flex: 1 1 56px; width: 56px; }
#modal-box .room #create-room { flex: 0 0 auto; height: 40px; }
#modal-box .hero .row { flex-direction: column; align-items: stretch; gap: 6px; }
#modal-box .hero button { flex: 0 0 auto; }
#modal-box .hero button.primary { height: 40px; padding: 0 18px; font-size: var(--fs-l); }
#modal-box .hero #pass-play { height: 40px; padding: 0 14px; }
#modal-box .room .row { gap: 6px; }
#modal-box .room .row button, #modal-box .room .row input { height: 40px; }
#modal-box .you-row { margin-top: 8px; flex-wrap: nowrap; }
#modal-box .you-row .guest { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#modal-box .you-row #name-input { flex: 1 1 80px; }
#modal-box .you-row .room-styles { margin-left: auto; flex: 0 0 auto; }
#modal-box .avatar-pick { flex: 0 0 auto; }
#modal-box .lobby .links, #modal-box.lobby .links { margin: 6px 0 0 -8px; gap: 0; flex-wrap: wrap; }
#modal-box.lobby .links button { font-size: var(--fs-s); padding: 0 8px; height: 28px; }
#modal-box.lobby .lobby-note { margin: 0 0 6px; padding: 4px 8px; font-size: var(--fs-xs); }
#modal-box.register { width: min(100%, 560px); }
#modal-box.register .reg-form input { flex: 1 1 140px; }
/* v0.1.8 sticky footer: the action row stays on screen while the modal body scrolls. */
#modal-box .row.end.modal-foot { position: sticky; bottom: calc(-1 * var(--mpy)); z-index: 2; margin: 10px calc(-1 * var(--mpx)) calc(-1 * var(--mpy));
  padding: 8px var(--mpx) var(--mpy); background: rgba(20, 23, 26, .97); border-top: 1px solid var(--panel-line); border-radius: 0 0 15px 15px; }
#modal-box .room-styles { display: inline-flex; gap: 0; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); align-self: flex-start; }
#modal-box .room-styles button { height: 28px; border: 0; background: transparent; color: var(--muted); }
#modal-box .room-styles button[aria-pressed="true"] { background: rgba(255, 255, 255, .12); color: var(--text); font-weight: 600; }

/* 18+ gate */
.badge-18 { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1; padding: 3px 6px; border-radius: 999px;
  border: 1px solid rgba(212, 175, 95, .7); color: var(--accent); vertical-align: middle; letter-spacing: .04em; background: rgba(0, 0, 0, .25); }
#modal-box.age-gate { width: min(100%, 400px); text-align: center; padding: 24px 24px 20px; }
#modal-box.age-gate h2 { font-size: var(--fs-xl); margin: 12px 0 4px; }
#modal-box.age-gate .gate-line { margin: 0 0 16px; font-size: var(--fs-m); color: var(--muted); }
#modal-box.age-gate button.primary { height: 40px; font-size: var(--fs-l); padding: 0 22px; }
.gate-badge { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-xl); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); background: rgba(212, 175, 95, .06); }
#modal-box button.reward { border-color: rgba(212, 175, 95, .5); margin-right: auto; }

/* Rulebook */
.rules-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; margin-bottom: 8px; }
.num { display: flex; flex-direction: column; font-size: var(--fs-xs); color: var(--muted); gap: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip input { display: none; }
.chip span { display: inline-block; min-width: 32px; text-align: center; padding: 5px 8px; border-radius: 999px; background: var(--input); border: 1px solid rgba(255, 255, 255, .12); font-size: var(--fs-s); }
.chip input:checked + span { background: var(--text); color: #121416; border-color: transparent; font-weight: 600; }
.code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; background: var(--accent-soft); color: var(--accent); padding: 0 8px; border-radius: 6px; letter-spacing: .15em; }
.seat-list { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.seat-list li { background: rgba(255, 255, 255, .06); padding: 4px 10px; border-radius: 999px; font-size: var(--fs-s); }
.seat-list .waiting { opacity: .5; }

/* Results / scoreboard */
table.results { width: 100%; border-collapse: collapse; font-size: var(--fs-m); }
table.results td { padding: 5px 6px; border-bottom: 1px solid rgba(255, 255, 255, .06); vertical-align: middle; }
table.results td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.results tr.win td { background: rgba(212, 175, 95, .08); }
table.results tr.win td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
table.results tr.me td:nth-child(2) { font-weight: 700; }
table.results .mini { white-space: nowrap; }
table.results .card .pts { display: none; }
.win-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Portrait: block the game, ask to rotate */
#rotate-overlay { display: none; position: fixed; inset: 0; z-index: 100; background: var(--room); flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8vw; }
#rotate-overlay .rotate-icon { width: 44px; height: 72px; border: 2px solid var(--text); border-radius: 9px; opacity: .85; animation: rot 2.4s var(--ease) infinite; font-size: 0; }
#rotate-overlay p { font-size: var(--fs-xl); font-weight: 700; margin: 20px 0 4px; }
#rotate-overlay small { color: var(--muted); }
@keyframes rot { 0%, 25% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) { #rotate-overlay { display: flex; } }

@media (max-height: 380px) { #modal-box { font-size: var(--fs-s); --mpy: 12px; --mpx: 14px; } #modal-box h1, #modal-box h2 { font-size: var(--fs-l); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .seat.active .avatar, #my-area.active #my-tag .avatar { box-shadow: 0 0 0 2px var(--accent), 0 3px 8px rgba(0, 0, 0, .45); }
}

/* Deck reshuffle: fan -> riffle -> settle (transform/opacity only). */
.shuffle-card { position: fixed; border-radius: .9vh; pointer-events: none; will-change: transform, opacity;
  background: var(--card-back) center / 100% 100% no-repeat; box-shadow: 0 .4vh .8vh rgba(0, 0, 0, .45);
  animation: deck-shuffle 1s cubic-bezier(.4, .1, .3, 1) both; }
@keyframes deck-shuffle {
  0%   { transform: translate(0, 0) rotate(0); opacity: 0; }
  10%  { opacity: 1; }
  32%  { transform: translate(var(--fan-x), -12%) rotate(var(--fan-r)); }
  55%  { transform: translate(calc(var(--side) * 62%), -4%) rotate(calc(var(--side) * 6deg)); }
  78%  { transform: translate(calc(var(--side) * 8%), var(--stack)) rotate(0); opacity: 1; }
  100% { transform: translate(0, 0) rotate(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .shuffle-card { display: none; } }

/* ---------------------------------------------------------------- demo mock ads (DEMO_MOCK_ADS / ?demo=1) */
.mock-ad-banner { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .07) 0 8px, rgba(255, 255, 255, .03) 8px 16px); color: rgba(255, 255, 255, .8);
  font: 600 var(--fs-xs)/1.2 var(--font); text-align: center; border-radius: 6px; overflow: hidden; padding: 6px; }
.mock-ad-banner span { font-weight: 400; font-size: 10px; opacity: .75; }
.ad-slot.ad-demo .ad-fill { border: 0; background: none; }
.mock-ad-overlay { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .86); pointer-events: auto; }
.mock-ad-box { width: min(560px, 86vw); max-height: 90vh; background: var(--panel-solid); color: var(--text); border: 1px solid var(--panel-line); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); font-family: var(--font); }
.mock-ad-tag { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.mock-ad-body { min-height: 22vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  border: 1px dashed rgba(255, 255, 255, .22); border-radius: 10px; padding: 12px; }
.mock-ad-body p { margin: 6px 0 0; font-size: var(--fs-m); color: var(--muted); }
.mock-ad-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.mock-ad-actions button { font: 600 var(--fs-m)/1 var(--font); height: 34px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer; }
.mock-ad-actions button:disabled { opacity: .45; cursor: default; }
.mock-ad-skip { background: transparent; color: var(--text); border: 1px solid rgba(255, 255, 255, .25) !important; }
.mock-ad-close { background: var(--accent); color: var(--accent-ink); }
.mock-note { color: #d9c08a !important; }

/* ---------------------------------------------------------------- local admin panel */
#modal-box.admin { width: min(100%, 980px); }
.admin-note { border: 1px dashed rgba(212, 175, 95, .6); padding: 6px 10px; border-radius: 8px; }
.tabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.tabs .tab { opacity: .7; }
.tabs .tab.active { opacity: 1; background: rgba(255, 255, 255, .12) !important; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; max-height: 42vh; overflow: auto; align-items: start; }
.admin-form fieldset { border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 4px 8px; }
.admin-form fieldset fieldset { grid-column: auto; }
.admin-form legend { font-size: var(--fs-s); color: var(--muted); }
#modal-box .admin-form label.num { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 6px; font-size: var(--fs-s); margin: 2px 0; text-align: left; }
#modal-box .admin-form input { flex: 0 0 auto; height: 28px; padding: 0 6px; }
#modal-box .admin-form input[type=number] { width: 76px; }
.admin-form .pair { display: inline-flex; gap: 2px; align-items: center; }
#modal-box .admin-form .pair input { width: 60px; }
#admin-json { width: 100%; font: 12px/1.3 ui-monospace, monospace; background: #0d0f11; color: var(--text); border-radius: 10px; border: 1px solid var(--panel-line); }
.admin-errors { color: #f0a59a; margin: 4px 0; padding-left: 18px; }

/* ---------------------------------------------------------------- registration sheet, match history, ad categories */
.reg-sheet { position: fixed; left: calc(var(--st-l) + var(--stage-w) / 2); bottom: calc(var(--st-b) + 8px); transform: translateX(-50%); z-index: 60;
  width: min(calc(var(--stage-w) - 24px), 600px); background: rgba(20, 23, 26, .9); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  color: var(--text); border: 1px solid var(--panel-line); border-radius: 16px; padding: 12px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  font-size: var(--fs-m); max-height: calc(var(--stage-h) - 16px); overflow: auto; }
.reg-sheet h3 { margin: 0 0 4px; font-size: var(--fs-l); }
.reg-sheet .x { position: absolute; top: 8px; right: 8px; }
.reg-sheet input, .reg-sheet button { height: 32px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); background: var(--input); padding: 0 14px; color: var(--text); font: 500 var(--fs-m)/1 var(--font); }
.reg-sheet input { min-width: 0; flex: 1; border-radius: 10px; padding: 0 10px; }
.reg-sheet button.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.reg-sheet .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reg-sheet .row.end { justify-content: flex-end; }
.reg-form input[type=email] { flex: 2 1 160px; }
.reg-err { color: #f0a59a; min-height: 0; margin: 2px 0; }
.reg-err:empty { display: none; }
.sub-note { color: var(--accent); }
button.linkish { background: transparent !important; border: 0 !important; text-decoration: underline; text-underline-offset: 2px; padding: 0 2px !important; height: auto !important; color: var(--muted) !important; }
table.results.history td { font-size: var(--fs-s); }
.ad-cats .cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 12px; }
.cat-custom { display: flex; align-items: center; gap: 4px; }
.cat-custom .cat-row { flex: 1; }
.confirm-box { border: 1px solid rgba(196, 82, 74, .7); background: rgba(196, 82, 74, .12); border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.reg-sheet.inline { position: relative; left: auto; bottom: auto; transform: none; width: auto; z-index: auto; margin: 8px 0;
  box-shadow: none; max-height: none; background: rgba(255, 255, 255, .04); border-color: rgba(212, 175, 95, .4); }

/* ---------------------------------------------------------------- Pass & Play */
/* Privacy cover: full-screen, fully opaque (no transparency, no blur-through), above table / drawer / modal / zoom. */
#handoff { position: fixed; inset: 0; z-index: 90; background: #0d0f11; display: flex; align-items: center; justify-content: center; pointer-events: auto;
  padding: var(--st-t) var(--st-r) var(--st-b) var(--st-l);
  background-image: radial-gradient(ellipse 60% 70% at 50% 40%, #1b2a26 0%, #0d0f11 70%); }
#handoff .handoff-box { text-align: center; max-width: min(80vw, 560px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#handoff .handoff-round { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
#handoff .handoff-round b { color: var(--accent); }
#handoff .handoff-avatar { width: clamp(56px, 18vh, 76px); height: clamp(56px, 18vh, 76px); border-radius: 50%; display: grid; place-items: center; font-size: clamp(28px, 9vh, 38px); line-height: 1;
  background: radial-gradient(circle at 50% 35%, #30363a, #15181b 75%); box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(0, 0, 0, .5); margin-bottom: 4px; }
#handoff h2 { margin: 0; font-size: clamp(20px, 7vh, 30px); font-weight: 700; letter-spacing: -.01em; }
#handoff .small { font-size: var(--fs-s); color: var(--muted); margin: 0; }
#handoff .handoff-log { list-style: none; margin: 0; padding: 0; font-size: var(--fs-s); color: var(--muted); max-height: 20vh; overflow: hidden; }
#handoff .handoff-log li { padding: 1px 0; }
#handoff .handoff-go { margin-top: 6px; font: 700 var(--fs-l)/1 var(--font); height: 44px; padding: 0 26px; border-radius: 999px; border: 0; color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent), var(--accent-2)); cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
#handoff .handoff-quit { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; font-size: var(--fs-s); cursor: pointer; }
/* While the privacy cover is up the room-art wall slot is hidden; the cover's own zone (#ad-cover-rect, in
   #ad-layer above the cover, opposite the "show my cards" button) is the only ad on that screen. */
html.pp-covered #bg-layer .ad-slot { display: none !important; }
/* v0.1.8 atomic cover swap: the class flips in the same task that shows / hides the cover, so no frame ever
   shows a table gutter over the cover, or the cover's zone over the table. */
html.pp-covered #ad-layer .ad-zone:not(#ad-cover-rect) { display: none !important; }
html:not(.pp-covered) #ad-cover-rect { display: none !important; }
html.pp-covered #ui-layer { visibility: hidden; }
#banner .pp-done { margin-left: 8px; pointer-events: auto; height: 26px; border-radius: 999px; border: 0; padding: 0 12px; font: 700 var(--fs-s)/1 var(--font); background: var(--text); color: #121416; cursor: pointer; }
#modal-box .pp-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 8px 0; }
#modal-box .pp-seat .pp-n { width: 1.4em; text-align: right; color: var(--muted); }
#modal-box .pp-seat .reg-err { flex-basis: 100%; color: #f0a59a; }
#modal-box .reg-err:empty { display: none; }
#modal-box .pp-results { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
#modal-box .pp-results section { gap: 4px; }
/* Admin › Emoji stats panel */
fieldset.emoji-stats { border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 8px 12px 10px; margin: 12px 0 0; }
fieldset.emoji-stats legend { padding: 0 6px; font-size: var(--fs-s); font-weight: 600; letter-spacing: .02em; color: var(--muted); }

/* v0.1.8 lobby on short landscape phones (844x390, 740x360): headings collapse, buttons stay 36-40px tall. */
@media (max-height: 420px) {
  #modal-box.lobby .lobby-head { margin-bottom: 6px; }
  #modal-box.lobby .wordmark { font-size: var(--fs-xl); }
  #modal-box.lobby .lobby-grid h3 { display: none; }
  #modal-box.lobby .lobby-grid section { padding: 6px 8px; }
  #modal-box .hero button.primary, #modal-box .hero #pass-play, #modal-box .room #create-room, #modal-box .room .row button, #modal-box .room .row input { height: 36px; }
  #modal-box .you-row { margin-top: 6px; }
  #modal-box .you-row .avatar-pick { width: 36px; height: 36px !important; font-size: 18px !important; }
  #modal-box.lobby .links { margin-top: 2px; }
  #modal-box.lobby .links button { height: 26px; }
}
.reg-sheet.inline.compact { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin: 6px 0; }
.reg-sheet.inline.compact .reg-nudge { flex: 1 1 auto; font-weight: 600; font-size: var(--fs-s); }
.reg-sheet.inline.compact button { height: 30px; flex: 0 0 auto; }
/* v0.1.8 results on short landscape phones: tighter rows, one-line action footer. */
@media (max-height: 420px) {
  #modal-box.results h2 { margin-bottom: 2px; }
  #modal-box.results > .small { margin-bottom: 4px; }
  #modal-box.results table.results td { padding: 2px 6px; }
  #modal-box.results .row.end { gap: 6px; }
  #modal-box.results .row.end button { padding: 0 12px; white-space: nowrap; }
  #modal-box.results .reg-sheet.inline.compact { margin: 4px 0 0; padding: 4px 8px; }
  #modal-box.results .reg-sheet.inline.compact button { height: 28px; }
  #modal-box .row.end.modal-foot { padding-top: 6px; margin-top: 6px; }
}
#modal-box .pp-foot { flex-wrap: nowrap; }
#modal-box .pp-foot .pp-bots-l { display: flex; align-items: center; gap: 6px; font-size: var(--fs-s); color: var(--muted); white-space: nowrap; }
#modal-box .pp-foot select { width: 56px; flex: 0 0 auto; }
#modal-box .pp-foot .spacer { flex: 1 1 auto; }
@media (max-height: 420px) {
  #modal-box.pass-play .pp-seats { margin: 4px 0; gap: 4px 12px; }
  #modal-box.pass-play .pp-seat .avatar-pick { width: 34px; height: 34px !important; font-size: 17px !important; }
}
