/* ═══════════════════════════════════════════════════════════════
   APARDI — Global Design System
   ═══════════════════════════════════════════════════════════════ */

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

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:      #06080f;
  --bg-surface:   #0d1120;
  --bg-card:      #141928;
  --bg-elevated:  #1c2438;
  --bg-hover:     #222d44;

  --gold:         #f0c040;
  --gold-dim:     #c89b28;
  --gold-glow:    rgba(240, 192, 64, 0.25);
  --teal:         #3ecfbf;
  --teal-dim:     #2aab9c;
  --red:          #e84040;
  --green-felt:   #1a6b3c;
  --green-bright: #22c55e;

  --text:         #e8eaf6;
  --text-muted:   #7a88aa;
  --text-dim:     #4a5568;
  --border:       rgba(255,255,255,0.07);
  --border-gold:  rgba(240,192,64,0.3);

  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-xl:    28px;

  --shadow:       0 8px 32px rgba(0,0,0,0.5);
  --shadow-gold:  0 0 24px rgba(240,192,64,0.2);
  --glow-teal:    0 0 20px rgba(62,207,191,0.3);

  --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }
ul { list-style: none; }

/* ── Keyframe animations ──────────────────────────────────────── */
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
@keyframes countPulse {
  0%   { transform: scale(1.3); opacity:0.6; }
  100% { transform: scale(1);   opacity:1; }
}
@keyframes toastIn {
  from { opacity:0; transform:translateX(-50%) translateY(12px); }
  to   { opacity:1; transform:translateX(-50%) translateY(0); }
}
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════════════
   AUTH PAGE
   ═══════════════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(62,207,191,0.08) 0%, transparent 70%),
              radial-gradient(ellipse 60% 50% at 80% 100%, rgba(240,192,64,0.06) 0%, transparent 70%),
              var(--bg-base);
}

/* animated background blobs */
.auth-bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.auth-bg span {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: float 12s ease-in-out infinite;
}
.auth-bg span:nth-child(1) {
  width: 500px; height: 500px;
  background: var(--teal);
  top: -200px; left: -150px;
  animation-delay: 0s;
}
.auth-bg span:nth-child(2) {
  width: 400px; height: 400px;
  background: var(--gold);
  bottom: -150px; right: -100px;
  animation-delay: -4s;
}
.auth-bg span:nth-child(3) {
  width: 300px; height: 300px;
  background: #7c4dff;
  top: 40%; left: 55%;
  animation-delay: -8s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.03);
  animation: slideUp 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo h1 {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}
.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Tab toggle */
.auth-tabs {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
  background: transparent;
  border: none;
}
.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Form */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.form-group input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
}
.form-group input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(62,207,191,0.12);
}
.form-group input::placeholder { color: var(--text-dim); }

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--gold) 0%, #e8a800 100%);
  color: #1a0f00;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(240,192,64,0.3);
  margin-top: 4px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(240,192,64,0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  background: rgba(232,64,64,0.12);
  border: 1px solid rgba(232,64,64,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #ff8080;
  display: none;
}
.auth-error.show { display: block; animation: shake 0.3s ease; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}


/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

.dashboard-page {
  min-height: 100vh;
  background: var(--bg-base);
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.nav-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-right { display: flex; align-items: center; gap: 20px; }

.chips-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 99px;
  padding: 6px 16px 6px 12px;
  font-weight: 700;
  font-size: 15px;
}
.chips-icon { font-size: 18px; }
.chips-count { color: var(--gold); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 24px 32px 0;
}
.tab-btn {
  padding: 10px 28px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  transition: var(--transition);
  position: relative;
}
.tab-btn.active {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
}
.tab-btn .tab-icon { margin-right: 8px; }

/* Tab content */
.tab-content {
  padding: 32px;
  display: none;
}
.tab-content.active { display: block; }

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
}
.section-title span { color: var(--text-muted); font-weight: 400; font-size: 15px; margin-left: 8px; }

/* Buttons */
.btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--gold), #e8a800);
  color: #1a0f00;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(240,192,64,0.25);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(240,192,64,0.4); }

