/* =========================================================
   MANGALA – Lüks Oyun Salonu & Modern Glassmorphism CSS
   Ceviz Ahşap, Eskitme Altın & Doğal Taş Teması
   ========================================================= */

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

:root {
  /* Renk Paleti */
  --bg-primary: #0a0705;
  --bg-secondary: #130d0a;
  --wood-dark: #1f1109;
  --wood-mid: #381e0f;
  --wood-accent: #683a1c;
  
  --gold-light: #f7d896;
  --gold-primary: #d4a76a;
  --gold-dark: #916833;
  --gold-glow: rgba(212, 167, 106, 0.28);
  --gold-glow-high: rgba(247, 216, 150, 0.45);
  
  --glass-bg: rgba(26, 16, 11, 0.48);
  --glass-bg-hover: rgba(45, 27, 18, 0.65);
  --glass-border: rgba(212, 167, 106, 0.16);
  --glass-border-hover: rgba(247, 216, 150, 0.42);
  
  --text-primary: #f5eedf;
  --text-secondary: #b8a691;
  --text-muted: #756656;
  --danger: #d9534f;
  --success: #3cb371;

  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: radial-gradient(ellipse at 50% 40%, #1c110b 0%, #0d0805 55%, #050302 100%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ===== ARKA PLAN SÜSLEMELERİ & AMBİYANS ===== */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-glow), transparent 70%);
  opacity: 0.25;
  filter: blur(2px);
  animation: floatOrb 22s infinite ease-in-out;
}

.p1 { width: 340px; height: 340px; top: -70px; left: -80px; animation-delay: 0s; }
.p2 { width: 240px; height: 240px; top: 65%; right: -50px; animation-delay: -5s; }
.p3 { width: 180px; height: 180px; bottom: -40px; left: 38%; animation-delay: -10s; }
.p4 { width: 280px; height: 280px; top: 15%; left: 62%; animation-delay: -14s; opacity: 0.16; }
.p5 { width: 200px; height: 200px; bottom: 15%; left: 8%; animation-delay: -8s; opacity: 0.2; }
.p6 { width: 140px; height: 140px; top: 45%; right: 18%; animation-delay: -17s; opacity: 0.22; }

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(35px, -45px) scale(1.08); }
  50% { transform: translate(-25px, 25px) scale(0.92); }
  75% { transform: translate(20px, 35px) scale(1.04); }
}

/* ===== EKRAN GEÇİŞLERİ ===== */
.screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  animation: screenFadeIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen.active {
  display: flex;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== LOBİ MENÜSÜ ===== */
.lobby-container {
  text-align: center;
  max-width: 760px;
  width: 100%;
  padding: 2.2rem;
  z-index: 2;
}

.logo-area {
  margin-bottom: 2.8rem;
}

.game-title {
  font-size: clamp(3.2rem, 8.5vw, 5.6rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  background: linear-gradient(135deg, #a67439 0%, #e2b978 28%, #fff0cc 50%, #d4a76a 75%, #8f6027 100%);
  background-size: 250% 250%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerGold 5s ease-in-out infinite;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 28px var(--gold-glow));
}

@keyframes shimmerGold {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  font-size: clamp(0.95rem, 2.6vw, 1.25rem);
  color: var(--gold-light);
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  margin-top: 0.6rem;
  opacity: 0.9;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.title-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
  margin: 1.4rem auto 0;
  border-radius: 2px;
  box-shadow: 0 0 10px var(--gold-glow);
}

/* Mod Kartları */
.mode-cards {
  display: flex;
  gap: 1.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-card {
  flex: 1;
  min-width: 195px;
  max-width: 235px;
  padding: 2.2rem 1.6rem;
  background: var(--glass-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  font-family: var(--font);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 235, 205, 0.1);
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--gold-glow), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.mode-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  transform: translateY(-8px) scale(1.025);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 32px var(--gold-glow);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-card:active {
  transform: translateY(-2px) scale(0.99);
}

.mode-icon {
  font-size: 2.8rem;
  margin-bottom: 0.9rem;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.5));
}

.mode-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.mode-card p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* ===== GLASS CARD (BEKLEME / KATILMA MODAL KARTLARI) ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2.8rem 2.2rem;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 230, 190, 0.15);
  animation: cardScalePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 2;
}

@keyframes cardScalePop {
  from { opacity: 0; transform: scale(0.88) translateY(24px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.glass-card h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.8rem;
}

/* Oda Kodu Alanı */
.room-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 1.5rem 0;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 167, 106, 0.2);
}

#room-code-text {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px var(--gold-glow-high);
}

.btn-icon-small {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
}

.btn-icon-small:hover {
  background: rgba(212, 167, 106, 0.2);
  border-color: var(--gold-primary);
  transform: scale(1.08);
}

