/* ============================================================
   GameHub design system — "midnight card room"
   Self-hosted type: Cinzel (display) + Inter (UI)
   ============================================================ */

@font-face {
  font-family: 'Cinzel'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/cinzel-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/cinzel-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/inter-700.woff2') format('woff2');
}

:root {
  --bg-0: #0a0e1d;
  --bg-1: #101730;
  --felt: #143528;
  --panel: rgba(17, 23, 46, 0.62);
  --panel-solid: #121936;
  --glass-edge: rgba(255, 255, 255, 0.08);
  --gold: #d9b25f;
  --gold-bright: #f0cd82;
  --gold-faint: rgba(217, 178, 95, 0.28);
  --ink: #e9edfa;
  --ink-dim: #99a3c8;
  --ink-faint: #6d789c;
  --accent: #7d9aff;
  --accent-2: #34d8ac;
  --danger: #ff5d73;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --font-display: 'Cinzel', Georgia, serif;
  --font-ui: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 640px at 75% -12%, rgba(52, 72, 148, 0.35) 0%, transparent 60%),
    radial-gradient(900px 620px at -5% 105%, rgba(24, 66, 52, 0.5) 0%, transparent 55%),
    linear-gradient(165deg, var(--bg-0) 0%, var(--bg-1) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.045em; }
h3 {
  margin: 0 0 0.75rem;
  color: var(--gold);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* slim, quiet scrollbars everywhere */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.16) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); }

/* ---------- floating background cards ---------- */
#bg-scene {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  perspective: 900px; overflow: hidden;
}
.floating-card {
  position: absolute; width: 88px; height: 128px; border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(48, 66, 128, 0.5) 0%, rgba(24, 33, 70, 0.5) 65%);
  border: 1px solid rgba(150, 170, 255, 0.14);
  box-shadow: 0 24px 50px rgba(0,0,0,0.4);
  opacity: 0.32;
  animation: drift 30s ease-in-out infinite;
}
.fc-1 { top: 12%; left: 6%;  animation-delay: 0s;   transform: rotate(-14deg); }
.fc-2 { top: 65%; left: 12%; animation-delay: -6s;  transform: rotate(9deg);  width: 68px; height: 100px; }
.fc-3 { top: 20%; right: 9%; animation-delay: -12s; transform: rotate(18deg); }
.fc-4 { top: 72%; right: 16%;animation-delay: -18s; transform: rotate(-7deg); width: 60px; height: 90px; }
.fc-5 { top: 45%; left: 48%; animation-delay: -9s;  transform: rotate(3deg);  opacity: 0.16; }
@keyframes drift {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  25% { translate: 12px -22px; rotate: 4deg; }
  50% { translate: -10px -8px; rotate: -3deg; }
  75% { translate: 8px 14px; rotate: 2deg; }
}

.view { position: relative; z-index: 1; }

/* ---------- login ---------- */
.login-stage {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  perspective: 1100px;
}
.login-card {
  width: min(400px, 92vw);
  background: linear-gradient(170deg, rgba(23, 30, 58, 0.85), rgba(13, 18, 38, 0.9));
  border: 1px solid var(--glass-edge);
  border-radius: 22px;
  padding: 2.6rem 2.4rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(18px);
  text-align: center;
  transform-style: preserve-3d;
  animation: card-enter 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}
@keyframes card-enter {
  from { opacity: 0; transform: rotateX(28deg) translateY(60px) scale(0.92); }
  to   { opacity: 1; transform: rotateX(0) translateY(0) scale(1); }
}
.tilt3d { transition: transform 0.15s ease-out; will-change: transform; }
.logo-mark { font-size: 3rem; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.5)); }
.login-card h1 {
  margin: 0.5rem 0 0.15rem; font-size: 1.9rem; color: var(--gold-bright);
  letter-spacing: 0.12em;
}
.tagline { color: var(--ink-dim); margin: 0 0 1.7rem; font-size: 0.9rem; }