.btn-teal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--teal), #2aab9c);
  color: #001a18;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(62,207,191,0.2);
}
.btn-teal:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(62,207,191,0.35); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

/* Rejoin banner */
.rejoin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(62,207,191,0.12), rgba(240,192,64,0.08));
  border: 1px solid rgba(62,207,191,0.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.rejoin-banner p { font-weight: 600; color: var(--teal); }
.rejoin-banner span { font-size: 13px; color: var(--text-muted); }

/* Public lobbies grid */
.lobbies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.lobby-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.lobby-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  opacity: 0;
  transition: var(--transition);
}
.lobby-card:hover {
  border-color: rgba(62,207,191,0.25);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.lobby-card:hover::before { opacity: 1; }

.lobby-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.lobby-card-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 2px;
}
.lobby-card-creator {
  font-size: 12px;
  color: var(--text-muted);
}
.lobby-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-public  { background: rgba(62,207,191,0.15); color: var(--teal); }
.badge-private { background: rgba(240,192,64,0.15); color: var(--gold); }

.lobby-card-info {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.lobby-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lobby-info-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lobby-info-value {
  font-size: 15px;
  font-weight: 700;
}
.lobby-info-value.gold  { color: var(--gold); }
.lobby-info-value.teal  { color: var(--teal); }

.lobby-card-footer { display: flex; justify-content: flex-end; }

/* Player slots mini */
.player-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.player-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.player-dot.filled { background: var(--teal); border-color: var(--teal); }

/* Join private form */
.join-private-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}
.join-private-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.join-code-row {
  display: flex;
  gap: 12px;
}
.join-code-row input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text);
  text-align: center;
  transition: var(--transition);
}
.join-code-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.join-code-row input::placeholder { letter-spacing: 2px; font-size: 15px; font-weight: 400; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow);
  transform: scale(0.92) translateY(20px);
  transition: var(--transition);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 22px; font-weight: 800; }
.modal-close {
  background: var(--bg-elevated);
  border: none;
  color: var(--text-muted);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { background: var(--red); color: #fff; }

.modal-form { display: flex; flex-direction: column; gap: 18px; }
.modal-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.modal-form input, .modal-form select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
}
.modal-form input:focus, .modal-form select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(62,207,191,0.12);
}
.modal-form select { appearance: none; cursor: pointer; }
.modal-form select option { background: var(--bg-card); }

.type-toggle {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 4px;
}
.type-toggle-btn {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.type-toggle-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
}

/* Market */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  max-width: 600px;
}

.market-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.market-card.featured {
  border-color: var(--border-gold);
  background: linear-gradient(145deg, var(--bg-card), #1e2a10);
}
.market-card.featured::after {
  content: 'BEST VALUE';
  position: absolute;
  top: 14px; right: -20px;
  background: linear-gradient(135deg, var(--gold), #e8a800);
  color: #1a0f00;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 28px;
  transform: rotate(30deg);
}
.market-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.market-card.featured:hover { box-shadow: var(--shadow-gold); }

.market-chip-icon { font-size: 52px; margin-bottom: 12px; }
.market-amount {
  font-size: 40px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
}
.market-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.market-price {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 260px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
  font-size: 14px;
  font-weight: 500;
}
.toast.success { border-left: 3px solid var(--green-bright); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--teal); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(60px) scale(0.9); max-height: 0; padding: 0; }
}
.toast.removing { animation: toastOut 0.25s ease forwards; }


/* ═══════════════════════════════════════════════════════════════
   GAME ROOM
   ═══════════════════════════════════════════════════════════════ */

.game-page {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

/* Waiting Room */
.waiting-room {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.waiting-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.lobby-name-display {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
}
.lobby-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
  justify-content: center;
}
.lobby-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}
.lobby-meta-item strong { color: var(--gold); }

/* Seats grid */
.seats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  margin-bottom: 32px;
}

