/* ── Night Poker — Styles ─────────────────────────────────── */
:root {
  --bg:       #050308;
  --card-bg:  #0d0a1a;
  --felt:     #0a2318;
  --felt2:    #0c2b1e;
  --rim:      rgba(255,255,255,.07);
  --rim2:     rgba(255,255,255,.12);
  --ink:      #7c3aed;
  --glow:     #a78bfa;
  --green:    #00d68f;
  --gold:     #f5c518;
  --red:      #ef4444;
  --cyan:     #06b6d4;
  --text:     #f1f0f5;
  --text2:    #9ca3af;
  --muted:    #4b5563;
  --sans:     'Inter', system-ui, sans-serif;
  --mono:     'JetBrains Mono', 'Fira Code', monospace;
  --serif:    'Playfair Display', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Nav ─────────────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: rgba(5,3,8,.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--rim);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.nav-logo {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.nav-logo span { color: var(--glow); }
.nav-right { display: flex; align-items: center; gap: 10px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font-family: var(--sans); font-weight: 700;
  transition: all .15s; display: inline-flex;
  align-items: center; gap: 6px;
}
.btn-primary {
  background: var(--ink); color: #fff;
  padding: 10px 20px; font-size: 14px;
}
.btn-primary:hover { background: #6d28d9; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--rim2);
  color: var(--text2); padding: 9px 18px; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--glow); color: var(--glow); }
.btn-green {
  background: rgba(0,214,143,.15);
  border: 1px solid rgba(0,214,143,.35);
  color: var(--green); padding: 10px 20px; font-size: 14px;
}
.btn-green:hover { background: rgba(0,214,143,.25); }
.btn-red {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  color: var(--red); padding: 10px 20px; font-size: 14px;
}
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

/* ── Toast ───────────────────────────────────────────────── */
#toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--card-bg);
  border: 1px solid var(--rim2);
  border-radius: 10px; padding: 12px 18px;
  font-size: 13px; font-weight: 600;
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(0,214,143,.4); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,.4);  color: var(--red); }
.toast.info    { border-color: rgba(124,58,237,.4); color: var(--glow); }

@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes pulse {
  0%,100% { opacity: 1; } 50% { opacity: .4; }
}

/* ── Lobby ───────────────────────────────────────────────── */
.lobby {
  padding: 80px 24px 40px;
  max-width: 1100px; margin: 0 auto;
}
.lobby-hero {
  text-align: center;
  padding: 60px 0 48px;
}
.lobby-hero h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 400;
  letter-spacing: -.04em;
  line-height: 1.05;
  margin-bottom: 16px;
}
.lobby-hero h1 em { color: var(--green); font-style: normal; }
.lobby-hero p {
  color: var(--text2); font-size: 16px;
  line-height: 1.8; font-weight: 300;
  max-width: 480px; margin: 0 auto 32px;
}
.lobby-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,214,143,.08);
  border: 1px solid rgba(0,214,143,.2);
  border-radius: 100px; padding: 6px 16px;
  font-size: 11px; font-weight: 700;
  font-family: var(--mono);
  color: var(--green);
  letter-spacing: .5px;
  margin-bottom: 24px;
}
.lobby-zk-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

/* Table grid */
.tables-hdr {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.tables-hdr h2 { font-size: 18px; font-weight: 700; }
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-bottom: 40px;
}
.table-card {
  background: var(--card-bg);
  border: 1px solid var(--rim);
  border-radius: 16px; padding: 20px;
  cursor: pointer;
  transition: all .2s;
  position: relative; overflow: hidden;
}
.table-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}
.table-card:hover {
  border-color: rgba(0,214,143,.3);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,214,143,.08);
}
.tc-name {
  font-size: 15px; font-weight: 700; margin-bottom: 4px;
}
.tc-blind {
  font-size: 12px; color: var(--text2);
  font-family: var(--mono); margin-bottom: 16px;
}
.tc-seats {
  display: flex; gap: 6px; margin-bottom: 16px;
}
.tc-seat {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--rim2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.tc-seat.taken {
  background: rgba(124,58,237,.2);
  border-color: rgba(124,58,237,.4);
}
.tc-seat.you {
  background: rgba(0,214,143,.15);
  border-color: rgba(0,214,143,.4);
}
.tc-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
  font-family: var(--mono);
}
.tc-status {
  font-size: 10px; font-weight: 700;
  font-family: var(--mono);
  padding: 2px 8px; border-radius: 4px;
}
.tc-status.waiting {
  background: rgba(0,214,143,.1);
  color: var(--green);
}
.tc-status.playing {
  background: rgba(245,197,24,.1);
  color: var(--gold);
}

