/* ============================================================
   NEON CASINO 3D - Design System
   Dark + Neon + Gold, Futuristic Casino Theme
   ============================================================ */

:root {
  --bg-void: #060810;
  --bg-deep: #0a0e1a;
  --bg-surface: #111726;
  --bg-surface-2: #161d30;
  --bg-card: #1a2236;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 229, 255, 0.35);

  --neon-cyan: #00e5ff;
  --neon-cyan-soft: rgba(0, 229, 255, 0.5);
  --neon-magenta: #ff2fd0;
  --neon-purple: #7b2ff7;
  --neon-green: #00ffa3;
  --neon-red: #ff3860;

  --gold: #ffd166;
  --gold-deep: #e8a53d;
  --gold-glow: rgba(255, 209, 102, 0.45);

  --text-primary: #f4f6ff;
  --text-secondary: #a7b0c9;
  --text-dim: #6b7392;

  --felt-green: #0a3d2e;
  --felt-green-2: #0f5c44;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  --shadow-elevate: 0 10px 40px rgba(0, 0, 0, 0.55);
  --shadow-glow-cyan: 0 0 24px rgba(0, 229, 255, 0.35);
  --shadow-glow-gold: 0 0 24px rgba(255, 209, 102, 0.4);

  --font-display: 'Orbitron', 'Noto Sans JP', sans-serif;
  --font-body: 'Rajdhani', 'Noto Sans JP', sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(123, 47, 247, 0.18), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(0, 229, 255, 0.12), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 47, 208, 0.10), transparent 50%),
    var(--bg-void);
  min-height: 100vh;
  min-height: 100dvh;
}

#app-root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
button { font-family: var(--font-body); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0, 229, 255, 0.3); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Utility
   ============================================================ */
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-gold { color: var(--gold); }
.text-cyan { color: var(--neon-cyan); }
.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }

.glass-panel {
  background: linear-gradient(155deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-elevate);
}

.neon-border {
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 0 1px rgba(0,229,255,0.08) inset, var(--shadow-glow-cyan);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s cubic-bezier(.2,.9,.3,1.3), box-shadow 0.25s ease, filter 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  min-height: 48px;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.4); }

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), #0084ff);
  color: #001420;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(0, 229, 255, 0.6), inset 0 1px 0 rgba(255,255,255,0.4); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #241300;
  box-shadow: 0 4px 20px rgba(255, 209, 102, 0.4), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-gold:hover { box-shadow: 0 6px 28px rgba(255, 209, 102, 0.55); }

.btn-danger {
  background: linear-gradient(135deg, var(--neon-red), #c4004e);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 56, 96, 0.4);
}

.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); border-color: var(--border-glow); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 12px; min-height: 38px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }

.btn-icon {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-subtle);
  color: var(--text-primary); font-size: 16px;
}

/* ============================================================
   Inputs
   ============================================================ */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.field input, .field select {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.15);
}
.field-error { color: var(--neon-red); font-size: 12px; margin-top: 6px; }

/* ============================================================
   Toast
   ============================================================ */
#toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  right: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 360px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-elevate);
  animation: toastIn 0.3s cubic-bezier(.2,.9,.3,1.3);
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(12px);
}
.toast.success { background: linear-gradient(135deg, rgba(0,255,163,0.25), rgba(0,255,163,0.08)); border: 1px solid rgba(0,255,163,0.4); }
.toast.error { background: linear-gradient(135deg, rgba(255,56,96,0.3), rgba(255,56,96,0.1)); border: 1px solid rgba(255,56,96,0.5); }
.toast.info { background: linear-gradient(135deg, rgba(0,229,255,0.25), rgba(0,229,255,0.08)); border: 1px solid rgba(0,229,255,0.4); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(0,229,255,0.15);
  border-top-color: var(--neon-cyan);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-void);
  z-index: 10000;
  flex-direction: column;
  gap: 20px;
}
.page-loader .logo-loading {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-cyan), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.06em;
  animation: pulseGlow 1.6s ease-in-out infinite;
}
@keyframes pulseGlow { 0%,100% { filter: drop-shadow(0 0 6px rgba(0,229,255,0.4)); } 50% { filter: drop-shadow(0 0 20px rgba(255,209,102,0.6)); } }

