/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:        #0a0a0f;
  --bg2:       #111118;
  --bg3:       #18181f;
  --border:    #2a2a35;
  --gold:      #f0b429;
  --gold-dim:  #a07a1a;
  --green:     #22c55e;
  --red:       #ef4444;
  --blue:      #3b82f6;
  --purple:    #a855f7;
  --text:      #e8e8f0;
  --text-muted:#8888a0;
  --felt:      #0d2818;
  --felt2:     #112210;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(10,10,15,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--gold);
  letter-spacing: -0.02em;
}
.coin-icon { font-size: 1.4rem; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
  letter-spacing: 0.02em;
}
.nav-link:hover { color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--gold); }
.avatar-placeholder {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem;
}
.btn-logout {
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  transition: all 0.2s;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); }

.btn-discord {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #5865F2;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-discord:hover { background: #4752c4; }

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - 64px); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem 2rem;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240,180,41,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,180,41,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}
.orb-1 { width: 500px; height: 500px; background: var(--gold); top: -150px; right: -100px; }
.orb-2 { width: 400px; height: 400px; background: var(--green); bottom: -100px; left: -50px; }

.hero-content { text-align: center; position: relative; z-index: 1; max-width: 700px; }
.hero-badge {
  display: inline-block;
  background: rgba(240,180,41,0.1);
  border: 1px solid rgba(240,180,41,0.3);
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 1rem;
  border-radius: 99px;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}
.title-line { display: block; }
.accent { color: var(--gold); }
.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 5rem; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gold);
  color: #000;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  border: none;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.btn-primary:hover { background: #ffcc4d; transform: translateY(-1px); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

/* Feature cards */
.feature-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 900px;
  position: relative;
  z-index: 1;
}
@media (max-width: 700px) { .feature-cards { grid-template-columns: repeat(2, 1fr); } }
.feature-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
}
.feature-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 8px 32px rgba(240,180,41,0.1); }
.feature-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.feature-card h3 { font-family: 'Syne', sans-serif; font-size: 0.95rem; margin-bottom: 0.4rem; }
.feature-card p  { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header { padding: 2.5rem 2rem 1rem; max-width: 1100px; margin: 0 auto; }
.page-title { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 800; }
.page-sub   { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.9rem; }

/* ─── Dashboard ──────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 2rem 3rem;
}
@media (max-width: 640px) { .dashboard-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card-balance { grid-column: span 1; }
.balance-amount {
  font-family: 'Syne', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
}
.balance-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.card-stats { grid-column: span 1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat-item { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-val { font-size: 1rem; font-weight: 700; }
.positive { color: var(--green); }
.negative { color: var(--red); }

.card-flip { grid-column: span 1; }
.flip-area { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin: 1rem 0; }
.coin {
  width: 80px; height: 80px;
  font-size: 3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d080, #a07820);
  box-shadow: 0 4px 20px rgba(240,180,41,0.3), inset 0 -4px 8px rgba(0,0,0,0.3);
  transition: transform 0.3s;
  user-select: none;
}
.coin.spinning { animation: coinSpin 0.8s cubic-bezier(0.4,0,0.2,1) infinite; }
.coin.win-flash { animation: winPulse 0.5s ease; }
.coin.loss-flash { animation: lossPulse 0.5s ease; }
.coin.jackpot { animation: jackpotGlow 1.5s ease infinite; }
@keyframes coinSpin { 0%{transform:rotateY(0)} 100%{transform:rotateY(720deg)} }
@keyframes winPulse { 0%,100%{box-shadow:0 4px 20px rgba(240,180,41,0.3)} 50%{box-shadow:0 0 40px rgba(34,197,94,0.8)} }
@keyframes lossPulse { 0%,100%{box-shadow:0 4px 20px rgba(240,180,41,0.3)} 50%{box-shadow:0 0 40px rgba(239,68,68,0.8)} }
@keyframes jackpotGlow { 0%,100%{box-shadow:0 0 40px rgba(240,180,41,0.5)} 50%{box-shadow:0 0 80px rgba(240,180,41,1), 0 0 120px rgba(240,180,41,0.5)} }

.flip-result { min-height: 1.5rem; font-size: 0.9rem; font-weight: 700; transition: all 0.3s; }
.result-win    { color: var(--green); }
.result-loss   { color: var(--red); }
.result-jackpot{ color: var(--gold); font-size: 1.1rem; }
.result-neutral { color: var(--text-muted); }
.flip-controls { display: flex; gap: 0.75rem; }
.flip-odds { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.5rem; }

.card-actions { grid-column: span 1; }
.action-links { display: flex; flex-direction: column; gap: 0.5rem; }
.action-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.action-link:hover { background: var(--bg3); border-color: var(--border); }
.action-icon { font-size: 1.4rem; }
.action-name { font-size: 0.9rem; font-weight: 700; }
.action-desc { font-size: 0.75rem; color: var(--text-muted); }
.action-arrow { margin-left: auto; color: var(--text-muted); }

.amount-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 150px;
  transition: border-color 0.2s;
}
.amount-input:focus { outline: none; border-color: var(--gold); }
.amount-input.large { width: 200px; }

/* ─── Game Layout ────────────────────────────────────────────────────────── */
.game-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.game-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
}
.game-meta { display: flex; align-items: center; gap: 0.75rem; }
.phase-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.phase-betting  { border-color: var(--gold); color: var(--gold); background: rgba(240,180,41,0.1); }
.phase-playing  { border-color: var(--green); color: var(--green); background: rgba(34,197,94,0.1); }
.phase-resolving{ border-color: var(--purple); color: var(--purple); background: rgba(168,85,247,0.1); }
.phase-showdown { border-color: var(--gold); color: var(--gold); background: rgba(240,180,41,0.1); }
.phase-preflop,.phase-flop,.phase-turn,.phase-river { border-color: var(--green); color: var(--green); background: rgba(34,197,94,0.08); }