.waiting-text {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dots::after {
  content: '';
  animation: dotBlink 1.4s steps(4, end) infinite;
}

@keyframes dotBlink {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Odaya Katıl Giriş Kutusu */
#input-room-code {
  width: 100%;
  padding: 1rem 1.2rem;
  font-size: 1.5rem;
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-align: center;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  outline: none;
  transition: all var(--transition);
  margin-bottom: 0.6rem;
}

#input-room-code::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-weight: 300;
}

#input-room-code:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px var(--gold-glow-high);
  background: rgba(0, 0, 0, 0.6);
}

.error-text {
  color: var(--danger);
  font-size: 0.88rem;
  min-height: 1.4em;
  margin-bottom: 1rem;
  font-weight: 500;
}

.join-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ===== BUTONLAR ===== */
.btn-primary {
  padding: 0.85rem 2.2rem;
  font-size: 0.98rem;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #a67439 0%, #d4a76a 50%, #f7d896 100%);
  color: #170d05;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #be8744 0%, #e8bc7c 50%, #ffebbe 100%);
  box-shadow: 0 8px 25px var(--gold-glow-high);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 0.85rem 2.2rem;
  font-size: 0.98rem;
  font-family: var(--font);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: rgba(212, 167, 106, 0.12);
}

/* ===== OYUN EKRANI & BAŞLIK (GAME SCREEN) ===== */
#game-screen {
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 50%, #1a100a 0%, #0d0805 60%, #040201 100%);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.6rem;
  width: 100%;
  max-width: 1350px;
  z-index: 3;
  flex-shrink: 0;
}

.btn-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-family: var(--font);
  font-weight: 600;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--glass-bg-hover);
  color: var(--gold-light);
  border-color: var(--gold-primary);
  box-shadow: 0 4px 15px var(--gold-glow);
}

.back-arrow {
  font-size: 1.15rem;
}

.sound-btn {
  padding: 0.55rem 0.85rem;
  font-size: 1.15rem;
}

/* Sıra Göstergesi */
.turn-indicator {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-light);
  padding: 0.55rem 1.8rem;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px var(--gold-glow);
}

.turn-indicator.extra-turn {
  color: #55efc4;
  border-color: rgba(85, 239, 196, 0.45);
  box-shadow: 0 0 25px rgba(85, 239, 196, 0.35);
  animation: pulseGreenGlow 0.6s ease-in-out 3;
}

@keyframes pulseGreenGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.room-info {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  padding: 0.45rem 0.95rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.hidden { display: none !important; }

/* ===== CANVAS OYUN ALANI ===== */
.canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.6rem;
  overflow: hidden;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-canvas {
  border-radius: 12px;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.75));
  max-width: 100%;
  max-height: 100%;
}

/* ===== OYUN SONU KARTI (GAME OVER OVERLAY) ===== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 2, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fadeInModal 0.35s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-over-card {
  min-width: 320px;
}

.trophy {
  font-size: 3.4rem;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 4px 15px rgba(247, 216, 150, 0.5));
  animation: trophyPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes trophyPop {
  from { transform: scale(0) rotate(-25deg); }
  to { transform: scale(1) rotate(0deg); }
}

#game-over-title {
  font-size: 1.8rem;
  color: var(--gold-light);
  margin-bottom: 0.4rem;
}

#game-over-score {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.8rem;
  font-weight: 500;
}

.game-over-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== RESPONSIVE & MOBİL DİKEY (PORTRAIT) UYUMLULUĞU ===== */
@media (max-width: 768px) {
  .mode-cards {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  .mode-card {
    max-width: 290px;
    width: 100%;
    padding: 1.4rem 1.2rem;
  }
  .mode-icon {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
  }
  .game-header {
    padding: 0.4rem 0.7rem;
    gap: 0.5rem;
  }
  .btn-icon {
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
  }
  .turn-indicator {
    font-size: 0.82rem;
    padding: 0.4rem 1.1rem;
  }
  .glass-card {
    padding: 2rem 1.4rem;
  }
  .canvas-container {
    padding: 0.2rem 0.4rem;
  }
}

/* Mobil Dikey Ekran (Portrait Mode) Özel İyileştirmeler */
@media (orientation: portrait) and (max-width: 600px) {
  .game-header {
    padding: 0.35rem 0.5rem;
  }
  .turn-indicator {
    font-size: 0.78rem;
    padding: 0.35rem 0.9rem;
    letter-spacing: 0.02em;
  }
  .btn-icon {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }
  .room-info {
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
  }
  .canvas-container {
    padding: 0.1rem 0.2rem;
  }
}

@media (max-height: 520px) {
  .game-header { padding: 0.25rem 0.8rem; }
  .logo-area { margin-bottom: 0.8rem; }
  .game-title { font-size: 2.4rem; }
  .subtitle { font-size: 0.85rem; margin-top: 0.2rem; }
}

/* ===== TURNUVA / SEYÝRCÝ MODU ===== */
.tournament-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1350px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 2rem;
  z-index: 5;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.t-player {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}
.t-player.active {
  color: #fff;
  text-shadow: 0 0 15px var(--gold-glow-high);
  transform: scale(1.05);
}
.t-score {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold-primary);
  margin-top: 0.2rem;
}
.t-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.t-vs {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.t-live-ticker {
  font-size: 1rem;
  font-weight: 500;
  color: #55efc4;
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(85,239,196,0.3);
  text-shadow: 0 0 8px rgba(85,239,196,0.5);
}

/* ===== ANALÝZ MODALI ===== */
.analytics-card {
  max-width: 500px;
}
.analytics-content {
  text-align: left;
  margin-top: 1rem;
  color: var(--text-primary);
}
.analytics-item {
  background: rgba(0,0,0,0.3);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.8rem;
  border-left: 3px solid var(--gold-primary);
}
.analytics-item h4 {
  color: var(--gold-light);
  margin-bottom: 0.3rem;
}
.analytics-item p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.eff-score {
  font-size: 2rem;
  font-weight: 800;
  color: #55efc4;
  text-align: center;
  margin: 1rem 0;
  text-shadow: 0 0 15px rgba(85,239,196,0.4);
}


/* =========================================
   KURALLAR MODAL (NASIL OYNANIR)
   ========================================= */
.rules-card {
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  text-align: left;
}
.rules-card::-webkit-scrollbar {
  width: 6px;
}
.rules-card::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 4px;
}
.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.close-btn:hover {
  color: #fff;
  transform: scale(1.1);
}
.rules-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.rule-item {
  background: rgba(20, 10, 5, 0.5);
  border-left: 4px solid var(--gold-dark);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
}
.rule-item h4 {
  margin: 0 0 8px 0;
  color: var(--gold-light);
  font-size: 1.1rem;
}
.rule-item p {
  margin: 0;
  font-size: 0.95rem;
  color: #e6dac3;
  line-height: 1.5;
}
.rule-item strong {
  color: #fff;
}