/* ============================================================
   Auth Screens
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  position: relative;
  overflow: hidden;
}
.auth-bg-glow {
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,229,255,0.15), transparent 70%);
  border-radius: 50%;
  top: -200px; left: -150px;
  pointer-events: none;
  animation: floatSlow 8s ease-in-out infinite;
}
.auth-bg-glow.gold {
  background: radial-gradient(circle, rgba(255,209,102,0.13), transparent 70%);
  top: auto; bottom: -250px; right: -200px; left: auto;
  animation-delay: -3s;
}
@keyframes floatSlow { 0%,100% { transform: translate(0,0); } 50% { transform: translate(30px,-20px); } }

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 28px;
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .icon {
  font-size: 46px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(255,209,102,0.5));
}
.auth-logo h1 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--neon-cyan), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-logo p {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-top: 4px;
  text-transform: uppercase;
}
.auth-tabs {
  display: flex;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-display);
}
.auth-tab.active {
  background: linear-gradient(135deg, var(--neon-cyan), #0084ff);
  color: #001420;
  box-shadow: 0 2px 12px rgba(0,229,255,0.4);
}
.auth-footer-note {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
}
.bonus-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(255,209,102,0.15), rgba(255,209,102,0.03));
  border: 1px solid rgba(255,209,102,0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 12px;
}
.bonus-banner .fa-gift { color: var(--gold); font-size: 20px; }

/* ============================================================
   App Shell / Header
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: rgba(6, 8, 16, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.brand .icon { font-size: 20px; filter: drop-shadow(0 0 10px rgba(255,209,102,0.5)); }
.brand-text {
  background: linear-gradient(135deg, var(--neon-cyan), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.header-right { display: flex; align-items: center; gap: 8px; }

.chip-display {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255,209,102,0.18), rgba(255,209,102,0.05));
  border: 1px solid rgba(255,209,102,0.35);
  border-radius: 20px;
  padding: 7px 12px 7px 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
  cursor: pointer;
  transition: transform 0.15s ease;
  white-space: nowrap;
}
.chip-display:active { transform: scale(0.95); }
.chip-display .chip-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2cc, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 0 8px rgba(255,209,102,0.6), inset 0 -2px 3px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.chip-display.updating { animation: chipPulse 0.5s ease; }
@keyframes chipPulse { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

.avatar-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-magenta));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  padding-bottom: calc(70px + var(--safe-bottom));
  position: relative;
}

/* ============================================================
   Bottom Navigation (Mobile-first)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  background: rgba(8, 11, 20, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 4px calc(6px + var(--safe-bottom));
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
  border-radius: 10px;
}
.nav-item i { font-size: 18px; }
.nav-item.active { color: var(--neon-cyan); }
.nav-item.active i { filter: drop-shadow(0 0 8px rgba(0,229,255,0.6)); }
.nav-item:active { transform: scale(0.92); }

/* ============================================================
   Lobby
   ============================================================ */