/* ── Poker Table ─────────────────────────────────────────── */
.table-page {
  padding-top: 56px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.table-topbar {
  background: rgba(5,3,8,.8);
  border-bottom: 1px solid var(--rim);
  padding: 10px 24px;
  display: flex; align-items: center;
  gap: 16px; flex-wrap: wrap;
}
.table-topbar-name {
  font-weight: 700; font-size: 14px;
}
.table-topbar-blind {
  font-size: 12px; color: var(--text2);
  font-family: var(--mono);
}
.table-topbar-pot {
  font-size: 13px; font-weight: 700;
  font-family: var(--mono); color: var(--gold);
}
.topbar-zk {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  font-family: var(--mono); color: var(--green);
  display: flex; align-items: center; gap: 5px;
}
.topbar-zk-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

/* Felt table */
.felt-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
}
.felt {
  width: min(800px, 100%);
  aspect-ratio: 16/9;
  background: radial-gradient(ellipse at center, var(--felt2) 0%, var(--felt) 60%, #061a10 100%);
  border-radius: 50%;
  border: 8px solid #2a1a08;
  box-shadow:
    0 0 0 4px #1a0e04,
    0 0 80px rgba(0,0,0,.8),
    inset 0 0 60px rgba(0,0,0,.4);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

/* Community cards in centre */
.community-area {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}
.community-cards {
  display: flex; gap: 8px;
}
.pot-display {
  font-size: 13px; font-weight: 700;
  font-family: var(--mono); color: var(--gold);
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(245,197,24,.2);
  border-radius: 8px; padding: 4px 14px;
}
.phase-badge {
  font-size: 10px; font-weight: 700;
  font-family: var(--mono); color: var(--text2);
  text-transform: uppercase; letter-spacing: 1px;
}

/* Playing card */
.card {
  width: 52px; height: 72px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  transition: transform .2s;
  flex-shrink: 0;
}
.card-face {
  background: #fff; color: #111;
  border: 1px solid rgba(0,0,0,.1);
}
.card-face.red { color: #dc2626; }
.card-face .rank {
  position: absolute; top: 4px; left: 5px;
  font-size: 11px; font-weight: 800; line-height: 1;
}
.card-face .suit {
  position: absolute; bottom: 4px; right: 5px;
  font-size: 14px; line-height: 1;
  transform: rotate(180deg);
}
.card-face .center-suit { font-size: 22px; }
.card-back {
  background: linear-gradient(135deg, #1a1040, #0d0820);
  border: 1px solid rgba(124,58,237,.3);
}
.card-back::after {
  content: '🌙';
  font-size: 20px;
  opacity: .6;
}
.card-hidden {
  background: linear-gradient(135deg, #1a1040, #0d0820);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--muted);
}

/* Player seats positioned around the oval */
.seat {
  position: absolute;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  width: 110px;
}
/* Positions: 6-handed around the oval */
.seat-0 { bottom: -60px; left: 50%; transform: translateX(-50%); }
.seat-1 { bottom: -40px; left: 5%; }
.seat-2 { top: -40px; left: 5%; }
.seat-3 { top: -60px; left: 50%; transform: translateX(-50%); }
.seat-4 { top: -40px; right: 5%; }
.seat-5 { bottom: -40px; right: 5%; }

.seat-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--rim2);
  background: var(--card-bg);
  display: flex; align-items: center;
  justify-content: center; font-size: 22px;
  position: relative;
  transition: border-color .2s;
}
.seat-avatar.active {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(245,197,24,.4);
}
.seat-avatar.folded { opacity: .4; filter: grayscale(1); }
.seat-avatar.you {
  border-color: var(--green);
}
.dealer-chip {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold); color: #000;
  font-size: 8px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.seat-name {
  font-size: 11px; font-weight: 700;
  color: var(--text);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100px;
}
.seat-stack {
  font-size: 11px; font-family: var(--mono);
  color: var(--green); font-weight: 700;
}
.seat-bet {
  font-size: 10px; font-family: var(--mono);
  color: var(--gold);
}
.seat-cards {
  display: flex; gap: 4px;
}
.seat-cards .card {
  width: 36px; height: 50px;
  font-size: 9px;
}
.seat-cards .card .rank { font-size: 8px; }
.seat-cards .card .suit { font-size: 10px; }
.seat-cards .card .center-suit { font-size: 14px; }
.seat-action-badge {
  font-size: 9px; font-weight: 700;
  font-family: var(--mono);
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase;
}
.sab-fold   { background: rgba(239,68,68,.15); color: var(--red); }
.sab-check  { background: rgba(156,163,175,.1); color: var(--text2); }
.sab-call   { background: rgba(6,182,212,.1);  color: var(--cyan); }
.sab-raise  { background: rgba(245,197,24,.12); color: var(--gold); }
.sab-allin  { background: rgba(239,68,68,.25); color: #f87171; }
.seat-folded { opacity: .45; pointer-events: none; }

/* ── Quick Deal banner ───────────────────────────────────────── */
.quick-deal-banner {
  background: linear-gradient(135deg, rgba(124,58,237,.1), rgba(6,182,212,.06));
  border: 1px solid rgba(124,58,237,.22);
  border-radius: 20px;
  padding: 36px 24px;
  text-align: center;
  margin-bottom: 32px;
}
.sab-allin  { background: rgba(239,68,68,.2);  color: #f87171; font-size: 8px; }

/* Hole cards (your hand) */
.your-hand {
  display: flex; gap: 8px;
  margin-top: 6px;
}
.your-hand .card {
  width: 52px; height: 72px;
}
.your-hand .card:hover { transform: translateY(-6px); }

/* Empty seat */
.seat-empty .seat-avatar {
  border-style: dashed;
  border-color: var(--muted);
  cursor: pointer;
  opacity: .5;
}
.seat-empty .seat-avatar:hover { opacity: 1; border-color: var(--green); }
.seat-empty .seat-name { color: var(--muted); font-weight: 400; }

/* ── ZK proof badge & commitment hash ───────────────────────── */
.zk-proof-badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--green); color: #000;
  font-size: 9px; font-weight: 800;
  font-family: var(--mono);
  padding: 2px 5px; border-radius: 6px;
  letter-spacing: .03em;
}
.seat-cards { position: relative; }

.commit-hash {
  font-size: 9px; font-family: var(--mono);
  color: var(--glow); opacity: .7;
  margin-top: 2px; margin-bottom: 2px;
  text-align: center; letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 120px;
}

/* ── Action bar ──────────────────────────────────────────── */
.action-bar {
  background: rgba(5,3,8,.95);
  border-top: 1px solid var(--rim);
  padding: 16px 24px;
  display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.action-bar.hidden { display: none; }

.raise-wrap {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 200px;
}
.raise-label {
  font-size: 10px; font-weight: 700;
  font-family: var(--mono); color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
}
.raise-slider {
  width: 100%; accent-color: var(--ink);
}
.raise-val {
  font-size: 13px; font-weight: 700;
  font-family: var(--mono); color: var(--gold);
}
.raise-presets {
  display: flex; gap: 6px;
}
.raise-preset {
  background: rgba(124,58,237,.1);
  border: 1px solid rgba(124,58,237,.25);
  border-radius: 6px; padding: 4px 10px;
  font-size: 11px; font-weight: 700;
  font-family: var(--mono); color: var(--glow);
  cursor: pointer;
  transition: all .15s;
}
.raise-preset:hover {
  background: rgba(124,58,237,.2);
  border-color: var(--ink);
}

/* Timer bar */
.timer-wrap {
  width: 100%; height: 3px;
  background: var(--rim);
  position: relative; overflow: hidden;
}
.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--red));
  transition: width 1s linear;
}

/* ── ZK proof modal ──────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500; align-items: center; justify-content: center;
}
.overlay.open { display: flex; }
.modal {
  background: #0f0c1e;
  border: 1px solid rgba(124,58,237,.3);
  border-radius: 20px; padding: 28px;
  width: 480px; max-width: 95vw;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
}
.modal-title {
  font-size: 16px; font-weight: 800;
  margin-bottom: 4px;
}
.modal-sub {
  font-size: 12px; color: var(--text2);
  font-family: var(--mono); margin-bottom: 20px;
}
.modal-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 18px; float: right;
  margin-top: -4px;
}

/* Create table form */
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 11px; font-weight: 700;
  font-family: var(--mono); color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  display: block; margin-bottom: 6px;
}
.form-input {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--rim2);
  border-radius: 10px; padding: 10px 14px;
  color: var(--text); font-size: 14px;
  font-family: var(--sans);
  outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: var(--ink); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ZK proof status */