/* =========================================
   TOURNAMENT CLOCKS & EVALUATION BAR
   ========================================= */
.digital-clock {
  background: rgba(20, 10, 5, 0.85);
  border: 1px solid var(--gold-dark);
  color: var(--gold-light);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 5px 12px;
  border-radius: 6px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
  letter-spacing: 1px;
}
.digital-clock.danger {
  color: #ff4757;
  border-color: #ff4757;
  animation: pulse-danger 1s infinite alternate;
}
@keyframes pulse-danger {
  from { box-shadow: inset 0 0 10px rgba(255, 71, 87, 0.2); }
  to { box-shadow: inset 0 0 15px rgba(255, 71, 87, 0.6), 0 0 10px rgba(255, 71, 87, 0.4); }
}
.header-tools {
  display: flex;
  gap: 10px;
}
.eval-bar-container {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 12px;
  height: 60%;
  background: rgba(20, 10, 5, 0.7);
  border: 1px solid rgba(255, 215, 160, 0.3);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  z-index: 50;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.eval-bar-fill {
  width: 100%;
  background: linear-gradient(to top, #b88228, #f9e29d);
  transition: height 0.5s ease-out;
}
.eval-bar-text {
  position: absolute;
  top: 50%;
  left: -40px;
  transform: translateY(-50%);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* =========================================
   SETTINGS MODAL & TOGGLES
   ========================================= */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(20, 10, 5, 0.4);
  border-radius: 8px;
  border-left: 3px solid #888;
}
.setting-item span {
  color: #e6dac3;
  font-size: 0.95rem;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255,255,255,0.2);
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--gold-dark);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* ================================================
   SPECTATOR MODE & LIVE HUD
   ================================================ */

.spectator-mode canvas {
  pointer-events: none;
  cursor: default;
}

.live-badge {
  display: inline-block;
  background-color: rgba(220, 53, 69, 0.2);
  color: #ff6b81;
  padding: 4px 10px;
  border: 1px solid rgba(255, 107, 129, 0.4);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
  letter-spacing: 1px;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(255, 107, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 129, 0); }
}

.t-active-turn {
  color: #fce8b3;
  font-weight: bold;
  margin-bottom: 5px;
  text-shadow: 0 0 8px rgba(252, 232, 179, 0.5);
}

.t-player.active {
  box-shadow: 0 0 15px rgba(252, 232, 179, 0.6);
  border-color: #fce8b3;
  color: #fff;
}
/* ================================================
   THEME SELECTOR
   ================================================ */

.theme-selector {
  display: flex;
  gap: 12px;
  margin-top: 5px;
  width: 100%;
  justify-content: space-between;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.theme-card input {
  display: none;
}
.t-preview {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: 0.3s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.theme-card input:checked + .t-preview {
  box-shadow: 0 0 12px var(--gold-dark), inset 0 0 5px rgba(255,255,255,0.2);
  border-color: #fff !important;
}
.t-name {
  font-size: 0.65rem;
  color: #ccc;
  margin-top: 5px;
  text-align: center;
}
.theme-card input:checked ~ .t-name {
  color: var(--gold-light);
  font-weight: bold;
}