.timer-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  background: rgba(240,180,41,0.1);
  border: 1px solid rgba(240,180,41,0.3);
}
.timer-badge.hidden { display: none; }
.balance-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
}


/* ─── Felt Table ─────────────────────────────────────────────────────────── */
.table-felt {
  background: radial-gradient(ellipse at center, var(--felt2) 0%, var(--felt) 100%);
  border: 2px solid #1a3d28;
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-shadow: var(--shadow), inset 0 2px 4px rgba(255,255,255,0.03);
  position: relative;
  overflow: hidden;
}
.table-felt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.005) 10px, rgba(255,255,255,0.005) 11px);
  pointer-events: none;
}

.dealer-area, .hole-area, .board-area { position: relative; }
.area-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 0.75rem;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.playing-card {
  min-width: 52px;
  height: 72px;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.2);
  user-select: none;
  transition: transform 0.15s;
  animation: cardDeal 0.3s ease;
}
.playing-card.sm { min-width: 36px; height: 50px; font-size: 0.8rem; }
@keyframes cardDeal { from{transform:translateY(-20px) scale(0.8);opacity:0} to{transform:none;opacity:1} }
.red-card   { color: #c0392b; }
.black-card { color: #1a1a1a; }
.back-card  { background: linear-gradient(135deg, #1a2a8c 25%, #2a3ab0 50%, #1a2a8c 75%); color: #fff; font-size: 1.5rem; }

.hand-val, .hand-val-sm {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-top: 0.35rem;
}
.hand-val-sm { display: inline-block; }
.hand-val-sm.bust { color: var(--red); }
.hand-result {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-left: 0.5rem;
}

.board-placeholder { color: rgba(255,255,255,0.2); font-size: 0.85rem; font-style: italic; }

/* ─── Players row ────────────────────────────────────────────────────────── */
.players-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.player-area {
  flex: 1;
  min-width: 140px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.85rem;
  transition: all 0.2s;
}
.player-me     { border-color: rgba(240,180,41,0.4); background: rgba(240,180,41,0.06); }
.player-active { border-color: var(--green); box-shadow: 0 0 12px rgba(34,197,94,0.25); }
.player-folded { opacity: 0.4; }
.player-allin  { border-color: var(--purple); }

.player-name { font-size: 0.8rem; font-weight: 700; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bal  { font-size: 0.75rem; color: var(--gold); }
.player-bet  { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.player-hand { margin-top: 0.5rem; }
.hand-active { opacity: 1; }
.hand-info   { display: flex; align-items: center; margin-top: 0.3rem; flex-wrap: wrap; gap: 0.3rem; }

.card-row.mini { margin-top: 0.5rem; }

/* Poker specifics */
.poker-players .player-area { min-width: 120px; }
.board-area { display: flex; flex-direction: column; }
.cur-bet-display { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin-top: 0.4rem; }
.hole-area { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 1rem; }
.hole-card { transform-style: preserve-3d; }

.role-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.role-badge.dealer { background: rgba(255,255,255,0.2); color: #fff; }
.role-badge.sb     { background: rgba(240,180,41,0.3); color: var(--gold); }
.role-badge.bb     { background: rgba(59,130,246,0.3); color: var(--blue); }
.status-tag {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
}
.status-tag.folded { background: rgba(239,68,68,0.2); color: var(--red); }
.status-tag.allin  { background: rgba(168,85,247,0.2); color: var(--purple); }

/* ─── Summary Bar ────────────────────────────────────────────────────────── */
.summary-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}
.poker-summary { text-align: left; line-height: 1.8; }

/* ─── Controls ───────────────────────────────────────────────────────────── */
.controls-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.waiting-msg { color: var(--text-muted); font-size: 0.875rem; }

.btn-hit, .btn-stand, .btn-double, .btn-fold, .btn-check, .btn-call, .btn-raise {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.15s;
}
.btn-hit    { background: var(--blue); color: #fff; }
.btn-hit:hover    { background: #2563eb; }
.btn-stand  { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-stand:hover  { border-color: var(--gold); }
.btn-double { background: var(--gold); color: #000; }
.btn-double:hover { background: #ffcc4d; }
.btn-fold   { background: var(--red); color: #fff; }
.btn-fold:hover   { background: #dc2626; }
.btn-check  { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-check:hover  { border-color: var(--green); }
.btn-call   { background: var(--green); color: #000; }
.btn-call:hover   { background: #16a34a; }
.btn-raise  { background: var(--purple); color: #fff; }
.btn-raise:hover  { background: #9333ea; }
.raise-group { display: flex; gap: 0.5rem; align-items: center; }

/* ─── Leaderboard ────────────────────────────────────────────────────────── */
.leaderboard-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}
.leaderboard-table {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover  { background: var(--bg3); }
.lb-me         { background: rgba(240,180,41,0.07); }
.lb-rank       { min-width: 40px; font-size: 1.1rem; }
.lb-name       { flex: 1; font-size: 0.9rem; }
.lb-amount     { font-weight: 700; color: var(--gold); font-size: 0.9rem; }
.sc            { font-size: 0.75rem; opacity: 0.7; }
.lb-loading, .lb-empty { padding: 2rem; text-align: center; color: var(--text-muted); }
.lb-footer { font-size: 0.72rem; color: var(--text-muted); text-align: center; margin-top: 0.75rem; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 999;
  animation: toastIn 0.3s ease, toastOut 0.4s ease 3s forwards;
  max-width: 90vw;
  text-align: center;
}
.toast-error { background: var(--red); color: #fff; }
.toast-info  { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
@keyframes toastIn  { from{opacity:0;transform:translateX(-50%) translateY(20px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
@keyframes toastOut { to{opacity:0;transform:translateX(-50%) translateY(20px)} }

/* ─── Pot display ────────────────────────────────────────────────────────── */
#pot-display { font-size: 0.8rem; color: rgba(255,255,255,0.5); }