.lobby-container { padding: 16px 14px 8px; max-width: 900px; margin: 0 auto; }
.lobby-hero {
  border-radius: var(--radius-xl);
  padding: 26px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(123,47,247,0.25), rgba(0,229,255,0.12));
  border: 1px solid var(--border-subtle);
}
.lobby-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,209,102,0.25), transparent 55%);
}
.lobby-hero-content { position: relative; z-index: 1; }
.lobby-hero h2 {
  font-size: 20px; margin-bottom: 6px;
  background: linear-gradient(135deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lobby-hero p { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 22px 4px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title i { color: var(--neon-cyan); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .game-grid { grid-template-columns: repeat(4, 1fr); }
}

.game-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: transform 0.25s cubic-bezier(.2,.9,.3,1.3), box-shadow 0.25s ease;
  perspective: 600px;
}
.game-card:active { transform: scale(0.96); }
.game-card-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  transition: transform 0.4s ease;
}
.game-card:hover .game-card-bg { transform: scale(1.08) rotateY(8deg); }
.game-card.blackjack .game-card-bg { background: linear-gradient(160deg, #1a3d2e, #0a1f18); }
.game-card.baccarat .game-card-bg { background: linear-gradient(160deg, #3d1a2e, #1f0a18); }
.game-card.roulette .game-card-bg { background: linear-gradient(160deg, #1a2a3d, #0a121f); }
.game-card.poker .game-card-bg { background: linear-gradient(160deg, #3d2e1a, #1f180a); }
.game-card-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
}
.game-card-info h3 { font-size: 13px; font-weight: 700; color: #fff; }
.game-card-info span { font-size: 10px; color: var(--text-secondary); }
.game-card-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,209,102,0.9);
  color: #241300;
  font-size: 9px; font-weight: 800;
  padding: 3px 8px; border-radius: 10px;
  letter-spacing: 0.03em;
}
.game-card-glow {
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.stat-box {
  padding: 14px 8px;
  text-align: center;
  border-radius: var(--radius-md);
}
.stat-box .val { font-family: var(--font-display); font-size: 17px; font-weight: 800; color: var(--gold); }
.stat-box .lbl { font-size: 10px; color: var(--text-dim); margin-top: 2px; letter-spacing: 0.04em; }

/* ============================================================
   Generic Panels / Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  width: 100%; max-width: 400px;
  padding: 24px 20px;
  max-height: 88vh;
  overflow-y: auto;
  animation: modalPop 0.28s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes modalPop { from { transform: scale(0.85) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); }

.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.list-row:last-child { border-bottom: none; }
.list-row .amount.pos { color: var(--neon-green); font-weight: 700; }
.list-row .amount.neg { color: var(--neon-red); font-weight: 700; }

/* ============================================================
   Game Table Common
   ============================================================ */
.game-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}
.game-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 12px 8px;
  background: rgba(6,8,16,0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  position: relative;
}
.game-title-tag {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}
.game-table-area {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px 10px calc(10px + var(--safe-bottom));
  min-height: 0;
}
.felt-surface {
  position: absolute; inset: 8px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(160deg, var(--felt-green-2), var(--felt-green));
  border: 6px solid #1a1108;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6), inset 0 0 60px rgba(0,0,0,0.4);
  z-index: 0;
}
.felt-surface.blue {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.06), transparent 60%), linear-gradient(160deg, #123a5c, #0a1f38);
}
.felt-surface.purple {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.06), transparent 60%), linear-gradient(160deg, #3a1258, #1f0a38);
}
.table-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chip-tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-tray::-webkit-scrollbar { display: none; }
.poker-chip {
  width: 52px; height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s cubic-bezier(.2,.9,.3,1.4);
  border: 3px dashed rgba(255,255,255,0.35);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 6px 12px rgba(0,0,0,0.4);
}
.poker-chip:active { transform: translateY(3px) scale(0.94); box-shadow: 0 1px 0 rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.4); }
.poker-chip.selected { transform: translateY(-4px) scale(1.08); box-shadow: 0 0 0 3px #fff, 0 8px 16px rgba(0,0,0,0.5); }
.poker-chip[data-val="10"] { background: radial-gradient(circle at 35% 30%, #6ec6ff, #1565c0); }
.poker-chip[data-val="50"] { background: radial-gradient(circle at 35% 30%, #ff8a8a, #c62828); }
.poker-chip[data-val="100"] { background: radial-gradient(circle at 35% 30%, #8affc1, #1e7d4f); }
.poker-chip[data-val="500"] { background: radial-gradient(circle at 35% 30%, #cf9bff, #6a1fb0); }
.poker-chip[data-val="1000"] { background: radial-gradient(circle at 35% 30%, #ffe58a, #b8860b); }
.poker-chip[data-val="5000"] { background: radial-gradient(circle at 35% 30%, #2c2c2c, #000); border-color: rgba(255,209,102,0.6); }

.action-bar {
  display: flex;
  gap: 8px;
  padding: 10px 4px calc(4px + var(--safe-bottom));
  flex-wrap: wrap;
}
.action-bar .btn { flex: 1; min-width: 72px; }

.bet-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin: 0 4px 8px;
  font-size: 13px;
  font-weight: 700;
}

/* ============================================================
   Playing Cards (3D flip)
   ============================================================ */
.card-3d {
  width: 62px; height: 88px;
  position: relative;
  perspective: 400px;
  flex-shrink: 0;
}
.card-3d.sm { width: 44px; height: 62px; }
.card-3d.lg { width: 78px; height: 110px; }
.card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.3,.9,.3,1.05);
}
.card-3d.flipped .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0;
  border-radius: 8px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.1) inset;
  font-family: var(--font-display);
}
.card-front {
  background: linear-gradient(160deg, #fdfdfd, #e8e8ea);
  color: #1a1a1a;
}
.card-face.red-suit { color: #d61b3c; }
.card-face.black-suit { color: #14161c; }
.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(0,229,255,0.08) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #1a2a4a, #0a1428);
  border: 2px solid rgba(0,229,255,0.35);
  transform: rotateY(180deg);
  display: flex; align-items: center; justify-content: center;
}
.card-back::after {
  content: '♠';
  font-size: 22px;
  color: rgba(0,229,255,0.5);
  text-shadow: 0 0 12px rgba(0,229,255,0.6);
}
.card-rank-tl { font-size: 13px; font-weight: 800; line-height: 1; }
.card-suit-tl { font-size: 11px; line-height: 1; }
.card-3d.sm .card-rank-tl { font-size: 10px; }
.card-3d.sm .card-suit-tl { font-size: 9px; }
.card-center-suit { font-size: 22px; align-self: center; opacity: 0.85; }
.card-3d.sm .card-center-suit { font-size: 15px; }
.card-rank-br { font-size: 13px; font-weight: 800; align-self: flex-end; transform: rotate(180deg); line-height: 1; }
.card-3d.sm .card-rank-br { font-size: 10px; }

.card-dealt {
  animation: dealCard 0.42s cubic-bezier(.2,.7,.3,1.15) both;
}
@keyframes dealCard {
  from { opacity: 0; transform: translate(-40px, -60px) rotate(-25deg) scale(0.6); }
  to { opacity: 1; transform: translate(0,0) rotate(0) scale(1); }
}

.hand-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 96px;
  align-items: center;
}

/* ============================================================
   Chips on Table (bet placement animation)
   ============================================================ */
.table-chip {
  width: 34px; height: 34px;
  border-radius: 50%;
  position: absolute;
  border: 2px dashed rgba(255,255,255,0.4);
  box-shadow: 0 3px 6px rgba(0,0,0,0.5);
  animation: chipDrop 0.35s cubic-bezier(.3,.6,.3,1.4) both;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #fff;
}
@keyframes chipDrop {
  from { opacity: 0; transform: translateY(-50px) scale(0.5); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chip-fly {
  position: fixed;
  width: 40px; height: 40px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3000;
  transition: all 0.55s cubic-bezier(.2,.7,.3,1);
}

/* ============================================================
   Roulette Wheel (3D)
   ============================================================ */
.roulette-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  perspective: 900px;
}
.roulette-wheel-container {
  width: 260px; height: 260px;
  position: relative;
  transform: rotateX(38deg);
  transform-style: preserve-3d;
}
@media (max-width: 380px) {
  .roulette-wheel-container { width: 220px; height: 220px; }
}
.roulette-wheel {
  width: 100%; height: 100%;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(from 0deg,
    #14161c 0deg 9.73deg, #d61b3c 9.73deg 19.46deg, #14161c 19.46deg 29.19deg, #d61b3c 29.19deg 38.92deg,
    #14161c 38.92deg 48.65deg, #d61b3c 48.65deg 58.38deg, #14161c 58.38deg 68.11deg, #d61b3c 68.11deg 77.84deg,
    #14161c 77.84deg 87.57deg, #d61b3c 87.57deg 97.30deg, #14161c 97.30deg 107.03deg, #d61b3c 107.03deg 116.76deg,
    #14161c 116.76deg 126.49deg, #d61b3c 126.49deg 136.22deg, #14161c 136.22deg 145.95deg, #d61b3c 145.95deg 155.68deg,
    #14161c 155.68deg 165.41deg, #d61b3c 165.41deg 175.14deg, #14161c 175.14deg 184.86deg, #0f5c3c 184.86deg 194.59deg,
    #d61b3c 194.59deg 204.32deg, #14161c 204.32deg 214.05deg, #d61b3c 214.05deg 223.78deg, #14161c 223.78deg 233.51deg,
    #d61b3c 233.51deg 243.24deg, #14161c 243.24deg 252.97deg, #d61b3c 252.97deg 262.70deg, #14161c 262.70deg 272.43deg,
    #d61b3c 272.43deg 282.16deg, #14161c 282.16deg 291.89deg, #d61b3c 291.89deg 301.62deg, #14161c 301.62deg 311.35deg,
    #d61b3c 311.35deg 321.08deg, #14161c 321.08deg 330.81deg, #d61b3c 330.81deg 340.54deg, #14161c 340.54deg 350.27deg,
    #d61b3c 350.27deg 360deg);
  box-shadow: 0 0 0 8px #2a1c0c, 0 0 0 12px #4a2f10, 0 20px 50px rgba(0,0,0,0.7), inset 0 0 40px rgba(0,0,0,0.5);
  transition: transform 3.2s cubic-bezier(.15,.85,.1,1);
}
.roulette-wheel-numbers {
  position: absolute; inset: 0;
  border-radius: 50%;
}
.roulette-wheel-numbers span {
  position: absolute;
  left: 50%; top: 6px;
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  transform-origin: 0 124px;
  width: 14px;
  text-align: center;
  margin-left: -7px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.roulette-hub {
  position: absolute;
  width: 40%; height: 40%;
  top: 30%; left: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold-deep) 60%, #8a5a10);
  box-shadow: 0 0 20px rgba(255,209,102,0.5), inset 0 4px 8px rgba(255,255,255,0.4), inset 0 -4px 8px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transform: translateZ(14px);
}
.roulette-ball {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ccc);
  box-shadow: 0 2px 4px rgba(0,0,0,0.6);
  top: 4px; left: 50%;
  margin-left: -6px;
  transform-origin: 50% 126px;
  z-index: 5;
}
.roulette-ball.spinning {
  animation: ballSpin 3.2s cubic-bezier(.15,.75,.2,1) forwards;
}
@keyframes ballSpin {
  0% { transform: rotate(0deg) translateZ(20px); }
  70% { transform: rotate(1080deg) translateZ(20px); }
  100% { transform: rotate(var(--ball-final-angle, 1440deg)) translateZ(2px); }
}
.roulette-pointer {
  position: absolute;
  top: -6px; left: 50%;
  width: 0; height: 0;
  margin-left: -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 14px solid var(--gold);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  z-index: 10;
}
.roulette-result-badge {
  margin-top: 14px;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  animation: resultPop 0.4s cubic-bezier(.2,.8,.3,1.3);
}
@keyframes resultPop { from { transform: scale(0); } to { transform: scale(1); } }
.roulette-result-badge.red { background: radial-gradient(circle at 35% 30%, #ff5a72, #b3123a); }
.roulette-result-badge.black { background: radial-gradient(circle at 35% 30%, #3a3d47, #0f1117); }
.roulette-result-badge.green { background: radial-gradient(circle at 35% 30%, #35d18f, #0a7d4f); }

/* Roulette betting board */
.roulette-board-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 6px 0 12px; }
.roulette-board {
  display: grid;
  grid-template-columns: 36px repeat(12, 36px);
  grid-template-rows: repeat(3, 34px) 26px;
  gap: 2px;
  min-width: max-content;
  margin: 0 auto;
  padding: 0 8px;
}
.rb-cell {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, filter 0.15s ease;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.15);
}
.rb-cell:active { transform: scale(0.9); }
.rb-cell.red { background: linear-gradient(160deg, #e5304f, #a30f2f); }
.rb-cell.black { background: linear-gradient(160deg, #2c2f3a, #14161c); }
.rb-cell.green { background: linear-gradient(160deg, #2fd18f, #0a7d4f); }
.rb-cell.outside { background: rgba(255,255,255,0.06); font-size: 10px; grid-column: span 3; }
.rb-cell.has-bet::after {
  content: attr(data-chip-count);
  position: absolute;
  bottom: -4px; right: -4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gold);
  color: #241300;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 6px rgba(255,209,102,0.7);
}
.rb-zero { grid-row: 1 / 4; grid-column: 1; border-radius: 4px; }

/* ============================================================
   Baccarat table
   ============================================================ */
.baccarat-hands { display: flex; justify-content: space-around; gap: 10px; margin-bottom: 8px; }
.baccarat-side { flex: 1; text-align: center; }
.baccarat-side h4 { font-size: 12px; letter-spacing: 0.08em; margin-bottom: 8px; color: var(--text-secondary); }
.baccarat-side.player h4 { color: var(--neon-cyan); }
.baccarat-side.banker h4 { color: var(--neon-magenta); }
.baccarat-total {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  margin-top: 8px;
}
.baccarat-bet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}
.bacc-bet-cell {
  border-radius: var(--radius-md);
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  border: 1.5px solid var(--border-subtle);
  transition: transform 0.15s ease, border-color 0.2s ease;
  position: relative;
}
.bacc-bet-cell:active { transform: scale(0.95); }
.bacc-bet-cell.active { border-color: var(--gold); box-shadow: 0 0 14px rgba(255,209,102,0.35); }
.bacc-bet-cell .label { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.bacc-bet-cell .payout { font-size: 9px; color: var(--text-dim); margin-top: 2px; }
.bacc-bet-cell .bet-amt { font-family: var(--font-display); color: var(--gold); font-size: 13px; margin-top: 4px; font-weight: 800; min-height: 16px; }
.bacc-pair-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }

/* ============================================================
   Poker table
   ============================================================ */
.poker-table-oval {
  border-radius: 50% / 40%;
  min-height: 220px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 10px;
}
.poker-seat { text-align: center; }
.poker-seat .seat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 700; }
.poker-pot-display {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--gold);
  font-size: 15px;
  margin: 4px 0;
}
.poker-community { display: flex; justify-content: center; gap: 5px; min-height: 68px; align-items: center; }
.poker-hand-name-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(0,229,255,0.15);
  border: 1px solid rgba(0,229,255,0.3);
  color: var(--neon-cyan);
  margin-top: 6px;
}
.poker-raise-panel {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px;
}
.poker-raise-panel input[type=range] { flex: 1; }
.poker-log {
  font-size: 11px;
  color: var(--text-dim);
  max-height: 50px;
  overflow-y: auto;
  padding: 4px 8px;
  text-align: center;
}

/* ============================================================
   Win / Result overlays
   ============================================================ */
.result-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55);
  z-index: 1500;
  animation: fadeIn 0.25s ease;
}
.result-card {
  text-align: center;
  padding: 32px 28px;
  border-radius: var(--radius-xl);
  animation: resultCardPop 0.45s cubic-bezier(.2,.75,.25,1.2);
  max-width: 320px;
}
@keyframes resultCardPop { from { transform: scale(0.6) translateY(30px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.result-card .big-icon { font-size: 54px; margin-bottom: 12px; }
.result-card h2 { font-size: 22px; margin-bottom: 6px; }
.result-card .amount-display {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  margin: 10px 0;
}
.result-card .amount-display.win { color: var(--neon-green); }
.result-card .amount-display.lose { color: var(--neon-red); }
.result-card .amount-display.push { color: var(--text-secondary); }

.win { color: var(--neon-green); }
.lose { color: var(--neon-red); }
.push { color: var(--text-secondary); }

/* ============================================================
   Confetti / Particles canvas
   ============================================================ */
#particle-canvas {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 2500;
}

/* ============================================================
   Responsive fine-tuning
   ============================================================ */
@media (max-width: 400px) {
  .brand-text { font-size: 14px; }
  .chip-display { font-size: 12px; padding: 6px 10px 6px 6px; }
  .card-3d { width: 52px; height: 74px; }
  .card-3d.sm { width: 38px; height: 54px; }
  .lobby-hero h2 { font-size: 17px; }
  .action-bar .btn { font-size: 12px; padding: 11px 12px; min-width: 60px; }
}

@media (max-height: 700px) {
  .hand-row { min-height: 78px; }
  .poker-community { min-height: 56px; }
}

/* Prevent overflow issues on small screens */
.game-table-area, .table-content, .lobby-container { max-width: 100vw; overflow-x: hidden; }
* { min-width: 0; }

/* Landscape mobile: compress vertical paddings */
@media (max-height: 480px) and (orientation: landscape) {
  .app-header { padding-top: 6px; padding-bottom: 6px; }
  .game-topbar { padding-top: 6px; padding-bottom: 6px; }
}