.zk-status {
  background: rgba(124,58,237,.06);
  border: 1px solid rgba(124,58,237,.2);
  border-radius: 12px; padding: 14px 16px;
  margin-top: 16px;
}
.zk-status-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-family: var(--mono);
}
.zk-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}
.zk-dot.pending { background: var(--gold); }
.zk-dot.error   { background: var(--red); animation: none; }

/* ── Wallet connect ──────────────────────────────────────── */
.wc-modal {
  text-align: center;
}
.wc-icon { font-size: 48px; margin-bottom: 16px; }
.wc-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.wc-sub { font-size: 13px; color: var(--text2); margin-bottom: 24px; line-height: 1.7; }
.wc-benefits {
  display: flex; gap: 10px;
  margin-bottom: 24px;
}
.wc-benefit {
  flex: 1;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--rim);
  border-radius: 10px; padding: 12px;
  font-size: 11px; color: var(--text2);
  line-height: 1.6;
}
.wc-benefit strong { display: block; color: var(--text); margin-bottom: 2px; }

/* ── Showdown reveal ─────────────────────────────────────── */
.showdown-area {
  display: flex; flex-wrap: wrap; gap: 20px;
  justify-content: center; padding: 20px 0;
}
.sd-player {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}
.sd-avatar { font-size: 32px; }
.sd-name { font-size: 12px; font-weight: 700; }
.sd-cards { display: flex; gap: 6px; }
.sd-winner-badge {
  background: rgba(245,197,24,.15);
  border: 1px solid rgba(245,197,24,.35);
  border-radius: 6px; padding: 3px 10px;
  font-size: 11px; font-weight: 700;
  color: var(--gold); font-family: var(--mono);
}

/* ── Stats strip ─────────────────────────────────────────── */
.stats-strip {
  display: flex; gap: 24px;
  padding: 12px 24px;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--rim);
  flex-wrap: wrap;
}
.stat-cell { display: flex; flex-direction: column; gap: 2px; }
.stat-val {
  font-size: 13px; font-weight: 700;
  font-family: var(--mono); color: var(--text);
}
.stat-lbl {
  font-size: 10px; color: var(--muted);
  font-family: var(--mono); text-transform: uppercase;
  letter-spacing: .6px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .felt { border-radius: 40%; }
  .seat { width: 80px; }
  .seat-avatar { width: 36px; height: 36px; font-size: 16px; }
  .card { width: 40px; height: 56px; }
  .action-bar { padding: 12px 16px; }
  .raise-wrap { min-width: 140px; }
  .wc-benefits { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
}
