@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-surface: rgba(30, 41, 59, 0.7);

  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);

  --accent: #fbbf24;
  /* Gold */
  --accent-glow: rgba(251, 191, 36, 0.4);

  --danger: #ef4444;
  --success: #10b981;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-active: rgba(59, 130, 246, 0.15);

  --font-main: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(251, 191, 36, 0.08), transparent 40%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-muted);
}

.text-gradient {
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gold {
  color: var(--accent);
}

/* Components */
.btn {
  border: none;
  background: var(--bg-panel);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--primary);
  box-shadow: 0 4px 20px var(--primary-glow);
  border-color: transparent;
}

.btn.primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.input-field {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 14px;
  border-radius: 12px;
  width: 100%;
  font-family: var(--font-main);
  font-size: 16px;
  transition: border-color 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.4);
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Layout */
.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wrap-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80vh;
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flex-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.spacer {
  flex: 1;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-8 {
  margin-bottom: 32px;
}

.text-center {
  text-align: center;
}

.w-full {
  width: 100%;
}

/* Mobile */
@media (max-width: 640px) {
  .logo {
    font-size: 40px;
  }

  .card-glass {
    padding: 24px;
  }
}

/* =========================================
   POKER ROOM SPECIFIC STYLES
   ========================================= */

.room-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 16px;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}

.badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
}

/* The Table */
.poker-table-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  perspective: 1000px;
}

.poker-table {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 2/1;
  /* Oval shape */
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: 200px;
  border: 12px solid #334155;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.05) inset,
    0 50px 100px rgba(0, 0, 0, 0.5);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.table-felt {
  position: absolute;
  inset: 10px;
  border-radius: 190px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.pot-container {
  z-index: 10;
  text-align: center;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(4px);
  margin-bottom: 20px;
}

.pot-label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pot-value {
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.board-cards {
  display: flex;
  gap: 8px;
  justify-content: center;
  min-height: 84px;
  /* Card Height */
  perspective: 800px;
}

/* Cards */
.card-unit {
  width: 56px;
  height: 80px;
  background: #f1f5f9;
  border-radius: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  font-weight: 800;
  user-select: none;
  transition: transform 0.3s var(--ease-elastic);
}

.card-unit:hover {
  transform: translateY(-8px);
}

.card-unit.red {
  color: #dc2626;
}

.card-unit.black {
  color: #1e293b;
}

.card-rank {
  font-size: 18px;
  line-height: 1;
}

.card-suit {
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.card-lg-suit {
  position: absolute;
  font-size: 32px;
  opacity: 0.15;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.card-unit.back {
  background:
    repeating-linear-gradient(45deg, #1e293b 0, #1e293b 5px, #334155 5px, #334155 10px);
  border: 2px solid #fff;
}

.card-unit.back::after {
  content: '';
}

/* Players Wrapper - we will use Grid to position them around if possible, or just a flex row for now for robustness */
.seats-top {
  position: absolute;
  top: -60px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 32px;
}

.seats-bottom {
  position: absolute;
  bottom: -60px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 32px;
}

/* Dynamic Players List (fallback) */
.players-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.player-node {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: all 0.3s;
}

.player-node.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
  transform: scale(1.05);
  z-index: 5;
}

.player-node.folded {
  opacity: 0.5;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
}

.player-name {
  font-size: 14px;
  font-weight: 600;
}

.player-chips {
  font-size: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.player-cards {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  height: 44px;
  /* Small cards */
}

.player-cards .card-unit {
  width: 32px;
  height: 44px;
  font-size: 10px;
}

.dealer-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #fff;
  color: #000;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Controls (Bottom) */
.controls-dock {
  background: var(--bg-surface);
  border-top: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  bottom: 0;
  backdrop-filter: blur(20px);
}

.my-hand-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.my-cards {
  display: flex;
  gap: 8px;
}

.my-cards .card-unit {
  width: 70px;
  height: 100px;
  font-size: 20px;
}

.action-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 12px;
}

.slider-group input {
  background: transparent;
  border: none;
  color: #fff;
  width: 80px;
  text-align: right;
}

@media (max-width: 600px) {
  .poker-table-wrap {
    display: none;
  }

  /* Hide big table on small mobile, show list instead? Or scale down */
  .poker-table-wrap {
    transform: scale(0.6);
    margin: -40px 0;
  }

  .controls-dock {
    padding: 12px;
  }

  .my-cards .card-unit {
    width: 50px;
    height: 72px;
    font-size: 16px;
  }
}