form label {
  display: block; text-align: left; margin: 0.85rem 0 0.3rem;
  color: var(--ink-dim); font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
}
input, select {
  width: 100%; padding: 0.7rem 0.9rem;
  background: rgba(6, 9, 22, 0.6);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  border-color: rgba(217, 178, 95, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 178, 95, 0.12);
}
input::placeholder { color: var(--ink-faint); }

/* ---------- buttons ---------- */
.btn {
  cursor: pointer;
  font-family: var(--font-ui); font-weight: 500; font-size: 0.9rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  padding: 0.55rem 1.05rem; border-radius: 10px;
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s, border-color 0.14s;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.btn-primary {
  background: linear-gradient(180deg, #f2cf82 0%, #d3a344 100%);
  color: #241a05; font-weight: 600; border: none;
  box-shadow: 0 3px 12px rgba(211, 163, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #ffdf96 0%, #e2b254 100%);
  box-shadow: 0 6px 20px rgba(211, 163, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-danger {
  background: rgba(255, 93, 115, 0.1); border-color: rgba(255, 93, 115, 0.35); color: #ff9daa;
}
.btn-danger:hover { background: rgba(255, 93, 115, 0.2); border-color: rgba(255, 93, 115, 0.5); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-big { width: 100%; margin-top: 1.5rem; padding: 0.85rem; font-size: 1rem; letter-spacing: 0.04em; }
.btn-nav { border-radius: 999px; padding: 0.45rem 1.2rem; color: var(--ink-dim); }
.btn-nav.active {
  background: rgba(217, 178, 95, 0.12); border-color: var(--gold-faint); color: var(--gold-bright);
}

.error { color: var(--danger); margin-top: 0.8rem; font-size: 0.85rem; }
.hint { color: var(--ink-faint); font-size: 0.8rem; line-height: 1.5; }
code {
  background: rgba(0,0,0,0.4); padding: 0.1em 0.4em; border-radius: 5px;
  font-size: 0.85em; color: var(--gold-bright);
}

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.4rem;
  padding: 0.75rem 1.6rem;
  background: rgba(7, 10, 22, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  color: var(--gold-bright); letter-spacing: 0.12em;
}
.version-badge { font-size: 0.6rem; color: var(--ink-faint); vertical-align: super; font-family: var(--font-ui); letter-spacing: 0; }
.topbar nav { display: flex; gap: 0.5rem; flex: 1; }
.userbox { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-dim); font-size: 0.88rem; white-space: nowrap; }
@media (max-width: 640px) {
  .topbar { gap: 0.6rem; padding: 0.55rem 0.8rem; }
  .brand { font-size: 1rem; letter-spacing: 0.08em; }
  .btn-nav { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
  .userbox { font-size: 0.78rem; gap: 0.35rem; }
  .userbox .btn { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
  .page-title { font-size: 1.2rem; }
}

.conn-banner {
  position: sticky; top: 0; z-index: 200; text-align: center;
  background: linear-gradient(135deg, #7a1f30, #5a1622); color: #ffd9de;
  padding: 0.45rem 1rem; font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 93, 115, 0.5);
}

.page { max-width: 1200px; margin: 0 auto; padding: 1.8rem 1.5rem 3rem; }
.page-title { color: var(--gold-bright); margin: 0.4rem 0 1.2rem; font-size: 1.5rem; }

/* The game room uses the whole screen — the table is the star. */
#page-room { max-width: 1780px; padding: 0.9rem 1.2rem 1.4rem; }
@media (max-width: 700px) {
  .page { padding: 1rem 0.7rem 2rem; }
  #page-room { padding: 0.5rem 0.5rem 1rem; }
}

/* ---------- game shelf (3D cards) ---------- */
.game-shelf {
  display: flex; gap: 1.8rem; flex-wrap: wrap;
  perspective: 1200px; padding: 0.8rem 0 1.8rem;
}
.game-card {
  width: 212px; height: 292px; position: relative;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.1);
  cursor: pointer;
}
.game-card:hover { transform: rotateY(8deg) rotateX(5deg) translateY(-10px) scale(1.03); }
.game-card .face {
  position: absolute; inset: 0; border-radius: 18px; padding: 1.25rem 1.15rem 1.1rem;
  display: flex; flex-direction: column;
  background:
    radial-gradient(150px 100px at 82% -4%, rgba(217, 178, 95, 0.16), transparent 65%),
    linear-gradient(168deg, #1d2547 0%, #141b38 55%, #0f152b 100%);
  border: 1px solid rgba(217, 178, 95, 0.32);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
}
.game-card .face::after {
  content: ""; position: absolute; inset: 9px; border-radius: 12px;
  border: 1px solid rgba(217, 178, 95, 0.14); pointer-events: none;
}
.game-card:hover .face { border-color: rgba(240, 205, 130, 0.55); }
.game-card .g-icon { font-size: 2.4rem; }
.game-card .g-name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.12rem;
  color: var(--gold-bright); margin: 0.6rem 0 0.3rem; letter-spacing: 0.05em; line-height: 1.25;
}
.game-card .g-tag { color: var(--ink-dim); font-size: 0.78rem; line-height: 1.5; flex: 1; }
.game-card .g-players {
  font-size: 0.68rem; font-weight: 600; color: var(--accent-2);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.8rem;
}
.game-card .g-actions { display: flex; gap: 0.5rem; position: relative; z-index: 3; }
.game-card .g-actions .btn { flex: 1; padding: 0.5rem 0.4rem; font-size: 0.82rem; touch-action: manipulation; }

/* ---------- lobby panels ---------- */
.lobby-columns { display: grid; gap: 1.2rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 14px 36px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
}
.room-list { display: flex; flex-direction: column; gap: 0.5rem; min-height: 60px; }
.room-row {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.65rem 0.9rem; border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s, border-color 0.15s;
}
.room-row:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); }
.room-row .r-game { color: var(--gold-bright); font-weight: 600; font-size: 0.92rem; }
.room-row .r-meta { color: var(--ink-dim); font-size: 0.82rem; flex: 1; letter-spacing: 0.03em; }
.room-row .r-status {
  font-size: 0.68rem; font-weight: 600; padding: 0.18rem 0.65rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.r-status.lobby { background: rgba(52, 216, 172, 0.12); color: var(--accent-2); }
.r-status.playing { background: rgba(217, 178, 95, 0.12); color: var(--gold-bright); }
.join-by-code { display: flex; gap: 0.5rem; margin-top: 1rem; }
.join-by-code input { text-transform: uppercase; letter-spacing: 0.25em; width: 9.5em; font-weight: 600; }

/* ---------- room ---------- */
.room-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; }
.room-code-badge { color: var(--ink-dim); font-size: 0.85rem; }
.room-code-badge strong {
  color: var(--accent-2); letter-spacing: 0.3em; font-size: 1.05rem; font-weight: 600;
}
.room-actions { display: flex; gap: 0.6rem; }
.room-body { display: grid; grid-template-columns: 1fr minmax(240px, 300px); gap: 1.2rem; margin-top: 0.8rem; }
@media (max-width: 900px) { .room-body { grid-template-columns: 1fr; gap: 0.8rem; } }

/* ---------- the table ---------- */
.game-area {
  height: clamp(540px, calc(100dvh - 215px), 1250px);
  border-radius: 30px; position: relative;
  background:
    radial-gradient(ellipse 105% 65% at 50% 14%, rgba(255, 255, 255, 0.075), transparent 55%),
    repeating-radial-gradient(ellipse at 50% 44%, transparent 0 90px, rgba(0, 0, 0, 0.045) 90px 92px),
    radial-gradient(ellipse at 50% 44%, #1f5f49 0%, #1a4e3c 42%, #123b2d 70%, #0c2d22 100%);
  box-shadow:
    inset 0 0 0 1px rgba(240, 205, 130, 0.4),
    inset 0 0 0 12px #2c2012,
    inset 0 0 0 13px rgba(240, 205, 130, 0.22),
    inset 0 30px 70px rgba(0, 0, 0, 0.3),
    inset 0 0 150px rgba(0, 0, 0, 0.5),
    0 34px 80px rgba(0, 0, 0, 0.55);
  perspective: 1400px;
  overflow: hidden;
}
.game-area::after {
  content: "G A M E H U B";
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2.4rem); letter-spacing: 0.6em;
  color: rgba(255, 255, 255, 0.04);
  pointer-events: none; user-select: none; white-space: nowrap;
}
/* Small screens: the table sizes itself to its contents. A fixed height forces
   rows to overlap once Custody / prompts appear. min-height uses vh (not dvh)
   so the on-screen keyboard does not resize the table and shove the chat box
   out from under the user's finger. */
@media (max-width: 860px) {
  .game-area { height: auto; min-height: clamp(420px, 62vh, 760px); }
}
@media (max-width: 700px) {
  .game-area {
    border-radius: 18px;
    box-shadow:
      inset 0 0 0 1px rgba(240, 205, 130, 0.4),
      inset 0 0 0 7px #2c2012,
      inset 0 0 0 8px rgba(240, 205, 130, 0.22),
      inset 0 0 100px rgba(0, 0, 0, 0.5),
      0 20px 50px rgba(0, 0, 0, 0.5);
  }
  .room-header { gap: 0.4rem; }
  .room-actions .btn { padding: 0.45rem 0.7rem; font-size: 0.82rem; }
}

/* seat ring: players around the table (up to 20 seats) */
.seat-ring { position: absolute; inset: 0; }
.seat {
  position: absolute; width: 92px; text-align: center;
  transform: translate(-50%, -50%);
}
.seat .avatar {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-size: 1rem;
  background: linear-gradient(150deg, #33497f, #1d2850);
  border: 1px solid rgba(240, 205, 130, 0.55);
  box-shadow: 0 8px 20px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
}
.seat.offline .avatar { filter: grayscale(1) brightness(0.55); }
.seat .s-name {
  margin-top: 0.35rem; font-size: 0.72rem; font-weight: 500; color: var(--ink);
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px; padding: 0.12rem 0.55rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92px;
  backdrop-filter: blur(6px);
}
.seat .s-badge { font-size: 0.62rem; color: var(--gold-bright); letter-spacing: 0.06em; margin-top: 2px; }

.table-msg {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: rgba(238, 242, 255, 0.7); text-align: center; font-family: var(--font-display);
  font-size: 1.05rem; letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7); padding: 0 3rem;
}

/* ---------- side panel ---------- */
.side-panel { display: flex; flex-direction: column; gap: 1rem; }
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.42rem 0.2rem; border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.88rem;
}
.player-list li:last-child { border-bottom: none; }
.player-list .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 6px rgba(52,216,172,0.6); }
.player-list .offline .dot { background: #555e77; box-shadow: none; }
.player-list .host-star { color: var(--gold); font-size: 0.8rem; }
.player-list .kick { margin-left: auto; color: var(--ink-faint); }
.player-list .kick:hover { color: var(--danger); }

.chat-panel { display: flex; flex-direction: column; min-height: 260px; scroll-margin-top: 4rem; }

/* Phone-only jump-to-chat button with an unread badge. */
#chat-fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 90;
  width: 52px; height: 52px; border-radius: 50%;
  display: none; place-items: center;
  font-size: 1.4rem; cursor: pointer;
  background: linear-gradient(180deg, #f2cf82 0%, #d3a344 100%);
  color: #241a05; border: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.5);
}
#chat-fab:active { transform: scale(0.94); }
.chat-fab-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-family: var(--font-ui); font-size: 0.7rem; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--bg-0);
}
@media (max-width: 860px) {
  #chat-fab:not([hidden]) { display: grid; }
}
.chat-log {
  flex: 1; overflow-y: auto; max-height: 240px; font-size: 0.84rem;
  display: flex; flex-direction: column; gap: 0.3rem; padding: 0.3rem 0;
  line-height: 1.45;
}
.chat-log .c-from { color: var(--accent-2); font-weight: 600; }
#chat-form { display: flex; gap: 0.4rem; margin-top: 0.6rem; }

/* ---------- admin ---------- */
.admin-grid { display: grid; grid-template-columns: 320px 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 1000px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-grid form label { margin-bottom: 0.6rem; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th {
  text-align: left; color: var(--ink-faint); font-weight: 600; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--glass-edge);
}
.admin-table td { padding: 0.5rem 0.55rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.admin-table .btn { padding: 0.28rem 0.65rem; font-size: 0.76rem; }
.badge {
  padding: 0.14rem 0.55rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.badge.admin { background: rgba(217, 178, 95, 0.14); color: var(--gold-bright); }
.badge.player { background: rgba(125, 154, 255, 0.13); color: var(--accent); }
.badge.on { background: rgba(52, 216, 172, 0.13); color: var(--accent-2); }
.badge.off { background: rgba(255, 93, 115, 0.13); color: var(--danger); }
.game-toggle-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem 0; font-size: 0.9rem; }
.game-toggle-row .g-title { flex: 1; }

/* ---------- modals & toasts ---------- */
.modal {
  border: 1px solid rgba(217, 178, 95, 0.3); border-radius: 18px;
  background: linear-gradient(170deg, rgba(21, 28, 55, 0.96), rgba(12, 16, 33, 0.97));
  color: var(--ink); padding: 1.5rem 1.7rem;
  width: min(760px, 94vw); max-height: 86vh;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(18px);
}
.modal::backdrop { background: rgba(3, 5, 12, 0.72); backdrop-filter: blur(5px); }
.modal-small { width: min(420px, 94vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.modal-head h2 {
  margin: 0; color: var(--gold-bright); font-size: 1.15rem; letter-spacing: 0.08em;
}
.rules-body { overflow-y: auto; max-height: 64vh; line-height: 1.65; font-size: 0.92rem; color: #d6dcf2; }
.rules-body h3 { margin-top: 1.4rem; font-size: 0.75rem; }
.rules-body h4 { color: var(--gold); font-family: var(--font-ui); font-size: 0.9rem; }
.rules-body strong { color: var(--ink); }
.rules-body table { border-collapse: collapse; margin: 0.7rem 0; font-size: 0.86rem; }
.rules-body td, .rules-body th { border: 1px solid rgba(255,255,255,0.1); padding: 0.4rem 0.65rem; }
.rules-body th { color: var(--ink-faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; }

#toast-stack { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 100; }
.toast {
  background: rgba(15, 20, 40, 0.92); border: 1px solid var(--glass-edge);
  border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 0.7rem 1rem; box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: toast-in 0.25s ease-out;
  max-width: 320px; font-size: 0.88rem; line-height: 1.4;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--accent-2); }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }

/* ---------- generic playing card (for game clients) ---------- */
.pcard {
  width: 110px; height: 160px; border-radius: 12px; position: relative;
  transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(0.3, 0.9, 0.4, 1.1);
  cursor: pointer;
}
.pcard .p-face, .pcard .p-back {
  position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
}
.pcard .p-face {
  background: linear-gradient(160deg, #f8f3e4, #e5dcc4);
  color: #241a05; border: 1px solid #b3a478; padding: 0.5rem; text-align: center;
}
.pcard .p-back {
  background: linear-gradient(135deg, #2a3a72, #1b2650),
              repeating-linear-gradient(45deg, transparent 0 7px, rgba(255,255,255,0.05) 7px 14px);
  border: 1px solid rgba(140, 160, 255, 0.4);
  transform: rotateY(180deg);
}
.pcard.facedown .p-face { transform: rotateY(180deg); }
.pcard.facedown .p-back { transform: rotateY(0); }
.pcard:hover { transform: translateY(-10px) rotateX(6deg); }
