:root {
  color-scheme: dark;
  --ink: #f4f0e8;
  --muted: #9eabc0;
  --night: #06101f;
  --navy: #0a1930;
  --panel: rgba(12, 29, 52, 0.88);
  --line: #2b4669;
  --line-bright: #42688e;
  --coral: #ff5e62;
  --coral-dark: #b82f42;
  --blue: #4fa7ff;
  --mint: #54dfb1;
  --violet: #a880ff;
  --paper: #f4efe5;
  --black: #07101d;
  --radius: 18px;
  --shadow-pixel: 6px 6px 0 rgba(1, 5, 13, 0.6);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Informational animation stays below authoritative gameplay controls. */
  --layer-cinematic: 1650;
  --layer-gameplay-overlay: 1850;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

/* Snap keeps the shared Standard 52 table language while giving the
   synchronized reveal and reaction controls a purpose-built focal point. */
.snap-game {
  --snap-coral: #ff6b57;
  --snap-cyan: #63e5ff;
  --snap-ink: #07101d;
  padding-bottom: max(9rem, env(safe-area-inset-bottom));
}

.snap-phase-banner {
  width: min(680px, calc(100% - 2rem));
  margin: .4rem auto 1rem;
  padding: .9rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 22px;
  background: rgba(5, 17, 30, .66);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .2);
  text-align: center;
  display: grid;
  gap: .15rem;
}

.snap-phase-banner > span,
.snap-phase-banner > small {
  color: rgba(255, 255, 255, .72);
  letter-spacing: .08em;
}

.snap-phase-banner > span { font-size: .72rem; font-weight: 800; }
.snap-phase-banner > small { letter-spacing: 0; }
.snap-phase-banner > strong {
  color: #fffaf0;
  font: 800 clamp(2.1rem, 8vw, 4.8rem)/.95 "Pixelify Sans", system-ui, sans-serif;
  text-transform: uppercase;
}

.snap-phase-banner.counting {
  border-color: color-mix(in srgb, var(--snap-coral) 70%, white);
  box-shadow: 0 0 0 4px rgba(255, 107, 87, .12), 0 16px 48px rgba(0, 0, 0, .28);
}

.snap-phase-banner.counting > strong {
  color: var(--snap-coral);
  font-size: clamp(4.6rem, 16vw, 8.5rem);
  text-shadow: 0 5px 0 rgba(0, 0, 0, .24);
}

.snap-table-grid {
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(440px, 1.2fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
}

.snap-player-grid {
  display: grid;
  gap: .65rem;
}

.snap-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .68rem .75rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: rgba(5, 17, 30, .62);
}

.snap-player.you { border-color: rgba(99, 229, 255, .7); }
.snap-player.ready { box-shadow: inset 4px 0 0 #72eea8; }
.snap-player.penalized { box-shadow: inset 4px 0 0 var(--snap-coral); }
.snap-player .player-avatar { width: 2.5rem; height: 2.5rem; font-size: .82rem; }
.snap-player > div:nth-child(2) { min-width: 0; display: grid; }
.snap-player > div:nth-child(2) strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snap-player > div:nth-child(2) small { color: rgba(255, 255, 255, .66); font-size: .68rem; letter-spacing: .07em; }
.snap-player dl { margin: 0; display: flex; gap: .55rem; }
.snap-player dl div { display: grid; text-align: center; }
.snap-player dt { color: rgba(255, 255, 255, .58); font-size: .62rem; text-transform: uppercase; }
.snap-player dd { margin: 0; color: #fff; font-weight: 800; }

.snap-center-board {
  min-height: 330px;
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr)) minmax(90px, .65fr);
  align-items: center;
  justify-items: center;
  gap: clamp(.4rem, 2vw, 1.2rem);
  padding: 1rem;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .1), transparent 60%), rgba(5, 17, 30, .32);
}

.snap-compare-card,
.snap-hidden-source {
  display: grid;
  justify-items: center;
  gap: .45rem;
  color: rgba(255, 255, 255, .68);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.snap-center-board .playing-card {
  width: clamp(106px, 15vw, 156px);
  height: clamp(151px, 21.3vw, 222px);
}

.snap-compare-card.current .playing-card {
  box-shadow: 0 0 0 5px rgba(99, 229, 255, .2), 0 20px 38px rgba(0, 0, 0, .32);
}

.snap-empty-card {
  width: clamp(106px, 15vw, 156px);
  aspect-ratio: 5 / 7;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 255, 255, .24);
  border-radius: 12px;
  color: rgba(255, 255, 255, .42);
  font: 800 3rem/1 "Pixelify Sans", system-ui, sans-serif;
}

.snap-hidden-source .card-back { opacity: .82; }

.snap-result {
  width: min(720px, calc(100% - 2rem));
  margin: .8rem auto 0;
  padding: .7rem 1rem;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  gap: .65rem;
  background: rgba(5, 17, 30, .72);
  color: #fff;
  text-align: center;
}