.seat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  min-height: 88px;
}
.seat-card.occupied { border-color: rgba(62,207,191,0.2); }
.seat-card.me       { border-color: rgba(240,192,64,0.3); background: linear-gradient(135deg, var(--bg-card), rgba(240,192,64,0.05)); }
.seat-card.ready    { border-color: var(--green-bright); }
.seat-card.empty    { border-style: dashed; opacity: 0.5; }

.seat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.seat-avatar.filled { background: linear-gradient(135deg, var(--teal), var(--teal-dim)); color: #001a18; }
.seat-avatar.empty-av { background: var(--bg-elevated); color: var(--text-dim); font-size: 22px; }

.seat-info { flex: 1; }
.seat-name { font-weight: 700; font-size: 15px; }
.seat-status { font-size: 12px; margin-top: 2px; }
.seat-status.ready   { color: var(--green-bright); }
.seat-status.waiting { color: var(--text-muted); }
.seat-status.empty   { color: var(--text-dim); }

.seat-ready-icon { font-size: 20px; }

/* Lobby code display */
.lobby-code-box {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 12px 24px;
  text-align: center;
  margin-bottom: 24px;
  cursor: pointer;
  transition: var(--transition);
}
.lobby-code-box:hover { border-color: var(--gold); box-shadow: var(--gold-glow) 0 0 0 3px; }
.lobby-code-box p { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.lobby-code-box span {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--gold);
}

/* Countdown overlay */
.countdown-overlay {
  position: fixed; inset: 0;
  background: rgba(6,8,15,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  display: none;
}
.countdown-overlay.show { display: flex; }
.countdown-number {
  font-size: 120px;
  font-weight: 900;
  color: var(--gold);
  animation: countPulse 1s ease-in-out;
  text-shadow: 0 0 60px rgba(240,192,64,0.5);
}
@keyframes countPulse {
  0%   { transform: scale(1.4); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: scale(0.7); opacity: 0; }
}

/* ── Game Area ──────────────────────────────────────────────────── */
.game-area {
  flex: 1;
  display: none;
  flex-direction: column;
}
.game-area.active { display: flex; }

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.game-header-logo {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Timer */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.timer-circle {
  position: relative;
  width: 52px; height: 52px;
}
.timer-circle svg { transform: rotate(-90deg); }
.timer-circle .track {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 4;
}
.timer-circle .progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 126;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-circle .progress.danger { stroke: var(--red); }
.timer-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
}
.timer-number.danger { color: var(--red); }

/* Game table */
.game-table {
  flex: 1;
  background: radial-gradient(ellipse at center, #1d5c35 0%, #0f3320 60%, #071a10 100%);
  position: relative;
  overflow: hidden;
  min-height: 300px;
}
.game-table::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 40px, rgba(255,255,255,0.02) 40px, rgba(255,255,255,0.02) 41px),
    repeating-linear-gradient(90deg,  transparent, transparent 40px, rgba(255,255,255,0.02) 40px, rgba(255,255,255,0.02) 41px);
}

/* Opponents */
.opponents-row {
  display: flex;
  justify-content: space-around;
  padding: 16px;
  position: relative;
  z-index: 2;
}
.opponent-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.opponent-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #2a3a5a, #1a2840);
  border: 2px solid var(--border);
  transition: var(--transition);
}
.opponent-slot.current-turn .opponent-avatar {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(240,192,64,0.5);
}
.opponent-name { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.opponent-tile-count {
  background: var(--bg-card);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Domino tile */
.domino-tile {
  display: inline-flex;
  flex-direction: column;
  background: #f5f0e8;
  border-radius: 8px;
  border: 2px solid #d4c8a8;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.8);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}
.domino-tile:hover { transform: translateY(-8px); box-shadow: 0 12px 24px rgba(0,0,0,0.6); }

.domino-half {
  width: 52px; height: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 6px;
  gap: 2px;
}
.domino-divider {
  height: 2px;
  background: #c8b888;
  margin: 0 4px;
}
.pip {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #2a2a2a;
  align-self: center;
  justify-self: center;
}
.pip.hidden { visibility: hidden; }

/* Board area */
.board-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 160px;
}
.board-area .domino-tile { cursor: default; }
.board-area .domino-tile:hover { transform: none; }

.board-empty-text {
  color: rgba(255,255,255,0.2);
  font-size: 15px;
  font-style: italic;
  user-select: none;
}

/* Player hand */
.player-hand-area {
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 3;
}
.hand-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}
.hand-tiles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Game over overlay */
.game-over-overlay {
  position: fixed; inset: 0;
  background: rgba(6,8,15,0.9);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 800;
  flex-direction: column;
  gap: 24px;
  text-align: center;
  padding: 32px;
}
.game-over-overlay.show { display: flex; }

.game-over-title {
  font-size: 52px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: winPulse 1s ease-in-out infinite alternate;
}
@keyframes winPulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.3); }
}
.game-over-winner { font-size: 24px; font-weight: 700; }
.game-over-winner span { color: var(--gold); }
.game-over-pot { font-size: 16px; color: var(--text-muted); }
.game-over-pot strong { color: var(--gold); }
.game-over-redirect { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.confetti { font-size: 48px; animation: spinBounce 1s ease-in-out infinite alternate; }
@keyframes spinBounce {
  from { transform: rotate(-15deg) scale(1); }
  to   { transform: rotate(15deg) scale(1.2); }
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .auth-card { padding: 32px 24px; }
  .nav { padding: 0 16px; }
  .tab-content { padding: 20px 16px; }
  .tab-bar { padding: 16px 16px 0; }
  .seats-grid { grid-template-columns: 1fr; max-width: 320px; }
  .game-header { padding: 10px 16px; }
  .opponents-row { gap: 8px; }
  .domino-half { width: 44px; height: 44px; }
  .modal { padding: 24px 20px; }
  .join-code-row { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════
   GAME PHASE — DOMINO WRAPPERS
   ═══════════════════════════════════════════════════════════════ */

.domino-wrapper {
  display: inline-flex;
  border-radius: 12px;
  transition: var(--transition);
  cursor: default;
}

.domino-wrapper.playable {
  cursor: pointer;
  filter: drop-shadow(0 0 8px rgba(62,207,191,0.5));
  transform: translateY(-4px);
}

.domino-wrapper.playable:hover {
  filter: drop-shadow(0 0 14px rgba(62,207,191,0.8));
  transform: translateY(-8px) scale(1.05);
}

.domino-wrapper.unplayable {
  opacity: 0.35;
  filter: grayscale(60%);
  cursor: not-allowed;
}

/* ── Opponent slot (used in playing view bar) ── */
.opponent-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
}

/* ── Toast animation ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ════════════════════════════════════════════════════════════════
   DOMINO TILES
   ════════════════════════════════════════════════════════════════ */

.domino-wrapper {
  display: inline-flex;
  border-radius: 10px;
  cursor: default;
  transition: transform .18s, box-shadow .18s, filter .18s, opacity .18s;
  user-select: none;
}

.domino-wrapper.playable {
  cursor: pointer;
  filter: drop-shadow(0 0 8px rgba(62, 207, 191, 0.55));
  transform: translateY(-6px);
}
.domino-wrapper.playable:hover {
  filter: drop-shadow(0 0 14px rgba(62, 207, 191, 0.85));
  transform: translateY(-10px) scale(1.05);
}

.domino-wrapper.unplayable {
  opacity: 0.30;
  filter: grayscale(70%);
  cursor: not-allowed;
}

/* The actual tile */
.domino-tile {
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, #f5f5f0, #e8e8e2);
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  box-shadow:
    inset 0 1px 3px rgba(255,255,255,0.8),
    0 3px 8px rgba(0,0,0,0.5);
  width: 44px;
  overflow: hidden;
}

.domino-half {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows:    repeat(3, 1fr);
  gap: 3px;
  padding: 5px;
  box-sizing: border-box;
  width: 100%;
  height: 44px;
}

.domino-divider {
  height: 2px;
  background: rgba(0, 0, 0, 0.3);
  margin: 0 4px;
  flex-shrink: 0;
}

.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a1a2e;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
  justify-self: center;
  align-self: center;
}
.pip.hidden {
  visibility: hidden;
}