.snap-result.success strong { color: #72eea8; }
.snap-result.failure strong { color: var(--snap-coral); }
.snap-result.neutral strong { color: var(--snap-cyan); }

.snap-action-dock {
  position: fixed;
  z-index: 24;
  left: 50%;
  bottom: max(.8rem, env(safe-area-inset-bottom));
  translate: -50% 0;
  width: min(680px, calc(100% - 1.4rem));
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding: .72rem;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 22px;
  background: rgba(4, 13, 25, .92);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
}

.snap-action-dock small { color: rgba(255, 255, 255, .62); text-align: center; }
.snap-primary-action {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #75f0ff, #36bfd7);
  color: var(--snap-ink);
  font: 800 clamp(1.5rem, 5vw, 2.5rem)/1 "Pixelify Sans", system-ui, sans-serif;
  letter-spacing: .05em;
  box-shadow: inset 0 -5px 0 rgba(7, 16, 29, .24), 0 8px 20px rgba(0, 0, 0, .24);
  touch-action: manipulation;
}

.snap-primary-action.react:not(:disabled) {
  min-height: 78px;
  background: linear-gradient(180deg, #ff8b72, var(--snap-coral));
  animation: snap-pulse .58s ease-in-out infinite alternate;
}

.snap-primary-action:disabled { opacity: .48; filter: grayscale(.25); }

@keyframes snap-pulse {
  to { scale: 1.015; box-shadow: inset 0 -5px 0 rgba(7, 16, 29, .24), 0 0 0 6px rgba(255, 107, 87, .17), 0 12px 28px rgba(0, 0, 0, .3); }
}

@media (max-width: 760px) {
  .snap-table-grid { grid-template-columns: 1fr; }
  .snap-player-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); order: 2; }
  .snap-player { grid-template-columns: auto minmax(0, 1fr); }
  .snap-player dl { grid-column: 1 / -1; justify-content: space-around; }
  .snap-center-board { min-height: 260px; grid-template-columns: repeat(3, minmax(86px, 1fr)); padding: .7rem; }
  .snap-hidden-source { display: none; }
  .snap-center-board .playing-card,
  .snap-empty-card { width: clamp(88px, 27vw, 128px); }
  .snap-result { align-items: center; flex-direction: column; gap: .15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .snap-primary-action.react:not(:disabled) { animation: none; }
}

@font-face {
  font-family: "Cardcade Pixel";
  src: url("assets/fonts/cardcade-pixel-ranks.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0032, U+0035;
}

@font-face {
  font-family: "Cardcade Pixel";
  src: url("assets/fonts/pixelify-sans-latin.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0000-0031, U+0033-0034, U+0036-10FFFF;
}

@font-face {
  font-family: "Cardcade Ranks";
  src: url("assets/fonts/cardcade-pixel-ranks.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--night); overscroll-behavior: none; }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(47, 91, 137, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 91, 137, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 78% 68%, rgba(132, 67, 111, 0.14), transparent 30rem),
    var(--night);
  background-size: 5px 5px, 5px 5px, auto, auto;
}

.card-art-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

button, input, select { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -4rem;
  padding: 0.7rem 1rem;
  color: var(--black);
  background: var(--paper);
}
.skip-link:focus { top: 1rem; }

.site-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin-inline: auto;
  padding-inline: var(--safe-left) var(--safe-right);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  min-height: calc(92px + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(73, 109, 151, 0.45);
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand strong, h1, h2, h3, .eyebrow, .button-label, .room-code {
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 900;
}

.brand strong { display: block; font-size: 1.12rem; letter-spacing: 0.02em; }
.brand-mark { position: relative; width: 47px; height: 48px; display: block; }
.brand-mark i {
  position: absolute;
  width: 29px;
  height: 39px;
  top: 4px;
  left: 8px;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 5px;
  background: var(--coral);
  box-shadow: 3px 3px 0 #3b1624;
}
.brand-mark i:first-child { transform: rotate(-15deg) translateX(-6px); background: var(--blue); }
.brand-mark i:last-child { transform: rotate(15deg) translateX(6px); background: var(--mint); }
.brand-mark i:nth-child(2) { z-index: 2; }

.pwa-tools { display: flex; align-items: center; gap: .7rem; }
.install-button { min-height: 38px; padding: .45rem .7rem; border: 1px solid var(--line-bright); border-radius: 8px; color: var(--ink); background: #0b1b31; font: 800 .7rem "Courier New", monospace; cursor: pointer; }
.install-button[hidden] { display: none; }
.topbar-status { display: flex; gap: 0.45rem; align-items: center; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.09em; }
.status-light { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }
.topbar-status[data-status="offline"] .status-light { background: var(--coral); box-shadow: 0 0 12px var(--coral); }
.topbar-status[data-status="reconnecting"] .status-light { background: #ffc85a; box-shadow: 0 0 12px #ffc85a; animation: statusPulse 1s steps(2, end) infinite; }
.topbar-status[data-status="update"] .status-light { background: var(--blue); box-shadow: 0 0 12px var(--blue); }

.system-banner { position: fixed; z-index: 1800; top: calc(var(--safe-top) + 8px); left: 50%; width: min(620px, calc(100% - var(--safe-left) - var(--safe-right) - 20px)); min-height: 44px; padding: .55rem .65rem; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: .65rem; border: 2px solid var(--line-bright); border-radius: 10px; color: var(--ink); background: rgba(12,29,52,.98); box-shadow: 5px 6px 0 rgba(0,0,0,.46); transform: translateX(-50%); font-size: .78rem; }
.system-banner[hidden] { display: none; }
.system-banner-dot { width: 10px; height: 10px; background: #ffc85a; }
.system-banner[data-status="offline"] { border-color: #b94e57; }
.system-banner[data-status="offline"] .system-banner-dot { background: var(--coral); }
.system-banner[data-status="update"] .system-banner-dot { background: var(--blue); }
.system-banner button { min-height: 30px; border: 1px solid #75baff; border-radius: 6px; color: var(--ink); background: #15375c; font: 800 .68rem "Courier New", monospace; }

@keyframes statusPulse { 50% { opacity: .3; } }

main { padding: clamp(2rem, 5vw, 5rem) 0 max(clamp(2rem, 5vw, 5rem), var(--safe-bottom)); }
main:focus { outline: none; }
footer { min-height: calc(64px + var(--safe-bottom)); padding-bottom: var(--safe-bottom); display: flex; justify-content: space-between; align-items: center; color: #718098; font-size: 0.72rem; border-top: 1px solid rgba(73, 109, 151, 0.35); text-transform: uppercase; letter-spacing: 0.08em; }

.install-dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px); padding: clamp(22px, 5vw, 36px); border: 2px solid var(--line-bright); border-radius: 18px; color: var(--ink); background: #0b1c32; box-shadow: 9px 11px 0 rgba(0,0,0,.55); }
.install-dialog::backdrop { background: rgba(1,6,13,.78); backdrop-filter: blur(4px); }
.install-dialog-icon { margin-bottom: 1rem; }
.install-dialog h2 { font-size: clamp(1.55rem, 6vw, 2.2rem); }
.install-dialog p, .install-steps { color: #bdcad9; line-height: 1.55; }
.install-steps { padding-left: 1.25rem; }
.install-steps li + li { margin-top: .65rem; }

.screen-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 2.2rem; }
.screen-head > div { max-width: 720px; }
.back-button, .icon-button {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 2px solid var(--line);
  border-radius: 11px;
  background: #0b1b31;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
  cursor: pointer;
  font-size: 1.3rem;
}

h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 1rem; font-size: clamp(2.75rem, 8vw, 6.8rem); line-height: 0.86; letter-spacing: -0.08em; text-wrap: balance; }
h2 { margin-bottom: 0.45rem; font-size: clamp(1.65rem, 4vw, 2.5rem); line-height: 1.05; }
h3 { margin-bottom: 0.4rem; font-size: 1.05rem; }
.lede { color: var(--muted); font-size: clamp(1rem, 2vw, 1.22rem); line-height: 1.6; }
.eyebrow { margin-bottom: 0.75rem; color: var(--coral); font-size: 0.72rem; letter-spacing: 0.17em; text-transform: uppercase; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr); gap: clamp(2rem, 7vw, 7rem); align-items: center; }
.home-copy .lede { max-width: 600px; }
.home-actions { display: grid; gap: 0.75rem; margin-top: 2.2rem; max-width: 590px; }

.arcade-button {
  position: relative;
  width: 100%;
  min-height: 72px;
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.9rem;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: linear-gradient(100deg, rgba(18, 42, 73, 0.96), rgba(9, 24, 44, 0.96));
  box-shadow: var(--shadow-pixel);
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.arcade-button:hover { transform: translate(-2px, -2px); border-color: var(--blue); }
.arcade-button.primary { border-color: #f27e77; background: linear-gradient(100deg, #d7424d, #a7243e); }
.button-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 2px solid rgba(255,255,255,0.22); border-radius: 9px; background: rgba(4,12,25,0.5); font-size: 1.25rem; }
.button-label { display: block; margin-bottom: 0.16rem; font-size: 1.05rem; }
.button-copy { display: block; color: #bbc6d6; font-size: 0.78rem; }
.primary .button-copy { color: #ffe3df; }
.button-arrow { color: var(--blue); font-size: 1.4rem; }

.hero-table {
  position: relative;
  min-height: 480px;
  border: 2px solid var(--line);
  border-radius: 38% 38% 18px 18px;
  background: radial-gradient(circle at 50% 75%, #143b4d, #09182b 68%);
  box-shadow: 12px 12px 0 rgba(1,6,15,0.55), inset 0 0 60px rgba(72, 163, 185, 0.12);
  overflow: hidden;
}
.hero-table::before { content: "STANDARD 52"; position: absolute; top: 2rem; left: 50%; transform: translateX(-50%); color: #5b7898; font: 700 0.68rem "Courier New", monospace; letter-spacing: 0.2em; white-space: nowrap; }
.hero-table::after { content: ""; position: absolute; width: 360px; height: 220px; border: 1px solid rgba(83, 206, 178, 0.22); border-radius: 50%; left: 50%; bottom: -110px; transform: translateX(-50%); }

.hero-card {
  position: absolute;
  width: 170px;
  aspect-ratio: 0.7;
  left: 50%;
  bottom: 44px;
  padding: 0.8rem;
  border: 4px solid #e9e1d3;
  border-radius: 12px;
  color: #0d2442;
  background:
    linear-gradient(rgba(80,60,30,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80,60,30,.05) 1px, transparent 1px), var(--paper);
  background-size: 4px 4px;
  box-shadow: 6px 8px 0 rgba(0,0,0,0.48);
  transform-origin: 50% 130%;
  font: 900 2.2rem/0.82 Georgia, serif;
}
.hero-card span { display: block; }
.hero-card.red { color: #c42e40; }
.hero-card.one { transform: translateX(-104%) rotate(-18deg); }
.hero-card.two { z-index: 2; transform: translateX(-50%) translateY(-24px) rotate(0); }
.hero-card.three { z-index: 3; transform: translateX(5%) rotate(18deg); }
.hero-card .suit { margin-top: 0.3rem; font-size: 2.8rem; }

.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.choice-card {
  min-height: 260px;
  padding: 1.45rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow-pixel);
  text-align: left;
  cursor: pointer;
}
.choice-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.choice-card .choice-icon { width: 58px; height: 58px; margin-bottom: auto; display: grid; place-items: center; border-radius: 13px; color: var(--blue); background: rgba(79,167,255,0.13); font-size: 1.65rem; }
.choice-card p { color: var(--muted); line-height: 1.5; }
.choice-card strong { color: var(--blue); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.09em; }

.family-section + .family-section { margin-top: 2.5rem; }
.family-header { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--line); }
.family-header p { margin: 0; max-width: 600px; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.family-kicker { color: var(--blue); font: 700 0.68rem "Courier New", monospace; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- Spatial deck and game library ---------- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.library-screen { overflow: hidden; }
.library-screen .site-shell {
  width: 100%;
  height: 100dvh;
  padding: 0;
  grid-template-rows: auto minmax(0, 1fr);
}
.library-screen .topbar {
  position: relative;
  z-index: 80;
  min-height: calc(66px + var(--safe-top));
  padding: var(--safe-top) max(18px, var(--safe-right)) 0 max(18px, var(--safe-left));
  border: 0;
  background: linear-gradient(#030b17 12%, rgba(3,11,23,.66) 70%, transparent);
}
.library-screen .brand-mark { transform: scale(.72); transform-origin: left center; }
.library-screen .brand strong { color: rgba(235,245,255,.78); font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; }
.library-screen .topbar-status { color: rgba(187,208,231,.48); font-size: .62rem; }
.library-screen main { min-height: 0; padding: 0; overflow: hidden; }
.library-screen footer { display: none; }

.arcade-library-scene {
  --library-deck-width: clamp(128px, min(18vw, 31vh), 220px);
  --library-orbit-x: clamp(170px, 28vw, 360px);
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  perspective: 1100px;
  perspective-origin: 50% 48%;
  color: #f4f7fb;
  background:
    radial-gradient(circle at 50% 46%, rgba(47,95,134,.19), transparent 30%),
    radial-gradient(circle at 50% 115%, rgba(33,93,90,.18), transparent 42%),
    linear-gradient(180deg, #030a14, #06101d 55%, #020710);
}
.arcade-library-atmosphere {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(137,190,225,.38) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(102,235,197,.25) 0 1px, transparent 1.5px);
  background-position: 7% 18%, 83% 72%;
  background-size: 83px 79px, 131px 113px;
  opacity: .24;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}
.arcade-library-hud {
  position: absolute;
  z-index: 70;
  top: max(10px, var(--safe-top));
  left: max(14px, var(--safe-left));
  right: max(14px, var(--safe-right));
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}
.arcade-library-hud > * { pointer-events: auto; }
.arcade-library-hud > span {
  color: rgba(203,222,241,.55);
  font: 800 .62rem "Cardcade Pixel", "Courier New", monospace;
  letter-spacing: .16em;
}
.arcade-library-hud b { color: rgba(239,249,255,.86); }
.arcade-library-back {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  color: rgba(235,247,255,.76);
  background: transparent;
  font: 900 1.65rem/1 "Cardcade Pixel", monospace;
  text-shadow: 3px 4px 0 rgba(0,0,0,.55);
  cursor: pointer;
}
.arcade-library-back:hover { color: #fff; transform: translateX(-2px); }

.orbital-deck-stage,
.spatial-game-stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 300ms cubic-bezier(.2,.76,.2,1), opacity 220ms ease, filter 300ms ease;
}
.orbital-deck-stage { z-index: 10; }
.deck-orbit-viewport {
  position: absolute;
  inset: 0;
  overflow: visible;
  transform-style: preserve-3d;
  touch-action: pan-y;
}
.orbital-deck {
  --orbit-face-brightness: 1;
  --orbit-face-saturation: 1;
  --orbit-face-opacity: 1;
  --orbit-shadow-y: 24px;
  --orbit-shadow-blur: 25px;
  --orbit-shadow-alpha: .62;
  position: absolute;
  top: 47%;
  left: 50%;
  width: var(--library-deck-width);
  aspect-ratio: 5 / 7;
  padding: 0;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  filter: none;
  opacity: 1;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transition: transform 270ms cubic-bezier(.2,.78,.22,1);
  touch-action: manipulation;
  cursor: pointer;
}
.orbital-deck:focus-visible { outline: 0 !important; }
.orbital-deck-hit-target {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.001);
  transform: translateZ(100px);
}
.orbital-deck[data-orbit-slot="0"] {
  z-index: 8;
  --orbit-face-brightness: 1.08;
  --orbit-face-saturation: 1.08;
  transform: translate3d(-50%, calc(-50% + 62px), 235px) scale(1);
}
.orbital-deck[data-orbit-slot="1"] {
  z-index: 5;
  --orbit-face-brightness: .64;
  --orbit-face-saturation: .78;
  --orbit-face-opacity: .9;
  --orbit-shadow-y: 18px;
  --orbit-shadow-blur: 18px;
  --orbit-shadow-alpha: .56;
  transform: translate3d(calc(-50% + var(--library-orbit-x)), calc(-50% - 16px), -45px) scale(.73);
}
.orbital-deck[data-orbit-slot="-1"] {
  z-index: 5;
  --orbit-face-brightness: .64;
  --orbit-face-saturation: .78;
  --orbit-face-opacity: .9;
  --orbit-shadow-y: 18px;
  --orbit-shadow-blur: 18px;
  --orbit-shadow-alpha: .56;
  transform: translate3d(calc(-50% - var(--library-orbit-x)), calc(-50% - 16px), -45px) scale(.73);
}
.orbital-deck[data-orbit-slot="2"],
.orbital-deck[data-orbit-slot="-2"] {
  z-index: 1;
  --orbit-face-brightness: .34;
  --orbit-face-saturation: .52;
  --orbit-face-opacity: .72;
  --orbit-shadow-y: 12px;
  --orbit-shadow-blur: 12px;
  --orbit-shadow-alpha: .5;
}
.orbital-deck[data-orbit-slot="2"] { transform: translate3d(-50%, calc(-50% - 116px), -315px) scale(.5); }
.orbital-deck[data-orbit-slot="-2"] { transform: translate3d(-50%, calc(-50% - 116px), -315px) scale(.5); }
.orbital-deck-box {
  --deck-box-depth: clamp(38px, 4.4vw, 58px);
  --deck-box-half-depth: clamp(19px, 2.2vw, 29px);
  --deck-box-face: #e6dcc5;
  --deck-box-back: #746b5c;
  --deck-box-edge-dark: #716653;
  --deck-box-outline: #fff4dc;
  --deck-box-ink: #15233a;
  --deck-box-accent: #bd3448;
  --deck-box-grid: rgba(67, 51, 31, .09);
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transition: transform 140ms ease;
  transform: rotateX(-5deg);
}
.orbital-deck[data-orbit-slot="1"] .orbital-deck-box { transform: rotateY(-58deg) rotateX(-5deg); }
.orbital-deck[data-orbit-slot="-1"] .orbital-deck-box { transform: rotateY(58deg) rotateX(-5deg); }
.orbital-deck[data-orbit-slot="2"] .orbital-deck-box { transform: rotateY(-164deg) rotateX(-5deg); }
.orbital-deck[data-orbit-slot="-2"] .orbital-deck-box { transform: rotateY(164deg) rotateX(-5deg); }
.orbital-deck:hover,
.orbital-deck.controller-hover { --orbit-face-brightness: 1.08; }
.orbital-deck.active .orbital-deck-box {
  transform: rotateX(-12deg) rotateY(-20deg);
  animation: orbitalDeckIdle 2.8s ease-in-out infinite;
}
.show-games .orbital-deck.active .orbital-deck-box { animation-play-state: paused; }
@keyframes orbitalDeckIdle {
  0%, 100% { transform: translateY(0) rotateX(-12deg) rotateY(-20deg); }
  50% { transform: translateY(-4px) rotateX(-12deg) rotateY(-20deg); }
}

.deck-box-front,
.deck-box-rear {
  position: absolute;
  inset: 0;
  padding: clamp(17px, 2vw, 25px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(8px, 1.1vw, 13px);
  overflow: hidden;
  border: 5px solid var(--deck-box-edge-dark);
  border-radius: 0;
  color: var(--deck-box-ink);
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, var(--deck-box-grid) 12px 15px),
    linear-gradient(var(--deck-box-grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--deck-box-grid) 2px, transparent 2px),
    var(--deck-box-face);
  background-size: auto, 10px 10px, 10px 10px, auto;
  box-shadow:
    inset 0 0 0 4px var(--deck-box-outline),
    inset 0 0 0 8px var(--deck-box-edge-dark),
    inset 0 0 0 11px color-mix(in srgb, var(--deck-box-outline) 56%, transparent);
  filter:
    brightness(var(--orbit-face-brightness))
    saturate(var(--orbit-face-saturation))
    drop-shadow(0 var(--orbit-shadow-y) var(--orbit-shadow-blur) rgba(0, 0, 0, var(--orbit-shadow-alpha)));
  opacity: var(--orbit-face-opacity);
  transition: filter 220ms ease, opacity 220ms ease;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, calc(100% - 5px) 2px, 100% 2px, 100% calc(100% - 5px), calc(100% - 2px) calc(100% - 5px), calc(100% - 2px) 100%, 5px 100%, 5px calc(100% - 2px), 0 calc(100% - 2px), 0 5px, 2px 5px, 2px 2px, 5px 2px);
  text-align: center;
}
.deck-box-front { transform: translateZ(var(--deck-box-half-depth)); }
.deck-box-front::before,
.deck-box-rear::before {
  content: "";
  position: absolute;
  inset: 15px;
  border: 3px solid var(--deck-box-outline);
  box-shadow:
    inset 0 0 0 3px var(--deck-box-edge-dark),
    0 0 0 3px color-mix(in srgb, var(--deck-box-outline) 34%, transparent);
}
.deck-box-front::after {
  content: "";
  position: absolute;
  inset: 21px;
  background:
    linear-gradient(var(--deck-box-outline) 0 0) 0 0 / 18px 4px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 0 0 / 4px 18px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 100% 0 / 18px 4px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 100% 0 / 4px 18px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 0 100% / 18px 4px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 0 100% / 4px 18px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 100% 100% / 18px 4px no-repeat,
    linear-gradient(var(--deck-box-outline) 0 0) 100% 100% / 4px 18px no-repeat;
  opacity: .78;
}
.deck-box-rear {
  color: var(--deck-box-accent);
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(0, 0, 0, .2) 6px 12px),
    var(--deck-box-back);
  transform: rotateY(180deg) translateZ(var(--deck-box-half-depth));
}
.deck-box-rear span { position: relative; font: 900 clamp(2rem, 5vw, 4rem)/1 "Cardcade Pixel", monospace; }
.deck-box-rear b { position: relative; font: 900 .58rem "Cardcade Pixel", monospace; letter-spacing: .14em; text-transform: uppercase; }
.deck-box-side,
.deck-box-top,
.deck-box-bottom {
  position: absolute;
  display: block;
  overflow: hidden;
  border: 4px solid var(--deck-box-edge-dark);
  color: var(--deck-box-accent);
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, var(--deck-box-grid) 10px 13px),
    var(--deck-box-back);
  box-shadow:
    inset 0 0 0 4px var(--deck-box-outline),
    inset 0 0 0 8px var(--deck-box-edge-dark),
    inset 0 0 0 11px color-mix(in srgb, var(--deck-box-outline) 42%, transparent);
  filter: brightness(var(--orbit-face-brightness)) saturate(var(--orbit-face-saturation));
  opacity: var(--orbit-face-opacity);
  transition: filter 220ms ease, opacity 220ms ease;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.deck-box-side {
  top: 0;
  width: var(--deck-box-depth);
  height: 100%;
  display: grid;
  place-items: center;
}
.deck-box-side i,
.deck-box-top i {
  position: relative;
  z-index: 2;
  color: var(--deck-box-accent);
  font: 900 clamp(1.2rem, 2.6vw, 2rem)/1 "Cardcade Pixel", Georgia, serif;
  font-style: normal;
  text-shadow: 3px 3px 0 rgba(0,0,0,.34);
}
.deck-box-side-right { right: calc(0px - var(--deck-box-half-depth)); transform: rotateY(90deg); }
.deck-box-side-left { left: calc(0px - var(--deck-box-half-depth)); transform: rotateY(-90deg); }
.deck-box-top,
.deck-box-bottom {
  left: 0;
  width: 100%;
  height: var(--deck-box-depth);
}
.deck-box-top {
  top: calc(0px - var(--deck-box-half-depth));
  display: grid;
  place-items: center;
  transform: rotateX(90deg);
}
.deck-box-bottom { bottom: calc(0px - var(--deck-box-half-depth)); transform: rotateX(-90deg); }
.deck-box-front small,
.deck-box-front strong,
.deck-box-front b { position: relative; z-index: 2; }
.deck-box-front small { font: 900 clamp(.48rem, .9vw, .66rem) "Cardcade Pixel", monospace; letter-spacing: .18em; text-transform: uppercase; opacity: .78; }
.deck-box-front strong { max-width: 88%; font: 900 clamp(.72rem, 1.45vw, 1.08rem)/1.08 "Cardcade Pixel", monospace; overflow-wrap: anywhere; text-transform: uppercase; }
.deck-box-front b { font: 900 clamp(.46rem, .8vw, .58rem) "Cardcade Pixel", monospace; letter-spacing: .1em; text-transform: uppercase; opacity: .74; }
.deck-box-emblem {
  position: relative;
  z-index: 2;
  width: min(76%, 142px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--deck-box-accent);
  font: 900 clamp(3.4rem, 7.5vw, 6rem)/1 "Cardcade Pixel", Georgia, serif;
  text-shadow: 5px 6px 0 rgba(0,0,0,.38);
}
.orbital-deck-box[data-family="standard-52"] {
  --deck-box-face: #7d1f2e;
  --deck-box-back: #4a101c;
  --deck-box-edge-dark: #350914;
  --deck-box-outline: #efc45c;
  --deck-box-ink: #f7d56f;
  --deck-box-accent: #f7d56f;
  --deck-box-grid: rgba(255,109,91,.12);
}
.orbital-deck-box[data-family="color-action"] {
  --deck-box-face: #234d8b;
  --deck-box-back: #172d61;
  --deck-box-edge-dark: #291849;
  --deck-box-outline: #f0c95b;
  --deck-box-ink: #fff8e4;
  --deck-box-accent: #71eba0;
  --deck-box-grid: rgba(103,199,255,.12);
}
.orbital-deck-box[data-family="color-action"] .deck-box-front { text-shadow: 2px 3px 0 rgba(0,0,0,.48); }
.orbital-deck-box[data-family="rotating-rummy"] {
  --deck-box-face: #111921;
  --deck-box-back: #080d12;
  --deck-box-edge-dark: #05090d;
  --deck-box-outline: #d8bd50;
  --deck-box-ink: #f6cc4f;
  --deck-box-accent: #6ce7ff;
  --deck-box-grid: rgba(108,231,255,.12);
}
.orbital-deck-box[data-family="finders-makers"] {
  --deck-box-face: #145744;
  --deck-box-back: #092f28;
  --deck-box-edge-dark: #05251f;
  --deck-box-outline: #d4b857;
  --deck-box-ink: #e9fff4;
  --deck-box-accent: #baffdc;
  --deck-box-grid: rgba(149,255,203,.12);
}

.orbit-step {
  position: absolute;
  z-index: 28;
  top: 51%;
  width: 58px;
  height: 76px;
  padding: 0;
  border: 0;
  color: rgba(224,240,252,.48);
  background: transparent;
  font: 900 clamp(2rem, 5vw, 4rem)/1 "Cardcade Pixel", monospace;
  text-shadow: 4px 5px 0 rgba(0,0,0,.54);
  transform: translateY(-50%);
  cursor: pointer;
}
.orbit-step:hover,
.orbit-step.controller-hover { color: #fff; }
.orbit-step-left { left: max(14px, 4vw); }
.orbit-step-right { right: max(14px, 4vw); }
.orbit-readout {
  position: absolute;
  z-index: 24;
  left: 50%;
  bottom: clamp(48px, 7vh, 78px);
  width: min(90%, 560px);
  display: grid;
  gap: 5px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
.orbit-readout strong { font: 900 clamp(.88rem, 2vw, 1.25rem) "Cardcade Pixel", monospace; letter-spacing: .06em; text-transform: uppercase; text-shadow: 3px 4px 0 #000; }
.orbit-readout small { color: rgba(195,217,235,.6); font: 800 .58rem "Cardcade Pixel", monospace; letter-spacing: .08em; text-transform: uppercase; }

.show-games .orbital-deck-stage {
  opacity: .34;
  filter: brightness(.56) blur(.6px);
  transform: translate3d(0, -19%, -540px) scale(.64);
  pointer-events: none;
}
.show-games .orbital-deck:not(.active) { --orbit-face-opacity: .15; }
.spatial-game-stage {
  z-index: 36;
  padding: clamp(62px, 9vh, 92px) max(18px, var(--safe-right)) max(58px, calc(var(--safe-bottom) + 52px)) max(18px, var(--safe-left));
  display: grid;
  grid-template-rows: auto minmax(0, auto) auto;
  place-content: center;
  justify-items: center;
  opacity: 0;
  transform: translate3d(0, 48px, 260px) scale(.9);
  pointer-events: none;
}
.show-games .spatial-game-stage { opacity: 1; transform: translate3d(0, 0, 165px) scale(1); pointer-events: auto; }
.spatial-game-family {
  margin: 0 0 12px;
  color: rgba(191,217,238,.54);
  font: 900 .62rem "Cardcade Pixel", monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.spatial-mode-list {
  width: min(92vw, 620px);
  max-height: min(55vh, 440px);
  padding: 26px 28px;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  mask-image: linear-gradient(to bottom, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.spatial-mode-list::-webkit-scrollbar { display: none; }
.spatial-game-option {
  position: relative;
  width: 100%;
  min-height: 46px;
  padding: 7px 28px;
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  border: 0;
  color: rgba(235,244,251,.42);
  background: transparent;
  text-align: center;
  text-shadow: 3px 4px 0 rgba(0,0,0,.76);
  transform: scale(.94) translateZ(0);
  transition: color 120ms ease, transform 140ms cubic-bezier(.2,.8,.2,1), opacity 120ms ease;
  cursor: pointer;
}
.spatial-game-option > span { flex: 0 0 auto; opacity: 0; font: 900 1.2rem "Cardcade Pixel", monospace; transform: translateX(-6px); transition: opacity 120ms ease, transform 120ms ease; }
.spatial-game-option strong { min-width: 0; font: 900 clamp(1.18rem, 3vw, 2.05rem)/1.05 "Cardcade Pixel", monospace; letter-spacing: .035em; text-transform: uppercase; }
.spatial-game-option:hover:not(:disabled) { color: rgba(255,255,255,.76); transform: scale(.99); }
.spatial-game-option.active,
.spatial-game-option:focus-visible,
.spatial-game-option.controller-hover {
  color: #fff;
  transform: scale(1.08) translateZ(24px);
}
.spatial-game-option.active > span,
.spatial-game-option:focus-visible > span,
.spatial-game-option.controller-hover > span { opacity: 1; transform: translateX(0); }
.spatial-game-option:focus-visible { outline: 0; }
.spatial-game-option:disabled { opacity: .25; cursor: not-allowed; }
.spatial-game-context {
  min-height: 1rem;
  margin: 12px 0 0;
  color: rgba(198,219,235,.46);
  font: 800 .57rem "Cardcade Pixel", monospace;
  letter-spacing: .06em;
  text-align: center;
  text-transform: uppercase;
}
.spatial-mode-empty { color: rgba(255,255,255,.6); }
.arcade-library-help {
  position: absolute;
  z-index: 74;
  left: 50%;
  bottom: max(14px, calc(var(--safe-bottom) + 8px));
  width: min(94%, 700px);
  margin: 0;
  color: rgba(176,205,226,.42);
  font: 800 .54rem "Cardcade Pixel", monospace;
  letter-spacing: .12em;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.arcade-library-scene.reduced-motion :is(.orbital-deck-stage, .spatial-game-stage, .orbital-deck, .orbital-deck-box, .spatial-game-option),
.arcade-library-scene.reduced-motion .orbital-deck.active .orbital-deck-box { animation: none !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
.badge { display: inline-flex; padding: 0.38rem 0.55rem; border: 1px solid var(--line-bright); border-radius: 999px; color: #b9c8da; font: 700 0.62rem "Courier New", monospace; letter-spacing: .09em; text-transform: uppercase; }

.form-panel, .room-panel, .solo-panel {
  padding: clamp(1rem, 3vw, 1.6rem);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-pixel);
}
.form-panel { max-width: 620px; margin-inline: auto; }
.field { display: grid; gap: 0.45rem; margin-bottom: 1rem; }
.field label { color: #c7d2e1; font-weight: 700; font-size: 0.82rem; }
.field input, .field select {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #07152a;
}
.field-help { color: var(--muted); font-size: 0.74rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: 1.25rem; }
.segmented button { min-height: 48px; border: 2px solid var(--line); border-radius: 9px; background: #0a1930; cursor: pointer; }
.segmented button.active { border-color: var(--blue); background: rgba(79,167,255,.14); }

.action-button {
  min-height: 50px;
  padding: .8rem 1rem;
  border: 2px solid var(--line-bright);
  border-radius: 10px;
  color: var(--ink);
  background: #102644;
  box-shadow: 3px 3px 0 rgba(0,0,0,.34);
  font-weight: 800;
  cursor: pointer;
}
.action-button.primary { border-color: #ff8882; background: linear-gradient(180deg, #dd4b55, #a82b41); }
.action-button:disabled { cursor: not-allowed; opacity: .46; }
.button-row { display: flex; gap: .7rem; flex-wrap: wrap; }
.button-row > * { flex: 1 1 150px; }

.room-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(380px, 1.1fr); gap: 1rem; align-items: start; }
.room-layout .full-width { grid-column: 1 / -1; }
.room-code-box { padding: 1.1rem; margin-bottom: 1rem; border: 2px dashed var(--line-bright); border-radius: 13px; text-align: center; background: rgba(4,13,27,.52); }
.room-code { margin: .35rem 0; color: var(--ink); font-size: clamp(2rem, 7vw, 4rem); letter-spacing: .16em; }
.room-code-label { color: var(--blue); font: 700 .66rem "Courier New", monospace; letter-spacing: .16em; text-transform: uppercase; }
.player-list { display: grid; gap: .55rem; margin: 1rem 0; }
.player-row { min-height: 63px; padding: .65rem; display: grid; grid-template-columns: 42px 1fr auto; gap: .7rem; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(5,16,33,.55); }
.player-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: #152c4e; font: 900 .78rem "Courier New", monospace; }
.player-row strong { display: block; }
.player-row small { color: var(--muted); }
.ready-pill { color: var(--muted); font: 700 .62rem "Courier New", monospace; text-transform: uppercase; letter-spacing: .1em; }
.ready-pill.ready { color: var(--mint); }
.connection-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--coral); }
.connection-dot.online { background: var(--mint); }

.room-game-choice { display: grid; justify-items: start; gap: .6rem; }
.room-game-choice > strong { font: 900 clamp(1.2rem, 3vw, 1.8rem) "Cardcade Pixel", monospace; text-transform: uppercase; }
.room-game-choice > p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.room-game-choice .action-button { margin-top: .35rem; }
.stepper { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; margin: 1rem 0; }
.stepper button { height: 44px; border: 2px solid var(--line); color: var(--ink); background: #0a1930; cursor: pointer; }
.stepper output { text-align: center; font: 900 1.1rem "Courier New", monospace; }
.hot-seat-names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin: 1rem 0; }
.hot-seat-names .field { margin: 0; }
.callout { padding: .85rem 1rem; border-left: 4px solid var(--blue); color: #bcc9d9; background: rgba(79,167,255,.08); font-size: .82rem; line-height: 1.5; }
.callout.coral { border-color: var(--coral); background: rgba(255,94,98,.08); }
.empty-state { padding: 2rem; border: 2px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; }

.skin-preview { min-height: 103px; padding: .5rem; display: flex; align-items: end; justify-content: center; gap: .55rem; overflow: hidden; border: 1px solid rgba(91,137,184,.32); border-radius: 9px; background: radial-gradient(circle at 50% 120%, rgba(67,112,156,.22), rgba(3,12,25,.72)); }
.skin-preview-card { position: relative; width: 54px; height: 77px; display: grid; place-items: center; overflow: hidden; border: 3px solid #e7ddc8; border-radius: 7px; box-shadow: 4px 5px 0 rgba(0,0,0,.42); }
.skin-preview-face { transform: rotate(-4deg); }
.skin-preview-back { transform: rotate(4deg); }
.skin-preview-standard-face { color: #bd2936; background: linear-gradient(rgba(83,64,35,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(83,64,35,.055) 1px, transparent 1px), #f5eedf; background-size: 4px 4px; }
.skin-preview-standard-face > span { position: absolute; top: 6px; left: 7px; display: grid; justify-items: center; font-family: "Cardcade Ranks", "Courier New", monospace; line-height: .78; }
.skin-preview-standard-face > span strong { font-size: 1.05rem; font-weight: 400; }
.skin-preview-standard-face > span i { margin-top: 1px; font: normal .68rem Georgia, serif; }
.skin-preview-standard-face > b { position: absolute; inset: 30px 25% 16px; display: grid; place-items: center; font: normal 1.25rem/.8 Georgia, serif; }
.skin-preview-standard-back { color: #cbe4ff; background: repeating-linear-gradient(45deg, #112948 0 4px, #1b3b62 4px 7px); font: 900 .76rem "Cardcade Pixel", monospace; letter-spacing: .08em; }
.skin-preview-juan-face { color: #fffaf0; background: linear-gradient(132deg, rgba(255,255,255,.15), transparent 34%, rgba(5,13,26,.1)), #43b66b; }
.skin-preview-juan-face small { position: absolute; top: 6px; left: 7px; font: 400 .9rem "Cardcade Ranks", monospace; }
.skin-preview-juan-face b { font: 400 2.4rem "Cardcade Ranks", monospace; text-shadow: 2px 2px 0 rgba(5,13,26,.16); }
.skin-preview-juan-prism { color: #fffaf0; background: radial-gradient(circle at 50% 45%, rgba(124,169,217,.22), transparent 36%), #0b1320; }
.skin-preview-juan-prism small { position: absolute; top: 6px; left: 7px; font: 800 .4rem "Cardcade Pixel", monospace; letter-spacing: -.03em; }
.skin-preview-juan-prism .juan-wild-tiles { width: 48%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8%; }
.skin-preview-juan-back { color: #fffaf0; background: linear-gradient(135deg, rgba(255,255,255,.08), transparent 46%), #0b1c34; font: 900 .68rem "Cardcade Pixel", monospace; letter-spacing: .1em; }
.skin-preview-rummy-face { color: #f5ca4d; border-color: #dce9f4; background: #080c12; }
.skin-preview-rummy-face small { position: absolute; top: 6px; left: 7px; font: 400 .9rem "Cardcade Ranks", monospace; }
.skin-preview-rummy-face b { font: 400 2.45rem/.78 "Cardcade Ranks", monospace; text-shadow: 2px 3px 0 #02050a; }
.skin-preview-rummy-wild { border-color: #dce9f4; background: linear-gradient(145deg, #1a2633, #080c12 72%); }
.skin-preview-rummy-back { color: #f5ca4d; background: repeating-linear-gradient(45deg, rgba(245,202,77,.15) 0 3px, transparent 3px 7px), repeating-linear-gradient(-45deg, rgba(98,184,255,.1) 0 3px, transparent 3px 7px), #101821; font: 900 .74rem "Cardcade Pixel", monospace; letter-spacing: .11em; }
.table-skin-preview {
  position: relative;
  min-height: 112px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--table-border);
  border-radius: 12px;
  color: var(--table-preview-ink);
  background:
    linear-gradient(var(--table-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--table-grid) 1px, transparent 1px),
    radial-gradient(circle at 50% 120%, var(--table-green-light), var(--table-green) 58%, var(--table-green-deep));
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow: inset 0 0 30px var(--table-felt-shadow), 4px 5px 0 rgba(0,0,0,.32);
  isolation: isolate;
}
.table-skin-preview::before { content: ""; position: absolute; z-index: -1; inset: 10px; border: 1px solid var(--table-preview-line); border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.table-skin-preview > span { position: relative; z-index: 1; padding: .35rem .55rem; border: 1px solid var(--table-preview-line); border-radius: 999px; background: rgba(4,12,23,.38); font: 800 .62rem "Cardcade Pixel", "Courier New", monospace; letter-spacing: .09em; text-transform: uppercase; }
.table-skin-preview > i { position: absolute; z-index: 1; width: 26px; height: 26px; border: 2px solid var(--table-preview-line); border-radius: 50%; background: rgba(255,255,255,.055); box-shadow: 0 0 0 999px rgba(255,255,255,.012); }
.legacy-mode-preview { margin-top: .7rem; display: flex; align-items: end; gap: .45rem; }
.legacy-preview-card { position: relative; width: 38px; height: 54px; overflow: hidden; border: 1px solid rgba(0,0,0,.18); border-radius: 5px; box-shadow: 3px 4px 0 rgba(0,0,0,.38); }
.legacy-preview-face { color: #3f6089; background: linear-gradient(160deg, #fbf6ea, #f7f1e2 42%, #e9dec4); font-family: Georgia, "Times New Roman", serif; transform: rotate(-3deg); }
.legacy-preview-face > span { position: absolute; z-index: 2; top: 3px; left: 4px; display: grid; justify-items: center; line-height: .76; }
.legacy-preview-face > span strong { font-size: .65rem; }
.legacy-preview-face > span i { margin-top: 1px; font: normal .42rem Georgia, serif; }
.legacy-preview-face > svg { position: absolute; inset: 22% 28% 9%; width: 44%; height: 69%; filter: drop-shadow(1px 1px 0 rgba(13,20,34,.15)); }
.legacy-preview-back {
  border-color: rgba(116,184,255,.48);
  background:
    linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%),
    linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%),
    #142644;
  background-position: 0 0, 3px 3px;
  background-size: 6px 6px;
  transform: rotate(3deg);
}

.toast { position: fixed; z-index: 2000; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); max-width: calc(100% - 2rem); padding: .8rem 1rem; border: 2px solid var(--line-bright); border-radius: 9px; color: var(--ink); background: #10243e; box-shadow: 5px 5px 0 rgba(0,0,0,.5); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity 150ms ease, transform 150ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.controller-cursor {
  position: fixed;
  z-index: 2500;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-48px, -48px, 0);
  transition: opacity 120ms ease;
}
.controller-cursor:not([hidden]) { opacity: 1; }
.controller-cursor svg { display: block; width: 100%; height: 100%; overflow: visible; }
.controller-cursor :is(path, circle) { fill: none; stroke-linecap: square; }
.controller-cursor-outline { stroke: #02050b; stroke-width: 4.5; }
.controller-cursor-fill { stroke: #fff; stroke-width: 1.8; }
#controller-keyboard-root { position: fixed; z-index: 1950; inset: 0; pointer-events: none; }
.controller-keyboard-dialog {
  position: absolute;
  inset: 0;
  padding: calc(var(--safe-top) + 1rem) calc(var(--safe-right) + 1rem) calc(var(--safe-bottom) + 1rem) calc(var(--safe-left) + 1rem);
  display: grid;
  place-items: center;
  background: rgba(1, 8, 18, .82);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}
.controller-keyboard-panel {
  width: min(760px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(1rem, 3vw, 1.45rem);
  border: 2px solid #5b91c4;
  border-radius: 15px;
  color: var(--ink);
  background: linear-gradient(145deg, #122d4e, #08182d);
  box-shadow: 8px 9px 0 rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(180, 224, 255, .16);
}
.controller-keyboard-kicker { margin: 0 0 .28rem; color: #8ecfff; font: 800 .68rem "Courier New", monospace; letter-spacing: .12em; text-transform: uppercase; }
.controller-keyboard-title { margin: 0; font-size: clamp(1.35rem, 4vw, 2rem); }
.controller-keyboard-help { margin: .42rem 0 .85rem; color: #b8c8d9; font-size: .85rem; line-height: 1.4; }
.controller-keyboard-value {
  min-height: 48px;
  margin-bottom: .85rem;
  padding: .72rem .85rem;
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid #50779f;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(3, 12, 25, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  font: 800 1rem "Courier New", monospace;
}
.controller-keyboard-value.empty { color: #91a7bf; font-style: italic; }
.controller-keyboard-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr)); gap: .42rem; }
.controller-keyboard-key,
.controller-keyboard-action {
  min-height: 46px;
  border: 2px solid #365d84;
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #193b60, #0b2039);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, .42);
  cursor: pointer;
  font: 900 .92rem "Courier New", monospace;
}
.controller-keyboard-key:hover,
.controller-keyboard-action:hover { border-color: #8cd0ff; background: #20517f; }
.controller-keyboard-actions { margin-top: .75rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: .42rem; }
.controller-keyboard-action { padding: .4rem .55rem; font-size: .76rem; }
.controller-keyboard-action.done { border-color: #ff9088; background: linear-gradient(180deg, #d64b58, #99263c); }
@media (max-width: 520px) {
  .controller-keyboard-dialog { padding: calc(var(--safe-top) + .55rem) calc(var(--safe-right) + .55rem) calc(var(--safe-bottom) + .55rem) calc(var(--safe-left) + .55rem); }
  .controller-keyboard-panel { padding: .85rem; border-radius: 11px; }
  .controller-keyboard-help { margin-bottom: .65rem; font-size: .76rem; }
  .controller-keyboard-value { min-height: 42px; margin-bottom: .65rem; padding: .58rem .65rem; }
  .controller-keyboard-keys { grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr)); gap: .32rem; }
  .controller-keyboard-key,
  .controller-keyboard-action { min-height: 40px; }
  .controller-keyboard-actions { margin-top: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .32rem; }
}
.controller-hover:not(.playing-card),
.controller-focus:not(.playing-card) {
  outline: 3px solid #81d5ff !important;
  outline-offset: 3px;
  filter: brightness(1.08) saturate(1.08);
}
.controller-hover.orbital-deck,
.controller-focus.orbital-deck {
  outline: 0 !important;
  filter: none !important;
}
.error-text { color: #ff9696; }

/* ---------- Shared physical-card table ---------- */
.playing-game .topbar, .playing-game .site-shell > footer { display: none; }
.playing-game {
  --game-viewport-height: 100vh;
  --game-main-top: 12px;
  --game-main-bottom: max(14px, var(--safe-bottom));
}
@supports (height: 100svh) {
  .playing-game { --game-viewport-height: 100svh; }
}
.playing-game .site-shell { width: min(1420px, calc(100% - 24px)); min-height: var(--game-viewport-height); }
.playing-game .site-shell { padding-top: var(--safe-top); }
.playing-game main { padding: var(--game-main-top) 0 var(--game-main-bottom); }

.standard-card-game,
.table-skin-classic-green {
  --table-green: #0f4635;
  --table-green-light: #176249;
  --table-green-deep: #092b23;
  --table-border: #315a54;
  --table-grid: rgba(255,255,255,.018);
  --table-felt-shadow: rgba(0,0,0,.28);
  --table-preview-ink: #d8efe5;
  --table-preview-line: rgba(184,235,211,.42);
}

.standard-card-game {
  --game-card-width: clamp(86px, 24vw, 112px);
  --game-card-height: calc(var(--game-card-width) * 1.42);
  min-height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  color: #f5f0e4;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.table-skin-midnight-blue {
  --table-green: #103a5d;
  --table-green-light: #216b98;
  --table-green-deep: #061d35;
  --table-border: #3b7094;
  --table-grid: rgba(182,229,255,.024);
  --table-felt-shadow: rgba(1,10,25,.42);
  --table-preview-ink: #d7efff;
  --table-preview-line: rgba(181,225,255,.5);
}

.table-skin-burgundy-velvet {
  --table-green: #5a2031;
  --table-green-light: #8d3a52;
  --table-green-deep: #2d0d18;
  --table-border: #985168;
  --table-grid: rgba(255,224,227,.023);
  --table-felt-shadow: rgba(30,0,9,.42);
  --table-preview-ink: #ffe5e8;
  --table-preview-line: rgba(255,211,219,.48);
}

.table-skin-plum-purple {
  --table-green: #4d285c;
  --table-green-light: #754486;
  --table-green-deep: #271130;
  --table-border: #875895;
  --table-grid: rgba(244,222,255,.024);
  --table-felt-shadow: rgba(19,3,25,.44);
  --table-preview-ink: #f4e1fa;
  --table-preview-line: rgba(235,202,245,.5);
}

.standard-card-game h2, .standard-card-game h3,
.standard-card-game button, .standard-card-game .family-kicker,
.selection-status, .suit-ladder, .blackjack-rule-bar,
.holdem-rule-bar, .five-card-draw-rule-bar {
  font-family: "Cardcade Pixel", "Courier New", monospace;
}

.game-topbar {
  min-height: 68px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
}
.game-topbar h2 { margin: 2px 0 0; font-size: 1.5rem; }
.game-topbar p { margin: 2px 0 0; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-score { min-width: 68px; min-height: 48px; display: grid; grid-template-columns: auto auto; gap: 8px; place-items: center; border: 2px solid var(--line); border-radius: 10px; color: var(--ink); background: #0d203a; opacity: 1 !important; }
.game-score span { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.game-score strong { font-size: 1.25rem; }

:is(.suit-ladder, .blackjack-rule-bar, .holdem-rule-bar, .five-card-draw-rule-bar) {
  min-height: 50px;
  padding: 8px 14px;
  display: flex;
  gap: clamp(8px, 2.4vw, 30px);
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: #aab8c9;
  background: rgba(8, 24, 43, .82);
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .08em;
}
:is(.suit-ladder, .blackjack-rule-bar, .holdem-rule-bar, .five-card-draw-rule-bar) > i { color: #61738b; font-style: normal; }
:is(.blackjack-rule-bar, .holdem-rule-bar, .five-card-draw-rule-bar) > strong { color: #d8e1ec; }
.suit-rank { display: inline-flex; gap: 5px; align-items: center; color: #d8e1ec; font-size: 1.1rem; }
.suit-rank b { color: #72859e; font-size: .7rem; }
.suit-rank.high { color: #ff6469; }
.rank-ladder { gap: clamp(9px, 2vw, 24px); }
.rank-run { color: #d8e1ec; font-size: clamp(.68rem, 1.5vw, .9rem); letter-spacing: .04em; white-space: nowrap; }
.rank-run b { color: var(--mint); font-size: 1.05em; }
.rank-run b.high-card { color: #ff6469; }

.game-opponents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.game-seat {
  min-height: 78px;
  padding: 9px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 25, 45, .88);
  transition: border-color 140ms ease, transform 140ms ease;
}
.game-seat.active { border-color: var(--mint); transform: translateY(-2px); box-shadow: 0 0 18px rgba(84, 223, 177, .12); }
.game-seat-copy { min-width: 0; }
.game-seat-copy > strong, .game-seat-copy > small {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-seat-copy > small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.mini-deck { width: 36px; height: 48px; display: grid; place-items: center; border: 2px solid #46688c; border-radius: 5px; color: #cbe4ff; background: repeating-linear-gradient(45deg, #112948 0 4px, #1b3b62 4px 7px); box-shadow: 3px 3px 0 #020710; font: 800 .72rem "Cardcade Pixel", monospace; }
.seat-last-card {
  position: relative;
  width: 34px;
  height: 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #e9e1d3;
  border-radius: 5px;
  background: #f5eedf;
  box-shadow: 3px 4px 0 rgba(1, 6, 13, .52);
  transform: rotate(-2deg);
}
.seat-last-card.empty {
  border-color: #46688c;
  background:
    repeating-linear-gradient(45deg, transparent 0 4px, rgba(105,174,242,.17) 4px 6px),
    repeating-linear-gradient(-45deg, transparent 0 4px, rgba(105,174,242,.11) 4px 6px),
    #112948;
}
.seat-last-card.empty i { width: 15px; height: 20px; border: 1px solid rgba(203,228,255,.5); border-radius: 2px; }
.standard-seat-card { align-content: center; gap: 1px; color: #294f7b; }
.standard-seat-card.red { color: #bd2936; }
.standard-seat-card strong { font: 400 1rem/.82 "Cardcade Ranks", "Courier New", monospace; }
.standard-seat-card i { font: normal .72rem Georgia, serif; }
.juan-seat-card { color: var(--juan-ink, #fffaf0); border-color: rgba(255,250,240,.92); background: linear-gradient(132deg, rgba(255,255,255,.15), transparent 45%), var(--juan-face); text-shadow: 1px 2px 0 rgba(5,13,26,.32); }
.juan-seat-card::before { content: none; }
.juan-seat-card.juan-prism { --juan-ink: #fffaf0; background: radial-gradient(circle at 50% 42%, rgba(124,169,217,.24), transparent 44%), #0b1320; }
.juan-seat-card strong { position: relative; z-index: 1; max-width: 30px; font: 900 .78rem/.9 "Cardcade Pixel", monospace; text-align: center; }
.juan-seat-card strong.juan-rank-glyph { font-family: "Cardcade Ranks", "Courier New", monospace; font-weight: 400; }
.rummy-seat-card { --rummy-color: #f5ca4d; color: var(--rummy-color); border-color: #dce9f4; background: #080c12; text-shadow: 1px 2px 0 #02050a; }
.rummy-seat-card::before { content: none; }
.rummy-seat-card strong { position: relative; z-index: 1; max-width: 30px; font: 900 .76rem/.9 "Cardcade Pixel", monospace; text-align: center; }
.rummy-seat-card strong.rummy-rank-glyph { font-family: "Cardcade Ranks", "Courier New", monospace; font-weight: 400; }
.rummy-seat-card.rummy-wild { --rummy-color: #d8b8ff; }
.rummy-seat-card.rummy-pass { --rummy-color: #ffaaa0; }

.game-table {
  min-height: 225px;
  padding: 14px;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 2px solid var(--table-border);
  border-radius: 18px;
  background:
    linear-gradient(var(--table-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--table-grid) 1px, transparent 1px),
    radial-gradient(circle at 50% 110%, var(--table-green-light), var(--table-green) 58%, var(--table-green-deep));
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow: inset 0 0 55px var(--table-felt-shadow), 5px 5px 0 rgba(0,0,0,.38);
}
.game-status { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.game-status > span:first-child { flex: 1 1 auto; min-width: 0; }
.game-status strong, .game-status small { min-width: 0; display: block; overflow-wrap: anywhere; }
.game-status small { margin-top: 3px; color: #b2c5bb; font-size: .75rem; }
.game-status .badge { max-width: 42%; min-width: 0; flex: 0 1 42%; align-self: flex-start; justify-content: center; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; text-align: center; }
.active-pile { min-height: 150px; display: flex; align-items: center; justify-content: center; }
.active-pile.cards-pile {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.active-pile .empty-pile { min-width: min(500px, 90%); padding: 24px; border: 2px dashed rgba(237,229,207,.28); border-radius: 14px; text-align: center; background: rgba(3,13,11,.24); }
.empty-pile strong, .empty-pile span { display: block; }
.empty-pile span { margin-top: 6px; color: #b3c6bc; font-size: .78rem; }

.physical-hand {
  position: relative;
  min-height: 250px;
  padding: 12px 14px 0;
  border: 2px solid var(--line);
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(180deg, rgba(11, 31, 53, .9), rgba(5, 17, 31, .96));
  overflow: hidden;
}
.physical-hand.your-turn { border-color: #477b74; box-shadow: 0 0 24px rgba(84,223,177,.09); }
.hand-heading { min-height: 36px; display: flex; justify-content: space-between; gap: 1rem; align-items: start; position: relative; z-index: 220; }
.hand-heading strong, .hand-heading small { display: block; }
.hand-heading small { color: var(--muted); font-size: .7rem; margin-top: 2px; }
.selection-status { color: var(--muted); font-size: .74rem; text-align: right; }
.selection-status.valid { color: var(--mint); }
.selection-status.invalid { color: #ff8b8f; }
.game-hand { position: relative; width: 100%; min-height: 195px; margin-top: 2px; isolation: isolate; }

.playing-card {
  --fan-x: 0px;
  --fan-y: 70px;
  --fan-rotation: 0deg;
  --card-lift: 0px;
  position: absolute;
  left: 50%;
  top: 0;
  width: var(--game-card-width);
  height: var(--game-card-height);
  padding: 0;
  border: 3px solid #e7ddc8;
  border-radius: 10px;
  color: #294f7b;
  background:
    linear-gradient(rgba(83,64,35,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83,64,35,.055) 1px, transparent 1px),
    #f5eedf;
  background-size: 4px 4px;
  box-shadow: 5px 7px 0 rgba(0,0,0,.42), inset 0 0 14px rgba(89,66,31,.06);
  transform-origin: 50% 122%;
  transform:
    translate3d(calc(-50% + var(--fan-x)), calc(var(--fan-y) - var(--card-lift)), 0)
    rotate(var(--fan-rotation));
  transition:
    transform 260ms cubic-bezier(.2,.82,.2,1),
    box-shadow 180ms ease,
    filter 180ms ease,
    border-color 160ms ease;
  overflow: hidden;
  opacity: 1;
  cursor: pointer;
  touch-action: manipulation;
  will-change: transform;
  contain: layout paint;
  container-type: size;
}
.game-hand:not(.fan-ready) .playing-card { transition: none; }
.playing-card.red { color: #bd2936; }
.playing-card.selected {
  --card-lift: var(--fan-selected-lift, 38px);
  border-color: #53b6ff;
  box-shadow: 0 22px 34px rgba(0,0,0,.42), 0 0 0 3px #74b8ff, 4px 5px 0 rgba(7,10,18,.32);
  filter: saturate(1.08) brightness(1.03);
}
.playing-card.selected::before {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 2px;
  border: 2px solid #74b8ff;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(116,184,255,.16);
  pointer-events: none;
}
.playing-card.selectable:active {
  transform:
    translate3d(calc(-50% + var(--fan-x)), calc(var(--fan-y) - var(--card-lift)), 0)
    rotate(var(--fan-rotation)) scale(.99);
  filter: brightness(.96) saturate(1.08);
}
@media (hover: hover) and (pointer: fine) {
  .playing-card.selectable:hover:not(.selected) {
    --card-lift: var(--fan-hover-lift, 18px);
    z-index: 180 !important;
  }
}
.playing-card.selectable.controller-hover:not(.selected) {
  --card-lift: var(--fan-hover-lift, 18px);
  z-index: 180 !important;
}
.playing-card.selectable.controller-focus {
  outline: 3px solid #81d5ff;
  outline-offset: 4px;
  z-index: 190 !important;
}
.playing-card:focus-visible { outline: 4px solid #70c6ff; outline-offset: 4px; }
.card-corner { position: absolute; z-index: 2; top: 7px; left: 8px; top: 5.5cqh; left: 7cqw; display: grid; justify-items: center; font-family: "Cardcade Ranks", "Courier New", monospace; font-style: normal; line-height: .78; }
.card-corner strong { font-size: clamp(1.25rem, 4vw, 1.8rem); font-size: 18cqh; }
.card-corner i { margin-top: 4px; margin-top: 2.5cqh; font: normal 1.05rem Georgia, serif; font: normal 10.5cqh Georgia, serif; }
.card-corner.bottom { top: auto; left: auto; right: 8px; bottom: 7px; right: 7cqw; bottom: 5.5cqh; transform: rotate(180deg); }
.card-center { position: absolute; display: grid; place-items: center; filter: drop-shadow(2px 3px 0 rgba(0,0,0,.09)); }
.card-center:not(.court) { inset: 27% 16%; font: normal clamp(1.45rem, 5vw, 2.35rem)/.8 Georgia, serif; font: normal 24cqh/.8 Georgia, serif; }
/* Court silhouettes need extra clearance from the diagonal corner indices. */
.card-center.court { inset: 20% 27% 25%; filter: drop-shadow(2px 3px 0 rgba(0,0,0,.12)); }
.card-center.court svg { width: 100%; height: 100%; overflow: visible; }
.playing-card.played {
  position: absolute;
  left: 50%;
  top: 50%;
  flex: 0 0 86px;
  width: 86px;
  height: 122px;
  transform: translate3d(calc(-50% + var(--pile-x, 0px)), calc(-50% + var(--pile-y, 0px)), 0) rotate(var(--pile-rotation, 0deg));
  /* The surrounding table is intentionally re-rendered on game updates. A
     stable pile must not inherit the hand's transform transition during that
     replacement layout; new plays still use cardPileIn below. */
  transition: none;
  opacity: 1;
  cursor: default;
  margin: 0;
}
.playing-card.inert { cursor: default; }
.playing-card.played.enter { animation: cardPileIn .22s cubic-bezier(.2,.8,.3,1.1) both; }
.playing-card.dealt { animation: cardFanDeal .38s cubic-bezier(.18,.82,.25,1.05) both; }
.playing-card.drawn { animation: cardFanDraw .42s cubic-bezier(.18,.82,.25,1.05) both; }
.playing-card.card-exit { animation: cardExit .16s ease-in both; pointer-events: none; }
.playing-card.card-departing { opacity: 0; }

@keyframes cardPileIn {
  from { transform: translate3d(calc(-50% + var(--pile-x, 0px)), calc(-50% + var(--pile-y, 0px) + 14px), 0) rotate(var(--pile-rotation, 0deg)) scale(.9); opacity: 0; }
  to { transform: translate3d(calc(-50% + var(--pile-x, 0px)), calc(-50% + var(--pile-y, 0px)), 0) rotate(var(--pile-rotation, 0deg)) scale(1); opacity: 1; }
}
@keyframes cardFanDeal {
  from {
    transform: translate3d(calc(-50% + var(--fan-x) + 26px), calc(var(--fan-y) - 90px), 0) rotate(calc(var(--fan-rotation) - 9deg)) scale(.82);
    opacity: 0;
  }
  to {
    transform: translate3d(calc(-50% + var(--fan-x)), calc(var(--fan-y) - var(--card-lift)), 0) rotate(var(--fan-rotation)) scale(1);
    opacity: 1;
  }
}
@keyframes cardFanDraw {
  from {
    transform: translate3d(calc(-50% + var(--fan-x) + 46px), calc(var(--fan-y) - 170px), 0) rotate(calc(var(--fan-rotation) + 12deg)) scale(.72);
    opacity: 0;
  }
  to {
    transform: translate3d(calc(-50% + var(--fan-x)), calc(var(--fan-y) - var(--card-lift)), 0) rotate(var(--fan-rotation)) scale(1);
    opacity: 1;
  }
}
@keyframes cardExit {
  from { transform: translate3d(calc(-50% + var(--fan-x)), calc(var(--fan-y) - var(--card-lift)), 0) rotate(var(--fan-rotation)) scale(1); opacity: 1; }
  to { transform: translate3d(calc(-50% + var(--fan-x)), calc(var(--fan-y) - var(--card-lift) - 28px), 0) rotate(var(--fan-rotation)) scale(.86); opacity: 0; }
}

.card-flight {
  position: fixed !important;
  z-index: 1000 !important;
  left: 0 !important;
  top: 0 !important;
  margin: 0 !important;
  pointer-events: none !important;
  transform: none;
  transform-origin: center !important;
  transition: none !important;
  contain: layout paint;
}

.game-actions {
  position: sticky;
  z-index: 300;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 18, 34, .96);
  box-shadow: 0 -8px 28px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
}
/* The shared table scenes already reserve the bottom of the felt for the
   player's cards. Keep their controls in document flow so a tall dock cannot
   sit on top of those cards at short or phone-sized viewports. Snap has its own
   reaction dock and is intentionally unaffected. */
.standard-card-game > .game-actions {
  position: static;
  bottom: auto;
}
.game-actions button { min-height: 52px; border: 2px solid var(--line); border-radius: 9px; color: var(--ink); background: #10243f; font-weight: 800; }
.game-actions button.primary { border-color: #ff8580; background: linear-gradient(#d94752, #a82840); }
.game-actions button.danger { border-color: #c87072; color: #ffc8c8; background: #4b1e2b; }
.game-actions button:disabled { opacity: .38; }

.round-result {
  position: fixed;
  z-index: var(--layer-gameplay-overlay);
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(620px, calc(100% - 24px));
  padding: 20px;
  border: 2px solid var(--line-bright);
  border-radius: 16px;
  background: #0c1d34;
  box-shadow: 9px 11px 0 rgba(0,0,0,.55), 0 0 0 9999px rgba(1,6,13,.58);
  transform: translateX(-50%);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.round-result p { color: var(--muted); line-height: 1.5; }
.final-standings {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.final-standings li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(8, 24, 43, .72);
}
.final-standings li > span { color: var(--muted); font: 800 .68rem "Cardcade Pixel", "Courier New", monospace; }
.final-standings strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final-standings small { color: var(--muted); white-space: nowrap; }
.final-standings li.winner {
  border-color: #f0c553;
  background: linear-gradient(135deg, rgba(240,197,83,.18), rgba(13,32,58,.94));
  box-shadow: 0 0 16px rgba(240,197,83,.16);
}
.final-standings li.winner > span,
.final-standings li.winner small { color: #ffe6a5; }

/* ---------- Blackjack dealer table ---------- */
.blackjack-dealer-zone {
  min-height: 158px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 340px);
  gap: clamp(14px, 4vw, 48px);
  align-items: center;
  justify-items: center;
}
.blackjack-dealer-copy { min-width: 0; color: #d8e1ec; text-align: center; }
.blackjack-dealer-copy span, .blackjack-dealer-copy strong { display: block; }
.blackjack-dealer-copy span { color: var(--blue); font: 800 .72rem "Cardcade Pixel", "Courier New", monospace; letter-spacing: .1em; text-transform: uppercase; }
.blackjack-dealer-copy strong { max-width: 260px; margin-top: 6px; font-size: .78rem; line-height: 1.35; }
.blackjack-dealer-pile {
  width: min(100%, 340px) !important;
  min-height: 144px !important;
  overflow: visible !important;
}
.blackjack-card-back {
  display: block;
  border-color: #46688c;
  color: #cbe4ff;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(105,174,242,.18) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(203,228,255,.08) 6px 8px),
    linear-gradient(145deg, #1b3b62, #112948);
  box-shadow: 5px 7px 0 rgba(0,0,0,.48), inset 0 0 0 2px rgba(105,174,242,.16);
}
.blackjack-card-back::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(203,228,255,.58);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.blackjack-hand { min-height: 286px; }
.blackjack-hand-summaries {
  position: relative;
  z-index: 240;
  margin: 2px 0 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 6px;
}
.blackjack-hand-summary {
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid rgba(104, 126, 154, .7);
  border-radius: 7px;
  color: #dce5f0;
  background: rgba(4, 13, 25, .32);
}
.blackjack-hand-summary.active { border-color: var(--mint); box-shadow: inset 0 0 0 1px rgba(84,223,177,.18); }
.blackjack-hand-summary.complete { opacity: .78; }
.blackjack-hand-summary span, .blackjack-hand-summary strong { display: block; }
.blackjack-hand-summary span { color: #9aafc8; font: 800 .6rem "Cardcade Pixel", "Courier New", monospace; text-transform: uppercase; }
.blackjack-hand-summary strong { margin-top: 2px; font-size: .72rem; }
.blackjack-insurance-prompt {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  padding: 13px;
  display: grid;
  gap: 5px;
  border: 2px solid var(--line-bright);
  border-radius: 13px;
  color: var(--ink);
  background: linear-gradient(110deg, rgba(20, 58, 82, .9), rgba(7, 22, 40, .95));
  box-shadow: 5px 5px 0 rgba(0,0,0,.38);
  text-align: center;
}
.blackjack-insurance-prompt strong { font-size: 1rem; }
.blackjack-insurance-prompt small { color: var(--muted); font-size: .72rem; }
.blackjack-insurance-prompt .button-row { margin-top: 4px; justify-content: center; }
.blackjack-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ---------- Texas Hold'em fixed-limit table ---------- */
:is(.holdem-opponents, .five-card-draw-opponents) .game-seat.folded { opacity: .58; filter: saturate(.65); }
:is(.holdem-opponents, .five-card-draw-opponents) .game-seat.all-in { border-color: var(--blue); box-shadow: 0 0 15px rgba(79,167,255,.16); }
:is(.holdem-opponents, .five-card-draw-opponents) .game-seat.eliminated { opacity: .45; }
.poker-hole-back {
  color: #cbe4ff;
  border-color: #46688c;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(105,174,242,.18) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(203,228,255,.08) 6px 8px),
    linear-gradient(145deg, #1b3b62, #112948);
}
.poker-hole-back::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(203,228,255,.58); border-radius: 3px; }
.poker-hole-back i { position: relative; z-index: 1; font: 900 .86rem "Cardcade Pixel", "Courier New", monospace; font-style: normal; text-shadow: 2px 2px 0 rgba(0,0,0,.48); }
.holdem-board-zone {
  min-height: 164px;
  display: grid;
  grid-template-columns: minmax(128px, .72fr) minmax(210px, 1.5fr);
  gap: clamp(12px, 4vw, 44px);
  align-items: center;
  justify-items: center;
}
.holdem-board-copy { min-width: 0; color: #d8e1ec; text-align: center; }
.holdem-board-copy span, .holdem-board-copy strong { display: block; }
.holdem-board-copy span { color: var(--blue); font: 800 .7rem "Cardcade Pixel", "Courier New", monospace; letter-spacing: .1em; text-transform: uppercase; }
.holdem-board-copy strong { max-width: 290px; margin-top: 6px; font-size: .75rem; line-height: 1.38; }
.holdem-board { width: min(100%, 430px) !important; min-height: 144px !important; }
.holdem-board .empty-pile { min-width: min(300px, 90%); padding: 18px 10px; }
.holdem-hand { min-height: 286px; }
.holdem-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Five Card Draw fixed-limit table ---------- */
.draw-hole-back {
  color: #cbe4ff;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(105,174,242,.18) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(203,228,255,.08) 6px 8px),
    linear-gradient(145deg, #1b3b62, #112948);
}
.five-card-draw-table-zone {
  min-height: 164px;
  display: grid;
  grid-template-columns: minmax(150px, .9fr) minmax(220px, 1.35fr);
  gap: clamp(12px, 4vw, 44px);
  align-items: center;
  justify-items: center;
}
.five-card-draw-piles { min-width: 0; display: flex; align-items: center; justify-content: center; gap: clamp(18px, 5vw, 56px); }
.draw-stack, .draw-discard-pile {
  position: relative;
  width: calc(var(--game-card-width) + 18px);
  min-height: calc(var(--game-card-height) + 34px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  color: #d8e1ec;
  text-align: center;
}
.five-card-draw-pile-cards {
  position: absolute;
  inset: 0 auto auto 50%;
  width: var(--game-card-width);
  height: var(--game-card-height);
  transform: translateX(-50%);
  transform-style: preserve-3d;
}
.draw-card-back {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: var(--game-card-width);
  height: var(--game-card-height);
  display: grid;
  place-items: center;
  border: 3px solid #46688c;
  border-radius: 10px;
  color: #cbe4ff;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(105,174,242,.18) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(203,228,255,.08) 6px 8px),
    linear-gradient(145deg, #1b3b62, #112948);
  box-shadow: 5px 7px 0 rgba(0,0,0,.48), inset 0 0 0 2px rgba(105,174,242,.16);
  transform-origin: 50% 64%;
}
.draw-card-back::after { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(203,228,255,.58); border-radius: 4px; }
.draw-card-back.empty { opacity: .42; }
.draw-stack > strong, .draw-discard-pile > strong { position: relative; z-index: 3; margin-top: 4px; font: 800 .64rem "Cardcade Pixel", "Courier New", monospace; letter-spacing: .07em; text-transform: uppercase; }
.draw-stack > small, .draw-discard-pile > small { position: relative; z-index: 3; color: var(--muted); font-size: .64rem; }
.five-card-draw-hand { min-height: 286px; }
.five-card-draw-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.five-card-draw-actions.draw-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.five-card-draw-showdown { margin-top: 14px; display: grid; gap: 7px; }
.five-card-draw-showdown-list { display: grid; gap: 7px; }
.five-card-draw-showdown-hand {
  min-width: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 24, 43, .72);
}
.five-card-draw-showdown-hand.winner { border-color: #f0c553; background: linear-gradient(135deg, rgba(240,197,83,.18), rgba(13,32,58,.94)); box-shadow: inset 0 0 0 1px rgba(255,225,165,.14); }
.draw-showdown-copy { min-width: 0; }
.draw-showdown-copy strong, .draw-showdown-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draw-showdown-copy strong { font-size: .78rem; }
.draw-showdown-copy small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.draw-showdown-cards { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
.draw-showdown-card {
  width: 32px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid #eee0ca;
  border-radius: 5px;
  color: #294f7b;
  background: #f5eedf;
  box-shadow: 2px 3px 0 rgba(0,0,0,.35);
}
.draw-showdown-card.red { color: #bd2936; }
.draw-showdown-card strong { font: 400 .85rem/.82 "Cardcade Ranks", "Courier New", monospace; }
.draw-showdown-card i { margin-top: -4px; font: normal .62rem Georgia, serif; }

/* ---------- JUAN color/action table ---------- */
.juan-game {
  --juan-blaze: #ef4d54;
  --juan-tide: #2d7dd2;
  --juan-grove: #43b66b;
  --juan-spark: #f2bf3d;
}

.juan-lane-bar {
  --juan-active: #2d7dd2;
  min-height: 50px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 18px);
  border: 2px solid color-mix(in srgb, var(--juan-active) 72%, #fff);
  border-radius: 13px;
  color: #f1f5f9;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--juan-active) 47%, #102039), color-mix(in srgb, var(--juan-active) 19%, #081525) 72%);
  background-size: 5px 5px, 5px 5px, auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 -9px 22px rgba(0,0,0,.23), 0 0 18px color-mix(in srgb, var(--juan-active) 22%, transparent);
  font: 800 .7rem "Cardcade Pixel", "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.juan-lane-bar > strong { min-width: 52px; color: color-mix(in srgb, var(--juan-active) 40%, white); text-shadow: 0 1px 2px #06101f; }
.juan-direction { min-width: 34px; color: #fff; font-size: 1.35rem; text-align: center; }
.juan-game[data-active-color="blaze"] .juan-lane-bar { --juan-active: var(--juan-blaze); }
.juan-game[data-active-color="tide"] .juan-lane-bar { --juan-active: var(--juan-tide); }
.juan-game[data-active-color="grove"] .juan-lane-bar { --juan-active: var(--juan-grove); }
.juan-game[data-active-color="spark"] .juan-lane-bar { --juan-active: var(--juan-spark); }

.juan-blaze { --juan-face: var(--juan-blaze, #ef4d54); --juan-deep: #a92138; }
.juan-tide { --juan-face: var(--juan-tide, #2d7dd2); --juan-deep: #14508c; }
.juan-grove { --juan-face: var(--juan-grove, #43b66b); --juan-deep: #18723f; }
.juan-spark { --juan-face: var(--juan-spark, #f2bf3d); --juan-deep: #b87918; }

.juan-reaction-panel {
  min-width: 0;
  min-height: 62px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 2px solid var(--line);
  border-radius: 13px;
  background: rgba(8,24,43,.9);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  pointer-events: auto;
}
.juan-reaction-panel > span { min-width: 0; }
.juan-reaction-panel strong,
.juan-reaction-panel small { display: block; }
.juan-reaction-panel strong { font-size: .82rem; }
.juan-reaction-panel small { margin-top: 3px; color: var(--muted); font-size: .67rem; line-height: 1.35; }
.juan-reaction-panel button { min-height: 40px; flex: 0 0 auto; padding: 7px 10px; border: 2px solid #f2ebdd; border-radius: 8px; color: #fffaf0; background: #192d4a; font: 800 .62rem "Cardcade Pixel", monospace; text-transform: uppercase; cursor: pointer; }
.juan-reaction-panel button:hover:not(:disabled),
.juan-reaction-panel button:focus-visible { filter: brightness(1.12); transform: translateY(-1px); }
.juan-reaction-panel button:disabled { cursor: wait; opacity: .55; }
.juan-reaction-panel button.primary { border-color: #ff8580; background: linear-gradient(135deg, #cf3e4d, #7c2040); }
.juan-call-panel { border-color: #f0c553; background: linear-gradient(135deg, rgba(240,197,83,.18), rgba(8,24,43,.95)); }
.juan-catch-panel { border-color: var(--coral); background: linear-gradient(135deg, rgba(255,94,98,.17), rgba(8,24,43,.95)); }
.juan-catch-panel button { border-color: #ff8580; background: #702b40; }
.juan-prism-challenge-panel { border-color: #8da9d8; background: linear-gradient(135deg, rgba(74,127,210,.2), rgba(8,24,43,.95)); }
.juan-prism-wait-panel { border-style: dashed; }
.juan-reaction-actions { display: flex; flex: 0 0 auto; gap: 6px; }

#juan-gameplay-overlay-root {
  position: fixed;
  z-index: var(--layer-gameplay-overlay);
  inset: 0;
  pointer-events: none;
}
.juan-gameplay-overlay {
  position: absolute;
  left: 50%;
  bottom: max(10px, calc(var(--safe-bottom) + 6px));
  width: min(660px, calc(100% - var(--safe-left) - var(--safe-right) - 20px));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px);
  display: grid;
  gap: 7px;
  transform: translateX(-50%);
  pointer-events: none;
}

.juan-game .game-opponents { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.juan-game .game-seat { min-height: 66px; }
.juan-game .game-seat.juan-alert { border-color: var(--coral); box-shadow: 0 0 20px rgba(255,94,98,.14); }
.juan-game .game-seat.juan-alert small { color: #ffaaa8; }
.juan-game .game-seat.juan-call-pending { border-color: #f0c553; box-shadow: 0 0 20px rgba(240,197,83,.18); }
.juan-game .game-seat.juan-call-pending small { color: #ffe6a5; }

.game-seat.placement-first,
.game-score.placement-first,
.juan-game .game-seat.placement-first {
  border-color: #f0c553;
  background: linear-gradient(135deg, rgba(240,197,83,.22), rgba(13,32,58,.96));
  box-shadow: 0 0 22px rgba(240,197,83,.28);
}
.game-seat.placement-second,
.game-score.placement-second,
.juan-game .game-seat.placement-second {
  border-color: #c9d4e3;
  background: linear-gradient(135deg, rgba(201,212,227,.19), rgba(13,32,58,.96));
  box-shadow: 0 0 20px rgba(201,212,227,.22);
}
.game-seat.placement-third,
.game-score.placement-third,
.juan-game .game-seat.placement-third {
  border-color: #dc9764;
  background: linear-gradient(135deg, rgba(220,151,100,.2), rgba(13,32,58,.96));
  box-shadow: 0 0 20px rgba(220,151,100,.24);
}
.game-seat.placement-first .game-seat-copy > small,
.game-score.placement-first span { color: #ffe6a5; }
.game-seat.placement-second .game-seat-copy > small,
.game-score.placement-second span { color: #e7eef8; }
.game-seat.placement-third .game-seat-copy > small,
.game-score.placement-third span { color: #ffc89f; }

.juan-game .mini-deck, .juan-stock {
  color: #fffaf0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 46%),
    #0b1c34;
}

.juan-pile-zone { min-height: 150px; display: flex; align-items: center; justify-content: center; gap: clamp(22px, 6vw, 70px); }
.juan-pile-zone .active-pile { min-height: 135px; min-width: 100px; }
.juan-pile-zone .active-pile.cards-pile { width: 86px; min-width: 86px; flex: 0 0 86px; overflow: visible; }
.juan-stock {
  position: relative;
  width: 86px;
  height: 122px;
  display: grid;
  border: 5px solid #f2ebdd;
  border-radius: 10px;
  box-shadow: 7px 8px 0 rgba(0,0,0,.42), 0 0 0 2px #1a2947;
}
.juan-stock::before { content: ""; position: absolute; inset: 9px; border: 2px solid rgba(255,255,255,.72); border-radius: 5px; background: rgba(255,255,255,.025); }
.juan-stock::after { content: none; }
.ordinary-stock-display { display: grid; justify-items: center; gap: 6px; }
.ordinary-stock-copy { position: relative; z-index: 4; display: grid; justify-items: center; gap: 2px; color: #f5f0e4; line-height: 1; text-align: center; text-shadow: 1px 2px 0 rgba(0,0,0,.5); }
.ordinary-stock-copy strong { font: 800 .64rem "Cardcade Pixel", "Courier New", monospace; letter-spacing: .07em; text-transform: uppercase; }
.ordinary-stock-copy small { color: #c4cfdd; font-size: .64rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Minimal face system: the color field and one mark do the visual work. */
.juan-card {
  --juan-ink: #fffaf0;
  color: var(--juan-ink);
  border: 3px solid rgba(255,250,240,.94);
  border-radius: 10px;
  background: var(--juan-face);
  box-shadow: 5px 7px 0 rgba(0,0,0,.5), inset 0 0 0 1px rgba(5,13,26,.24);
}
.juan-spark { --juan-ink: #16233a; }
.juan-card-ink {
  position: absolute;
  z-index: 0;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background:
    linear-gradient(132deg, rgba(255,255,255,.15), transparent 34%, rgba(5,13,26,.1) 100%),
    var(--juan-face);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.13), inset 0 -16px 25px rgba(5,13,26,.08);
  pointer-events: none;
}
.juan-card-ink::before,
.juan-card-ink::after { content: none; }
.juan-card.juan-prism { --juan-face: #0b1320; --juan-ink: #fffaf0; }
.juan-prism .juan-card-ink {
  background:
    radial-gradient(circle at 50% 42%, rgba(124,169,217,.18), transparent 36%),
    linear-gradient(135deg, rgba(255,255,255,.07), transparent 48%),
    #0b1320;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), inset 0 -18px 28px rgba(0,0,0,.35);
}
.juan-card-center {
  position: absolute;
  z-index: 2;
  inset: 21% 14% 18%;
  display: grid;
  place-items: center;
  color: var(--juan-ink);
  pointer-events: none;
}
.juan-card-center > b {
  font: 400 clamp(3.15rem, 8.5vw, 5rem)/.82 "Cardcade Ranks", "Courier New", monospace;
  letter-spacing: 0;
  text-shadow: 2px 3px 0 rgba(5,13,26,.16);
}
.juan-corner {
  top: 8px;
  left: 8px;
  color: var(--juan-ink);
  line-height: .8;
  text-shadow: 1px 2px 0 rgba(5,13,26,.18);
}
.juan-corner strong {
  max-width: 42px;
  font: 900 clamp(.72rem, 2.45vw, 1.05rem)/.84 "Cardcade Pixel", "Courier New", monospace;
  letter-spacing: -.05em;
}
.juan-corner strong.juan-rank-glyph {
  font-family: "Cardcade Ranks", "Courier New", monospace;
  font-weight: 400;
  letter-spacing: 0;
}
.juan-kind-double-draw .juan-corner strong,
.juan-kind-prism-burst .juan-corner strong {
  max-width: none;
  font: 400 clamp(.96rem, 3.05vw, 1.28rem)/.76 "Cardcade Ranks", "Courier New", monospace;
  letter-spacing: -.12em;
  text-shadow: 1px 2px 0 rgba(5,13,26,.26);
  transform: scaleX(.82);
  transform-origin: left center;
}
.juan-kind-double-draw .juan-corner.bottom strong,
.juan-kind-prism-burst .juan-corner.bottom strong { transform-origin: right center; }
.juan-kind-double-draw .juan-corner strong {
  color: #fffaf0;
  paint-order: stroke fill;
  -webkit-text-stroke: 1px #07101d;
  text-shadow: 1px 2px 0 #07101d;
}
.juan-action-mark {
  position: relative;
  width: 76%;
  height: 66%;
  display: block;
  color: var(--juan-ink);
}
.juan-action-mark i { position: absolute; display: block; }
.juan-action-pause { display: flex; align-items: center; justify-content: center; gap: 16%; }
.juan-action-pause i {
  position: relative;
  width: 20%;
  height: 82%;
  border: 3px solid currentColor;
  border-radius: 3px;
  box-shadow: 2px 2px 0 rgba(5,13,26,.12);
}
.juan-action-turnabout i {
  width: 76%;
  height: 27%;
  border-top: 3px solid currentColor;
  border-radius: 50%;
}
.juan-action-turnabout i::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -7px;
  width: 11px;
  height: 11px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(45deg);
}
.juan-action-turnabout i:first-child { top: 19%; left: 1%; }
.juan-action-turnabout i:last-child { right: 1%; bottom: 19%; transform: rotate(180deg); }
.juan-action-double-draw i {
  width: 42%;
  height: 66%;
  border: 3px solid currentColor;
  border-radius: 4px;
  background: color-mix(in srgb, var(--juan-face) 70%, transparent);
}
.juan-action-double-draw i:first-child { left: 8%; top: 2%; }
.juan-action-double-draw i:nth-child(2) { right: 8%; bottom: 2%; }
.juan-action-double-draw b,
.juan-action-prism-burst b {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  color: var(--juan-ink);
  font: 400 clamp(1.8rem, 5.35vw, 2.75rem)/.78 "Cardcade Ranks", "Courier New", monospace;
  letter-spacing: -.12em;
  paint-order: stroke fill;
  -webkit-text-stroke: 3px var(--juan-face);
  text-shadow: 2px 3px 0 rgba(5,13,26,.28);
  transform: translate(-50%, -50%);
}
.juan-action-double-draw b {
  color: #fffaf0;
  -webkit-text-stroke-color: #07101d;
}
.juan-action-prism,
.juan-action-prism-burst { width: 80%; height: 80%; display: grid; place-items: center; align-content: center; gap: 6%; }
.juan-wild-tiles { width: 68%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8%; }
.juan-action-mark .juan-wild-tiles i,
.skin-preview-juan-prism .juan-wild-tiles i { position: static; display: block; border: 1px solid rgba(255,250,240,.75); border-radius: 2px; box-shadow: 1px 2px 0 rgba(0,0,0,.3); transform: none; }
.juan-wild-tiles i:nth-child(1) { background: #ef4d54; }
.juan-wild-tiles i:nth-child(2) { background: #2d7dd2; }
.juan-wild-tiles i:nth-child(3) { background: #43b66b; }
.juan-wild-tiles i:nth-child(4) { background: #f2bf3d; }
.juan-action-prism-burst .juan-wild-tiles { width: 51%; }
.juan-action-prism-burst b { position: static; padding: 0; border: 0; border-radius: 0; background: transparent; transform: none; }
.juan-card.played .juan-card-center { inset: 20% 13% 17%; }
.juan-card.played .juan-card-center > b { font-size: 3rem; }
.juan-card.played .juan-action-mark { transform: scale(.88); }
.juan-prism-stage-card .juan-card.played .juan-card-center > b,
.juan-prism-reveal-card .juan-card.played .juan-card-center > b { font-size: 3.7rem; }
.juan-card.turn-drawn:not(.selected) {
  --card-lift: calc(var(--fan-selected-lift, 38px) * .45);
  border-color: #fff4b6;
  box-shadow: 0 17px 28px rgba(0,0,0,.4), 0 0 0 3px rgba(255,244,182,.82), 4px 5px 0 rgba(7,10,18,.32);
}
.juan-card.turn-drawn:not(.selected)::before {
  content: "DRAWN";
  position: absolute;
  z-index: 5;
  right: 5px;
  top: 5px;
  padding: 3px 4px;
  border: 1px solid rgba(6,16,31,.55);
  border-radius: 3px;
  color: #06101f;
  background: #fff4b6;
  font: 900 .43rem "Cardcade Pixel", monospace;
  text-shadow: none;
  pointer-events: none;
}

.juan-prism-dialog {
  position: fixed;
  z-index: var(--layer-gameplay-overlay);
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top)) max(14px, var(--safe-right)) max(18px, var(--safe-bottom)) max(14px, var(--safe-left));
  background: radial-gradient(circle at 50% 45%, rgba(59,96,151,.32), rgba(1,6,13,.86) 58%);
  backdrop-filter: blur(7px);
  animation: prismBackdropIn 180ms ease-out both;
}
.juan-prism-picker {
  width: min(460px, 100%);
  padding: 22px;
  overflow: hidden;
  border: 3px solid #f4eddf;
  border-radius: 18px;
  background:
    linear-gradient(rgba(89,169,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(89,169,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 25%, #183455, #09182d 65%);
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow: 10px 12px 0 rgba(0,0,0,.58), 0 0 42px rgba(79,167,255,.2);
  text-align: center;
  animation: prismPickerIn 360ms cubic-bezier(.16,.84,.26,1.08) both;
}
.juan-prism-picker h3 { margin: 4px 0 2px; font-size: 1.35rem; }
.juan-prism-picker > p { margin: 0; color: var(--muted); font-size: .78rem; }
.juan-prism-stage-card { height: 190px; margin: 12px auto 8px; display: grid; place-items: center; perspective: 700px; }
.juan-prism-stage-card .playing-card.played,
.juan-prism-reveal-card .playing-card.played {
  position: relative;
  left: auto;
  top: auto;
  width: 116px;
  height: 165px;
  transform: rotate(-2deg);
  animation: prismCardPresent 520ms cubic-bezier(.16,.84,.26,1.08) both;
}
.juan-color-chooser { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.juan-color-choice {
  --juan-choice: #fff;
  min-height: 52px;
  padding: 8px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border: 2px solid color-mix(in srgb, var(--juan-choice) 70%, white);
  border-radius: 9px;
  color: #fffaf0;
  background: linear-gradient(145deg, color-mix(in srgb, var(--juan-choice) 72%, #13223a), color-mix(in srgb, var(--juan-choice) 42%, #07101d));
  box-shadow: 4px 5px 0 rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.13);
  font: 900 .78rem "Cardcade Pixel", monospace;
  text-transform: uppercase;
  cursor: pointer;
  animation: prismChoiceIn 280ms var(--choice-delay, 120ms) ease-out both;
}
.juan-color-choice:hover, .juan-color-choice:focus-visible { filter: brightness(1.14); transform: translateY(-2px); }
.juan-color-choice i { width: 17px; height: 17px; flex: 0 0 auto; border: 2px solid rgba(255,255,255,.72); border-radius: 4px; background: var(--juan-choice); box-shadow: 0 0 13px var(--juan-choice); transform: rotate(45deg); }
.juan-color-choice.juan-blaze { --juan-choice: #ef4d54; }
.juan-color-choice.juan-tide { --juan-choice: #2d7dd2; }
.juan-color-choice.juan-grove { --juan-choice: #43b66b; }
.juan-color-choice.juan-spark { --juan-choice: #f2bf3d; }
.juan-prism-cancel { margin-top: 14px; padding: 7px 12px; border: 0; color: var(--muted); background: transparent; font: 800 .68rem "Cardcade Pixel", monospace; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

.juan-prism-reveal {
  --reveal-color: #fff;
  position: fixed;
  z-index: var(--layer-cinematic);
  inset: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 220px);
  place-content: center;
  align-items: center;
  gap: clamp(20px, 6vw, 56px);
  padding: max(24px, var(--safe-top)) max(18px, var(--safe-right)) max(24px, var(--safe-bottom)) max(18px, var(--safe-left));
  overflow: hidden;
  background: radial-gradient(circle at 43% 50%, color-mix(in srgb, var(--reveal-color) 28%, transparent), rgba(1,6,13,.91) 55%);
  backdrop-filter: blur(8px);
  animation: prismRevealScene 1.9s ease both;
  pointer-events: none;
}
.juan-prism-reveal.juan-blaze { --reveal-color: #ef4d54; }
.juan-prism-reveal.juan-tide { --reveal-color: #2d7dd2; }
.juan-prism-reveal.juan-grove { --reveal-color: #43b66b; }
.juan-prism-reveal.juan-spark { --reveal-color: #f2bf3d; }
.juan-prism-reveal.juan-call-reveal {
  --reveal-color: #54dfb1;
  grid-template-columns: auto minmax(0, 270px);
  background: radial-gradient(circle at 43% 50%, rgba(84, 223, 177, .3), rgba(1, 6, 13, .93) 57%);
}
.juan-call-shout {
  position: relative;
  z-index: 1;
  padding: 22px 18px 18px;
  border: 5px solid #fffaf0;
  border-radius: 18px;
  color: #07101d;
  background: #54dfb1;
  box-shadow: 9px 11px 0 rgba(0, 0, 0, .5), 0 0 38px rgba(84, 223, 177, .42);
  font: 900 clamp(2rem, 8vw, 4rem)/1 "Cardcade Pixel", monospace;
  letter-spacing: .04em;
  transform: rotate(-5deg);
  animation: prismRevealCard 2s cubic-bezier(.16,.84,.26,1.05) both;
}
.juan-call-reveal .juan-prism-reveal-copy strong { color: #75f2c8; }
.juan-prism-reveal-burst { position: absolute; left: 43%; top: 50%; width: 110vmax; height: 110vmax; border: 3px solid color-mix(in srgb, var(--reveal-color) 55%, transparent); border-radius: 50%; box-shadow: inset 0 0 80px color-mix(in srgb, var(--reveal-color) 20%, transparent), 0 0 80px color-mix(in srgb, var(--reveal-color) 20%, transparent); transform: translate(-50%, -50%); animation: prismBurst 1.7s ease-out both; }
.juan-prism-reveal-card { position: relative; z-index: 1; filter: drop-shadow(0 0 22px color-mix(in srgb, var(--reveal-color) 48%, transparent)); }
.juan-prism-reveal-card .playing-card.played { width: 132px; height: 188px; animation: prismRevealCard 1.65s cubic-bezier(.16,.84,.26,1.05) both; }
.juan-prism-reveal-copy { position: relative; z-index: 1; text-align: left; animation: prismRevealCopy 1.55s 160ms ease both; }
.juan-prism-reveal-copy span, .juan-prism-reveal-copy small { display: block; color: #c5d0df; }
.juan-prism-reveal-copy span { font: 800 .72rem "Cardcade Pixel", monospace; text-transform: uppercase; }
.juan-prism-reveal-copy strong { margin: 7px 0 5px; display: flex; gap: 12px; align-items: center; color: #fffaf0; font: 900 clamp(1.7rem, 8vw, 3.2rem)/1 "Cardcade Pixel", monospace; text-transform: uppercase; text-shadow: 3px 4px 0 rgba(0,0,0,.55); }
.juan-prism-reveal-copy strong i { width: 27px; height: 27px; flex: 0 0 auto; border: 3px solid #fffaf0; border-radius: 6px; background: var(--reveal-color); box-shadow: 0 0 24px var(--reveal-color); transform: rotate(45deg); }
.juan-prism-reveal-copy small { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }

@keyframes prismBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes prismPickerIn { from { opacity: 0; transform: translateY(30px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes prismCardPresent { from { opacity: 0; transform: translateY(46px) rotate(-12deg) scale(.72); } to { opacity: 1; transform: translateY(0) rotate(-2deg) scale(1); } }
@keyframes prismChoiceIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes prismRevealScene { 0% { opacity: 0; } 10%, 84% { opacity: 1; } 100% { opacity: 0; } }
@keyframes prismBurst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.05); } 28% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
@keyframes prismRevealCard { 0% { opacity: 0; transform: translateY(80px) rotate(-18deg) scale(.55); } 24%, 78% { opacity: 1; transform: translateY(0) rotate(-3deg) scale(1); } 100% { opacity: 0; transform: translateY(-22px) rotate(3deg) scale(.94); } }
@keyframes prismRevealCopy { 0% { opacity: 0; transform: translateX(24px); } 18%, 78% { opacity: 1; transform: translateX(0); } 100% { opacity: 0; transform: translateX(-8px); } }

.hot-seat-handoff {
  min-height: calc(100svh - 28px);
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
}
.handoff-panel {
  width: min(580px, 100%);
  padding: clamp(24px, 6vw, 48px);
  border: 2px solid var(--line-bright);
  border-radius: 20px;
  background:
    linear-gradient(rgba(89,169,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(89,169,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 20%, #132d4b, #071629 64%);
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow: 9px 11px 0 rgba(0,0,0,.48);
  text-align: center;
}
.handoff-card-back {
  width: 112px;
  aspect-ratio: 2 / 2.84;
  margin: 24px auto 18px;
  display: grid;
  place-items: center;
  border: 5px solid #e8dfcc;
  border-radius: 12px;
  color: #9dcaff;
  background:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(89,169,255,.18) 7px 9px),
    repeating-linear-gradient(-45deg, transparent 0 7px, rgba(89,169,255,.12) 7px 9px),
    #0b2749;
  box-shadow: 7px 9px 0 rgba(0,0,0,.45);
  transform: rotate(-3deg);
}

/* ---------- Rotating Rummy Routes ---------- */
.rotating-rummy-game {
  --rummy-red: #ef5d62;
  --rummy-blue: #4c9cff;
  --rummy-green: #55c878;
  --rummy-yellow: #f5ca4d;
}
.rummy-table-stage { display: contents; }
.rummy-route-banner {
  min-height: 76px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(rgba(245,202,77,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76,156,255,.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(17,29,46,.97), rgba(5,12,21,.98));
  background-size: 5px 5px, 5px 5px, auto;
  box-shadow: inset 0 0 22px rgba(0,0,0,.18);
}
.rummy-route-banner h3 { margin: 2px 0; color: #fff5d3; font-size: 1rem; }
.rummy-route-banner p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.rummy-route-banner.complete {
  border-color: #f5ca4d;
  background:
    linear-gradient(rgba(245,202,77,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,202,77,.055) 1px, transparent 1px),
    linear-gradient(135deg, rgba(83,58,13,.96), rgba(23,16,6,.98));
  box-shadow: inset 0 0 22px rgba(245,202,77,.12), 0 0 18px rgba(245,202,77,.12);
}
.rummy-route-banner.complete .family-kicker { color: #ffe3a1; }
.rummy-route-banner.complete h3 { color: #fff6d6; }
.rummy-route-banner.complete p { color: #f0dbab; }
.rummy-pass-dialog {
  position: fixed;
  z-index: var(--layer-gameplay-overlay);
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(16px, var(--safe-top)) max(14px, var(--safe-right)) max(16px, var(--safe-bottom)) max(14px, var(--safe-left));
  background: rgba(2, 8, 18, .76);
  backdrop-filter: blur(6px);
}
.rummy-pass-picker {
  width: min(380px, 100%);
  padding: 20px;
  border: 2px solid #dfebf5;
  border-radius: 16px;
  background: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px), radial-gradient(circle at 50% 0, #1b3750, #091728 72%);
  background-size: 5px 5px, 5px 5px, auto;
  box-shadow: 8px 10px 0 rgba(0,0,0,.5), 0 0 28px rgba(79,167,255,.18);
  text-align: center;
}
.rummy-pass-picker h3 { margin: 5px 0; font-size: 1.15rem; }
.rummy-pass-picker p { margin: 0 0 15px; color: #ccd9e5; font-size: .78rem; }
.rummy-pass-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.rummy-pass-targets button { min-height: 48px; overflow-wrap: anywhere; border: 1px solid #8db5d8; border-radius: 9px; color: #f5f9fc; background: #173653; font: 800 .72rem "Cardcade Pixel", monospace; }
.rummy-pass-targets button:hover, .rummy-pass-targets button:focus-visible { border-color: #f5ca4d; background: #245276; }
.rummy-pass-cancel { min-height: 42px; margin-top: 12px; padding: 7px 18px; border: 1px solid #91abc2; border-radius: 8px; color: #e4edf5; background: #15283a; }
.rummy-route-circuit { flex: 0 0 auto; }
.rummy-pattern-help { border: 1px solid rgba(126,159,194,.48); border-radius: 10px; background: rgba(8,20,35,.84); color: var(--muted); font-size: .68rem; }
.rummy-pattern-help-toggle { width: 100%; min-height: 0; margin: 0; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; background: transparent; color: #dce9f4; cursor: pointer; font: 800 .68rem "Cardcade Pixel", monospace; letter-spacing: .04em; text-align: left; }
.rummy-pattern-help-toggle:hover, .rummy-pattern-help-toggle.controller-hover, .rummy-pattern-help-toggle.controller-focus { background: rgba(126,159,194,.13); }
.rummy-pattern-help-toggle[aria-expanded="true"] { border-bottom: 1px solid rgba(126,159,194,.35); border-radius: 9px 9px 0 0; }
.rummy-pattern-help-toggle span { color: #f5ca4d; font-size: 1rem; line-height: .6; }
.rummy-pattern-help > div { padding: 8px 11px 9px; }
.rummy-pattern-help ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 16px; margin: 0; padding-left: 16px; }
.rummy-pattern-help li { line-height: 1.35; }
.rummy-pattern-help b { color: #fff5d3; }
.rummy-pattern-help p { margin: 8px 0 0; line-height: 1.35; }
.rummy-route-progress { display: grid; grid-template-columns: repeat(5, 9px); gap: 5px; }
.rummy-route-progress i { width: 9px; height: 9px; border: 1px solid rgba(210,226,241,.52); border-radius: 2px; background: #102039; box-shadow: inset 0 0 0 1px rgba(0,0,0,.28); transform: rotate(45deg); }
.rummy-route-progress i.current { border-color: #f5ca4d; background: #f5ca4d; box-shadow: 0 0 12px rgba(245,202,77,.72); }
.rummy-route-progress i.cleared { border-color: #70dfb0; background: #55c878; box-shadow: 0 0 8px rgba(85,200,120,.45); }
.rotating-rummy-game .game-seat.rummy-route-clear { border-color: #f5ca4d; background: linear-gradient(135deg, rgba(245,202,77,.16), rgba(9,25,45,.9)); box-shadow: 0 0 18px rgba(245,202,77,.16); }
.rotating-rummy-game .game-seat.rummy-route-clear small { color: #ffe8a0; }

.rummy-pile-zone { min-height: 150px; display: flex; align-items: center; justify-content: center; gap: clamp(22px, 6vw, 70px); }
.rummy-pile-zone .active-pile { min-height: 135px; min-width: 100px; }
.rummy-pile-zone .active-pile.cards-pile { width: 86px; min-width: 86px; flex: 0 0 86px; overflow: visible; }
.rummy-stock {
  position: relative;
  width: 86px;
  height: 122px;
  display: grid;
  border: 4px solid #dce9f4;
  border-radius: 10px;
  color: #f5ca4d;
  background: repeating-linear-gradient(45deg, rgba(245,202,77,.15) 0 3px, transparent 3px 7px), repeating-linear-gradient(-45deg, rgba(76,156,255,.1) 0 3px, transparent 3px 7px), #101821;
  box-shadow: 7px 8px 0 rgba(0,0,0,.46), inset 0 0 0 1px rgba(255,255,255,.11);
}
.rummy-stock::before { content: ""; position: absolute; inset: 9px; border: 2px solid rgba(220,233,244,.55); border-radius: 5px; pointer-events: none; }
.rummy-stock::after { content: none; }

.rummy-red { --rummy-color: var(--rummy-red, #ef5d62); }
.rummy-blue { --rummy-color: var(--rummy-blue, #4c9cff); }
.rummy-green { --rummy-color: var(--rummy-green, #55c878); }
.rummy-yellow { --rummy-color: var(--rummy-yellow, #f5ca4d); }
.rummy-wild { --rummy-color: #d8b8ff; }
.rummy-pass { --rummy-color: #ffaaa0; }
.rummy-card {
  color: var(--rummy-color, #f5ca4d);
  border-color: #dce9f4;
  background: #080c12;
  box-shadow: 5px 7px 0 rgba(0,0,0,.52);
}
.rummy-card-ink { position: absolute; z-index: 0; inset: 0; border-radius: inherit; background: #080c12; pointer-events: none; }
.rummy-card-ink::before,
.rummy-card-ink::after { content: none; }
.rummy-corner { color: var(--rummy-color); text-shadow: 1px 2px 0 #02050a; }
.rummy-corner strong { max-width: 42px; font: 900 clamp(.72rem, 2.45vw, 1.05rem)/.84 "Cardcade Pixel", "Courier New", monospace; letter-spacing: -.05em; }
.rummy-corner strong.rummy-rank-glyph { font-family: "Cardcade Ranks", "Courier New", monospace; font-weight: 400; letter-spacing: 0; }
.rummy-card-center { position: absolute; z-index: 2; inset: 21% 8% 18%; display: grid; place-items: center; color: var(--rummy-color); pointer-events: none; text-align: center; }
.rummy-card-center > b { width: 100%; max-width: 100%; display: block; overflow: visible; font: 400 min(56cqw, 46cqh)/.82 "Cardcade Ranks", "Courier New", monospace; letter-spacing: 0; font-variant-numeric: tabular-nums; text-align: center; text-shadow: 2px 3px 0 #02050a, 0 0 13px color-mix(in srgb, var(--rummy-color) 35%, transparent); transform: translate(-1px, -1px); white-space: nowrap; }
.rummy-card.played .rummy-card-center { inset: 20% 8% 17%; }
.rummy-action-mark { position: relative; width: 78%; height: 70%; display: block; color: var(--rummy-color); }
.rummy-action-mark i { position: absolute; display: block; }
.rummy-wild-mark { width: 58%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8%; }
.rummy-wild-mark i { position: static; min-width: 0; margin: 0; display: block; border: 0; border-radius: 2px; box-shadow: none; transform: none; }
.rummy-wild-mark i:nth-child(1) { background: var(--rummy-red, #ef5d62); }
.rummy-wild-mark i:nth-child(2) { background: var(--rummy-yellow, #f5ca4d); }
.rummy-wild-mark i:nth-child(3) { background: var(--rummy-blue, #4c9cff); }
.rummy-wild-mark i:nth-child(4) { background: var(--rummy-green, #55c878); }
.rummy-action-wild { width: 58%; height: auto; aspect-ratio: 1; display: grid; place-items: center; }
.rummy-action-wild .rummy-wild-mark { width: 100%; height: 100%; }
.rummy-action-pass { display: flex; align-items: center; justify-content: center; gap: 16%; }
.rummy-action-pass i { position: relative; width: 20%; height: 82%; border: 3px solid currentColor; border-radius: 3px; box-shadow: 2px 2px 0 rgba(0,0,0,.34); }
.rummy-wild-mark-seat { width: 56%; }
.rummy-wild-mark-preview { width: 52%; }

.rummy-link-group-cards { min-height: 39px; display: flex; align-items: center; overflow: hidden; padding-left: 2px; }
.rummy-link-group-cards .playing-card.played { position: relative; left: auto; top: auto; flex: 0 0 27px; width: 27px; height: 39px; margin-left: -9px; border-width: 1px; border-radius: 3px; transform: rotate(-3deg); box-shadow: 1px 2px 0 rgba(0,0,0,.45); }
.rummy-link-group-cards .playing-card.played:first-child { margin-left: 0; }
.rummy-link-group-cards .rummy-card-center { inset-inline: 7%; }
.rummy-link-group-cards .rummy-card-center > b { font-size: min(48cqw, 40cqh); text-shadow: 1px 1px 0 #02050a; }
.rummy-link-group-cards .rummy-corner strong { max-width: 92%; font-size: min(26cqw, 20cqh); white-space: nowrap; }
.rummy-link-board { padding: 9px 11px; border: 1px solid rgba(163,193,226,.38); border-radius: 12px; background: linear-gradient(135deg, rgba(10,28,49,.84), rgba(4,13,24,.8)); }
.rummy-link-board-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.rummy-link-board-heading small { color: var(--muted); font-size: .62rem; text-align: right; }
.rummy-link-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 7px; }
.rummy-link-group-card { min-width: 0; padding: 6px; border: 1px solid rgba(163,193,226,.28); border-radius: 9px; background: rgba(3,11,20,.62); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.rummy-link-group-card.selected { border-color: #f5ca4d; background: rgba(111,78,18,.26); box-shadow: 0 0 13px rgba(245,202,77,.18); }
.rummy-link-group-card > button { width: 100%; min-height: 28px; margin-top: 5px; padding: 4px 5px; font-size: .55rem; }
.rummy-actions { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.rummy-actions button.primary { border-color: #f5ca4d; background: linear-gradient(#b98425, #81531b); }

/* ---------- Standard 52 skin packs ---------- */
.card-skin-cardcade-pixel {
  --pixel-back-ink: #cbe4ff;
  --pixel-back-border: #46688c;
  --pixel-back-deep: #112948;
  --pixel-back-light: #1b3b62;
  --pixel-back-keyline: rgba(203,228,255,.58);
  --pixel-back-pattern: rgba(105,174,242,.18);
  --pixel-back-inset: rgba(105,174,242,.16);
}
.card-back.card-skin-cardcade-pixel {
  isolation: isolate;
  color: var(--pixel-back-ink);
  border-color: var(--pixel-back-border);
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, var(--pixel-back-pattern) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(203,228,255,.08) 6px 8px),
    linear-gradient(145deg, var(--pixel-back-light), var(--pixel-back-deep));
  box-shadow: 5px 7px 0 rgba(0,0,0,.48), inset 0 0 0 2px var(--pixel-back-inset);
  text-shadow: 2px 3px 0 rgba(0,0,0,.5);
}
.card-back.card-skin-cardcade-pixel::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: clamp(4px, 8%, 9px);
  border: 2px solid var(--pixel-back-keyline);
  border-radius: max(3px, calc(1em * .28));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  pointer-events: none;
}
.card-back.card-skin-cardcade-pixel > :is(i, b, span, strong) { z-index: 2; color: inherit; }
.card-back.card-skin-cardcade-pixel > :is(span, strong) { position: relative; }
.draw-card-back.card-skin-cardcade-pixel::after { content: none; }
.draw-stack.card-skin-cardcade-pixel::before,
.draw-stack.card-skin-cardcade-pixel::after {
  border-color: var(--pixel-back-border);
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, var(--pixel-back-pattern) 6px 8px),
    linear-gradient(145deg, var(--pixel-back-light), var(--pixel-back-deep));
  box-shadow: inset 0 0 0 2px var(--pixel-back-inset);
}
.card-skin-casino-gold {
  --skin-paper: #f6eed9;
  --skin-paper-deep: #eadbb9;
  --skin-border: #d1ad58;
  --skin-black: #17344d;
  --skin-red: #a32634;
  --skin-accent: #f0c85b;
  --skin-back: #071b31;
  --skin-back-deep: #0d3151;
  --skin-keyline: rgba(240,200,91,.78);
  --skin-pattern: rgba(240,200,91,.18);
  --skin-inset: rgba(240,200,91,.16);
  --skin-preview-border: #786b46;
}
.card-skin-royal-violet {
  --skin-paper: #f3eff7;
  --skin-paper-deep: #ded6eb;
  --skin-border: #a995d0;
  --skin-black: #3a3567;
  --skin-red: #ad2f64;
  --skin-accent: #9fe0d2;
  --skin-back: #241940;
  --skin-back-deep: #46326f;
  --skin-keyline: rgba(207,190,248,.82);
  --skin-pattern: rgba(176,148,231,.22);
  --skin-inset: rgba(159,224,210,.16);
  --skin-preview-border: #6a628c;
}
.card-skin-crimson-arcade {
  --skin-paper: #f8efdc;
  --skin-paper-deep: #e8d5b1;
  --skin-border: #e4b84e;
  --skin-black: #4a1b25;
  --skin-red: #a92639;
  --skin-accent: #f7d56f;
  --skin-back: #7d1f2e;
  --skin-back-deep: #3f0b18;
  --skin-keyline: rgba(239,196,92,.9);
  --skin-pattern: rgba(255,235,174,.15);
  --skin-inset: rgba(239,196,92,.2);
  --skin-preview-border: #8d6342;
}

.playing-card.card-skin-casino-gold,
.playing-card.card-skin-royal-violet,
.playing-card.card-skin-crimson-arcade {
  color: var(--skin-black);
  border-color: var(--skin-border);
  background:
    linear-gradient(rgba(74,52,23,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,52,23,.045) 1px, transparent 1px),
    radial-gradient(circle at 25% 12%, rgba(255,255,255,.84), transparent 38%),
    linear-gradient(145deg, var(--skin-paper), var(--skin-paper-deep));
  background-size: 5px 5px, 5px 5px, auto, auto;
  box-shadow: 5px 7px 0 rgba(0,0,0,.44), inset 0 0 0 1px rgba(255,255,255,.6), inset 0 0 16px rgba(70,45,20,.08);
}
.playing-card.card-skin-royal-violet {
  background:
    linear-gradient(rgba(67,48,91,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67,48,91,.04) 1px, transparent 1px),
    radial-gradient(circle at 25% 12%, rgba(255,255,255,.9), transparent 38%),
    linear-gradient(145deg, var(--skin-paper), var(--skin-paper-deep));
  background-size: 5px 5px, 5px 5px, auto, auto;
}
.playing-card.card-skin-casino-gold.red,
.playing-card.card-skin-royal-violet.red,
.playing-card.card-skin-crimson-arcade.red,
.standard-seat-card.card-skin-casino-gold.red,
.standard-seat-card.card-skin-royal-violet.red,
.standard-seat-card.card-skin-crimson-arcade.red { color: var(--skin-red); }
.playing-card.card-skin-casino-gold.selected { border-color: #ffd875; box-shadow: 0 22px 34px rgba(0,0,0,.44), 0 0 0 3px #f0c85b, 4px 5px 0 rgba(7,10,18,.32); }
.playing-card.card-skin-casino-gold.selected::before { border-color: #ffe29a; box-shadow: inset 0 0 0 2px rgba(240,200,91,.18); }
.playing-card.card-skin-royal-violet.selected { border-color: #cdbbff; box-shadow: 0 22px 34px rgba(0,0,0,.44), 0 0 0 3px #9fe0d2, 4px 5px 0 rgba(7,10,18,.32); }
.playing-card.card-skin-royal-violet.selected::before { border-color: #baf0e4; box-shadow: inset 0 0 0 2px rgba(159,224,210,.2); }
.playing-card.card-skin-crimson-arcade.selected { border-color: #ffe08a; box-shadow: 0 22px 34px rgba(0,0,0,.44), 0 0 0 3px #efc45c, 4px 5px 0 rgba(7,10,18,.32); }
.playing-card.card-skin-crimson-arcade.selected::before { border-color: #ffe7a7; box-shadow: inset 0 0 0 2px rgba(239,196,92,.2); }
.playing-card.card-skin-casino-gold:focus-visible { outline-color: #ffe29a; }
.playing-card.card-skin-royal-violet:focus-visible { outline-color: #baf0e4; }
.playing-card.card-skin-crimson-arcade:focus-visible { outline-color: #ffe7a7; }

.standard-seat-card.card-skin-casino-gold,
.standard-seat-card.card-skin-royal-violet,
.standard-seat-card.card-skin-crimson-arcade {
  color: var(--skin-black);
  border-color: var(--skin-border);
  background:
    linear-gradient(rgba(74,52,23,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,52,23,.045) 1px, transparent 1px),
    linear-gradient(145deg, var(--skin-paper), var(--skin-paper-deep));
  background-size: 4px 4px, 4px 4px, auto;
}

.card-back.card-skin-casino-gold,
.card-back.card-skin-royal-violet,
.card-back.card-skin-crimson-arcade {
  isolation: isolate;
  color: var(--skin-accent);
  border-color: var(--skin-border);
  background:
    linear-gradient(135deg, rgba(255,255,255,.1), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, var(--skin-pattern) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255,255,255,.06) 6px 8px),
    linear-gradient(145deg, var(--skin-back-deep), var(--skin-back));
  box-shadow: 5px 7px 0 rgba(0,0,0,.48), inset 0 0 0 2px var(--skin-inset);
  text-shadow: 2px 3px 0 rgba(0,0,0,.5);
}
.card-back.card-skin-royal-violet {
  background:
    radial-gradient(circle at 50% 42%, rgba(159,224,210,.15), transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,.1), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(45deg, transparent 0 6px, var(--skin-pattern) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(159,224,210,.1) 6px 8px),
    linear-gradient(145deg, var(--skin-back-deep), var(--skin-back));
}
.card-back.card-skin-crimson-arcade {
  background:
    linear-gradient(135deg, rgba(255,255,255,.1), transparent 38%, rgba(0,0,0,.14)),
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(255,255,255,.055) 11px 14px),
    var(--skin-back);
  box-shadow: 5px 7px 0 rgba(0,0,0,.48), inset 0 0 0 4px var(--skin-back-deep), inset 0 0 0 6px var(--skin-inset);
}
.card-back.card-skin-casino-gold::before,
.card-back.card-skin-royal-violet::before,
.card-back.card-skin-crimson-arcade::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: clamp(4px, 8%, 9px);
  border: 2px solid var(--skin-keyline);
  border-radius: max(3px, calc(1em * .28));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  pointer-events: none;
}
.card-back.card-skin-casino-gold > :is(i, b, span, strong),
.card-back.card-skin-royal-violet > :is(i, b, span, strong),
.card-back.card-skin-crimson-arcade > :is(i, b, span, strong) { z-index: 2; color: inherit; }
.card-back.card-skin-casino-gold > :is(span, strong),
.card-back.card-skin-royal-violet > :is(span, strong),
.card-back.card-skin-crimson-arcade > :is(span, strong) { position: relative; }
.draw-card-back.card-skin-casino-gold::after,
.draw-card-back.card-skin-royal-violet::after,
.draw-card-back.card-skin-crimson-arcade::after { content: none; }
.draw-stack.card-skin-casino-gold::before,
.draw-stack.card-skin-casino-gold::after,
.draw-stack.card-skin-royal-violet::before,
.draw-stack.card-skin-royal-violet::after,
.draw-stack.card-skin-crimson-arcade::before,
.draw-stack.card-skin-crimson-arcade::after {
  border-color: var(--skin-border);
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, var(--skin-pattern) 6px 8px),
    linear-gradient(145deg, var(--skin-back-deep), var(--skin-back));
  box-shadow: inset 0 0 0 2px var(--skin-inset);
}
.draw-stack.card-skin-crimson-arcade::before,
.draw-stack.card-skin-crimson-arcade::after {
  background:
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(255,255,255,.055) 11px 14px),
    var(--skin-back);
  box-shadow: inset 0 0 0 4px var(--skin-back-deep), inset 0 0 0 6px var(--skin-inset);
}

.skin-preview.card-skin-casino-gold,
.skin-preview.card-skin-royal-violet,
.skin-preview.card-skin-crimson-arcade { border-color: var(--skin-preview-border); }
.skin-preview.card-skin-casino-gold .skin-preview-standard-face,
.skin-preview.card-skin-royal-violet .skin-preview-standard-face,
.skin-preview.card-skin-crimson-arcade .skin-preview-standard-face {
  color: var(--skin-red);
  border-color: var(--skin-border);
  background:
    linear-gradient(rgba(74,52,23,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,52,23,.045) 1px, transparent 1px),
    linear-gradient(145deg, var(--skin-paper), var(--skin-paper-deep));
  background-size: 4px 4px, 4px 4px, auto;
}

/* ---------- JUAN color/action skin packs ---------- */
.card-skin-juan-night-shift {
  --juan-skin-accent: #79e6ff;
  --juan-skin-border: #b9f3ff;
  --juan-skin-back: #07101e;
  --juan-skin-back-deep: #101c34;
}
.card-skin-juan-paper-pop {
  --juan-skin-accent: #fff4df;
  --juan-skin-border: #fff4df;
  --juan-skin-back: #e84f59;
  --juan-skin-back-deep: #b72e44;
}

:is(.juan-card, .juan-seat-card).card-skin-juan-night-shift.juan-blaze { --juan-face: #351520; --juan-deep: #170b14; --juan-ink: #ff8188; --juan-skin-color: #ff5563; }
:is(.juan-card, .juan-seat-card).card-skin-juan-night-shift.juan-tide { --juan-face: #102a46; --juan-deep: #081525; --juan-ink: #80c9ff; --juan-skin-color: #3da6ff; }
:is(.juan-card, .juan-seat-card).card-skin-juan-night-shift.juan-grove { --juan-face: #123226; --juan-deep: #081b15; --juan-ink: #8ce6af; --juan-skin-color: #54d68a; }
:is(.juan-card, .juan-seat-card).card-skin-juan-night-shift.juan-spark { --juan-face: #382d12; --juan-deep: #1d1608; --juan-ink: #ffe184; --juan-skin-color: #ffc84b; }
:is(.juan-card, .juan-seat-card).card-skin-juan-night-shift.juan-prism { --juan-face: #09111f; --juan-deep: #040912; --juan-ink: #f8fbff; --juan-skin-color: #79e6ff; }

.juan-card.card-skin-juan-night-shift {
  border-color: color-mix(in srgb, var(--juan-skin-color) 72%, white);
  background: var(--juan-face);
  box-shadow: 5px 7px 0 rgba(0,0,0,.58), 0 0 0 1px color-mix(in srgb, var(--juan-skin-color) 48%, transparent), inset 0 0 0 1px rgba(255,255,255,.1);
}
.juan-card.card-skin-juan-night-shift .juan-card-ink {
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 43%, color-mix(in srgb, var(--juan-skin-color) 28%, transparent), transparent 48%),
    linear-gradient(145deg, color-mix(in srgb, var(--juan-face) 90%, white), var(--juan-deep));
  background-size: 5px 5px, 5px 5px, auto, auto;
  box-shadow: inset 0 0 0 2px rgba(2,7,15,.55), inset 0 0 20px rgba(0,0,0,.34);
}
.juan-card.card-skin-juan-night-shift .juan-corner,
.juan-card.card-skin-juan-night-shift .juan-card-center { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--juan-skin-color) 42%, transparent)); }
.juan-card.card-skin-juan-night-shift.juan-prism .juan-card-ink {
  background:
    linear-gradient(rgba(121,230,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121,230,255,.04) 1px, transparent 1px),
    conic-gradient(from 45deg at 50% 50%, rgba(255,85,99,.2), rgba(61,166,255,.2), rgba(84,214,138,.2), rgba(255,200,75,.2), rgba(255,85,99,.2)),
    #07101e;
  background-size: 5px 5px, 5px 5px, auto, auto;
}
.juan-seat-card.card-skin-juan-night-shift {
  color: var(--juan-ink);
  border-color: color-mix(in srgb, var(--juan-skin-color) 70%, white);
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--juan-skin-color) 28%, transparent), transparent 52%),
    linear-gradient(145deg, var(--juan-face), var(--juan-deep));
  text-shadow: 0 0 5px color-mix(in srgb, var(--juan-skin-color) 58%, transparent);
}

:is(.juan-card, .juan-seat-card).card-skin-juan-paper-pop.juan-blaze { --juan-face: #fff4e3; --juan-deep: #f8dec9; --juan-ink: #9e2034; --juan-skin-color: #df3f50; }
:is(.juan-card, .juan-seat-card).card-skin-juan-paper-pop.juan-tide { --juan-face: #f2f4e8; --juan-deep: #dbe8df; --juan-ink: #185288; --juan-skin-color: #287fbd; }
:is(.juan-card, .juan-seat-card).card-skin-juan-paper-pop.juan-grove { --juan-face: #f4f3df; --juan-deep: #dce8ce; --juan-ink: #17633c; --juan-skin-color: #2e9e62; }
:is(.juan-card, .juan-seat-card).card-skin-juan-paper-pop.juan-spark { --juan-face: #fff2d0; --juan-deep: #f3ddb0; --juan-ink: #87510c; --juan-skin-color: #d9941a; }
:is(.juan-card, .juan-seat-card).card-skin-juan-paper-pop.juan-prism { --juan-face: #f8efdf; --juan-deep: #dfd2bf; --juan-ink: #12243c; --juan-skin-color: #e84f59; }

.juan-card.card-skin-juan-paper-pop {
  border-color: #fff8e9;
  background: var(--juan-face);
  box-shadow: 5px 7px 0 color-mix(in srgb, var(--juan-skin-color) 38%, #111522), 0 0 0 2px var(--juan-skin-color), inset 0 0 0 1px rgba(255,255,255,.75);
}
.juan-card.card-skin-juan-paper-pop .juan-card-ink {
  background:
    linear-gradient(rgba(88,59,31,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88,59,31,.055) 1px, transparent 1px),
    linear-gradient(118deg, color-mix(in srgb, var(--juan-skin-color) 23%, transparent) 0 22%, transparent 22% 76%, color-mix(in srgb, var(--juan-skin-color) 14%, transparent) 76%),
    linear-gradient(145deg, var(--juan-face), var(--juan-deep));
  background-size: 5px 5px, 5px 5px, auto, auto;
  box-shadow: inset 7px 0 0 var(--juan-skin-color), inset 0 0 0 1px rgba(87,52,29,.13);
}
.juan-card.card-skin-juan-paper-pop.juan-prism .juan-card-ink {
  background:
    linear-gradient(rgba(88,59,31,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88,59,31,.055) 1px, transparent 1px),
    conic-gradient(from 45deg at 50% 50%, rgba(223,63,80,.18), rgba(40,127,189,.18), rgba(46,158,98,.18), rgba(217,148,26,.18), rgba(223,63,80,.18)),
    linear-gradient(145deg, var(--juan-face), var(--juan-deep));
  background-size: 5px 5px, 5px 5px, auto, auto;
  box-shadow: inset 7px 0 0 #e84f59, inset 0 0 0 1px rgba(87,52,29,.13);
}
.juan-card.card-skin-juan-paper-pop .juan-action-double-draw i { background: color-mix(in srgb, var(--juan-face) 88%, white); }
.juan-card.card-skin-juan-paper-pop:is(.juan-kind-double-draw, .juan-kind-prism-burst) .juan-corner strong {
  color: #07101d;
  -webkit-text-stroke: 0;
  text-shadow: none;
}
.juan-card.card-skin-juan-paper-pop .juan-action-double-draw b,
.juan-card.card-skin-juan-paper-pop .juan-action-prism-burst b {
  color: #07101d;
  background: transparent;
  -webkit-text-stroke-color: var(--juan-face);
}
.juan-seat-card.card-skin-juan-paper-pop {
  color: var(--juan-ink);
  border-color: var(--juan-skin-color);
  background:
    linear-gradient(118deg, color-mix(in srgb, var(--juan-skin-color) 28%, transparent) 0 25%, transparent 25%),
    linear-gradient(145deg, var(--juan-face), var(--juan-deep));
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--juan-skin-color) 34%, #111522);
  text-shadow: none;
}

/* JUAN's default skin shipped with no back rule at all, so every face-down JUAN
   card painted as a transparent rectangle with nothing but its border: opponent
   hands disappeared into the felt and the side seats had no card to show. Match
   the deck's own stock card -- navy field, cream keyline -- so a face-down JUAN
   card reads the same wherever it appears. */
.card-back.card-skin-juan-minimal {
  isolation: isolate;
  color: #fffaf0;
  border-color: #f2ebdd;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .1), transparent 44%, rgba(0, 0, 0, .16)),
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(145deg, #16294a, #0b1c34);
  background-size: auto, 5px 5px, 5px 5px, auto;
  box-shadow: 5px 7px 0 rgba(0, 0, 0, .48), inset 0 0 0 2px rgba(255, 250, 240, .16);
  text-shadow: 2px 3px 0 rgba(0, 0, 0, .5);
}
.card-back.card-skin-juan-minimal::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: clamp(3px, 8%, 9px);
  border: 2px solid rgba(255, 250, 240, .58);
  border-radius: max(3px, calc(1em * .28));
  pointer-events: none;
}
.card-back.card-skin-juan-minimal > :is(b, i, span, strong) { position: relative; z-index: 2; color: inherit; }

.card-back.card-skin-juan-night-shift,
.card-back.card-skin-juan-paper-pop {
  isolation: isolate;
  color: var(--juan-skin-accent);
  border-color: var(--juan-skin-border);
  text-shadow: 2px 3px 0 rgba(0,0,0,.48);
}
.card-back.card-skin-juan-night-shift {
  background:
    radial-gradient(circle at 50% 48%, rgba(121,230,255,.2), transparent 27%),
    linear-gradient(rgba(121,230,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121,230,255,.055) 1px, transparent 1px),
    linear-gradient(145deg, var(--juan-skin-back-deep), var(--juan-skin-back));
  background-size: auto, 5px 5px, 5px 5px, auto;
  box-shadow: 5px 7px 0 rgba(0,0,0,.52), inset 0 0 0 2px rgba(121,230,255,.18), inset 0 0 22px rgba(121,230,255,.08);
}
.card-back.card-skin-juan-paper-pop {
  background:
    linear-gradient(rgba(255,244,223,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,244,223,.08) 1px, transparent 1px),
    linear-gradient(35deg, transparent 0 38%, rgba(255,244,223,.16) 38% 50%, transparent 50% 62%, rgba(255,244,223,.1) 62% 68%, transparent 68%),
    linear-gradient(145deg, var(--juan-skin-back), var(--juan-skin-back-deep));
  background-size: 5px 5px, 5px 5px, auto, auto;
  box-shadow: 5px 7px 0 rgba(73,19,31,.46), inset 0 0 0 3px rgba(255,244,223,.24);
}
.card-back.card-skin-juan-night-shift > :is(b, i, span, strong),
.card-back.card-skin-juan-paper-pop > :is(b, i, span, strong) { position: relative; z-index: 2; color: inherit; }
.juan-stock.card-skin-juan-night-shift::before { border-color: rgba(121,230,255,.72); box-shadow: 0 0 12px rgba(121,230,255,.18); }
.juan-stock.card-skin-juan-paper-pop::before { border-color: rgba(255,244,223,.78); }

.skin-preview.card-skin-juan-night-shift { border-color: rgba(121,230,255,.48); background: radial-gradient(circle at 50% 120%, rgba(121,230,255,.18), rgba(3,12,25,.82)); }
.skin-preview.card-skin-juan-paper-pop { border-color: rgba(232,79,89,.48); background: radial-gradient(circle at 50% 120%, rgba(232,79,89,.2), rgba(34,16,24,.76)); }
.skin-preview.card-skin-juan-night-shift .skin-preview-juan-face { color: #8ce6af; border-color: #9df1bc; background: radial-gradient(circle at 50% 43%, rgba(84,214,138,.28), transparent 50%), linear-gradient(145deg, #123226, #081b15); box-shadow: 4px 5px 0 rgba(0,0,0,.5), 0 0 0 1px #54d68a; }
.skin-preview.card-skin-juan-night-shift .skin-preview-juan-prism { border-color: #b9f3ff; background: conic-gradient(from 45deg, rgba(255,85,99,.18), rgba(61,166,255,.2), rgba(84,214,138,.2), rgba(255,200,75,.18), rgba(255,85,99,.18)), #07101e; }
.skin-preview.card-skin-juan-paper-pop .skin-preview-juan-face { color: #17633c; border-color: #fff8e9; background: linear-gradient(118deg, rgba(46,158,98,.28) 0 23%, transparent 23%), linear-gradient(145deg, #f4f3df, #dce8ce); box-shadow: 4px 5px 0 rgba(46,77,42,.42), 0 0 0 2px #2e9e62; }
.skin-preview.card-skin-juan-paper-pop .skin-preview-juan-prism { color: #12243c; border-color: #fff8e9; background: conic-gradient(from 45deg, rgba(223,63,80,.2), rgba(40,127,189,.2), rgba(46,158,98,.2), rgba(217,148,26,.2), rgba(223,63,80,.2)), linear-gradient(145deg, #f8efdf, #dfd2bf); box-shadow: 4px 5px 0 rgba(73,19,31,.35), 0 0 0 2px #e84f59; }

/* ---------- Rotating Rummy Blackout skin ---------- */
.card-skin-rotating-rummy-blackout {
  --rummy-back-ink: #f5ca4d;
  --rummy-back-border: #dce9f4;
  --rummy-back-deep: #080c12;
  --rummy-back-mid: #17212d;
}
.rummy-card.card-skin-rotating-rummy-blackout {
  border-color: var(--rummy-back-border);
  background: #080c12;
}
.card-back.card-skin-rotating-rummy-blackout {
  isolation: isolate;
  color: var(--rummy-back-ink);
  border-color: var(--rummy-back-border);
  background:
    radial-gradient(circle at 50% 46%, rgba(245,202,77,.15), transparent 26%),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(245,202,77,.13) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(76,156,255,.1) 6px 8px),
    linear-gradient(145deg, var(--rummy-back-mid), var(--rummy-back-deep));
  box-shadow: 5px 7px 0 rgba(0,0,0,.52), inset 0 0 0 2px rgba(220,233,244,.13);
  text-shadow: 2px 3px 0 #02050a;
}
.card-back.card-skin-rotating-rummy-blackout::before { content: ""; position: absolute; z-index: 1; inset: 9px; border: 1px solid rgba(220,233,244,.44); border-radius: 5px; pointer-events: none; }
.card-back.card-skin-rotating-rummy-blackout > :is(b, i, span, strong) { position: relative; z-index: 2; color: inherit; }
.rummy-stock.card-skin-rotating-rummy-blackout::before { border-color: rgba(220,233,244,.55); }
.rummy-seat-card.card-skin-rotating-rummy-blackout { border-color: #dce9f4; }
.skin-preview.card-skin-rotating-rummy-blackout { border-color: rgba(245,202,77,.5); background: radial-gradient(circle at 50% 120%, rgba(245,202,77,.16), rgba(3,10,18,.84)); }
.skin-preview.card-skin-rotating-rummy-blackout .skin-preview-rummy-face { border-color: #dce9f4; box-shadow: 4px 5px 0 rgba(0,0,0,.52), 0 0 0 1px rgba(245,202,77,.32); }
.skin-preview.card-skin-rotating-rummy-blackout .skin-preview-rummy-wild { border-color: #dce9f4; }

/* ---------- Rotating Rummy Light skin ---------- */
.card-skin-rotating-rummy-light {
  --rummy-light-paper: #f8faf5;
  --rummy-light-paper-deep: #e4eceb;
  --rummy-light-border: #40576a;
  --rummy-light-ink: #183044;
}
.rummy-card.card-skin-rotating-rummy-light {
  border-color: var(--rummy-light-border);
  background: #ffffff;
  box-shadow: 5px 7px 0 rgba(6,17,29,.42);
}
.rummy-card.card-skin-rotating-rummy-light .rummy-card-ink { background: #ffffff; }
.card-back.card-skin-rotating-rummy-light {
  isolation: isolate;
  color: var(--rummy-light-ink);
  border-color: var(--rummy-light-border);
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(239,93,98,.18) 6px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(76,156,255,.16) 6px 8px),
    linear-gradient(145deg, #ffffff, var(--rummy-light-paper-deep));
  box-shadow: 5px 7px 0 rgba(6,17,29,.42), inset 0 0 0 2px rgba(24,48,68,.08);
  text-shadow: 1px 1px 0 rgba(255,255,255,.82);
}
.card-back.card-skin-rotating-rummy-light::before { content: ""; position: absolute; z-index: 1; inset: 9px; border: 1px solid rgba(24,48,68,.38); border-radius: 5px; pointer-events: none; }
.card-back.card-skin-rotating-rummy-light > :is(b, i, span, strong) { position: relative; z-index: 2; color: inherit; }
.rummy-stock.card-skin-rotating-rummy-light::before { border-color: rgba(24,48,68,.42); }
.rummy-seat-card.card-skin-rotating-rummy-light { border-color: var(--rummy-light-border); background: #ffffff; box-shadow: 3px 4px 0 rgba(6,17,29,.42); text-shadow: 1px 1px 0 rgba(255,255,255,.7); }
.skin-preview.card-skin-rotating-rummy-light { border-color: rgba(147,180,198,.68); background: radial-gradient(circle at 50% 120%, rgba(126,180,201,.2), rgba(8,23,39,.9)); }
.skin-preview.card-skin-rotating-rummy-light .skin-preview-rummy-face { border-color: var(--rummy-light-border); background: #ffffff; box-shadow: 4px 5px 0 rgba(6,17,29,.42), 0 0 0 1px rgba(255,255,255,.72); }
.skin-preview.card-skin-rotating-rummy-light .skin-preview-rummy-wild { border-color: var(--rummy-light-border); background: linear-gradient(145deg, #ffffff, var(--rummy-light-paper-deep)); box-shadow: 4px 5px 0 rgba(6,17,29,.42), 0 0 0 1px rgba(255,255,255,.72); }

/* ---------- Original 3s & 7s / Thirteen Standard 52 Legacy Mode ---------- */
.playing-card.card-style-legacy-standard {
  container-type: size;
  color: #3f6089;
  border: 1px solid rgba(0,0,0,.16);
  border-radius: clamp(7px, 2.4vw, 11px);
  background: linear-gradient(160deg, #fbf6ea 0%, #f7f1e2 42%, #e9dec4 100%);
  background-size: auto;
  box-shadow: 0 10px 22px rgba(0,0,0,.42);
}
.playing-card.card-style-legacy-standard.red,
.standard-seat-card.card-style-legacy-standard.red { color: #b52a30; }
.playing-card.card-style-legacy-standard.black,
.standard-seat-card.card-style-legacy-standard.black { color: #3f6089; }
.playing-card.card-style-legacy-standard .card-corner {
  top: 5.5%;
  left: 7%;
  justify-items: center;
  font-family: Georgia, "Times New Roman", "Palatino Linotype", serif;
  line-height: .82;
}
.playing-card.card-style-legacy-standard .card-corner strong { font-size: 19cqh; font-weight: 700; letter-spacing: -.04em; }
.playing-card.card-style-legacy-standard .card-corner i { margin-top: 2cqh; font: normal 14cqh Georgia, "Times New Roman", serif; }
.playing-card.card-style-legacy-standard .card-corner.bottom { top: auto; left: auto; right: 7%; bottom: 5.5%; }
.legacy-card-center { position: absolute; z-index: 1; inset: 20% 30%; display: grid; place-items: center; }
.legacy-emblem { font: normal 48cqh/1 Georgia, "Times New Roman", serif; filter: drop-shadow(0 .8cqh 1.2cqh rgba(0,0,0,.13)); }
.legacy-court svg { width: 100%; height: 100%; overflow: visible; color: inherit; filter: drop-shadow(0 1.5cqh 2cqh rgba(0,0,0,.14)); }

.standard-seat-card.card-style-legacy-standard {
  color: #3f6089;
  border-color: rgba(0,0,0,.22);
  background: linear-gradient(160deg, #fbf6ea, #f7f1e2 42%, #e9dec4);
}
.standard-seat-card.card-style-legacy-standard strong { font-family: Georgia, "Times New Roman", serif; font-weight: 700; }

.card-back.card-style-legacy-standard {
  color: #b9dcff;
  border-color: rgba(116,184,255,.48);
  background:
    linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%),
    linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%),
    #142644;
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
  box-shadow: 5px 7px 0 rgba(0,0,0,.42), inset 0 0 0 1px rgba(116,184,255,.16);
  text-shadow: 1px 2px 0 rgba(0,0,0,.5);
}
.blackjack-card-back.card-style-legacy-standard::before,
.draw-card-back.card-style-legacy-standard::after { border-color: rgba(116,184,255,.58); box-shadow: none; }
.draw-card-back.discard.card-style-legacy-standard { background: linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%), linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%), #142644; background-position: 0 0, 4px 4px; background-size: 8px 8px; }
.draw-stack.card-style-legacy-standard::before,
.draw-stack.card-style-legacy-standard::after { border-color: rgba(116,184,255,.48); background: linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%), linear-gradient(45deg, rgba(112,184,255,.28) 25%, transparent 25% 75%, rgba(112,184,255,.28) 75%), #142644; background-position: 0 0, 4px 4px; background-size: 8px 8px; box-shadow: inset 0 0 0 1px rgba(116,184,255,.16); }

.legacy-standard-mode .physical-hand { min-height: 190px; }
.game-hand.legacy-flat-hand {
  min-height: 145px;
  height: auto !important;
  padding: 24px 10px 18px;
  display: flex;
  align-items: end;
  justify-content: safe center;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  touch-action: pan-x;
  isolation: auto;
}
.game-hand.legacy-flat-hand::-webkit-scrollbar { display: none; }
.game-hand.legacy-flat-hand .playing-card {
  position: relative;
  flex: 0 0 auto;
  left: auto;
  top: auto;
  width: clamp(50px, 13.4vw, 72px);
  height: calc(clamp(50px, 13.4vw, 72px) * 1.42);
  margin: 0;
  transform: none;
  transform-origin: center;
  contain: layout paint;
  will-change: transform;
}
.game-hand.legacy-flat-hand .playing-card.selected { transform: translateY(-18px); }
.game-hand.legacy-flat-hand .playing-card.selectable.controller-hover:not(.selected) { transform: translateY(-8px); }
.game-hand.legacy-flat-hand .playing-card.selectable:active { transform: translateY(-4px) scale(.99); }
@media (hover: hover) and (pointer: fine) {
  .game-hand.legacy-flat-hand .playing-card.selectable:hover:not(.selected) { transform: translateY(-8px); }
}
.game-hand.legacy-flat-hand .playing-card.dealt { animation-name: legacyCardDeal; }
.game-hand.legacy-flat-hand .playing-card.drawn { animation-name: legacyCardDraw; }
.game-hand.legacy-flat-hand .playing-card.card-exit { animation-name: legacyCardExit; }
@keyframes legacyCardDeal { from { transform: translateY(-36px) translateX(8px) rotate(-10deg) scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes legacyCardDraw { from { transform: translateY(-70px) translateX(24px) rotate(10deg) scale(.78); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes legacyCardExit { from { transform: translateY(-18px) scale(1); opacity: 1; } to { transform: translateY(-46px) scale(.86); opacity: 0; } }
.handoff-instruction { margin: 0; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; }
.handoff-panel h1 { margin: .3rem 0 .75rem; font-size: clamp(2.3rem, 9vw, 4.6rem); line-height: .95; }
.handoff-privacy { max-width: 440px; margin: 0 auto; color: #bdcad9; line-height: 1.55; }
.handoff-actions { margin-top: 1.5rem; }
.handoff-end { width: min(260px, 100%); margin-top: 1.5rem; }
.cpu-thinking { width: 132px; height: 132px; margin: 24px auto 18px; display: grid; grid-template-columns: repeat(3, 10px); place-content: center; gap: 8px; border: 4px solid #e8dfcc; border-radius: 50%; color: #9dcaff; background: #0b2749; box-shadow: 7px 9px 0 rgba(0,0,0,.45); }
.cpu-thinking span { grid-column: 1 / -1; margin-bottom: 8px; font: 900 1.25rem "Cardcade Pixel", "Courier New", monospace; }
.cpu-thinking i { width: 10px; height: 10px; background: var(--blue); animation: cpuThinking 900ms steps(2, end) infinite; }
.cpu-thinking i:nth-of-type(2) { animation-delay: 150ms; }
.cpu-thinking i:nth-of-type(3) { animation-delay: 300ms; }
@keyframes cpuThinking { 0%, 35% { opacity: .25; transform: translateY(0); } 55%, 100% { opacity: 1; transform: translateY(-5px); } }

@media (min-width: 900px) {
  .standard-card-game { grid-template-columns: minmax(0, 1fr); }
  .physical-hand { min-height: 290px; }
  .game-hand { min-height: 235px; }
}


@media (max-width: 700px) {
  .arcade-library-scene {
    --library-deck-width: clamp(118px, 36vw, 154px);
    --library-orbit-x: clamp(122px, 37vw, 164px);
    perspective-origin: 50% 45%;
  }
  .library-screen .topbar { min-height: calc(58px + var(--safe-top)); padding-inline: max(12px, var(--safe-left)) max(12px, var(--safe-right)); }
  .library-screen .brand-mark { width: 36px; margin-right: -5px; transform: scale(.62); }
  .library-screen .brand strong { font-size: .72rem; }
  .library-screen .topbar-status { font-size: 0; }
  .library-screen .status-light { width: 8px; height: 8px; }
  .orbital-deck { top: 46%; }
  .orbital-deck[data-orbit-slot="0"] { transform: translate3d(-50%, calc(-50% + 48px), 190px) scale(1); }
  .orbital-deck[data-orbit-slot="1"] { transform: translate3d(calc(-50% + var(--library-orbit-x)), calc(-50% - 10px), -35px) scale(.69); }
  .orbital-deck[data-orbit-slot="-1"] { transform: translate3d(calc(-50% - var(--library-orbit-x)), calc(-50% - 10px), -35px) scale(.69); }
  .orbital-deck[data-orbit-slot="2"] { transform: translate3d(-50%, calc(-50% - 93px), -260px) scale(.47); }
  .orbital-deck[data-orbit-slot="-2"] { transform: translate3d(-50%, calc(-50% - 93px), -260px) scale(.47); }
  .orbital-deck[data-orbit-slot="1"] .orbital-deck-box { transform: rotateY(-61deg) rotateX(-5deg); }
  .orbital-deck[data-orbit-slot="-1"] .orbital-deck-box { transform: rotateY(61deg) rotateX(-5deg); }
  .deck-box-front, .deck-box-rear { padding: 13px; border-width: 3px; }
  .deck-box-front::before, .deck-box-rear::before { inset: 10px; border-width: 2px; }
  .deck-box-front::after { inset: 15px; }
  .deck-box-emblem { width: min(72%, 96px); font-size: clamp(2.8rem, 15vw, 4.4rem); }
  .deck-box-front small { font-size: .42rem; }
  .deck-box-front strong { font-size: .73rem; }
  .deck-box-front b { font-size: .43rem; }
  .orbit-step { display: none; }
  .orbit-readout { bottom: clamp(44px, 7vh, 62px); }
  .orbit-readout strong { font-size: .76rem; }
  .orbit-readout small { font-size: .46rem; }
  .show-games .orbital-deck-stage { transform: translate3d(0, -18%, -490px) scale(.6); }
  .spatial-game-stage { padding-top: 54px; padding-inline: 8px; }
  .spatial-mode-list { width: min(96vw, 500px); max-height: 56vh; padding: 22px 14px; }
  .spatial-game-option { min-height: 43px; padding: 6px 14px; gap: 7px; }
  .spatial-game-option strong { font-size: clamp(.84rem, 4.4vw, 1.15rem); }
  .spatial-game-context { max-width: 90vw; font-size: .48rem; }
  .arcade-library-help { font-size: .43rem; letter-spacing: .08em; }
}

@media (orientation: landscape) and (max-height: 640px) {
  .arcade-library-scene {
    --library-deck-width: clamp(98px, 28vh, 142px);
    --library-orbit-x: clamp(150px, 26vw, 285px);
  }
  .library-screen .topbar { display: none; }
  .library-screen main { grid-row: 1 / -1; }
  .arcade-library-hud { top: max(8px, var(--safe-top)); }
  .orbital-deck { top: 46%; }
  .orbital-deck[data-orbit-slot="0"] { transform: translate3d(-50%, calc(-50% + 27px), 205px) scale(1); }
  .orbital-deck[data-orbit-slot="1"] { transform: translate3d(calc(-50% + var(--library-orbit-x)), calc(-50% - 6px), -42px) scale(.7); }
  .orbital-deck[data-orbit-slot="-1"] { transform: translate3d(calc(-50% - var(--library-orbit-x)), calc(-50% - 6px), -42px) scale(.7); }
  .orbital-deck[data-orbit-slot="2"] { transform: translate3d(-50%, calc(-50% - 65px), -280px) scale(.48); }
  .orbital-deck[data-orbit-slot="-2"] { transform: translate3d(-50%, calc(-50% - 65px), -280px) scale(.48); }
  .orbital-deck[data-orbit-slot="1"] .orbital-deck-box { transform: rotateY(-58deg) rotateX(-5deg); }
  .orbital-deck[data-orbit-slot="-1"] .orbital-deck-box { transform: rotateY(58deg) rotateX(-5deg); }
  .orbit-readout { bottom: 30px; }
  .orbit-step { top: 50%; }
  .show-games .orbital-deck-stage { transform: translate3d(0, -12%, -500px) scale(.58); }
  .spatial-game-stage { padding-block: 38px 36px; }
  .spatial-game-family { margin-bottom: 4px; }
  .spatial-mode-list { max-height: 66vh; padding-block: 18px; }
  .spatial-game-option { min-height: 34px; padding-block: 3px; }
  .spatial-game-option strong { font-size: clamp(.76rem, 2.4vw, 1.1rem); }
  .spatial-game-context { margin-top: 4px; }
  .arcade-library-help { bottom: max(6px, var(--safe-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-library-scene :is(.orbital-deck-stage, .spatial-game-stage, .orbital-deck, .orbital-deck-box, .spatial-game-option),
  .arcade-library-scene .orbital-deck.active .orbital-deck-box { animation: none !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

@media (max-width: 820px) {
  .site-shell { width: min(100% - 24px, 680px); }
  .topbar { min-height: 76px; }
  .home-grid { grid-template-columns: 1fr; }
  .hero-table { min-height: 360px; order: -1; }
  .hero-card { width: 130px; }
  .choice-grid, .game-grid, .room-layout { grid-template-columns: 1fr; }
  .room-layout .full-width { grid-column: auto; }
  .family-header { display: block; }
  .family-header p { margin-top: .6rem; }
  .playing-game .site-shell { width: min(100% - 12px, 680px); }
  .playing-game main { padding-top: 4px; }
  .game-topbar { grid-template-columns: 44px 1fr 58px; gap: 7px; }
  .game-topbar h2 { font-size: 1.2rem; }
  .game-topbar p { max-width: 62vw; }
  .game-score { min-width: 54px; padding: 4px; grid-template-columns: 1fr; gap: 0; }
  :is(.suit-ladder, .blackjack-rule-bar, .holdem-rule-bar, .five-card-draw-rule-bar) { gap: 8px; padding-inline: 8px; }
  .game-opponents { gap: 5px; }
  .game-seat { min-height: 68px; grid-template-columns: 34px minmax(0, 1fr); padding: 6px; gap: 6px; }
  .game-seat .player-avatar { width: 34px; height: 34px; }
  .game-seat .mini-deck { display: none; }
  .game-table { min-height: 190px; padding: 10px; }
  .active-pile { min-height: 125px; }
  .physical-hand { min-height: 230px; padding-inline: 8px; }
  .game-actions { gap: 5px; padding: 6px; }
  .game-actions button { min-height: 48px; font-size: .76rem; }
  .juan-game .game-opponents { display: flex; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; scrollbar-width: none; }
  .juan-game .game-opponents::-webkit-scrollbar { display: none; }
  .juan-game .game-seat { flex: 0 0 145px; min-height: 58px; scroll-snap-align: start; }
  .juan-game .game-opponents.fit-opponents { overflow-x: hidden; scroll-snap-type: none; }
  .juan-game .game-opponents.fit-opponents .game-seat { flex: 1 1 0; min-width: 0; }
  .juan-game .game-opponents.fit-opponents .game-seat > span:nth-child(2) { min-width: 0; }
  .juan-game .juan-pile-zone { min-height: 125px; }
  .blackjack-dealer-zone { min-height: 132px; grid-template-columns: minmax(108px, .8fr) minmax(160px, 1fr); gap: 10px; }
  .blackjack-dealer-pile { min-height: 126px !important; }
  .blackjack-hand { min-height: 254px; }
  .blackjack-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .holdem-board-zone { min-height: 140px; grid-template-columns: minmax(105px, .76fr) minmax(154px, 1fr); gap: 9px; }
  .holdem-board { min-height: 126px !important; }
  .holdem-hand { min-height: 254px; }
  .five-card-draw-table-zone { min-height: 140px; grid-template-columns: minmax(105px, .76fr) minmax(154px, 1fr); gap: 9px; }
  .five-card-draw-hand { min-height: 254px; }
}

@media (max-height: 680px) {
  .standard-card-game {
    --game-card-width: clamp(72px, 20vw, 88px);
    --game-card-height: calc(var(--game-card-width) * 1.42);
  }
}

@media (orientation: landscape) and (max-height: 640px) {
  .standard-card-game {
    --game-card-width: clamp(34px, 9.5vh, 46px);
    --game-card-height: calc(var(--game-card-width) * 1.42);
  }
}

@media (max-width: 520px) {
  main { padding: .85rem 0 1.5rem; }
  footer { display: none; }
  .topbar { min-height: calc(58px + var(--safe-top)); }
  .brand { gap: .55rem; }
  .brand-mark { width: 39px; height: 42px; transform: scale(.88); transform-origin: left center; }
  .brand strong { font-size: .96rem; }
  .pwa-tools { gap: .45rem; }
  .install-button { min-height: 34px; padding-inline: .55rem; font-size: .62rem; }
  .topbar-status { font-size: 0; gap: 0; }
  .topbar-status .status-light { width: 10px; height: 10px; }
  .home-grid { gap: 1rem; align-items: start; }
  .home-copy h1 { margin-bottom: .65rem; font-size: clamp(2.45rem, 12vw, 3.25rem); line-height: .91; letter-spacing: -.065em; }
  .home-copy .lede { margin-bottom: 0; font-size: .86rem; line-height: 1.42; }
  .home-actions { gap: .55rem; margin-top: .9rem; }
  .arcade-button { min-height: 58px; padding: .55rem .65rem; grid-template-columns: 40px 1fr auto; gap: .65rem; box-shadow: 4px 4px 0 rgba(1, 5, 13, .55); }
  .button-icon { width: 38px; height: 38px; font-size: 1rem; }
  .button-label { font-size: .9rem; }
  .button-copy { font-size: .68rem; line-height: 1.25; }
  .hero-table { min-height: 180px; border-radius: 76px 76px 14px 14px; }
  .hero-table::before { top: .8rem; font-size: .58rem; }
  .hero-table::after { width: 250px; height: 140px; bottom: -86px; }
  .hero-card { width: 82px; bottom: 14px; padding: .42rem; border-width: 3px; border-radius: 8px; font-size: 1.25rem; }
  .hero-card.two { transform: translateX(-50%) translateY(-12px) rotate(0); }
  .hero-card .suit { margin-top: .18rem; font-size: 1.55rem; }
  .choice-card { min-height: 190px; }
  .screen-head { margin-bottom: 1.4rem; }
  .screen-head { gap: .75rem; }
  .screen-head .lede { font-size: .84rem; line-height: 1.45; }
  .room-code { font-size: 2rem; }
  .button-row { display: grid; grid-template-columns: 1fr; }
  .hot-seat-names { grid-template-columns: 1fr; }
  .handoff-panel { padding: 24px 18px; }
  .handoff-card-back { width: 92px; margin-block: 18px 14px; }
  .cpu-thinking { width: 104px; height: 104px; margin-block: 18px 14px; }
  .suit-ladder > span:first-child, .suit-ladder > span:last-child { display: none; }
  .suit-rank { font-size: .95rem; }
  .game-seat strong { font-size: .75rem; }
  .game-seat small { font-size: .62rem; }
  .game-status { gap: .5rem; font-size: .82rem; }
  .game-status .badge { flex-basis: 46%; max-width: 46%; padding: .32rem .42rem; font-size: .56rem; }
  .active-pile .empty-pile { padding: 16px 8px; }
  .hand-heading { gap: .35rem; }
  .selection-status { max-width: 48%; font-size: .65rem; }
  .playing-card.played { flex-basis: 72px; width: 72px; height: 102px; }
  .game-actions button { font-size: .69rem; padding-inline: 4px; }
  .juan-lane-bar { min-height: 44px; gap: 8px; padding-inline: 7px; font-size: .6rem; }
  .juan-lane-bar > strong { min-width: 42px; }
  .juan-direction { min-width: 25px; font-size: 1.1rem; }
  .juan-gameplay-overlay { bottom: max(7px, calc(var(--safe-bottom) + 4px)); width: calc(100% - var(--safe-left) - var(--safe-right) - 14px); gap: 5px; }
  .juan-reaction-panel { min-height: 56px; padding: 6px 7px; gap: 7px; }
  .juan-reaction-panel strong { font-size: .69rem; }
  .juan-reaction-panel small { font-size: .56rem; line-height: 1.2; }
  .juan-reaction-panel button { min-height: 42px; padding: 5px 7px; font-size: .56rem; }
  .juan-reaction-actions { max-width: 52%; }
  .juan-reaction-actions button { min-width: 0; flex: 1 1 0; }
  .juan-stock { width: 72px; height: 102px; }
  .juan-pile-zone .active-pile.cards-pile { width: 72px; min-width: 72px; flex-basis: 72px; }
  .juan-pile-zone { gap: 34px; }
  .juan-prism-picker { padding: 18px 14px 16px; }
  .juan-prism-picker h3 { font-size: 1.15rem; }
  .juan-prism-stage-card { height: 164px; margin-block: 7px 5px; }
  .juan-prism-stage-card .playing-card.played { width: 98px; height: 139px; }
  .juan-color-chooser { gap: 7px; }
  .juan-color-choice { min-height: 48px; padding-inline: 7px; gap: 7px; font-size: .68rem; }
  .juan-color-choice i { width: 14px; height: 14px; }
  .juan-prism-reveal { grid-template-columns: 1fr; gap: 12px; place-items: center; text-align: center; }
  .juan-prism-reveal-burst { left: 50%; top: 42%; }
  .juan-prism-reveal-card .playing-card.played { width: 112px; height: 159px; }
  .juan-prism-reveal-copy { text-align: center; }
  .juan-prism-reveal-copy strong { justify-content: center; }
  .juan-prism-reveal.juan-call-reveal { grid-template-columns: 1fr; }
  .juan-call-shout { font-size: clamp(2rem, 14vw, 3.3rem); }
  .blackjack-rule-bar { min-height: 42px; gap: 3px 7px; padding: 6px 8px; font-size: .55rem; }
  .blackjack-rule-bar i { display: none; }
  .blackjack-dealer-zone { min-height: 125px; grid-template-columns: 1fr; gap: 1px; }
  .blackjack-dealer-copy { display: flex; gap: 7px; align-items: baseline; }
  .blackjack-dealer-copy strong { max-width: 250px; margin-top: 0; font-size: .67rem; }
  .blackjack-dealer-copy span { font-size: .6rem; }
  .blackjack-dealer-pile { min-height: 104px !important; }
  .blackjack-dealer-pile .playing-card.played { width: 68px; height: 97px; }
  .blackjack-hand { min-height: 240px; }
  .blackjack-hand-summaries { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 4px; }
  .blackjack-hand-summary { min-height: 36px; padding: 5px 6px; }
  .blackjack-hand-summary span { font-size: .53rem; }
  .blackjack-hand-summary strong { font-size: .66rem; }
  .blackjack-insurance-prompt { padding: 10px; }
  .blackjack-insurance-prompt strong { font-size: .84rem; }
  .blackjack-insurance-prompt .button-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .blackjack-insurance-prompt .action-button { min-height: 40px; padding-inline: 5px; font-size: .64rem; }
  .holdem-rule-bar { min-height: 42px; gap: 3px 7px; padding: 6px 8px; font-size: .55rem; }
  .holdem-rule-bar i { display: none; }
  .holdem-board-zone { min-height: 126px; grid-template-columns: 1fr; gap: 1px; }
  .holdem-board-copy { display: flex; gap: 7px; align-items: baseline; }
  .holdem-board-copy strong { max-width: 250px; margin-top: 0; font-size: .65rem; }
  .holdem-board-copy span { font-size: .58rem; }
  .holdem-board { min-height: 103px !important; }
  .holdem-board .playing-card.played { width: 68px; height: 97px; }
  .holdem-hand { min-height: 240px; }
  .holdem-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .five-card-draw-rule-bar { min-height: 42px; gap: 3px 7px; padding: 6px 8px; font-size: .55rem; }
  .five-card-draw-rule-bar i { display: none; }
  .five-card-draw-table-zone { min-height: 126px; grid-template-columns: 1fr; gap: 1px; }
  .five-card-draw-piles { gap: 46px; }
  .draw-stack, .draw-discard-pile { width: calc(var(--game-card-width) + 14px); min-height: calc(var(--game-card-height) + 28px); }
  .draw-card-back { border-radius: 8px; }
  .draw-card-back::after { inset: 5px; }
  .draw-stack > strong, .draw-discard-pile > strong { margin-top: 2px; font-size: .54rem; }
  .draw-stack > small, .draw-discard-pile > small { font-size: .55rem; }
  .five-card-draw-hand { min-height: 240px; }
  .five-card-draw-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .five-card-draw-showdown-hand { grid-template-columns: 1fr; gap: 6px; }
  .draw-showdown-cards { justify-content: flex-start; }

  .playing-game .blackjack-insurance-prompt {
    position: fixed;
    z-index: 900;
    top: calc(var(--safe-top) + 8px);
    left: 50%;
    width: min(480px, calc(100% - var(--safe-left) - var(--safe-right) - 20px));
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
    overflow-y: auto;
    transform: translateX(-50%);
    box-shadow: 7px 8px 0 rgba(0,0,0,.5), 0 0 0 9999px rgba(1,6,13,.38);
  }

  /* A browser tab's address bar can remove enough visible height to create a
     small, distracting document scroll at the table. Keep the game compact
     on phone-width screens instead of making the player scroll to their hand
     or controls. */
  .playing-game .standard-card-game {
    --game-card-width: clamp(60px, 18vw, 76px);
    gap: 6px;
  }
  .playing-game .game-topbar { min-height: 54px; padding-block: 4px; }
  .playing-game :is(.suit-ladder, .blackjack-rule-bar, .holdem-rule-bar, .five-card-draw-rule-bar) { min-height: 40px; padding-block: 5px; }
  .playing-game .game-opponents { gap: 4px; }
  .playing-game .game-seat { min-height: 60px; }
  .playing-game .game-table { min-height: 140px; padding: 8px; }
  .playing-game .active-pile { min-height: 92px; }
  .playing-game .playing-card.played { flex-basis: 64px; width: 64px; height: 91px; }
  .playing-game .physical-hand,
  .playing-game .blackjack-hand,
  .playing-game .holdem-hand,
  .playing-game .five-card-draw-hand { min-height: 0; padding: 8px 8px 0; }
  .playing-game .game-hand { min-height: 0; }
  .playing-game .game-actions { padding: 5px; }
  .playing-game .game-actions button { min-height: 44px; }
  .playing-game :is(.blackjack-dealer-zone, .holdem-board-zone, .five-card-draw-table-zone) { min-height: 100px; }
  .playing-game :is(.blackjack-dealer-pile, .holdem-board) { min-height: 92px !important; }
  .playing-game :is(.blackjack-dealer-pile, .holdem-board) .playing-card.played { width: 60px; height: 85px; }
}

@media (max-width: 520px) and (min-height: 620px) {
  .home-screen { overflow: hidden; }
  .home-screen .site-shell { height: 100dvh; min-height: 0; grid-template-rows: auto 1fr; }
  .home-screen main { min-height: 0; padding: .45rem 0 max(.45rem, var(--safe-bottom)); overflow: hidden; }
  .home-screen .home-grid { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: .55rem; }
  .home-screen .hero-table { flex: 0 1 clamp(94px, 17dvh, 146px); width: 100%; min-height: 94px; }
  .home-screen .home-copy { min-height: 0; display: flex; flex-direction: column; }
  .home-screen .home-copy h1 { margin-bottom: .4rem; font-size: clamp(2.05rem, 10.5vw, 2.7rem); line-height: .9; }
  .home-screen .home-copy .lede { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .75rem; line-height: 1.3; }
  .home-screen .home-actions { margin-top: .5rem; gap: .35rem; }
  .home-screen .arcade-button { min-height: 45px; padding-block: .32rem; }
  .home-screen .button-icon { width: 34px; height: 34px; }
  .home-screen .button-label { font-size: .82rem; }
  .home-screen .button-copy { display: none; }
}

@media (display-mode: standalone) {
  body { user-select: none; -webkit-user-select: none; }
  input, textarea { user-select: text; -webkit-user-select: text; }
  .install-button { display: none !important; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .standard-card-game {
    --game-card-width: clamp(60px, 18vw, 76px);
    --game-card-height: calc(var(--game-card-width) * 1.42);
  }
}

@media (max-width: 720px) {
  .rummy-route-banner { align-items: flex-start; }
  .rummy-route-circuit { padding-top: 5px; }
  .rummy-pattern-help ul { grid-template-columns: 1fr; gap: 4px; }
  .rummy-link-board-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .rummy-link-board-heading small { text-align: left; }
  .rummy-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .playing-game .rummy-route-banner { min-height: 58px; padding: 7px 9px; gap: 8px; }
  .playing-game .rummy-route-banner h3 { font-size: .82rem; }
  .playing-game .rummy-route-banner p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .61rem; }
  .playing-game .rummy-route-progress { grid-template-columns: repeat(5, 7px); gap: 4px; }
  .playing-game .rummy-route-progress i { width: 7px; height: 7px; }
  .playing-game .rummy-pile-zone { min-height: 92px; gap: 34px; }
  .playing-game .rummy-pile-zone .active-pile { min-height: 92px; min-width: 64px; }
  .playing-game .rummy-pile-zone .active-pile.cards-pile { width: 64px; min-width: 64px; flex-basis: 64px; }
  .playing-game .rummy-stock { width: 64px; height: 91px; border-width: 3px; font-size: .62rem; }
  .playing-game .rummy-stock::before { inset: 6px; }
  .playing-game .rummy-link-group-cards .playing-card.played { flex-basis: 24px; width: 24px; height: 34px; margin-left: -8px; }
  .playing-game .rummy-link-board { padding: 7px; }
  .playing-game .rummy-link-targets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .playing-game .rummy-link-group-card { padding: 5px; }
  .playing-game .rummy-link-group-card > button { min-height: 25px; margin-top: 3px; font-size: .49rem; }
  .playing-game .rummy-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .playing-game .rummy-actions button { min-height: 39px; font-size: .58rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Finders Makers private-memory table ---------- */
.finders-makers-game {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 8px;
}
.finders-scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.finders-player {
  min-width: 0;
  min-height: 52px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  gap: 1px 7px;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 24, 43, .88);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.finders-player.active { border-color: var(--mint); box-shadow: 0 0 18px rgba(84,223,177,.16); transform: translateY(-1px); }
.finders-player.you { background: linear-gradient(125deg, rgba(47,120,110,.22), rgba(8,24,43,.9)); }
.finders-player > span {
  grid-row: 1 / -1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #69829e;
  border-radius: 8px;
  color: #bfe0ff;
  background: #102b4a;
  font: 900 .66rem "Cardcade Pixel", monospace;
}
.finders-player strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 .7rem "Cardcade Pixel", monospace; }
.finders-player b { align-self: center; color: #f7d878; font: 900 1.1rem "Cardcade Pixel", monospace; }
.finders-player small { color: var(--muted); font: 800 .5rem "Cardcade Pixel", monospace; letter-spacing: .08em; }

.finders-build-card {
  min-height: 76px;
  padding: 8px 10px;
  border: 2px solid #557a72;
  border-radius: 13px;
  color: #eaf9f1;
  background: linear-gradient(120deg, rgba(18,78,63,.92), rgba(8,35,46,.94));
  box-shadow: inset 0 0 0 1px rgba(178,255,221,.08), 4px 5px 0 rgba(0,0,0,.25);
}
.finders-build-card.shared { border-color: #efc65a; background: linear-gradient(120deg, rgba(105,75,21,.92), rgba(43,31,10,.95)); }
.finders-build-card.waiting { display: grid; gap: 3px; align-content: center; border-style: dashed; color: #c9d7df; background: rgba(8,25,43,.78); }
.finders-build-card.waiting small { color: var(--muted); font-size: .68rem; }
.finders-build-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; }
.finders-build-heading > span { min-width: 0; }
.finders-build-heading .family-kicker { display: block; color: #a8eacb; font-size: .54rem; }
.finders-build-card.shared .family-kicker { color: #ffe18a; }
.finders-build-heading strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 900 .95rem "Cardcade Pixel", monospace; }
.finders-build-heading > b { flex: 0 0 auto; font-size: 1.65rem; filter: drop-shadow(2px 3px 0 rgba(0,0,0,.3)); }
.finders-piece-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 5px; }
.finders-piece-list > span { min-width: 0; padding: 3px 4px; display: flex; gap: 4px; align-items: center; border: 1px solid rgba(210,255,235,.23); border-radius: 6px; background: rgba(2,15,21,.2); }
.finders-piece-list i { flex: 0 0 auto; font-style: normal; font-size: .9rem; }
.finders-piece-list small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d4eee1; font-size: .57rem; }

.finders-board-zone {
  min-height: 230px;
  padding: 9px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  border: 2px solid var(--table-border);
  border-radius: 16px;
  background:
    linear-gradient(var(--table-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--table-grid) 1px, transparent 1px),
    radial-gradient(circle at 50% 112%, var(--table-green-light), var(--table-green) 55%, var(--table-green-deep));
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow: inset 0 0 42px var(--table-felt-shadow), 5px 5px 0 rgba(0,0,0,.34);
}
.finders-board-status { min-width: 0; display: flex; gap: 9px; align-items: flex-start; justify-content: space-between; }
.finders-board-status > span:first-child { min-width: 0; }
.finders-board-status strong, .finders-board-status small { display: block; overflow-wrap: anywhere; }
.finders-board-status strong { font: 900 .68rem "Cardcade Pixel", monospace; }
.finders-board-status small { margin-top: 3px; color: #bfd4c9; font-size: .62rem; }
.finders-board-status .badge { flex: 0 0 auto; max-width: 42%; white-space: normal; text-align: center; line-height: 1.2; font-size: .55rem; }
.finders-piece-board {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--finders-columns, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--finders-rows, 3), minmax(0, 1fr));
  gap: clamp(5px, 1.2vw, 10px);
  place-items: center;
  container-type: size;
}
.finders-piece-card {
  position: relative;
  z-index: 0;
  width: min(100%, 82px);
  width: min(calc(25cqw - 8px), calc(23.81cqh - 4px), 92px);
  aspect-ratio: 5 / 7;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 2px solid #b8d8e4;
  border-radius: 8px;
  color: #d8f6ff;
  background: #102d50;
  box-shadow: 3px 4px 0 rgba(0,0,0,.34), inset 0 0 0 2px rgba(5,18,37,.32);
  font-family: "Cardcade Pixel", monospace;
  cursor: default;
  touch-action: manipulation;
  perspective: 800px;
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease, filter 130ms ease;
}
.finders-piece-card:not(:disabled) { cursor: pointer; }
.finders-piece-card:not(:disabled):hover { transform: translateY(-3px); border-color: #e6fbff; filter: brightness(1.12); }
.finders-piece-card:not(:disabled):active { transform: translateY(-1px) scale(.98); }
.finders-piece-card.selected { border-color: #ffc95d; box-shadow: 0 0 0 3px rgba(255,201,93,.27), 3px 4px 0 rgba(0,0,0,.34); transform: translateY(-4px); }
.finders-piece-card.attempted { border-color: #ea917e; }
.finders-piece-card-inner { position: absolute; inset: 0; transform-style: preserve-3d; }
.finders-piece-card-face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.finders-piece-card-back {
  background:
    linear-gradient(45deg, rgba(120,205,255,.2) 25%, transparent 25% 75%, rgba(120,205,255,.2) 75%),
    linear-gradient(45deg, rgba(120,205,255,.2) 25%, transparent 25% 75%, rgba(120,205,255,.2) 75%),
    #102d50;
  background-position: 0 0, 5px 5px, 0 0;
  background-size: 10px 10px;
}
.finders-piece-card.selected .finders-piece-card-back { background-color: #164467; }
.finders-piece-card-back > b { font: 900 clamp(1.1rem, 4vw, 2.2rem)/1 "Cardcade Pixel", monospace; text-shadow: 2px 3px 0 rgba(1,8,20,.7); }
.finders-piece-card-front { padding: 7px 4px; align-content: center; gap: 4px; color: #effff7; background: linear-gradient(145deg, #1c765b, #0c3938); transform: rotateY(180deg); text-align: center; box-shadow: inset 0 0 0 2px rgba(221,255,239,.24); }
.finders-piece-card-front > i { font-style: normal; font-size: clamp(1.45rem, 5vw, 2.75rem); line-height: 1; filter: drop-shadow(2px 3px 0 rgba(0,0,0,.28)); }
.finders-piece-card-front > strong { font: 900 clamp(.53rem, 1.7vw, .78rem)/1.05 "Cardcade Pixel", monospace; overflow-wrap: anywhere; }
.finders-piece-card-front > small { color: #bdecd7; font: 800 .42rem "Cardcade Pixel", monospace; letter-spacing: .04em; text-transform: uppercase; }
.finders-piece-board[data-finders-rows="4"] .finders-piece-card { width: min(calc(25cqw - 8px), calc(17.86cqh - 4px), 82px); }
.finders-piece-card.revealing {
  z-index: 20;
  border-color: #8bf2c3;
  box-shadow: 0 0 0 3px rgba(118,255,192,.28), 0 15px 28px rgba(0,0,0,.5), inset 0 0 0 2px rgba(222,255,241,.18);
  animation: findersPieceSearchLift 3.2s cubic-bezier(.16,.72,.18,1) both;
}
.finders-piece-card.revealing .finders-piece-card-inner { animation: findersPieceSearchFlip 3.2s cubic-bezier(.16,.72,.18,1) both; }
.finders-piece-card.revealing.reduced-motion { animation: none !important; }
.finders-piece-card.revealing.reduced-motion .finders-piece-card-inner { animation: none !important; transform: rotateY(180deg); }
.finders-card-index { position: absolute; top: 5px; left: 6px; color: rgba(225,246,255,.84); font: 800 .52rem "Cardcade Pixel", monospace; }
.finders-search-marker, .finders-attempt-marker { position: absolute; right: 4px; bottom: 3px; font-style: normal; font: 900 .7rem/1 "Cardcade Pixel", monospace; }
.finders-search-marker { color: #a3ffdb; text-shadow: 1px 2px 0 #07392b; }
.finders-attempt-marker { color: #ffae9d; text-shadow: 1px 2px 0 #592020; }
.finders-piece-card:focus-visible { outline: 3px solid #d3fbff; outline-offset: 3px; }
.finders-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.finders-actions.idle { grid-template-columns: minmax(170px, 300px); justify-content: center; }
.finders-actions .finders-build-trigger { min-width: min(300px, 100%); letter-spacing: .12em; text-transform: uppercase; }
.finders-result.sudden { border-color: #efc65a; background: linear-gradient(135deg, #3d2a0b, #101d32); }
.finders-result.complete { border-color: #6be4b5; }

.finders-search-confirmation {
  position: fixed;
  z-index: 2100;
  inset: 0;
  padding: max(18px, var(--safe-top)) max(14px, var(--safe-right)) max(18px, var(--safe-bottom)) max(14px, var(--safe-left));
  display: grid;
  place-items: center;
  background: rgba(1,8,16,.58);
  animation: findersSearchConfirmationIn 180ms cubic-bezier(.2,.8,.24,1.12) both;
}
.finders-search-confirmation.reduced-motion { animation: none !important; }
.finders-search-confirmation-panel {
  width: min(350px, 100%);
  padding: 18px;
  display: grid;
  gap: 9px;
  border: 3px solid #83f0c1;
  border-radius: 18px;
  color: #effff7;
  background: linear-gradient(145deg, #143f43, #08262e);
  box-shadow: 8px 10px 0 rgba(0,0,0,.55), inset 0 0 0 1px rgba(212,255,237,.1);
  text-align: center;
}
.finders-search-confirmation-panel .family-kicker { color: #a8f6d1; font-size: .57rem; }
.finders-search-confirmation-panel h3 { margin: 0; font: 900 1.3rem "Cardcade Pixel", monospace; text-transform: uppercase; }
.finders-search-confirmation-panel p { margin: 0; color: #c4e3d8; line-height: 1.4; font-size: .76rem; }
.finders-search-confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.finders-search-confirmation-actions button { min-height: 48px; border: 2px solid #54798d; border-radius: 10px; color: #eaf9f1; background: #102f43; font: 900 .72rem "Cardcade Pixel", monospace; text-transform: uppercase; }
.finders-search-confirmation-actions button.primary { border-color: #80edbd; background: linear-gradient(#278b69, #17624e); }
@keyframes findersSearchConfirmationIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes findersPieceSearchLift {
  0% { transform: translateY(12px) scale(.86) rotate(-5deg); filter: brightness(.86); }
  13% { transform: translateY(-5px) scale(1.05) rotate(2deg); filter: brightness(1.08); }
  28%, 73% { transform: translateY(-12%) scale(1.28) rotate(0deg); filter: brightness(1.12); }
  89% { transform: translateY(-3px) scale(1.04) rotate(-1deg); filter: brightness(1.04); }
  100% { transform: translateY(0) scale(1) rotate(0deg); filter: brightness(1); }
}
@keyframes findersPieceSearchFlip {
  0%, 19% { transform: rotateY(0deg); }
  31%, 72% { transform: rotateY(180deg); }
  86%, 100% { transform: rotateY(360deg); }
}

.finders-build-reveal {
  position: fixed;
  z-index: 2200;
  inset: 0;
  padding: max(18px, var(--safe-top)) max(14px, var(--safe-right)) max(18px, var(--safe-bottom)) max(14px, var(--safe-left));
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: #effff7;
  background: radial-gradient(circle at 50% 44%, rgba(90,226,171,.2), transparent 36%), rgba(1,8,16,.82);
  animation: findersBuildRevealOverlay 6.2s ease both;
  text-align: center;
}
.finders-build-reveal.shared { background: radial-gradient(circle at 50% 44%, rgba(255,201,93,.22), transparent 36%), rgba(18,11,3,.84); }
.finders-build-reveal-card { width: min(330px, 72vw, calc((100dvh - 128px) * 5 / 7)); aspect-ratio: 5 / 7; perspective: 1100px; animation: findersBuildObjectiveDeal 6.2s cubic-bezier(.16,.72,.18,1) both; }
.finders-build-reveal-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: findersBuildObjectiveFlip 6.2s cubic-bezier(.16,.72,.18,1) both; }
.finders-build-reveal-card-face { position: absolute; inset: 0; display: grid; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; border: 4px solid #b9ffdb; border-radius: 20px; box-shadow: 12px 16px 0 rgba(0,0,0,.48), inset 0 0 0 2px rgba(255,255,255,.14); }
.finders-build-reveal-card-back { place-items: center; align-content: center; gap: 14px; color: #d5fff0; background: repeating-linear-gradient(45deg, rgba(152,255,207,.18) 0 7px, transparent 7px 14px), linear-gradient(145deg, #17644f, #082d35); transform: rotateY(0deg); animation: findersBuildBackFace 6.2s step-end both; }
.finders-build-reveal-card-back::before { content: ""; position: absolute; inset: 12px; border: 2px solid rgba(218,255,239,.66); border-radius: 12px; }
.finders-build-reveal-card-front { padding: clamp(17px, 4vw, 26px); align-content: center; justify-items: center; gap: 9px; color: #effff7; background: linear-gradient(145deg, #1b7e60, #0b3740 72%); transform: rotateY(180deg); animation: findersBuildFrontFace 6.2s step-end both; }
.finders-build-reveal.shared .finders-build-reveal-card-face { border-color: #ffdb7b; }
.finders-build-reveal.shared .finders-build-reveal-card-front { background: linear-gradient(145deg, #8b631d, #38240b 72%); }
.finders-build-reveal-card-front .family-kicker { color: #b9f9d8; font-size: .65rem; letter-spacing: .15em; text-transform: uppercase; }
.finders-build-reveal.shared .finders-build-reveal-card-front .family-kicker { color: #ffe59d; }
.finders-build-reveal-card-front > strong { font: 900 clamp(1.35rem, 6vw, 2.2rem)/1 "Cardcade Pixel", monospace; overflow-wrap: anywhere; text-transform: uppercase; }
.finders-build-reveal-card-front > i { font-style: normal; font-size: clamp(3.8rem, 15vw, 5.8rem); line-height: 1; filter: drop-shadow(4px 6px 0 rgba(0,0,0,.25)); }
.finders-build-reveal-card-front > small { color: #c7eee0; font: 900 .57rem "Cardcade Pixel", monospace; letter-spacing: .1em; text-transform: uppercase; }
.finders-build-reveal-card-front > div { width: 100%; display: grid; gap: 6px; }
.finders-build-reveal-card-front > div > span { min-width: 0; padding: 7px 8px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(222,255,241,.35); border-radius: 8px; color: #eafff5; background: rgba(1,20,24,.28); font: 900 .67rem "Cardcade Pixel", monospace; text-align: left; }
.finders-build-reveal-card-front > div i { font-style: normal; font-size: 1.15rem; }
.finders-build-reveal > p { max-width: 360px; margin: 0; color: #d1eee2; font: 800 .72rem/1.45 "Cardcade Pixel", monospace; }
@keyframes findersBuildRevealOverlay { 0% { opacity: 0; } 8%, 94% { opacity: 1; } 100% { opacity: 0; } }
@keyframes findersBuildObjectiveDeal {
  0% { opacity: 0; transform: translateY(22vh) scale(.72) rotate(-9deg); }
  8% { opacity: 1; transform: translateY(0) scale(1.02) rotate(2deg); }
  14%, 94% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-2vh) scale(.97) rotate(0deg); }
}
@keyframes findersBuildObjectiveFlip { 0%, 14% { transform: rotateY(0deg); } 24%, 100% { transform: rotateY(180deg); } }
@keyframes findersBuildBackFace { 0%, 18.99% { opacity: 1; } 19%, 100% { opacity: 0; } }
@keyframes findersBuildFrontFace { 0%, 18.99% { opacity: 0; } 19%, 100% { opacity: 1; } }
.finders-build-reveal.reduced-motion { animation: none !important; }
.finders-build-reveal.reduced-motion .finders-build-reveal-card { animation: none !important; }
.finders-build-reveal.reduced-motion .finders-build-reveal-card-inner { animation: none !important; transform: rotateY(180deg); }
.finders-build-reveal.reduced-motion .finders-build-reveal-card-back { animation: none !important; opacity: 0; }
.finders-build-reveal.reduced-motion .finders-build-reveal-card-front { animation: none !important; opacity: 1; }

@media (min-width: 900px) {
  .playing-game .finders-makers-game {
    height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
    min-height: 0;
    grid-template-rows: 56px 54px 78px minmax(0, 1fr) 54px;
    overflow: hidden;
  }
  .finders-makers-game > :is(.game-topbar, .finders-scoreboard, .finders-build-card, .finders-board-zone, .game-actions) { min-height: 0; }
  .finders-makers-game .game-topbar { min-height: 0; padding: 3px 6px; }
  .finders-makers-game .game-topbar h2 { font-size: 1.18rem; }
  .finders-makers-game .game-topbar p { font-size: .64rem; }
  .finders-makers-game .game-score { min-height: 40px; min-width: 62px; }
  .finders-build-card { min-height: 0; padding: 6px 10px; }
  .finders-build-heading > b { font-size: 1.35rem; }
  .finders-board-zone { min-height: 0; }
  .finders-piece-board { gap: clamp(6px, .8vw, 10px); }
  .finders-actions { position: static; bottom: auto; min-height: 0; padding: 4px; border-radius: 10px; }
  .finders-actions button { min-height: 40px; font-size: .66rem; }
}

@media (max-width: 820px) {
  .finders-makers-game { gap: 6px; }
  .finders-player { min-height: 48px; padding: 5px 6px; }
  .finders-build-card { padding: 7px 8px; }
  .finders-board-zone { min-height: 270px; padding: 7px; }
  .finders-piece-board { gap: 5px; }
  .finders-piece-card { border-radius: 6px; }
}

@media (max-width: 430px) {
  .finders-build-heading strong { font-size: .8rem; }
  .finders-piece-list { gap: 3px; }
  .finders-piece-list > span { padding: 2px 3px; }
  .finders-piece-list i { font-size: .76rem; }
  .finders-piece-list small { font-size: .48rem; }
  .finders-board-status strong { font-size: .6rem; }
  .finders-board-status small { font-size: .54rem; }
  .finders-board-zone { min-height: 244px; }
  .finders-search-confirmation-panel { padding: 15px; }
}

@media (max-width: 520px) {
  .playing-game .finders-makers-game {
    height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
    min-height: 0;
    grid-template-rows: 54px 48px 70px minmax(0, 1fr) 48px;
    overflow: hidden;
  }
  .finders-makers-game > :is(.game-topbar, .finders-scoreboard, .finders-build-card, .finders-board-zone, .game-actions) { min-height: 0; }
  .finders-makers-game .game-topbar { min-height: 0; padding: 3px 4px; }
  .finders-makers-game .game-topbar h2 { font-size: 1rem; }
  .finders-makers-game .game-topbar p { font-size: .58rem; }
  .finders-makers-game .game-score { min-height: 38px; }
  .finders-player { min-height: 0; }
  .finders-build-card { min-height: 0; padding: 5px 7px; }
  .finders-build-heading > b { font-size: 1.1rem; }
  .finders-piece-list { margin-top: 3px; }
  .finders-board-zone { min-height: 0; }
  .finders-board-status { gap: 5px; }
  .finders-board-status small { display: none; }
  .finders-piece-board { gap: 4px; }
  .finders-actions { position: static; bottom: auto; min-height: 0; padding: 4px; border-radius: 9px; }
  .finders-actions button { min-height: 38px; font-size: .62rem; }
}

/* These overrides sit after the shared pile rules so Snap's comparison cards
   stay in normal grid flow instead of taking the absolute pile position. */
.snap-game .snap-center-board .playing-card {
  position: relative;
  inset: auto;
  translate: none;
  transform: none;
  margin: 0;
}

.snap-game .snap-hidden-source .card-back { position: relative; }

@media (max-width: 760px) {
  .snap-game .snap-center-board .snap-compare-card .playing-card,
  .snap-game .snap-center-board .snap-empty-card {
    width: clamp(88px, 27vw, 128px);
    height: clamp(125px, 38.3vw, 182px);
  }
}

/* ---------- Cardcade game-first shell ---------- */
:root {
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Cardcade Pixel", "Courier New", monospace;
  --shell-rail: rgba(126, 168, 208, .26);
  --shell-rail-bright: rgba(151, 205, 247, .62);
  --shell-shadow: rgba(0, 0, 0, .48);
}

.room-code,
.room-code-input,
.resume-table-strip > strong {
  font-family: var(--font-ui) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.game-shell-flow {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 118%, rgba(32, 103, 112, .24), transparent 42rem),
    radial-gradient(circle at 86% 14%, rgba(99, 55, 113, .14), transparent 34rem),
    #030b17;
}

.game-shell-flow .site-shell {
  width: 100%;
  min-height: 100dvh;
  padding: 0;
  grid-template-rows: minmax(0, 1fr);
}

.game-shell-flow .topbar {
  position: fixed;
  z-index: 90;
  top: 0;
  right: max(14px, var(--safe-right));
  width: auto;
  min-height: calc(54px + var(--safe-top));
  padding-top: var(--safe-top);
  border: 0;
  background: transparent;
}

.game-shell-flow .topbar .brand { display: none; }
.game-shell-flow .site-shell > footer { display: none; }
.game-shell-flow main { min-height: 100dvh; padding: 0; }

.game-shell-screen {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100dvh;
  padding: max(22px, calc(var(--safe-top) + 16px)) max(22px, calc(var(--safe-right) + 22px)) max(28px, calc(var(--safe-bottom) + 22px)) max(22px, calc(var(--safe-left) + 22px));
  overflow: clip;
}

.game-shell-screen::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(rgba(94, 146, 190, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 146, 190, .035) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 100%, rgba(26, 100, 94, .18), transparent 58%);
  background-size: 6px 6px, 6px 6px, auto;
  mask-image: linear-gradient(to bottom, transparent, #000 16%, #000);
  pointer-events: none;
}

#app.shell-transition-forward { animation: shellEnterForward 220ms cubic-bezier(.2, .78, .2, 1); }
#app.shell-transition-back { animation: shellEnterBack 190ms cubic-bezier(.2, .78, .2, 1); }
@keyframes shellEnterForward {
  from { opacity: .22; transform: translateY(16px) scale(.985); filter: blur(1.5px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes shellEnterBack {
  from { opacity: .3; transform: translateY(-10px) scale(1.012); filter: blur(1px); }
  to { opacity: 1; transform: none; filter: none; }
}

.game-shell-nav {
  position: relative;
  z-index: 12;
  width: min(1180px, 100%);
  min-height: 48px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.game-shell-nav .back-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--shell-rail);
  border-radius: 50%;
  background: rgba(4, 13, 26, .52);
  box-shadow: none;
}
.game-shell-nav > span {
  color: rgba(190, 216, 235, .62);
  font: 800 .62rem var(--font-display);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.shell-kicker {
  margin: 0;
  color: #77c7ff;
  font: 800 .65rem var(--font-display);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.controller-hint {
  margin: 0;
  color: rgba(177, 204, 225, .42);
  font: 800 .54rem var(--font-display);
  letter-spacing: .12em;
  text-align: center;
}

/* Title screen */
.title-screen {
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  padding-top: max(44px, calc(var(--safe-top) + 30px));
}
.title-lockup { text-align: center; }
.title-lockup h1 {
  max-width: none;
  margin: 0;
  color: #f7f1df;
  font: 900 clamp(4.1rem, 12vw, 8.8rem)/.72 var(--font-display);
  letter-spacing: -.075em;
  text-transform: uppercase;
  text-shadow: 7px 9px 0 rgba(0, 0, 0, .58);
}
.title-lockup h1 span:last-child { color: #ff6869; }
.main-menu {
  width: min(360px, 88vw);
  margin: clamp(22px, 5vh, 42px) 0 20px;
  display: grid;
  gap: 2px;
}
.main-menu-option {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 5px 18px;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  border: 0;
  color: rgba(233, 241, 247, .62);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 110ms ease, transform 110ms ease, background 110ms ease;
}
.main-menu-option > span { opacity: 0; color: #ff7370; font: 900 1.45rem var(--font-display); transform: translateX(-7px); transition: opacity 110ms ease, transform 110ms ease; }
.main-menu-option strong { font: 900 clamp(1.18rem, 3vw, 1.55rem) var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.main-menu-option:is(:hover, :focus-visible, .controller-hover, .controller-focus) {
  outline: 0;
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 91, 92, .16), transparent 82%);
  box-shadow: inset 3px 0 0 #ff6869;
  transform: translateX(6px);
}
.main-menu-option:is(:hover, :focus-visible, .controller-hover, .controller-focus) > span { opacity: 1; transform: translateX(0); }

/* Shared deck/game object */
.game-object {
  --object-face: #7d1f2e;
  --object-deep: #3f0b18;
  --object-line: #efc45c;
  --object-ink: #f7d56f;
  position: relative;
  width: clamp(132px, 18vw, 198px);
  aspect-ratio: 5 / 6.9;
  margin-inline: auto;
  perspective: 700px;
}
.game-object[data-family="color-action"] { --object-face: #234d8b; --object-deep: #131f51; --object-line: #f0c95b; --object-ink: #fff8e4; }
.game-object[data-family="rotating-rummy"] { --object-face: #111921; --object-deep: #05090d; --object-line: #d8bd50; --object-ink: #6ce7ff; }
.game-object[data-family="finders-makers"] { --object-face: #145744; --object-deep: #062920; --object-line: #d4b857; --object-ink: #e9fff4; }
.game-object-shadow { position: absolute; left: 12%; right: 2%; bottom: -8%; height: 14%; border-radius: 50%; background: rgba(0,0,0,.5); filter: blur(11px); }
.game-object-deck,
.game-object-card { position: absolute; display: grid; place-items: center; border-radius: 10px; }
.game-object-deck {
  z-index: 2;
  inset: 2% 9% 5% 7%;
  padding: 12px;
  grid-template-rows: auto 1fr auto;
  border: 4px solid var(--object-line);
  color: var(--object-ink);
  background:
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(255,255,255,.055) 11px 14px),
    var(--object-face);
  box-shadow: inset 0 0 0 5px var(--object-deep), 8px 11px 0 rgba(0,0,0,.44);
  transform: rotateY(-5deg) rotateZ(-2deg);
}
.game-object-deck::before { content: ""; position: absolute; inset: 13px; border: 2px solid color-mix(in srgb, var(--object-line) 68%, transparent); border-radius: 5px; }
.game-object-deck small,
.game-object-deck b { position: relative; z-index: 1; font: 900 .5rem var(--font-display); letter-spacing: .11em; text-transform: uppercase; }
.game-object-deck i { position: relative; z-index: 1; font: normal 900 clamp(3.2rem, 7vw, 5.4rem)/1 var(--font-display); text-shadow: 4px 5px 0 rgba(0,0,0,.38); }
.game-object-card {
  z-index: 1;
  inset: 9% 1% 0 20%;
  border: 3px solid rgba(235, 225, 205, .8);
  color: var(--object-ink);
  background: var(--object-deep);
  box-shadow: 5px 7px 0 rgba(0,0,0,.32);
  transform: rotate(9deg);
}
.game-object-card i { font: normal 900 1.6rem var(--font-display); opacity: .55; }
.game-object.compact { width: 88px; }
.game-object.compact .game-object-deck { padding: 7px; border-width: 3px; box-shadow: inset 0 0 0 3px var(--object-deep), 5px 7px 0 rgba(0,0,0,.38); }
.game-object.compact .game-object-deck::before { inset: 8px; border-width: 1px; }
.game-object.compact .game-object-deck small { font-size: .34rem; }
.game-object.compact .game-object-deck b { display: none; }
.game-object.compact .game-object-deck i { font-size: 2.2rem; }

/* Shared shell controls */
.game-primary-action,
.game-ready-action,
.game-secondary-action,
.game-tertiary-action {
  min-height: 52px;
  padding: 10px 18px;
  border: 0;
  color: var(--ink);
  font: 900 .76rem var(--font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.game-primary-action {
  min-height: 60px;
  border: 2px solid #ff9690;
  border-radius: 10px;
  background: linear-gradient(180deg, #e45259, #9f243b);
  box-shadow: inset 0 -5px 0 rgba(70,10,29,.42), 5px 6px 0 rgba(0,0,0,.38);
}
.game-primary-action:is(:hover, :focus-visible, .controller-hover) { filter: brightness(1.1); transform: translateY(-1px); }
.game-ready-action { border: 1px solid var(--shell-rail-bright); border-radius: 9px; background: rgba(13, 40, 65, .84); }
.game-ready-action.ready { border-color: #77e6bc; color: #baffdf; background: rgba(29, 98, 77, .48); }
.game-secondary-action { border: 0; border-bottom: 1px solid rgba(128, 174, 210, .48); background: transparent; color: #b8cce0; }
.game-secondary-action:is(:hover, :focus-visible, .controller-hover) { color: #fff; border-color: #82d2ff; background: rgba(72, 151, 213, .08); }
.game-tertiary-action { min-height: 44px; color: #8e9eb1; background: transparent; text-decoration: underline; text-underline-offset: 5px; }
.game-primary-action:disabled,
.game-ready-action:disabled,
.game-secondary-action:disabled { opacity: .34; cursor: not-allowed; filter: grayscale(.35); transform: none; }
.game-shell-action-dock { display: flex; align-items: center; justify-content: center; gap: 14px; }
.game-shell-action-dock .game-primary-action { min-width: min(300px, 52vw); }

.configuration-selector {
  min-width: 0;
  min-height: 68px;
  padding: 9px 4px 9px 12px;
  display: grid;
  grid-template-columns: minmax(112px, .7fr) minmax(180px, 1.3fr);
  align-items: center;
  gap: 14px;
  border-block: 1px solid var(--shell-rail);
  background: linear-gradient(90deg, rgba(30, 70, 105, .08), transparent);
}
.configuration-selector + .configuration-selector { border-top: 0; }
.configuration-selector label,
.configuration-label { color: #a9bed2; font: 800 .66rem var(--font-display); letter-spacing: .09em; text-transform: uppercase; }
.configuration-selector input {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid rgba(112, 159, 199, .55);
  border-radius: 7px;
  color: #fff;
  background: rgba(3, 13, 26, .72);
  font-family: var(--font-ui);
}
.game-stepper {
  width: 100%;
  margin: 0;
  grid-template-columns: 48px minmax(80px, 1fr) 48px;
  gap: 6px;
}
.game-stepper button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(121, 171, 211, .55);
  border-radius: 50%;
  color: #e6f5ff;
  background: rgba(13, 42, 69, .82);
  font: 900 1.4rem var(--font-display);
}
.game-stepper button:disabled { opacity: .3; cursor: not-allowed; }
.game-stepper output { display: flex; align-items: baseline; justify-content: center; gap: 7px; font-family: var(--font-display); }
.game-stepper output strong { color: #fff; font-size: 1.55rem; }
.game-stepper output span { color: #9fb4c8; font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; }
.game-stepper.compact { grid-template-columns: 38px minmax(62px, 1fr) 38px; }
.game-stepper.compact button { width: 38px; height: 38px; }
.setup-note { margin: 12px 0 0; color: #90a4b8; font-size: .72rem; line-height: 1.45; text-align: center; }

/* Pre-game table setup */
.pregame-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.pregame-layout {
  width: min(980px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(390px, 1.15fr);
  gap: clamp(34px, 7vw, 86px);
  align-items: center;
}
.pregame-game-identity { min-width: 0; text-align: center; }
.pregame-game-identity .game-object { margin-bottom: 22px; }
.pregame-game-identity h1 {
  max-width: 100%;
  margin: 7px 0 8px;
  font: 900 clamp(2.1rem, 5vw, 4.2rem)/.9 var(--font-display);
  letter-spacing: -.04em;
  text-transform: uppercase;
  text-wrap: balance;
}
.game-player-range { color: #91a6bb; font-size: .72rem; }
.table-setup-console { min-width: 0; padding: 12px 0; }
.player-seat-config-grid { margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.player-name-slot { min-width: 0; padding: 8px; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; align-items: center; border-bottom: 1px solid var(--shell-rail); background: rgba(7, 23, 40, .48); }
.player-name-slot > span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #4b769d; border-radius: 50%; color: #91d2ff; font: 900 .7rem var(--font-display); }
.player-name-slot .field { min-width: 0; margin: 0; gap: 4px; }
.player-name-slot .field label { font-size: .58rem; }
.player-name-slot .field input { min-width: 0; min-height: 42px; padding: 6px 8px; font-family: var(--font-ui); }
.pregame-actions { width: min(760px, 100%); margin: 16px auto 0; }

/* Layered command menus: choose first, configure one level deeper. */
.layered-menu-screen { overflow: hidden; }
.menu-depth-background {
  position: relative;
  min-height: calc(100dvh - max(44px, calc(var(--safe-top) + 32px)) - max(56px, calc(var(--safe-bottom) + 28px)));
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  transition: opacity 170ms ease, transform 210ms cubic-bezier(.2,.78,.2,1), filter 170ms ease;
  transform-origin: 50% 46%;
}
.menu-depth-background > .game-shell-nav { position: absolute; inset: 0 0 auto; }
.panel-open .menu-depth-background {
  opacity: .16;
  filter: blur(3px);
  transform: scale(.9) translateY(1.5%);
  pointer-events: none;
  user-select: none;
}
.game-menu-title-block { margin: 0 auto clamp(20px, 5vh, 42px); }
.game-menu-title-block h1 {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
}
.game-command-menu {
  width: min(360px, 88vw);
  margin: 0 auto;
  display: grid;
  gap: 2px;
  align-self: start;
}
.game-command-option {
  width: 100%;
  min-height: 62px;
  padding: 6px 18px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0;
  row-gap: 2px;
  border: 0;
  color: rgba(222, 235, 245, .62);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 110ms ease, transform 110ms ease, background 110ms ease;
}
.game-command-option > span:first-child {
  grid-row: 1 / 3;
  color: #ff7471;
  opacity: 0;
  font: 900 1.3rem var(--font-display);
  transform: translateX(-7px);
  transition: opacity 110ms ease, transform 110ms ease;
}
.game-command-option strong { font: 900 clamp(1.18rem, 3vw, 1.55rem) var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.game-command-option small { color: #8299ae; font: .64rem var(--font-ui); letter-spacing: .03em; text-align: left; }
.game-command-option:is(:hover, :focus-visible, .controller-hover, .controller-focus) {
  outline: 0;
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 91, 92, .15), transparent 84%);
  box-shadow: inset 3px 0 0 #ff6869;
  transform: translateX(6px);
}
.game-command-option:is(:hover, :focus-visible, .controller-hover, .controller-focus) > span:first-child { opacity: 1; transform: none; }
.game-command-option.unavailable { color: #56697b; cursor: default; }
.game-command-option.unavailable strong,
.game-command-option.unavailable small { color: inherit; }
.room-code-menu-value { color: #d8e7f2 !important; font-family: var(--font-ui) !important; font-weight: 800 !important; letter-spacing: .14em !important; }
.ghost-shell-nav { color: rgba(190,216,235,.62); }
.ghost-shell-nav > span:first-child { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--shell-rail); border-radius: 50%; }

.menu-layer {
  position: absolute;
  z-index: 30;
  inset: max(54px, calc(var(--safe-top) + 38px)) max(20px, calc(var(--safe-right) + 20px)) max(24px, calc(var(--safe-bottom) + 20px)) max(20px, calc(var(--safe-left) + 20px));
  width: min(680px, calc(100% - 40px));
  height: fit-content;
  max-height: calc(100dvh - max(86px, calc(var(--safe-top) + var(--safe-bottom) + 62px)));
  margin: auto;
  padding: clamp(20px, 4vw, 38px);
  overflow: auto;
  border-block: 1px solid rgba(123, 177, 218, .48);
  color: var(--ink);
  background:
    linear-gradient(rgba(79, 132, 174, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 132, 174, .025) 1px, transparent 1px),
    #050f1e;
  background-size: 5px 5px, 5px 5px, auto;
  box-shadow: 0 34px 90px rgba(0,0,0,.64), inset 0 1px rgba(255,255,255,.025);
  animation: menuLayerEnter 210ms cubic-bezier(.2,.78,.2,1);
}
@keyframes menuLayerEnter {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.layer-screen-head { min-height: 44px; margin: 0 0 18px; display: flex; align-items: center; gap: 12px; }
.layer-screen-head .back-button { width: 42px; height: 42px; border: 1px solid var(--shell-rail); border-radius: 50%; background: rgba(10,31,52,.7); box-shadow: none; }
.layer-screen-head > span { color: #8299ae; font: 800 .55rem var(--font-display); letter-spacing: .11em; text-transform: uppercase; }
.layer-title-block { margin: 0 auto clamp(26px, 5vh, 42px); text-align: center; }
.layer-title-block h2 { max-width: none; margin: 7px 0 0; font: 900 clamp(2rem, 7vw, 4.3rem)/.88 var(--font-display); letter-spacing: -.035em; text-transform: uppercase; }
.menu-entry-form { width: min(540px, 100%); margin: 0 auto; display: grid; gap: 18px; }
.menu-entry-row {
  min-height: 62px;
  padding: 8px 4px 8px 12px;
  display: grid;
  grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 14px;
  border-block: 1px solid var(--shell-rail);
  background: linear-gradient(90deg, rgba(24, 62, 93, .12), transparent);
}
.menu-entry-row + .menu-entry-row { border-top: 0; }
.menu-entry-row label { color: #9db3c7; font: 800 .61rem var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.menu-entry-row input {
  width: 100%;
  min-height: 48px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 2px solid #567895;
  border-radius: 0;
  color: #fff;
  background: rgba(2, 10, 20, .52);
  font-family: var(--font-ui);
}
.menu-entry-row input:focus { outline: 2px solid #80d0ff; outline-offset: 2px; border-color: transparent; }
.menu-entry-form .game-primary-action { width: min(310px, 100%); margin: 8px auto 0; }
.room-code-entry input { text-transform: uppercase; letter-spacing: .17em; }

@media (max-width: 720px) {
  .game-menu-title-block { margin: 0 auto 20px; }
  .game-command-menu { width: min(310px, 92vw); }
  .game-command-option { min-height: 55px; padding: 5px 14px; }
  .game-command-option strong { font-size: 1.02rem; }
  .game-command-option small { font-size: .58rem; }
  .menu-layer { inset: max(44px, var(--safe-top)) max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left)); width: calc(100% - 16px); max-height: calc(100dvh - max(16px, calc(var(--safe-top) + var(--safe-bottom)))); padding: 14px; }
  .layer-screen-head { margin-bottom: 10px; }
  .layer-title-block { margin-bottom: 22px; }
  .menu-entry-row { grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
}

@media (max-width: 430px) {
  .game-command-option { grid-template-columns: 20px minmax(0, 1fr); }
  .menu-entry-row { padding-left: 6px; grid-template-columns: 1fr; gap: 4px; }
  .menu-entry-row input { min-height: 45px; }
}

/* Appearance loadout: one category and one physical preview at a time. */
.appearance-menu-layer {
  width: min(1040px, calc(100% - 40px));
  height: min(760px, calc(100dvh - max(58px, calc(var(--safe-top) + var(--safe-bottom) + 36px))));
  max-height: calc(100dvh - max(58px, calc(var(--safe-top) + var(--safe-bottom) + 36px)));
  padding: clamp(18px, 3vw, 28px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 0;
  background: radial-gradient(circle at 66% 46%, rgba(8, 31, 46, .98), rgba(5, 15, 30, .91) 56%, rgba(5, 15, 30, .68) 78%, transparent 100%);
  box-shadow: none;
}
.appearance-layer-title { margin-bottom: clamp(10px, 2vh, 18px); }
.appearance-layer-title h2 { font-size: clamp(2.2rem, 5.5vw, 4rem); }
.appearance-layer-title small { display: block; margin-top: 8px; color: #8199ad; font: .66rem var(--font-ui); }
.appearance-layer-title small > span { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #6fdbaf; box-shadow: 0 0 9px rgba(111,219,175,.5); }
.appearance-console { min-height: 0; width: 100%; margin: 0; padding: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.appearance-loadout-layout { min-height: 0; display: grid; grid-template-columns: minmax(190px, .55fr) minmax(0, 1.45fr); gap: clamp(22px, 5vw, 64px); align-items: stretch; }
.appearance-category-menu { min-height: 0; padding-block: 6px; display: grid; align-content: center; }
.appearance-category-option {
  min-height: 58px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: center;
  border: 0;
  border-left: 2px solid transparent;
  color: #74899c;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.appearance-category-option > span { grid-row: 1 / 3; color: #59758e; font: 900 .82rem var(--font-display); text-align: center; }
.appearance-category-option strong { font: 900 .66rem var(--font-display); letter-spacing: .055em; text-transform: uppercase; }
.appearance-category-option small { color: #60778c; font: .6rem var(--font-ui); }
.appearance-category-option:is(.active, :hover, :focus-visible, .controller-hover, .controller-focus) {
  outline: 0;
  border-color: #ff706e;
  color: #fff;
  background: linear-gradient(90deg, rgba(255,91,92,.14), transparent 88%);
}
.appearance-category-option:is(.active, :hover, :focus-visible, .controller-hover, .controller-focus) > span { color: #ff7b78; }
.appearance-category-option:is(.active, :hover, :focus-visible, .controller-hover, .controller-focus) small { color: #91a8bc; }
.appearance-choice-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(190px, 1fr) auto auto; place-items: center; align-content: center; text-align: center; }
.appearance-stage-kicker { margin: 0; color: #77c7ff; font: 800 .55rem var(--font-display); letter-spacing: .13em; text-transform: uppercase; }
.appearance-choice-stage > h3 { max-width: none; margin: 5px 0 0; font: 900 clamp(1.35rem, 3vw, 2.2rem)/.9 var(--font-display); text-transform: uppercase; }
.appearance-object-stage {
  position: relative;
  isolation: isolate;
  width: min(520px, 100%);
  min-height: 230px;
  display: grid;
  place-items: center;
  animation: appearanceObjectEnter 170ms ease-out;
}
.appearance-object-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 12%;
  width: 82%;
  height: 44%;
  border-bottom: 1px solid rgba(100, 185, 166, .24);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(32,109,94,.18), transparent 68%);
  transform: translateX(-50%) perspective(420px) rotateX(62deg);
}
@keyframes appearanceObjectEnter {
  from { opacity: .25; transform: translateX(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.appearance-object-stage .table-skin-preview { width: min(480px, 92%); min-height: 210px; border-radius: 48%; box-shadow: inset 0 0 42px var(--table-felt-shadow), 10px 14px 0 rgba(0,0,0,.26); }
.appearance-object-stage .table-skin-preview::before { inset: 16px; }
.appearance-object-stage .skin-preview {
  width: min(390px, 90%);
  min-height: 210px;
  padding: 18px;
  gap: 16px;
  overflow: visible;
  border: 0;
  background: transparent;
}
.appearance-object-stage .skin-preview-card { width: 88px; height: 126px; border-width: 4px; border-radius: 9px; box-shadow: 8px 10px 0 rgba(0,0,0,.4); }
.appearance-object-stage .skin-preview-card:nth-child(1) { transform: translateY(5px) rotate(-8deg); }
.appearance-object-stage .skin-preview-card:nth-child(2) { transform: translateY(-5px) rotate(1deg); }
.appearance-object-stage .skin-preview-card:nth-child(3) { transform: translateY(5px) rotate(8deg); }
.appearance-legacy-preview,
.appearance-modern-preview { width: 100%; min-height: 190px; display: grid; place-items: center; }
.appearance-object-stage .legacy-mode-preview { margin: 0; gap: 12px; transform: scale(2.55); }
.appearance-choice-selector { width: min(430px, 100%); display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; gap: 9px; }
.appearance-choice-selector button { width: 52px; height: 52px; border: 1px solid rgba(118,174,215,.5); border-radius: 50%; color: #e9f6ff; background: rgba(12,39,64,.82); font: 900 1.7rem var(--font-display); cursor: pointer; }
.appearance-choice-selector button:is(:hover, :focus-visible, .controller-hover, .controller-focus) { outline: 2px solid #81d5ff; outline-offset: 3px; color: #fff; background: #16466e; }
.appearance-choice-selector output { min-width: 0; display: grid; gap: 5px; }
.appearance-choice-selector output strong { overflow: hidden; color: #fff; font: 900 clamp(.78rem, 2vw, 1rem) var(--font-display); letter-spacing: .05em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.appearance-choice-selector output small { color: #7790a5; font: .61rem var(--font-ui); }
.appearance-choice-description { max-width: 520px; min-height: 2.7em; margin: 14px 0 0; color: #8da4b8; font: .69rem/1.55 var(--font-ui); text-wrap: balance; }
.appearance-command-bar { min-height: 64px; padding-top: 10px; display: grid; grid-template-columns: 1fr minmax(220px, 300px) 1fr; align-items: center; gap: 14px; }
.appearance-command-bar > span { color: #667f94; font: 800 .49rem var(--font-display); letter-spacing: .08em; }
.appearance-command-bar .game-primary-action { grid-column: 2; width: 100%; }
.appearance-command-bar::after { content: ""; }

@media (max-width: 720px) {
  .appearance-menu-layer { width: calc(100% - 16px); height: calc(100dvh - max(16px, calc(var(--safe-top) + var(--safe-bottom)))); max-height: calc(100dvh - max(16px, calc(var(--safe-top) + var(--safe-bottom)))); }
  .appearance-layer-title { margin-bottom: 8px; }
  .appearance-layer-title h2 { font-size: clamp(1.8rem, 10vw, 2.8rem); }
  .appearance-loadout-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 8px; }
  .appearance-category-menu { padding: 0 0 6px; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; align-content: stretch; overflow: visible; }
  .appearance-category-option { min-width: 0; min-height: 54px; padding: 4px 2px; grid-template-columns: 1fr; grid-template-rows: 18px auto; place-items: center; align-content: center; border-left: 0; border-bottom: 2px solid transparent; text-align: center; }
  .appearance-category-option > span { grid-row: 1; }
  .appearance-category-option strong { grid-row: 2; font-size: clamp(.46rem, 1.7vw, .54rem); line-height: 1.15; overflow-wrap: anywhere; }
  .appearance-category-option small { display: none; }
  .appearance-choice-stage { grid-template-rows: auto auto minmax(150px, 1fr) auto auto; }
  .appearance-object-stage { min-height: 165px; }
  .appearance-object-stage .table-skin-preview { min-height: 145px; }
  .appearance-object-stage .skin-preview { min-height: 155px; padding: 9px; gap: 9px; }
  .appearance-object-stage .skin-preview-card { width: 62px; height: 89px; border-width: 3px; }
  .appearance-object-stage .legacy-mode-preview { transform: scale(1.85); }
  .appearance-choice-selector { grid-template-columns: 46px minmax(0, 1fr) 46px; }
  .appearance-choice-selector button { width: 46px; height: 46px; }
  .appearance-choice-description { min-height: 2.4em; margin-top: 8px; font-size: .63rem; }
  .appearance-command-bar { min-height: 58px; padding-top: 7px; grid-template-columns: 1fr; }
  .appearance-command-bar > span,
  .appearance-command-bar::after { display: none; }
  .appearance-command-bar .game-primary-action { grid-column: 1; width: min(300px, 100%); margin: 0 auto; min-height: 52px; }
}

@media (max-width: 430px) {
  .appearance-layer-title small { display: none; }
  .appearance-category-option { min-height: 50px; grid-template-rows: 16px auto; }
}

@media (orientation: landscape) and (max-height: 660px) {
  .appearance-menu-layer { height: calc(100dvh - max(16px, calc(var(--safe-top) + var(--safe-bottom)))); max-height: calc(100dvh - max(16px, calc(var(--safe-top) + var(--safe-bottom)))); }
  .appearance-menu-layer .layer-screen-head { margin-bottom: 2px; }
  .appearance-layer-title { margin-bottom: 5px; }
  .appearance-layer-title .shell-kicker,
  .appearance-layer-title small { display: none; }
  .appearance-layer-title h2 { font-size: 1.8rem; }
  .appearance-choice-stage { grid-template-rows: auto auto minmax(120px, 1fr) auto auto; }
  .appearance-object-stage { min-height: 130px; }
  .appearance-object-stage .table-skin-preview { min-height: 120px; }
  .appearance-object-stage .skin-preview { min-height: 125px; }
  .appearance-object-stage .skin-preview-card { width: 55px; height: 79px; }
  .appearance-choice-description { margin-top: 5px; min-height: 1.5em; }
  .appearance-command-bar { min-height: 50px; }
  .appearance-command-bar .game-primary-action { min-height: 46px; }
}

/* Multiplayer table lobby */
.room-lobby-screen { min-height: 100dvh; padding-bottom: max(18px, calc(var(--safe-bottom) + 12px)); }
.lobby-seat-ring {
  width: min(1160px, 100%);
  min-height: 620px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(330px, 520px) minmax(190px, 1fr);
  grid-template-rows: minmax(110px, 1fr) minmax(300px, 2fr) minmax(110px, 1fr);
  gap: 10px 20px;
  align-items: center;
}
.lobby-table-core {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 2;
  min-height: 330px;
  padding: 28px clamp(24px, 4vw, 46px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 2px solid #2b6858;
  border-radius: 88px;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 92%, #165441, #0d382f 60%, #071f1d);
  background-size: 5px 5px, 5px 5px, auto;
  box-shadow: inset 0 0 58px rgba(0,0,0,.34), 10px 13px 0 rgba(0,0,0,.3);
  text-align: center;
}
.lobby-table-core::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(176, 235, 209, .22); border-radius: 74px; pointer-events: none; }
.lobby-room-code { position: relative; z-index: 1; display: grid; justify-items: center; }
.lobby-room-code > span { color: #a8c9bd; font: 800 .55rem var(--font-display); letter-spacing: .15em; text-transform: uppercase; }
.lobby-room-code .room-code { margin: 2px 0 4px; color: #fff; font-size: clamp(1.75rem, 4vw, 2.9rem); letter-spacing: .16em; line-height: 1; text-shadow: 3px 4px 0 rgba(0,0,0,.28); }
.room-code-actions { display: flex; justify-content: center; gap: 8px; }
.room-code-actions button { min-height: 32px; padding: 4px 10px; border: 0; border-bottom: 1px solid rgba(178, 226, 210, .38); color: #bed6cd; background: transparent; font: 800 .58rem var(--font-display); text-transform: uppercase; }
.lobby-game-selection { position: relative; z-index: 1; min-width: 0; display: grid; justify-items: center; gap: 3px; }
.lobby-game-selection .game-object { margin-block: 0 4px; }
.lobby-game-selection > .lobby-game-family { color: #a9c4ba; font: 800 .5rem var(--font-display); letter-spacing: .1em; text-transform: uppercase; }
.lobby-game-selection > strong { max-width: 260px; font: 900 1.05rem var(--font-display); text-transform: uppercase; text-wrap: balance; }
.lobby-game-selection > small { color: #abc0b8; font-size: .66rem; }
.lobby-game-selection .game-secondary-action { min-height: 34px; margin-top: 5px; padding: 4px 10px; font-size: .56rem; }
.empty-deck { width: 72px; aspect-ratio: 5 / 7; display: grid; place-items: center; border: 2px dashed rgba(198, 222, 212, .38); border-radius: 9px; color: rgba(218, 237, 229, .44); font: 900 1.8rem var(--font-display); transform: rotate(-3deg); }
.lobby-bot-selector { z-index: 1; width: min(270px, 100%); min-height: 46px; padding: 4px; grid-template-columns: 88px 1fr; border-color: rgba(175, 220, 204, .22); background: rgba(2, 18, 15, .18); }
.lobby-capacity { position: relative; z-index: 1; color: #9ab5ab; font-size: .62rem; }

.lobby-seat {
  position: relative;
  min-width: 0;
  width: min(100%, 260px);
  min-height: 74px;
  padding: 8px 24px 8px 8px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 0;
  border-bottom: 2px solid rgba(92, 130, 163, .38);
  color: #d7e4ef;
  background: linear-gradient(90deg, rgba(13, 35, 58, .74), rgba(6, 19, 34, .18));
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.lobby-seat[data-lobby-slot="0"] { grid-column: 1; grid-row: 1; justify-self: end; }
.lobby-seat[data-lobby-slot="1"] { grid-column: 2; grid-row: 1; justify-self: center; }
.lobby-seat[data-lobby-slot="2"] { grid-column: 3; grid-row: 1; justify-self: start; }
.lobby-seat[data-lobby-slot="3"] { grid-column: 3; grid-row: 2; justify-self: start; }
.lobby-seat[data-lobby-slot="4"] { grid-column: 3; grid-row: 3; justify-self: start; }
.lobby-seat[data-lobby-slot="5"] { grid-column: 2; grid-row: 3; justify-self: center; }
.lobby-seat[data-lobby-slot="6"] { grid-column: 1; grid-row: 3; justify-self: end; }
.lobby-seat[data-lobby-slot="7"] { grid-column: 1; grid-row: 2; justify-self: end; }
.lobby-seat-marker { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #557da1; border-radius: 50%; color: #a9d9ff; background: #102b48; font: 900 .66rem var(--font-ui); }
.lobby-seat-copy { min-width: 0; }
.lobby-seat-copy strong,
.lobby-seat-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-seat-copy strong { font-family: var(--font-ui); font-size: .8rem; }
.lobby-seat-copy small { margin-top: 3px; color: #8fa7bb; font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; }
.lobby-ready-light { position: absolute; right: 8px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #52677a; transform: translateY(-50%); }
.lobby-seat.ready { border-color: #66dfb2; background: linear-gradient(90deg, rgba(19, 75, 61, .66), rgba(6, 28, 27, .14)); box-shadow: 0 0 22px rgba(76, 221, 171, .1); }
.lobby-seat.ready .lobby-ready-light { background: #70e8ba; box-shadow: 0 0 12px rgba(112, 232, 186, .85); }
.lobby-seat.host .lobby-seat-marker { border-color: #e6c65f; color: #ffe696; background: #4e3b16; }
.lobby-seat.you::before { content: "YOU"; position: absolute; right: 22px; top: 4px; color: #84cfff; font: 800 .44rem var(--font-display); letter-spacing: .08em; }
.lobby-seat.offline { opacity: .58; }
.lobby-seat.empty { border-bottom-style: dashed; color: #7f94a7; background: transparent; box-shadow: none; }
.lobby-seat.empty .lobby-seat-marker { border-style: dashed; color: #72879b; background: rgba(10, 28, 46, .3); }
.lobby-seat.empty .lobby-seat-copy small { color: #667b8e; }
.lobby-action-dock { position: sticky; z-index: 20; bottom: 0; width: min(820px, 100%); margin: -4px auto 0; padding: 10px max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left)); background: linear-gradient(transparent, rgba(3,11,23,.95) 28%); }
.game-prompt { min-height: 22px; margin: 0 0 7px; color: #aebdcb; font-size: .72rem; text-align: center; }
.game-prompt > span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #e6b34e; box-shadow: 0 0 8px rgba(230,179,78,.5); }
.game-prompt.ready { color: #b7e8d4; }
.game-prompt.ready > span { background: #67dfb2; box-shadow: 0 0 10px rgba(103,223,178,.7); }
.lobby-actions { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(220px, 1.4fr) minmax(110px, .65fr); align-items: center; gap: 10px; }

/* Shared in-game HUD refinement: information belongs to players and tables. */
.standard-card-game .game-topbar .back-button {
  border: 1px solid rgba(116, 157, 191, .36);
  border-radius: 50%;
  background: rgba(4, 15, 28, .34);
  box-shadow: none;
}
.standard-card-game .game-score {
  min-height: 46px;
  padding: 3px 4px 3px 12px;
  border: 0;
  border-left: 2px solid rgba(103, 165, 209, .56);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.standard-card-game :is(.suit-ladder, .blackjack-rule-bar, .holdem-rule-bar, .five-card-draw-rule-bar) {
  border: 0;
  border-block: 1px solid rgba(74, 112, 148, .4);
  border-radius: 0;
  background: linear-gradient(90deg, transparent, rgba(10, 32, 53, .72), transparent);
}
.standard-card-game .game-seat {
  border: 0;
  border-bottom: 2px solid rgba(66, 103, 139, .72);
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(110deg, rgba(10, 31, 52, .88), rgba(6, 18, 32, .46));
  box-shadow: 0 10px 22px rgba(0,0,0,.08);
}
.standard-card-game .game-seat.active { border-color: var(--mint); box-shadow: 0 10px 24px rgba(0,0,0,.12), 0 8px 18px rgba(84,223,177,.1); }
.standard-card-game .game-status .badge { border: 0; border-bottom: 1px solid rgba(228, 239, 230, .34); border-radius: 0; background: rgba(2, 22, 17, .18); }
.standard-card-game .physical-hand {
  border: 0;
  border-top: 2px solid rgba(61, 103, 137, .62);
  border-radius: 16px 16px 0 0;
  box-shadow: inset 0 18px 32px rgba(21, 54, 79, .08);
}
.standard-card-game .physical-hand.your-turn { border-color: #4d8f82; box-shadow: inset 0 18px 34px rgba(70, 151, 130, .08), 0 -8px 20px rgba(84,223,177,.035); }

@media (max-width: 820px) {
  .game-shell-screen { padding-inline: max(14px, calc(var(--safe-left) + 12px)) max(14px, calc(var(--safe-right) + 12px)); }
  .pregame-layout { grid-template-columns: 1fr; gap: 18px; align-content: start; }
  .pregame-game-identity { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 18px; align-items: center; text-align: left; }
  .pregame-game-identity .game-object { grid-row: 1 / -1; width: 112px; margin: 0; }
  .pregame-game-identity h1 { font-size: clamp(1.8rem, 8vw, 3rem); }
  .pregame-actions { margin-top: 12px; }
  .lobby-seat-ring { min-height: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; gap: 8px; }
  .lobby-table-core { grid-area: auto; grid-column: 1 / -1; order: -1; min-height: 310px; border-radius: 48px; }
  .lobby-table-core::before { border-radius: 38px; }
  .lobby-seat { grid-area: auto !important; width: 100%; justify-self: stretch !important; }
  .room-lobby-screen { overflow: visible; }
}

@media (max-width: 560px) {
  .game-shell-flow .topbar { min-height: calc(44px + var(--safe-top)); }
  .game-shell-flow .install-button { display: none; }
  .game-shell-nav { min-height: 42px; margin-bottom: 5px; }
  .game-shell-nav .back-button { width: 40px; height: 40px; }
  .game-shell-nav > span { max-width: calc(100% - 94px); font-size: .53rem; }
  .title-screen { grid-template-rows: auto auto; padding-top: max(36px, calc(var(--safe-top) + 28px)); }
  .title-lockup h1 { font-size: clamp(3.5rem, 21vw, 5.4rem); }
  .main-menu { width: min(310px, 92vw); margin-block: 16px 12px; }
  .main-menu-option { min-height: 47px; }
  .main-menu-option strong { font-size: 1.02rem; }
  .controller-hint { font-size: .43rem; letter-spacing: .08em; }
  .options-title-block { margin-bottom: 18px; }
  .options-console { gap: 24px; }
  .option-command { min-height: 72px; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; }
  .option-command-mark { width: 34px; height: 34px; }
  .option-command strong { font-size: .64rem; }
  .option-command small { font-size: .63rem; }
  .option-command-status { max-width: 66px; padding: 0; text-align: right; }
  .options-local-note { font-size: .64rem; }
  .pregame-screen { overflow: visible; }
  .pregame-game-identity { column-gap: 12px; }
  .pregame-game-identity .game-object { width: 88px; }
  .pregame-game-identity .game-object-deck { border-width: 3px; box-shadow: inset 0 0 0 3px var(--object-deep), 5px 7px 0 rgba(0,0,0,.38); }
  .pregame-game-identity .game-object-deck::before { inset: 8px; border-width: 1px; }
  .pregame-game-identity .game-object-deck small { font-size: .34rem; }
  .pregame-game-identity .game-object-deck b { display: none; }
  .pregame-game-identity .game-object-deck i { font-size: 2.25rem; }
  .pregame-game-identity h1 { margin-block: 4px; font-size: clamp(1.55rem, 8vw, 2.2rem); }
  .shell-kicker { font-size: .53rem; }
  .configuration-selector { min-height: 62px; padding-left: 8px; grid-template-columns: minmax(92px, .68fr) minmax(0, 1.32fr); gap: 8px; }
  .configuration-selector label,
  .configuration-label { font-size: .56rem; }
  .game-stepper { grid-template-columns: 42px minmax(64px, 1fr) 42px; gap: 3px; }
  .game-stepper button { width: 42px; height: 42px; }
  .player-seat-config-grid { grid-template-columns: 1fr; }
  .game-shell-action-dock { display: grid; gap: 7px; }
  .game-shell-action-dock .game-primary-action { width: 100%; min-width: 0; grid-row: 1; }
  .game-shell-action-dock .game-secondary-action { grid-row: 2; }
  .shell-title-block { margin-top: 4px; }
  .shell-title-block h1 { font-size: clamp(2.2rem, 13vw, 3.2rem); }
  .multiplayer-mode-choices { gap: 7px; }
  .multiplayer-mode-choice { min-height: 88px; padding: 9px; grid-template-columns: 32px 1fr; }
  .multiplayer-mode-choice strong { font-size: .95rem; }
  .multiplayer-mode-choice small { font-size: .63rem; }
  .resume-table-strip { grid-template-columns: 1fr auto; }
  .resume-table-strip > strong { grid-column: 1; grid-row: 2; }
  .resume-table-strip button { grid-column: 2; grid-row: 1 / 3; }
  .room-code-entry { grid-template-columns: 92px minmax(0, 1fr); }
  .room-code-entry input { letter-spacing: .1em; }
  .lobby-seat-ring { grid-template-columns: 1fr; }
  .lobby-table-core { min-height: 294px; padding: 24px 18px; border-radius: 34px; }
  .lobby-table-core::before { inset: 10px; border-radius: 26px; }
  .lobby-seat { min-height: 64px; }
  .lobby-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .lobby-actions .game-tertiary-action { grid-column: 1 / -1; min-height: 34px; }
  .lobby-actions .game-primary-action { min-height: 52px; padding-inline: 8px; font-size: .65rem; }
  .lobby-actions .game-ready-action { padding-inline: 8px; font-size: .65rem; }
  .game-prompt { font-size: .65rem; }
}

@media (orientation: landscape) and (max-height: 640px) {
  .title-screen { grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr); grid-template-rows: 1fr; padding-block: max(18px, var(--safe-top)) max(16px, var(--safe-bottom)); }
  .title-lockup { align-self: center; justify-self: end; }
  .title-lockup h1 { font-size: clamp(3.4rem, 11vw, 6.4rem); }
  .main-menu { align-self: center; justify-self: start; margin: 0; }
  .main-menu-option { min-height: 44px; }
  .pregame-screen,
  .multiplayer-entry-screen,
  .room-lobby-screen,
  .options-screen { overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  #app.shell-transition-forward,
  #app.shell-transition-back { animation: none !important; }
  .main-menu-option,
  .multiplayer-mode-choice,
  .game-primary-action { transform: none !important; }
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  scroll-behavior: auto !important;
  transition-duration: .001ms !important;
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
}
body.reduced-motion #app.shell-transition-forward,
body.reduced-motion #app.shell-transition-back { animation: none !important; }

/* ---------- Shared pseudo-3D tabletop scene ---------- */
.card-table-scene {
  --opponent-card-width: clamp(40px, 5vw, 64px);
  --opponent-card-height: calc(var(--opponent-card-width) * 1.42);
  --play-origin-x: 0px;
  --play-origin-y: -150px;
  --play-origin-rotation: 180deg;
  position: relative;
  min-height: clamp(590px, 72vh, 760px);
  overflow: hidden;
  isolation: isolate;
  perspective: 1050px;
  perspective-origin: 50% 42%;
  border-radius: 34px 34px 12px 12px;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(38, 73, 105, .16), transparent 58%),
    linear-gradient(180deg, rgba(2, 8, 17, .08), rgba(2, 8, 17, .62));
}

.card-table-depth {
  position: absolute;
  z-index: 1;
  inset: 1% 0 17%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.card-table-surface {
  position: absolute;
  /* The inline inset leaves a gutter outside the rail. Seats beside the viewer
     show no cards, so their name has to land somewhere, and it belongs off the
     playing surface rather than on top of it. */
  inset: 2% 9% .5%;
  overflow: hidden;
  border: clamp(10px, 1.5vw, 18px) solid var(--table-border);
  border-radius: 45% 45% 25% 25% / 34% 34% 18% 18%;
  background:
    linear-gradient(var(--table-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--table-grid) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 100%, var(--table-green-light), var(--table-green) 52%, var(--table-green-deep));
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow:
    inset 0 0 70px var(--table-felt-shadow),
    inset 0 -18px 26px rgba(255, 255, 255, .035),
    0 26px 34px rgba(0, 0, 0, .48),
    0 7px 0 color-mix(in srgb, var(--table-border) 52%, #050a11);
  transform: rotateX(40deg) translateZ(-8px);
  transform-origin: 50% 100%;
}

.card-table-surface::before {
  content: "";
  position: absolute;
  inset: clamp(8px, 1.2vw, 15px);
  border: 1px solid var(--table-preview-line);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .035);
}

.card-table-surface::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 13%;
  height: 16%;
  border-radius: 50%;
  background: rgba(0, 0, 0, .12);
  filter: blur(10px);
}

.card-table-surface > i {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 30%;
  aspect-ratio: 2.4 / 1;
  border: 1px solid color-mix(in srgb, var(--table-preview-line) 55%, transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.card-table-scene .table-seats-layer {
  position: absolute;
  z-index: 45;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  pointer-events: none;
}

.card-table-scene .table-seat {
  /* One shared camera: the scene supplies perspective, every seat is a plane
     placed in that same space.

     A player holds their cards face-toward-themselves, so the BACKS point at
     whoever sits opposite -- west's backs are for east to see, not for the
     viewer. --seat-hand-yaw is that angle, and for the side seats it is a right
     angle: their fans sit edge-on to the viewer, giving nothing away. The
     per-card bow then rocks only the ends off that line so the stack has some
     life, but every card stays a printed back: at these angles a card is read by
     its edge, and nothing of a hand is ever shown to anyone but its owner.
     North needs no yaw at all -- the viewer IS the player
     opposite it, which is why north alone shows its backs square to the camera.
     --seat-hand-roll tips the fan so the end nearest the camera drops, which is
     what makes it read as held rather than laid flat on the felt. */
  --seat-hand-shift-x: 0px;
  --seat-hand-shift-y: 0px;
  --seat-hand-depth: 26px;
  --seat-hand-yaw: 0deg;
  --seat-hand-pitch: -8deg;
  --seat-hand-roll: 0deg;
  --seat-hand-scale: .9;
  --seat-hand-origin-x: 50%;
  --seat-hand-origin-y: 84%;
  --seat-hand-shadow-x: 0px;
  --seat-hand-shadow-y: 12px;
  position: absolute;
  width: clamp(190px, 24%, 330px);
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 106px;
  grid-auto-flow: row;
  justify-items: center;
  gap: 2px;
  align-items: start;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, 0);
  transform-style: preserve-3d;
  transition: translate 160ms ease, filter 160ms ease;
}

.card-table-scene .table-seat.active {
  border: 0;
  box-shadow: none;
  translate: 0 -5px;
  filter: brightness(1.08);
}

.card-table-scene .table-seat-north {
  left: 50%;
  top: 13%;
  width: clamp(280px, 36%, 460px) !important;
  --seat-hand-shift-y: 18px;
  --seat-hand-depth: 38px;
  --seat-hand-pitch: -8deg;
  --seat-hand-scale: .94;
  --seat-hand-origin-y: 92%;
}
.card-table-scene .table-seat-north-west {
  left: 27%;
  top: 10%;
  --seat-hand-shift-x: 6px;
  --seat-hand-depth: 66px;
  --seat-hand-yaw: 45deg;
  --seat-hand-pitch: -10deg;
  --seat-hand-roll: -8deg;
  --seat-hand-scale: .84;
  --seat-hand-shadow-x: 6px;
}
.card-table-scene .table-seat-north-east {
  left: 73%;
  top: 10%;
  --seat-hand-shift-x: -6px;
  --seat-hand-depth: 66px;
  --seat-hand-yaw: -45deg;
  --seat-hand-pitch: -10deg;
  --seat-hand-roll: 8deg;
  --seat-hand-scale: .84;
  --seat-hand-shadow-x: -6px;
}
/* A seat the viewer sits beside shows no cards: edge-on there is nothing
   readable to draw, and the fan only ever fought the table for space. What
   matters is who is sitting there, so the seat collapses to its name chip and
   moves out into the gutter at the table's widest point -- roughly where that
   player's hands would be, but clear of the felt. */
.card-table-scene :is(.table-seat-west, .table-seat-east, .table-seat-west-near, .table-seat-east-near) {
  width: clamp(72px, 8.4%, 116px);
  grid-template-rows: auto;
  row-gap: 0;
}
.card-table-scene .table-seat-west { left: 4.6%; top: 44%; }
.card-table-scene .table-seat-east { left: 95.4%; top: 44%; }
.card-table-scene .table-seat-west-near { left: 4.6%; top: 60%; }
.card-table-scene .table-seat-east-near { left: 95.4%; top: 60%; }
.card-table-scene :is(.table-seat-west, .table-seat-east, .table-seat-west-near, .table-seat-east-near) .player-hud {
  width: 100%;
  padding-inline: 4px;
  border-radius: 12px;
}
.card-table-scene :is(.table-seat-west, .table-seat-east, .table-seat-west-near, .table-seat-east-near) .game-seat-copy > small {
  white-space: normal;
}

.card-table-scene .player-hud {
  position: relative;
  z-index: 3;
  justify-self: center;
  max-width: 100%;
  min-width: 0;
  min-height: 29px;
  padding: 4px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(135, 173, 205, .22);
  border-radius: 999px;
  color: #eef6ff;
  background: rgba(4, 13, 25, .78);
  box-shadow: 0 5px 15px rgba(0, 0, 0, .24);
  backdrop-filter: blur(5px);
}

.card-table-scene .player-hud .game-seat-copy { text-align: center; }
.card-table-scene .player-hud .game-seat-copy > strong { font: 800 clamp(.58rem, 1.1vw, .76rem) "Cardcade Pixel", monospace; }
.card-table-scene .player-hud .game-seat-copy > small { margin-top: 1px; color: #aebed0; font-size: clamp(.48rem, .8vw, .62rem); }
.card-table-scene .table-seat.active .player-hud,
.card-table-scene .local-player-hud.active {
  border-color: rgba(84, 223, 177, .58);
  box-shadow: 0 0 18px rgba(84, 223, 177, .18), 0 5px 15px rgba(0, 0, 0, .3);
}
.card-table-scene .table-seat.active .player-hud strong,
.card-table-scene .local-player-hud.active strong { color: #d6fff2; text-shadow: 0 0 11px rgba(84, 223, 177, .44); }
.turn-indicator {
  flex: 0 0 auto;
  padding: 3px 5px;
  border-radius: 999px;
  color: #071a16;
  background: var(--mint);
  font: 900 .45rem "Cardcade Pixel", monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.seat-played-card { display: grid; flex: 0 0 auto; transform: scale(.7); margin: -10px; }

.opponent-hand-wrap {
  width: 100%;
  height: 106px;
  display: grid;
  place-items: start center;
  transform-style: preserve-3d;
}

.opponent-hand {
  position: relative;
  width: 100%;
  height: 104px;
  transform:
    translate3d(var(--seat-hand-shift-x), var(--seat-hand-shift-y), var(--seat-hand-depth))
    rotateY(var(--seat-hand-yaw))
    rotateX(var(--seat-hand-pitch))
    rotateZ(var(--seat-hand-roll))
    scale(var(--seat-hand-scale));
  transform-origin: var(--seat-hand-origin-x) var(--seat-hand-origin-y);
  transform-style: preserve-3d;
  transition: transform 180ms ease;
}

.opponent-card {
  --opponent-x: 0px;
  --opponent-y: 0px;
  --opponent-z: 0px;
  --opponent-rotation: 0deg;
  /* Bends the card out of the flat hand plane so a fan wraps around the player
     holding it rather than lying flat like a printed sheet. */
  --opponent-bow: 0deg;
  position: absolute !important;
  left: 50% !important;
  top: 0 !important;
  width: var(--opponent-card-width) !important;
  height: var(--opponent-card-height) !important;
  min-width: 0;
  display: grid;
  place-items: center;
  margin: 0 !important;
  border-width: 2px;
  border-radius: clamp(4px, .6vw, 7px);
  box-shadow:
    var(--seat-hand-shadow-x, 0px) var(--seat-hand-shadow-y, 12px) 9px rgba(0, 0, 0, .34),
    3px 4px 0 rgba(0, 0, 0, .42),
    inset 0 0 0 1px rgba(255, 255, 255, .1);
  transform:
    translate3d(calc(-50% + var(--opponent-x)), var(--opponent-y), var(--opponent-z))
    rotateY(var(--opponent-bow))
    rotate(var(--opponent-rotation)) !important;
  transform-origin: 50% 120%;
  transition: none !important;
  pointer-events: none;
  contain: layout;
}

.table-seat.active .opponent-card {
  box-shadow:
    var(--seat-hand-shadow-x, 0px) var(--seat-hand-shadow-y, 12px) 9px rgba(0, 0, 0, .34),
    3px 4px 0 rgba(0, 0, 0, .42),
    0 0 10px rgba(84, 223, 177, .38),
    inset 0 0 0 1px rgba(255, 255, 255, .1);
}

.opponent-card.playing-card .card-corner strong { font-size: 18cqh; }
.opponent-card.playing-card .card-corner i { font-size: 10.5cqh; }

.card-table-scene[data-opponent-count="6"],
.card-table-scene[data-opponent-count="7"] { --opponent-card-width: clamp(28px, 3.6vw, 46px); }
.card-table-scene[data-opponent-count="6"] .table-seat,
.card-table-scene[data-opponent-count="7"] .table-seat { width: clamp(150px, 19%, 230px); }

.center-play-area {
  position: absolute;
  z-index: 30;
  left: 22%;
  top: 23%;
  width: 56%;
  height: 34%;
  min-width: 0;
  display: grid;
  place-items: stretch;
}

/* Hand-based table games use the open sky above the north player for the turn
   banner. Keeping it outside the center play area lets the opponent move toward
   the table without dragging any played cards or piles away from the felt. */
.tabletop-status-area {
  position: absolute;
  z-index: 60;
  left: 22%;
  top: 2%;
  width: 56%;
}

.card-table-scene .game-table {
  width: 100%;
  min-height: 0;
  height: 100%;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.card-table-scene .shedding-game-table {
  grid-template-rows: 1fr;
}
.card-table-scene .game-table.status-separated-table {
  grid-template-rows: minmax(0, 1fr);
}
/* Played cards belong to the felt, so they lie in the table's plane instead of
   standing up square to the camera. The tilt matches the felt's own rotateX, so
   the pile reads as resting on the surface rather than hovering in front of it.
   Only the pile is laid down: the status line and the empty-pile prompt stay
   screen-facing, because that is dense text the player has to read. */
.card-table-scene .center-play-area,
.card-table-scene .game-table {
  transform-style: preserve-3d;
}
.card-table-scene .active-pile.cards-pile {
  /* Tilting pushes the cards outside the pile's own box, and the box clips its
     overflow, which sliced the laid-down cards off along a hard edge. The scene
     already clips at its own boundary, so let the pile spill. */
  overflow: visible;
  transform: rotateX(var(--table-card-lay, 40deg));
  transform-origin: 50% 64%;
}

/* Five Card Draw's stock and discard, Snap's revealed board, and JUAN's and
   Rotating Rummy's stock cards are all cards on the same felt, so they lie in
   the same plane as every other pile. A stock sitting upright beside a pile
   that lies flat is the tell that gives a fake table away. Only the card objects
   tilt -- their labels stay screen-facing and readable. */
.casino-table-scene .five-card-draw-piles,
.snap-table-scene .snap-center-board,
.juan-table-scene .juan-pile-zone,
.rummy-table-scene .rummy-pile-zone {
  transform-style: preserve-3d;
}
.five-card-draw-table-scene .five-card-draw-piles { transform: translateY(12px); }
.five-card-draw-table-scene .draw-card-back,
.snap-table-scene .snap-center-board :is(.playing-card, .snap-empty-card) {
  transform: rotateX(var(--table-card-lay, 40deg));
  transform-origin: 50% 64%;
}
.card-back.ordinary-card-stock {
  transform: rotateX(var(--table-card-lay, 40deg));
  transform-origin: 50% 64%;
}
.five-card-draw-table-scene .draw-stack .draw-card-layer-1 { transform: translate3d(3px, 4px, -4px) rotateX(var(--table-card-lay, 40deg)); opacity: .72; }
.five-card-draw-table-scene .draw-stack .draw-card-layer-2 { transform: translate3d(1.5px, 2px, -2px) rotateX(var(--table-card-lay, 40deg)); opacity: .88; }
.five-card-draw-table-scene .draw-stack .draw-card-layer-3 { transform: rotateX(var(--table-card-lay, 40deg)); }
.five-card-draw-table-scene .draw-discard-pile .draw-card-back { transform: rotateX(var(--table-card-lay, 40deg)) rotateZ(5deg); }

.card-table-scene .game-status {
  position: relative;
  z-index: 4;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(3, 18, 16, .34);
  text-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}
.card-table-scene .active-pile { min-height: 0; }
.card-table-scene .active-pile .empty-pile {
  min-width: min(420px, 88%);
  padding: 15px;
  border-width: 1px;
  background: rgba(3, 13, 11, .15);
}

.card-table-scene .local-player-hud {
  position: absolute;
  z-index: 86;
  left: 50%;
  bottom: 252px;
  max-width: min(78%, 420px);
  transform: translateX(-50%);
}

.card-table-scene .physical-hand {
  position: absolute;
  z-index: 80;
  left: 5%;
  right: 5%;
  bottom: 0;
  min-height: 250px;
  padding: 10px 12px 0;
  overflow: visible;
  border: 0;
  border-top: 1px solid rgba(126, 168, 208, .18);
  border-radius: 48% 48% 0 0 / 14% 14% 0 0;
  background: linear-gradient(180deg, rgba(5, 17, 31, .14), rgba(5, 17, 31, .82) 76%);
  box-shadow: none;
}
.card-table-scene .physical-hand.your-turn { border-color: rgba(84, 223, 177, .38); box-shadow: 0 -18px 28px rgba(84, 223, 177, .045); }
.card-table-scene .hand-heading { padding-inline: clamp(2px, 4vw, 52px); }

.card-table-scene[data-play-origin="north"] { --play-origin-x: 0px; --play-origin-y: -175px; --play-origin-rotation: 180deg; }
.card-table-scene[data-play-origin="north-west"] { --play-origin-x: -235px; --play-origin-y: -155px; --play-origin-rotation: 160deg; }
.card-table-scene[data-play-origin="north-east"] { --play-origin-x: 235px; --play-origin-y: -155px; --play-origin-rotation: -160deg; }
.card-table-scene[data-play-origin="west"],
.card-table-scene[data-play-origin="west-near"] { --play-origin-x: -340px; --play-origin-y: -15px; --play-origin-rotation: 34deg; }
.card-table-scene[data-play-origin="east"],
.card-table-scene[data-play-origin="east-near"] { --play-origin-x: 340px; --play-origin-y: -15px; --play-origin-rotation: -34deg; }
.card-table-scene[data-play-origin="south"] { --play-origin-x: 0px; --play-origin-y: 210px; --play-origin-rotation: 0deg; }

.card-table-scene .playing-card.played.enter { animation-name: tableCardPileIn; animation-duration: .3s; }
@keyframes tableCardPileIn {
  from {
    transform: translate3d(
      calc(-50% + var(--pile-x, 0px) + var(--play-origin-x)),
      calc(-50% + var(--pile-y, 0px) + var(--play-origin-y)),
      0
    ) rotate(calc(var(--pile-rotation, 0deg) + var(--play-origin-rotation))) scale(.68);
    opacity: .18;
  }
  to {
    transform: translate3d(calc(-50% + var(--pile-x, 0px)), calc(-50% + var(--pile-y, 0px)), 0) rotate(var(--pile-rotation, 0deg)) scale(1);
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .card-table-scene {
    --opponent-card-width: clamp(30px, 8.5vw, 44px);
    min-height: clamp(540px, 76svh, 650px);
    border-radius: 24px 24px 8px 8px;
    perspective: 820px;
    perspective-origin: 50% 36%;
  }
  .card-table-depth { inset: 0 -5% 18%; }
  .card-table-surface { inset: 1% 1% 0; border-width: 10px; transform: rotateX(46deg) translateZ(-10px); }
  .card-table-scene .table-seat { width: clamp(150px, 36%, 220px); grid-template-rows: auto 82px; }
  .card-table-scene .table-seat-north { top: 12%; width: min(62%, 340px) !important; }
  .card-table-scene .table-seat-north-west { left: 28%; top: 6%; }
  .card-table-scene .table-seat-north-east { left: 72%; top: 6%; }
  /* A narrower scene cannot spare a full gutter, so the name tucks in far enough
     to clear the scene's own edge rather than being sliced by it. */
  .card-table-scene :is(.table-seat-west, .table-seat-east, .table-seat-west-near, .table-seat-east-near) { width: clamp(70px, 12%, 104px); row-gap: 0; }
  .card-table-scene .table-seat-west { left: 7%; top: 46%; }
  .card-table-scene .table-seat-east { left: 93%; top: 46%; }
  .card-table-scene .table-seat-north-west { --seat-hand-depth: 34px; --seat-hand-yaw: 45deg; --seat-hand-scale: .72; }
  .card-table-scene .table-seat-north-east { --seat-hand-depth: 34px; --seat-hand-yaw: -45deg; --seat-hand-scale: .72; }
  .card-table-scene .table-seat-west-near { left: 7%; top: 62%; }
  .card-table-scene .table-seat-east-near { left: 93%; top: 62%; }
  .card-table-scene .player-hud { min-height: 24px; padding: 3px 5px; gap: 3px; }
  .card-table-scene .player-hud .game-seat-copy > strong { font-size: .53rem; }
  .card-table-scene .player-hud .game-seat-copy > small { font-size: .43rem; }
  .card-table-scene .turn-indicator { padding: 2px 3px; font-size: .38rem; }
  .seat-played-card { display: none; }
  .opponent-hand-wrap, .opponent-hand { height: 82px; }
  .center-play-area { left: 15%; top: 24%; width: 70%; height: 30%; }
  .tabletop-status-area { left: 15%; top: 2%; width: 70%; }
  .card-table-scene .game-status small { font-size: .6rem; }
  .card-table-scene .local-player-hud { bottom: 218px; }
  .card-table-scene .physical-hand { left: 0; right: 0; min-height: 218px; padding-inline: 6px; }
  .card-table-scene .hand-heading { padding-inline: 6px; }
  .card-table-scene[data-opponent-count="6"],
  .card-table-scene[data-opponent-count="7"] { --opponent-card-width: clamp(23px, 6.2vw, 32px); }
  .card-table-scene[data-opponent-count="6"] .table-seat,
  .card-table-scene[data-opponent-count="7"] .table-seat { width: 126px; }
  .card-table-scene[data-play-origin="north-west"] { --play-origin-x: -120px; --play-origin-y: -130px; }
  .card-table-scene[data-play-origin="north-east"] { --play-origin-x: 120px; --play-origin-y: -130px; }
  .card-table-scene[data-play-origin="west"],
  .card-table-scene[data-play-origin="west-near"] { --play-origin-x: -155px; }
  .card-table-scene[data-play-origin="east"],
  .card-table-scene[data-play-origin="east-near"] { --play-origin-x: 155px; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .card-table-scene { min-height: clamp(520px, 78svh, 620px); }
  .card-table-depth { inset-inline: -8%; }
  .card-table-surface { transform: rotateX(44deg) translateZ(-10px); }
  .card-table-scene .table-seat-north { top: 13%; }
  /* At phone width the felt runs edge to edge and there is no gutter left, so
     the name sits at the table's shoulder, clear of the status bar and the pile. */
  .card-table-scene :is(.table-seat-west, .table-seat-east, .table-seat-west-near, .table-seat-east-near) { width: clamp(66px, 24%, 92px); }
  .card-table-scene .table-seat-west { left: 14%; top: 48%; }
  .card-table-scene .table-seat-east { left: 86%; top: 48%; }
  .card-table-scene .table-seat-west-near { left: 14%; top: 52%; }
  .card-table-scene .table-seat-east-near { left: 86%; top: 52%; }
  .center-play-area { top: 25%; height: 28%; }
  .tabletop-status-area { top: 1.5%; }
  .card-table-scene .active-pile .empty-pile span { display: none; }
  .card-table-scene .local-player-hud { bottom: 205px; }
  .card-table-scene .physical-hand { min-height: 205px; }
}

@media (orientation: landscape) and (max-height: 640px) {
  .card-table-scene {
    --opponent-card-width: clamp(24px, 7.5vh, 38px);
    min-height: 410px;
    perspective-origin: 50% 34%;
  }
  .card-table-depth { inset: 0 -2% 15%; }
  .card-table-surface { inset: 1% 2% 0; transform: rotateX(49deg) translateZ(-8px); }
  .center-play-area { left: 27%; top: 21%; width: 46%; height: 34%; }
  .tabletop-status-area { left: 27%; top: 1%; width: 46%; }
  .card-table-scene .table-seat { width: 160px; grid-template-rows: auto 60px; }
  .card-table-scene .table-seat-north { top: 10%; width: min(38%, 300px) !important; }
  .card-table-scene :is(.table-seat-north-west, .table-seat-north-east) { top: 2%; }
  .card-table-scene :is(.table-seat-west, .table-seat-east) { top: 32%; }
  .card-table-scene :is(.table-seat-west-near, .table-seat-east-near) { top: 43%; }
  .opponent-hand-wrap, .opponent-hand { height: 60px; }
  .card-table-scene .local-player-hud { bottom: 142px; }
  .card-table-scene .physical-hand { left: 8%; right: 8%; min-height: 142px; padding-top: 5px; }
  .card-table-scene .hand-heading { min-height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-table-scene .playing-card.played.enter { animation: none !important; }
  .card-table-scene .table-seat.active { translate: 0; }
}

body.reduced-motion .card-table-scene .playing-card.played.enter { animation: none !important; }
body.reduced-motion .card-table-scene .table-seat.active { translate: 0; }

/* Game-specific center objects remain screen-facing while the felt supplies
   the shared depth cue. This keeps dense rules text and reaction cards clear. */
.casino-table-scene .center-play-area { top: 15%; height: 36%; }
.casino-table-scene .blackjack-dealer-zone,
.casino-table-scene .holdem-board-zone,
.casino-table-scene .five-card-draw-table-zone { height: 100%; min-height: 0; }

/* Dealt cards belong on the table's centre line. These zones split the centre
   into a copy column and a card column, which pushes the cards off that axis --
   holdem's board sat about a hundred pixels right of centre while every other
   game's pile was dead centre. Stack the copy above the cards instead so the
   pile lands on the same axis as the felt, the seats, and the player's hand. */
.casino-table-scene :is(.blackjack-dealer-zone, .holdem-board-zone, .five-card-draw-table-zone) {
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: min-content;
  align-content: center;
  justify-items: center;
  gap: clamp(3px, .9vw, 9px);
}
.casino-table-scene :is(.blackjack-dealer-copy, .holdem-board-copy) {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: baseline;
  justify-content: center;
}
.casino-table-scene :is(.blackjack-dealer-copy, .holdem-board-copy) strong {
  max-width: none;
  margin-top: 0;
}
.casino-table-scene .blackjack-dealer-pile,
.casino-table-scene .holdem-board { min-height: 126px !important; }
.casino-table-scene .physical-hand { min-height: 262px; }
.casino-table-scene .local-player-hud { bottom: 264px; }

.card-table-scene .table-seat.folded .player-hud,
.card-table-scene .table-seat.eliminated .player-hud { opacity: .58; }
.card-table-scene .table-seat.all-in .player-hud { border-color: rgba(79, 167, 255, .68); }
.card-table-scene .table-seat.placement-first .player-hud { border-color: #f0c553; box-shadow: 0 0 18px rgba(240, 197, 83, .22); }
.card-table-scene .table-seat.placement-second .player-hud { border-color: #c9d4e3; }
.card-table-scene .table-seat.placement-third .player-hud { border-color: #dc9764; }
.card-table-scene .table-seat.juan-alert,
.card-table-scene .table-seat.juan-call-pending,
.card-table-scene .table-seat.rummy-route-clear { border: 0; background: transparent; box-shadow: none; }
.card-table-scene .table-seat.juan-alert .player-hud { border-color: var(--coral); box-shadow: 0 0 18px rgba(255, 94, 98, .22); }
.card-table-scene .table-seat.juan-call-pending .player-hud { border-color: #f0c553; box-shadow: 0 0 18px rgba(240, 197, 83, .2); }
.card-table-scene .table-seat.rummy-route-clear .player-hud { border-color: #f5ca4d; box-shadow: 0 0 16px rgba(245, 202, 77, .17); }

.juan-table-scene .center-play-area,
.five-card-draw-table-scene .center-play-area { top: 21%; height: 37%; }
.juan-table-scene .juan-pile-zone { height: 100%; min-height: 0; }
.juan-table-scene .juan-table { grid-template-rows: auto minmax(0, 1fr); }

.rummy-table-scene .center-play-area { top: 20%; height: 39%; }
.rummy-table-scene .rummy-table-stage {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 5px;
}
.rummy-table-scene .rummy-table { min-height: 0; }
.rummy-table-scene .rummy-pile-zone { height: 100%; min-height: 0; }

.snap-game { padding-bottom: max(9rem, env(safe-area-inset-bottom)); }
.snap-table-scene {
  /* Every child of a table scene is absolutely positioned, so auto inline
     margins made this one shrink-to-fit down to zero width and the whole table
     -- felt, seats, centre board, draw pile -- rendered invisible. The cap needs
     an explicit width to centre against. */
  width: min(1120px, 100%);
  min-height: clamp(520px, 68vh, 660px);
  margin-inline: auto;
}
.snap-table-scene .center-play-area { left: 9%; top: 33%; width: 82%; height: 42%; }
.snap-table-scene .snap-center-board {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(7px, 1.4vw, 14px);
  border: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .08), transparent 64%);
}
/* .snap-game's own breakpoint rules are more specific than a plain scene
   selector, so match their depth or the board sizes itself for the old
   standalone layout and overruns the felt. */
.snap-table-scene .snap-center-board :is(.snap-compare-card, .snap-hidden-source) .playing-card,
.snap-table-scene .snap-center-board .playing-card,
.snap-table-scene .snap-center-board .snap-empty-card {
  width: clamp(78px, 14vw, 124px) !important;
  height: auto !important;
  aspect-ratio: 5 / 7;
}
/* The current card lifts toward the viewer rather than out of the felt, so the
   board keeps one silhouette while still calling out the card in play. */
.snap-table-scene .snap-compare-card.current .playing-card {
  box-shadow: 0 0 0 4px rgba(99, 229, 255, .22), 0 14px 26px rgba(0, 0, 0, .34);
}
/* Snap is not a game of held hands: nobody picks their draw pile up, so its
   seats render no cards at all and carry only a HUD. The seat still marks where
   each player sits, and their draw and capture counts live on that HUD. */
.snap-table-scene .table-seat { grid-template-rows: auto; }
.snap-table-scene .table-seat-west { left: 11%; top: 22%; }
.snap-table-scene .table-seat-east { left: 89%; top: 22%; }
.snap-table-scene .table-seat-north { top: 2%; }
.snap-table-scene .local-player-hud { bottom: 4%; }

.snap-table-scene .table-seat.ready .player-hud { border-color: rgba(114, 238, 168, .58); }
.snap-table-scene .table-seat.penalized .player-hud { border-color: var(--snap-coral); }

/* Finders Makers keeps its board top-down and interactive, but places its
   two player HUDs at the near and far edges of the shared physical table. */
.playing-game .finders-makers-game {
  height: auto;
  min-height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
  grid-template-rows: auto minmax(610px, 1fr) auto;
  overflow: visible;
}
.finders-table-scene { min-height: clamp(610px, 76vh, 790px); }
.finders-table-scene .card-table-depth { inset: 1% 1% 7%; }
.finders-table-scene .card-table-surface { inset: 4% 3% 0; transform: rotateX(47deg) translateZ(-7px); }
.finders-table-scene .finders-scoreboard {
  position: absolute;
  z-index: 55;
  inset: 0;
  display: block;
  pointer-events: none;
}
.finders-table-scene .finders-player {
  position: absolute;
  left: 50%;
  width: min(270px, 42%);
  min-height: 40px;
  padding: 5px 8px;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  border: 1px solid rgba(126, 168, 208, .28);
  border-radius: 999px;
  background: rgba(4, 13, 25, .8);
  box-shadow: 0 5px 15px rgba(0, 0, 0, .24);
  transform: translateX(-50%);
}
.finders-table-scene .finders-player[data-table-seat="north"] { top: 1%; }
.finders-table-scene .finders-player[data-table-seat="south"] { bottom: 1%; }
.finders-table-scene .finders-player.active { transform: translateX(-50%) translateY(-3px); border-color: var(--mint); box-shadow: 0 0 17px rgba(84, 223, 177, .2); }
.finders-table-scene .finders-player > span { width: 27px; height: 27px; border-radius: 50%; }
.finders-table-scene .finders-build-card {
  position: absolute;
  z-index: 52;
  left: 2%;
  top: 18%;
  width: min(250px, 21%);
  min-height: 0;
  padding: 7px 8px;
}
.finders-table-scene .finders-piece-list { grid-template-columns: 1fr; }
.finders-table-scene .finders-board-zone {
  position: absolute;
  z-index: 35;
  left: 17%;
  top: 15%;
  width: 66%;
  height: 70%;
  min-height: 0;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(3, 24, 20, .18);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .18);
}

@media (max-width: 820px) {
  .casino-table-scene .center-play-area { top: 16%; height: 33%; }
  .five-card-draw-table-scene .center-play-area { top: 21%; height: 37%; }
  .casino-table-scene .physical-hand { min-height: 222px; }
  .casino-table-scene .local-player-hud { bottom: 224px; }
  .snap-table-scene { min-height: 530px; }
  .snap-table-scene .center-play-area { left: 5%; top: 24%; width: 90%; height: 44%; }
  .finders-table-scene { min-height: 590px; }
  .finders-table-scene .finders-build-card { left: 2%; top: 14%; width: 29%; }
  .finders-table-scene .finders-board-zone { left: 12%; top: 23%; width: 76%; height: 62%; }
  .finders-table-scene .finders-piece-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .casino-table-scene .blackjack-dealer-zone,
  .casino-table-scene .holdem-board-zone,
  .casino-table-scene .five-card-draw-table-zone { align-content: center; }
  .juan-table-scene .center-play-area { top: 21%; height: 34%; }
  .five-card-draw-table-scene .center-play-area { top: 21%; height: 34%; }
  .snap-table-scene { min-height: 510px; }
  .snap-table-scene .center-play-area { top: 19%; height: 47%; }
  .snap-table-scene .snap-center-board { grid-template-columns: repeat(3, minmax(72px, 1fr)); gap: 4px; }
  .snap-table-scene .snap-hidden-source { display: none; }
  .snap-table-scene .snap-center-board .playing-card,
  .snap-table-scene .snap-empty-card { width: clamp(72px, 24vw, 105px); }
  .finders-table-scene { min-height: 565px; }
  .finders-table-scene .finders-build-card {
    left: 4%;
    top: 10%;
    width: 92%;
    min-height: 64px;
  }
  .finders-table-scene .finders-piece-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finders-table-scene .finders-board-zone { left: 3%; top: 26%; width: 94%; height: 62%; }
  .finders-table-scene .finders-player { width: min(250px, 72%); }
}

@media (orientation: landscape) and (max-height: 640px) {
  .casino-table-scene .center-play-area { top: 13%; height: 40%; }
  .casino-table-scene .physical-hand { min-height: 150px; }
  .casino-table-scene .local-player-hud { bottom: 146px; }
  .snap-table-scene { min-height: 390px; }
  .snap-table-scene .center-play-area { left: 16%; top: 15%; width: 68%; height: 55%; }
  .finders-table-scene { min-height: 420px; }
  .finders-table-scene .finders-build-card { top: 17%; width: 23%; }
  .finders-table-scene .finders-board-zone { left: 20%; top: 12%; width: 60%; height: 74%; }
}

/* Desktop fans use larger cards than the narrow layout. Reserve a distinct
   middle band for table objects and keep the local HUD between it and the hand.
   Snap and Finders Makers have no held north fan and retain their own layouts. */
@media (min-width: 821px) and (min-height: 641px) {
  .card-table-scene:not(.snap-table-scene):not(.finders-table-scene) {
    min-height: clamp(660px, 72vh, 820px);
  }
  .card-table-scene .table-seat-north {
    --seat-hand-shift-y: 0px;
  }
  .card-table-scene:not(.snap-table-scene):not(.finders-table-scene) .center-play-area {
    top: 25%;
    height: 36%;
  }
  .card-table-scene.casino-table-scene.blackjack-table-scene .center-play-area,
  .card-table-scene.casino-table-scene.holdem-table-scene .center-play-area { top: 28%; }
  .card-table-scene:not(.snap-table-scene):not(.finders-table-scene) .local-player-hud {
    bottom: 242px;
  }
  .card-table-scene:not(.snap-table-scene):not(.finders-table-scene) .physical-hand {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    pointer-events: none;
  }
  .card-table-scene .physical-hand :is(.game-hand, .blackjack-hand-summaries) {
    pointer-events: auto;
  }
}

@media (max-width: 820px) and (min-height: 641px) {
  .blackjack-table-scene .center-play-area,
  .holdem-table-scene .center-play-area {
    top: 26%;
    height: 33%;
  }
}

/* Casino tables use the visible viewport as a fixed grid. The felt is the
   flexible row, so browser chrome or a short screen cannot push the action
   bar into a few pixels of document overflow. */
.playing-game:has(:is(.blackjack-game, .holdem-game, .five-card-draw-game)) {
  --game-main-top: 4px;
  --game-main-bottom: max(6px, var(--safe-bottom));
  overflow: hidden;
}
@supports (height: 100dvh) {
  .playing-game:has(:is(.blackjack-game, .holdem-game, .five-card-draw-game)) { --game-viewport-height: 100dvh; }
}
.playing-game .standard-card-game:is(.blackjack-game, .holdem-game, .five-card-draw-game) {
  height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  overflow: hidden;
}
.playing-game .standard-card-game:is(.blackjack-game, .holdem-game, .five-card-draw-game) > .casino-table-scene {
  width: 100%;
  height: 100%;
  min-height: 0;
}
.playing-game .blackjack-game > .blackjack-insurance-prompt {
  position: fixed;
  z-index: 900;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100% - var(--safe-left) - var(--safe-right) - 24px));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  box-shadow: 7px 8px 0 rgba(0,0,0,.5), 0 0 0 9999px rgba(1,6,13,.38);
}
@media (max-width: 520px) {
  .playing-game .blackjack-game > .blackjack-insurance-prompt {
    top: calc(var(--safe-top) + 8px);
    width: min(480px, calc(100% - var(--safe-left) - var(--safe-right) - 20px));
    transform: translateX(-50%);
  }
}

/* JUAN uses the visible viewport as a fixed table grid. Transient gameplay
   prompts render in #juan-gameplay-overlay-root, so reactions never add a row
   or change the document height. */
.playing-game:has(.juan-game) {
  --game-main-top: 4px;
  --game-main-bottom: max(6px, var(--safe-bottom));
  overflow: hidden;
}
@supports (height: 100dvh) {
  .playing-game:has(.juan-game) { --game-viewport-height: 100dvh; }
}
.playing-game .juan-game {
  height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  overflow: hidden;
}
.playing-game .juan-game > .juan-table-scene {
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Rummy owns five viewport rows: header, Route, help, table, actions. The
   completed groups occupy the old status area, never the pile's grid row.
   Keep that area reserved even before a Route is complete, so nothing jumps. */
.playing-game:has(.rotating-rummy-game) {
  --game-main-top: 4px;
  --game-main-bottom: max(6px, var(--safe-bottom));
}
@supports (height: 100dvh) {
  .playing-game:has(.rotating-rummy-game) { --game-viewport-height: 100dvh; }
}
.playing-game .rotating-rummy-game {
  height: calc(var(--game-viewport-height) - var(--safe-top) - var(--game-main-top) - var(--game-main-bottom));
  min-height: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 5px;
  overflow: visible;
}
.rotating-rummy-game .game-topbar { min-height: 50px; padding: 2px 6px; }
.rotating-rummy-game .game-topbar h2 { font-size: clamp(.95rem, 3.9vw, 1.25rem); }
.rotating-rummy-game .game-topbar p { font-size: .65rem; }
.rotating-rummy-game .rummy-route-banner { min-height: 58px; padding: 6px 9px; }
.rotating-rummy-game .rummy-pattern-help { position: relative; z-index: 400; }
.rotating-rummy-game .rummy-pattern-help > div:not([hidden]) {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: min(330px, calc(var(--game-viewport-height) - 180px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  background: #081423;
  box-shadow: 0 8px 20px rgba(0,0,0,.55);
}
.rotating-rummy-game .rummy-table-scene {
  --rummy-links-height: 116px;
  --rummy-hand-height: clamp(154px, 36cqh, 232px);
  --game-card-width: clamp(48px, min(17vw, 13cqh), 86px);
  --game-card-height: calc(var(--game-card-width) * 1.42);
  --opponent-card-width: clamp(23px, 6cqh, 38px);
  container-type: size;
  min-height: 0;
  height: 100%;
  border-radius: 12px;
}
.playing-game .rotating-rummy-game > .card-table-scene { min-height: 0; }
.rotating-rummy-game .tabletop-status-area { top: 0; left: 2%; width: 96%; height: var(--rummy-links-height); }
.rotating-rummy-game .rummy-link-board {
  height: 100%;
  max-height: none;
  padding: 5px 7px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px;
  overflow: hidden;
}
.rotating-rummy-game .rummy-link-board-heading { margin: 0; flex-direction: row; align-items: center; gap: 8px; }
.rotating-rummy-game .rummy-link-board-heading .family-kicker { font-size: .62rem; }
.rotating-rummy-game .rummy-link-board-heading small { display: block; font-size: .56rem; text-align: right; }
.rotating-rummy-game .rummy-link-empty { margin: 0; align-self: center; color: var(--muted); font-size: .72rem; text-align: center; }
.rotating-rummy-game .rummy-link-targets {
  min-height: 0;
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: max(142px, calc((100% - 7px) / 2));
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.rotating-rummy-game .rummy-link-group-card { padding: 3px; scroll-snap-align: start; }
.rotating-rummy-game .rummy-link-group-cards { min-height: 34px; }
.rotating-rummy-game .rummy-link-group-cards .playing-card.played { width: 24px; height: 34px; flex-basis: 24px; margin-left: -8px; }
.rotating-rummy-game .rummy-link-group-cards .playing-card.played:first-child { margin-left: 0; }
.rotating-rummy-game .rummy-link-group-card > button { min-height: 34px; margin-top: 2px; padding: 3px; border: 1px solid var(--line-bright); border-radius: 5px; background: #10243f; color: var(--ink); font-size: .57rem; }
.rotating-rummy-game .rummy-link-group-card > button:disabled { opacity: .45; }
.rotating-rummy-game .rummy-link-group-card.selected > button { border-color: #f5ca4d; background: #513b15; }
.rotating-rummy-game .rummy-table-scene :is(.table-seat-north, .table-seat-north-west, .table-seat-north-east) {
  top: calc(var(--rummy-links-height) + 4px);
  --seat-hand-shift-y: 0px;
  grid-template-rows: auto clamp(44px, 12cqh, 76px);
}
.rotating-rummy-game .opponent-hand-wrap,
.rotating-rummy-game .opponent-hand { height: clamp(44px, 12cqh, 76px); }
.rotating-rummy-game .card-table-scene.rummy-table-scene .center-play-area {
  top: calc(var(--rummy-links-height) + 20px + 14cqh);
  bottom: calc(var(--rummy-hand-height) + 30px);
  left: 26%;
  width: 48%;
  height: auto;
}
.rotating-rummy-game .rummy-table-scene .rummy-table { padding: 0; }
.rotating-rummy-game .rummy-pile-zone { container-type: size; gap: clamp(18px, 5vw, 44px); }
.rotating-rummy-game .rummy-stock,
.rotating-rummy-game .rummy-pile-zone .rummy-card.played {
  width: min(80px, 70cqh);
  height: min(114px, 100cqh);
}
.rotating-rummy-game .rummy-pile-zone .active-pile.cards-pile { width: min(80px, 70cqh); min-width: 0; flex-basis: min(80px, 70cqh); min-height: 0; }
.rotating-rummy-game .rummy-table-scene :is(.table-seat-west, .table-seat-east) { top: calc(var(--rummy-links-height) + 24cqh); }
.rotating-rummy-game .card-table-scene.rummy-table-scene .local-player-hud { bottom: var(--rummy-hand-height); }
.rotating-rummy-game .rummy-table-scene .physical-hand {
  min-height: 0;
  height: var(--rummy-hand-height);
  left: 0;
  right: 0;
  padding: 4px 6px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
.rotating-rummy-game .physical-hand .game-hand { min-height: 0; margin: 0; pointer-events: auto; }
.rotating-rummy-game .hand-heading { min-height: 30px; gap: 10px; }
.rotating-rummy-game .hand-heading strong { font-size: .85rem; }
.rotating-rummy-game .hand-heading small { font-size: .59rem; }
.rotating-rummy-game .selection-status { max-width: 65%; font-size: .6rem; line-height: 1.3; }
.rotating-rummy-game .rummy-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; }
.rotating-rummy-game .rummy-actions button { min-height: 42px; padding: 3px; font-size: .6rem; }
.rotating-rummy-game .rummy-actions [data-action="rummy-discard"] { grid-column: span 2; }
@media (min-width: 821px) {
  .rotating-rummy-game .rummy-link-targets { grid-auto-columns: max(142px, calc((100% - 21px) / 4)); }
  .rotating-rummy-game .card-table-scene.rummy-table-scene .center-play-area { bottom: calc(var(--rummy-hand-height) + 44px); }
  .rotating-rummy-game .rummy-actions { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .rotating-rummy-game .rummy-actions [data-action="rummy-discard"] { grid-column: auto; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .playing-game .rotating-rummy-game { gap: 4px; }
  .rotating-rummy-game .game-topbar { min-height: 40px; padding-block: 0; }
  .rotating-rummy-game .game-topbar p { display: none; }
  .rotating-rummy-game .game-topbar .back-button { width: 36px; height: 36px; min-height: 36px; }
  .rotating-rummy-game .game-score { min-height: 36px; }
  .rotating-rummy-game .rummy-route-banner { min-height: 0; padding: 4px 7px; }
  .rotating-rummy-game .rummy-route-banner .family-kicker { font-size: .53rem; }
  .rotating-rummy-game .rummy-route-banner h3 { font-size: .72rem; }
  .rotating-rummy-game .rummy-route-banner p { font-size: .57rem; }
  .rotating-rummy-game .rummy-pattern-help-toggle { padding: 5px 8px; font-size: .6rem; }
  .rotating-rummy-game .rummy-actions button { min-height: 40px; }
  .rotating-rummy-game .rummy-table-scene { --rummy-links-height: 98px; --rummy-hand-height: 136px; --opponent-card-width: 21px; --game-card-width: 48px; }
  .rotating-rummy-game .rummy-link-group-cards { min-height: 26px; }
  .rotating-rummy-game .rummy-link-group-cards .playing-card.played { height: 26px; width: 19px; flex-basis: 19px; }
  .rotating-rummy-game .rummy-table-scene :is(.table-seat-north, .table-seat-north-west, .table-seat-north-east) { grid-template-rows: auto 34px; }
  .rotating-rummy-game .opponent-hand-wrap,
  .rotating-rummy-game .opponent-hand { height: 34px; }
  .rotating-rummy-game .card-table-scene.rummy-table-scene .center-play-area { bottom: calc(var(--rummy-hand-height) + 38px); }
}
@media (orientation: landscape) and (max-height: 640px) {
  .playing-game .rotating-rummy-game { grid-template-columns: minmax(180px, 24%) minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 8px; }
  .rotating-rummy-game > :is(.game-topbar, .rummy-route-banner, .rummy-pattern-help, .rummy-actions) { grid-column: 1; }
  .rotating-rummy-game .game-topbar { grid-row: 1; grid-template-columns: 34px minmax(0, 1fr); gap: 5px; padding: 0; }
  .rotating-rummy-game .game-topbar h2 { font-size: .8rem; }
  .rotating-rummy-game .game-topbar :is(p, .game-score) { display: none; }
  .rotating-rummy-game .rummy-route-banner { grid-row: 2; }
  .rotating-rummy-game .rummy-route-circuit { display: none; }
  .rotating-rummy-game .rummy-pattern-help { grid-row: 3; }
  .rotating-rummy-game .rummy-pattern-help > div:not([hidden]) { max-height: calc(var(--game-viewport-height) - 200px); width: min(430px, 85vw); }
  .rotating-rummy-game .rummy-actions { grid-row: 4; align-self: end; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rotating-rummy-game .rummy-actions [data-action="rummy-discard"] { grid-column: span 3; }
  .rotating-rummy-game .rummy-table-scene { grid-column: 2; grid-row: 1 / 5; --rummy-hand-height: 148px; --game-card-width: clamp(42px, 13cqh, 62px); }
  .rotating-rummy-game .tabletop-status-area { left: 0; width: 30%; height: 100%; }
  .rotating-rummy-game .rummy-link-board-heading { flex-direction: column; align-items: start; }
  .rotating-rummy-game .rummy-link-board-heading small { text-align: left; }
  .rotating-rummy-game .rummy-link-targets { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); grid-auto-columns: auto; grid-auto-rows: 82px; align-content: start; overflow-x: hidden; overflow-y: auto; scroll-snap-type: y proximity; }
  .rotating-rummy-game .rummy-table-scene .table-seat-north { top: 2%; left: 66%; grid-template-rows: auto 50px; }
  .rotating-rummy-game .rummy-table-scene .table-seat-north-west { top: 2%; left: 48%; }
  .rotating-rummy-game .rummy-table-scene .table-seat-north-east { top: 2%; left: 82%; }
  .rotating-rummy-game .rummy-table-scene :is(.table-seat-west, .table-seat-east) { width: min(100px, 17%); grid-template-rows: auto; }
  .rotating-rummy-game .rummy-table-scene :is(.table-seat-west, .table-seat-east) .seat-last-card { display: none; }
  .rotating-rummy-game .rummy-table-scene .table-seat-west { top: 29%; left: 39%; }
  .rotating-rummy-game .rummy-table-scene .table-seat-east { top: 29%; left: 92%; }
  .rotating-rummy-game .card-table-scene.rummy-table-scene .center-play-area { top: 25%; left: 44%; width: 43%; bottom: 176px; }
  .rotating-rummy-game .card-table-scene.rummy-table-scene .local-player-hud { left: 66%; }
  .rotating-rummy-game .rummy-table-scene .physical-hand { left: 32%; }
  .rotating-rummy-game .hand-heading { padding-inline: 0; }
  .rotating-rummy-game .rummy-pile-zone { gap: 18px; }
}
