/* === Casino / 8-Ball Pool Theme === */
:root {
  --felt: #1B5E20;
  --felt-dark: #0D3B11;
  --felt-light: #2E7D32;
  --wood: #3E2723;
  --wood-light: #5D4037;
  --wood-border: #4E342E;
  --gold: #FFD54F;
  --gold-dark: #FFB300;
  --gold-glow: rgba(255,213,79,0.25);
  --cream: #FFF8E1;
  --cream-muted: #D7CCC8;
  --red: #E53935;
  --red-light: #4A1515;
  --green-bright: #4CAF50;
  --green-light: #1B3A1B;
  --bg: #0A1F0D;
  --bg-alt: #0D2B11;
  --surface: #143318;
  --surface-hover: #1B4620;
  --border: #2E5A33;
  --text: #E8F5E9;
  --text-muted: #A5D6A7;
  --text-inv: #0A1F0D;
  --primary: #FFD54F;
  --primary-hover: #FFCA28;
  --primary-light: #2A3A15;
  --success: #4CAF50;
  --success-light: #1B3A1B;
  --warning: #FF9800;
  --warning-light: #3A2A10;
  --danger: #E53935;
  --card-back: #B71C1C;
  --card-front: #143318;
  --card-pattern: #D32F2F;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 20px rgba(255,213,79,0.15);
  --transition: 150ms ease;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #1B5E20;
    --bg-alt: #2E7D32;
    --surface: #256D29;
    --surface-hover: #2E7D32;
    --border: #388E3C;
    --text: #FFFFFF;
    --text-muted: #C8E6C9;
    --text-inv: #1B5E20;
    --primary-light: #33691C;
    --success-light: #1B5E20;
    --warning-light: #4A3010;
    --card-front: #256D29;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  }
}

:root[data-theme="light"] {
  --bg: #1B5E20;
  --bg-alt: #2E7D32;
  --surface: #256D29;
  --surface-hover: #2E7D32;
  --border: #388E3C;
  --text: #FFFFFF;
  --text-muted: #C8E6C9;
  --text-inv: #1B5E20;
  --primary-light: #33691C;
  --success-light: #1B5E20;
  --warning-light: #4A3010;
  --card-front: #256D29;
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(46,125,50,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(13,59,17,0.5) 0%, transparent 60%);
}

/* Felt texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 4L36 20L20 36L4 20Z' fill='none' stroke='%23FFD54F' stroke-width='0.5' opacity='0.07'/%3E%3Cpath d='M20 12L28 20L20 28L12 20Z' fill='none' stroke='%23FFD54F' stroke-width='0.3' opacity='0.05'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='60' height='60' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* === Utilities === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #FFD54F 0%, #FFB300 100%);
  color: #3E2723;
  border: 1px solid #FFB300;
  box-shadow: 0 2px 8px rgba(255,179,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #FFCA28 0%, #FFA000 100%);
  box-shadow: 0 4px 16px rgba(255,179,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.12); border-color: var(--gold); }
.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn-outline:hover:not(:disabled) { background: var(--gold-glow); }
.btn-icon { background: transparent; color: var(--text-muted); padding: 8px; border-radius: 50%; border: none; text-transform: none; letter-spacing: 0; }
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--gold); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; width: 100%; }
.btn-danger { background: linear-gradient(180deg, #E53935 0%, #C62828 100%); color: #fff; border: 1px solid #C62828; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: rgba(255,213,79,0.15);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,213,79,0.2);
}
.badge-sm { padding: 2px 8px; font-size: 10px; }
.badge-success { background: rgba(76,175,80,0.15); color: var(--success); border-color: rgba(76,175,80,0.2); }
.badge-warning { background: rgba(255,152,0,0.15); color: var(--warning); border-color: rgba(255,152,0,0.2); }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gold);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field .optional { font-weight: 400; text-transform: none; color: var(--text-muted); }
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: all var(--transition);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted); opacity: 0.6; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background: rgba(0,0,0,0.4);
}
input.field-error, textarea.field-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229,57,53,0.15); }
.field-error-msg { font-size: 13px; color: #FF8A80; margin-top: 4px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.field textarea { resize: vertical; }

/* Custom select */
.custom-select { position: relative; width: 100%; z-index: 10; }
.custom-select-trigger {
  width: 100%;
  padding: 12px 14px;
  padding-right: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  position: relative;
}
.custom-select-trigger::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: translateY(-65%) rotate(45deg);
  transition: transform var(--transition);
}
.custom-select.open .custom-select-trigger::after { transform: translateY(-25%) rotate(-135deg); }
.custom-select-trigger:hover, .custom-select.open .custom-select-trigger {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background: rgba(0,0,0,0.4);
}
.custom-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  overflow: hidden;
}
.custom-select.open .custom-select-dropdown { display: block; }
.custom-select-option {
  padding: 11px 14px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.custom-select-option:last-child { border-bottom: none; }
.custom-select-option:hover { background: rgba(255,213,79,0.1); color: var(--gold); }
.custom-select-option.selected { background: rgba(255,213,79,0.12); color: var(--gold); font-weight: 600; }

.overlay {
  position: fixed;
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 4L36 20L20 36L4 20Z' fill='none' stroke='%23FFD54F' stroke-width='0.5' opacity='0.07'/%3E%3Cpath d='M20 12L28 20L20 28L12 20Z' fill='none' stroke='%23FFD54F' stroke-width='0.3' opacity='0.05'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 0%, rgba(46,125,50,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(13,59,17,0.5) 0%, transparent 60%),
    rgba(10,31,13,0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.3);
  text-align: center;
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,213,79,0.3) 0%, transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.modal h2 { font-size: 22px; margin-bottom: 8px; color: var(--gold); }
.modal .badge { margin-bottom: 20px; }
.modal-icon { font-size: 48px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(180deg, #FFD54F 0%, #FFB300 100%);
  color: #3E2723;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  opacity: 0;
  transition: all 300ms ease;
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(255,179,0,0.3);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* === Landing === */
.landing { max-width: 680px; margin: 0 auto; padding: 16px; position: relative; z-index: 1; }

.landing-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 0;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-svg { width: 44px; height: 44px; }
.logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero { text-align: center; padding: 40px 0 24px; }
.hero h1 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--cream);
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.hero h1 em {
  font-style: normal;
  color: var(--gold);
  text-shadow: 0 0 30px var(--gold-glow);
}
.hero-sub { color: var(--text-muted); font-size: 17px; margin-top: 12px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

.create-room-card {
  background: linear-gradient(180deg, rgba(20,51,24,0.9) 0%, rgba(13,43,17,0.95) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-top: 28px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  text-align: left;
  position: relative;
  backdrop-filter: blur(8px);
}
.create-room-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,213,79,0.2) 0%, transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius);
  padding: 3px;
  border: 1px solid rgba(255,255,255,0.05);
}
.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tab.active {
  background: linear-gradient(180deg, #FFD54F 0%, #FFB300 100%);
  color: #3E2723;
  box-shadow: 0 2px 8px rgba(255,179,0,0.3);
}
.tab:not(.active):hover { color: var(--gold); }

.join-section { margin-top: 32px; }
.join-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  position: relative;
}
.join-divider::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--border);
}
.join-divider span { background: var(--bg); padding: 0 16px; position: relative; }

.join-form { display: flex; gap: 8px; flex-wrap: wrap; }
.join-form .field-error-msg { width: 100%; margin-top: -4px; }
.join-form input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.join-form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 48px;
  padding-bottom: 48px;
}
.feature {
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(20,51,24,0.6);
  transition: all 300ms ease;
}
.feature:hover { border-color: var(--gold); box-shadow: var(--shadow-gold); transform: translateY(-2px); }
.feature-icon { margin-bottom: 10px; filter: drop-shadow(0 2px 8px rgba(255,213,79,0.2)); line-height: 0; }
.feature-icon svg { width: 48px; height: 48px; }
.feature h3 { font-size: 14px; font-weight: 700; color: var(--gold); margin-bottom: 4px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; text-transform: uppercase; letter-spacing: 0.5px; }
.feature p { font-size: 13px; color: var(--text-muted); line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

.landing-footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--gold); }

@media (max-width: 480px) {
  .hero h1 { font-size: 28px; }
  .features { grid-template-columns: 1fr; gap: 8px; }
}

/* === Content Pages === */
.content-page {
  padding: 40px 0 32px;
  position: relative;
  z-index: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.content-page h1 {
  font-size: 32px;
  color: var(--gold);
  margin-bottom: 8px;
  font-family: 'Georgia', serif;
}
.content-page h2 {
  font-size: 18px;
  color: var(--cream);
  margin-top: 28px;
  margin-bottom: 10px;
  font-family: 'Georgia', serif;
}
.content-page p, .content-page li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
}
.content-page ul, .content-page ol {
  padding-left: 20px;
  margin: 10px 0;
}
.content-page li { margin-bottom: 6px; }
.content-page strong { color: var(--text); }
.content-page .text-muted { font-size: 13px; }
.content-links { display: flex; gap: 10px; margin-top: 32px; flex-wrap: wrap; }
.content-links .btn { width: auto; }

/* === Room === */
.room { display: flex; flex-direction: column; min-height: 100vh; position: relative; z-index: 1; }

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10,31,13,0.95) 0%, rgba(20,51,24,0.95) 100%);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.room-header-left { display: flex; align-items: center; gap: 10px; }
.room-header-left h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}
.room-header-right { display: flex; align-items: center; gap: 8px; }
.logo-icon-sm { width: 28px; height: 28px; }
.stealth-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  border-color: var(--border);
  color: var(--text-muted);
}
.stealth-toggle .stealth-icon-eye { font-size: 16px; line-height: 1; }
.stealth-toggle .stealth-label { font-size: 11px; }
.stealth-toggle.stealth-active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* Stealth banner */
.stealth-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(255,213,79,0.12) 0%, rgba(255,179,0,0.08) 100%);
  border-bottom: 1px solid rgba(255,213,79,0.2);
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gold);
  animation: fadeIn 300ms ease;
}
.stealth-banner-icon { font-size: 18px; flex-shrink: 0; }
.stealth-banner-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.6;
}
.stealth-banner-close:hover { opacity: 1; }

/* Keyboard hint on deck cards */
.deck-card .key-hint {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: rgba(255,255,255,0.25);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
  pointer-events: none;
}
.deck-card:hover .key-hint { color: rgba(255,213,79,0.5); }
.deck-card.selected .key-hint { color: rgba(62,39,35,0.4); }

/* Topic */
.topic-bar { padding: 20px 16px 8px; text-align: center; }
.topic-input {
  width: 100%;
  max-width: 500px;
  padding: 12px 16px;
  border: 1px dashed rgba(255,213,79,0.3);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.2);
  color: var(--cream);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  font-family: 'Georgia', serif;
}
.topic-input:focus { outline: none; border-color: var(--gold); border-style: solid; box-shadow: 0 0 0 3px var(--gold-glow); }
.topic-input::placeholder { color: rgba(255,213,79,0.3); }
.topic-display { font-size: 18px; font-weight: 600; min-height: 1.5em; color: var(--cream); }

/* Participants grid (poker table) */
.table {
  padding: 24px 16px;
  background: radial-gradient(ellipse at center, rgba(46,125,50,0.15) 0%, transparent 70%);
}
.participants-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 80px;
}
.player-card-face {
  width: 68px;
  height: 92px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  transition: all 300ms ease;
  position: relative;
  perspective: 600px;
}
.card-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}
.card-front, .card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  backface-visibility: hidden;
}
.card-front {
  background: linear-gradient(180deg, #1A3D1E 0%, #0D2B11 100%);
  border: 2px solid var(--border);
  color: var(--gold);
  font-family: 'Georgia', serif;
}
.card-back {
  background: linear-gradient(135deg, #B71C1C 0%, #880E0E 50%, #B71C1C 100%);
  border: 2px solid #D32F2F;
  color: #FFD54F;
  transform: rotateY(180deg);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}
.card-back::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255,213,79,0.3);
  border-radius: 6px;
}
.card-back .card-pattern {
  font-size: 28px;
  opacity: 0.6;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.player-card.voted .card-inner { transform: rotateY(180deg); }
.player-card.voted .player-card-face { filter: drop-shadow(0 4px 12px rgba(183,28,28,0.4)); }
.player-card.revealed .card-inner { transform: rotateY(0deg); }
.player-card.revealed .card-front { border-color: var(--gold); box-shadow: 0 0 16px var(--gold-glow); }

.player-name {
  font-size: 12px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-muted);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.player-name.you { color: var(--gold); }
.player-card.offline { opacity: 0.35; }

/* Voting area */
.voting-section {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.25) 100%);
}
.deck-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
}
.deck-card {
  width: 58px;
  height: 80px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #1A3D1E 0%, #0D2B11 100%);
  color: var(--cream);
  font-size: 20px;
  font-weight: 700;
  font-family: 'Georgia', serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  box-shadow: var(--shadow);
  position: relative;
}
.deck-card::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
  pointer-events: none;
}
.deck-card:hover {
  border-color: var(--gold);
  transform: translateY(-6px);
  box-shadow: var(--shadow-md), 0 0 20px var(--gold-glow);
  color: var(--gold);
}
.deck-card.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, #FFD54F 0%, #FFB300 100%);
  color: #3E2723;
  transform: translateY(-6px);
  box-shadow: 0 6px 24px rgba(255,179,0,0.4);
}
.deck-card.disabled { opacity: 0.4; pointer-events: none; }
.deck-card.stealth-ref {
  pointer-events: none;
  opacity: 0.5;
  border-color: rgba(255,213,79,0.15);
  transform: none;
}
.deck-card.stealth-ref:hover { transform: none; box-shadow: var(--shadow); }

/* Stealth voting */
.stealth-voting { text-align: center; padding: 20px 0; }
.stealth-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.stealth-input-wrap { display: flex; gap: 8px; justify-content: center; max-width: 200px; margin: 0 auto; }
.stealth-input-field {
  width: 100px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.3);
  color: var(--gold);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  font-family: 'Georgia', serif;
}
.stealth-input-field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }

/* Host controls */
.host-controls { display: flex; gap: 10px; justify-content: center; padding: 16px; }

/* Results */
.results { padding: 20px 16px; animation: fadeIn 400ms ease; }
.results-grid { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 24px;
  min-width: 110px;
  backdrop-filter: blur(4px);
}
.result-label {
  font-size: 10px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.result-value { font-size: 28px; font-weight: 700; margin-top: 2px; color: var(--gold); font-family: 'Georgia', serif; }
#consensus-card.consensus-yes { border-color: var(--gold); box-shadow: 0 0 20px var(--gold-glow); }
#consensus-card.consensus-yes .result-value { color: var(--gold); }

/* Async mode */
.async-layout { display: flex; flex: 1; min-height: 0; }
.stories-panel {
  width: 260px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10,31,13,0.85) 0%, rgba(6,20,8,0.9) 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.stories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}
.stories-header h2 {
  font-size: 13px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stories-list { flex: 1; overflow-y: auto; padding: 6px; }

.story-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.story-item:hover { background: rgba(255,255,255,0.05); }
.story-item.active {
  background: rgba(255,213,79,0.08);
  border-color: rgba(255,213,79,0.2);
  box-shadow: inset 3px 0 0 var(--gold);
}
.story-item-title { font-size: 13px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin-bottom: 4px; color: var(--text); }
.story-item.active .story-item-title { color: var(--gold); }
.story-item-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

.story-detail { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; }
.story-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.story-header { margin-bottom: 20px; }
.story-header h3 { font-size: 22px; font-weight: 700; color: var(--cream); }
.story-desc { color: var(--text-muted); margin-top: 6px; font-size: 14px; white-space: pre-wrap; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

.story-progress { margin-bottom: 24px; }
.progress-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.progress-info span { font-size: 13px; color: var(--text-muted); }
.progress-bar { height: 8px; background: rgba(0,0,0,0.3); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: linear-gradient(90deg, #FFD54F 0%, #FFB300 100%); border-radius: 99px; transition: width 300ms ease; width: 0%; }

.votes-detail { margin-top: 16px; }
.vote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.vote-row:nth-child(odd) { background: rgba(0,0,0,0.15); }
.vote-row-name { font-weight: 600; }
.vote-row-value { font-weight: 700; font-size: 18px; color: var(--gold); font-family: 'Georgia', serif; }

/* Participants panel */
.participants-panel {
  position: fixed;
  right: 0;
  top: 53px;
  bottom: 0;
  width: 230px;
  background: linear-gradient(180deg, rgba(10,31,13,0.97) 0%, rgba(6,20,8,0.99) 100%);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 8;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.participants-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.participants-panel-header h3 {
  font-size: 11px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.participants-close-btn {
  display: none;
  font-size: 22px;
  padding: 2px 6px;
}
.participants-list { list-style: none; padding: 8px 10px; flex: 1; overflow-y: auto; }
.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.participant-item:hover { background: rgba(255,255,255,0.04); }
.participant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--felt-light) 0%, var(--felt-dark) 100%);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-muted);
  flex-shrink: 0;
  text-transform: uppercase;
  position: relative;
}
.participant-avatar.online { border-color: var(--success); }
.participant-avatar.you-avatar {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(255,213,79,0.2) 0%, rgba(255,179,0,0.1) 100%);
  color: var(--gold);
}
.participant-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid rgba(10,31,13,0.97);
  box-shadow: 0 0 6px rgba(76,175,80,0.4);
}
.participant-status-dot.offline { background: #555; box-shadow: none; }
.participant-info { flex: 1; min-width: 0; }
.participant-name-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  line-height: 1.3;
}
.participant-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold);
  line-height: 1.3;
}
.participant-you .participant-name-text { color: var(--gold); font-weight: 700; }

/* Mobile participants toggle */
.participants-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFD54F 0%, #FFB300 100%);
  color: #3E2723;
  border: none;
  font-size: 22px;
  cursor: pointer;
  z-index: 15;
  box-shadow: 0 4px 16px rgba(255,179,0,0.4);
  align-items: center;
  justify-content: center;
}
.toggle-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--success);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Hide elements based on role */
.room:not(.is-host) .host-only { display: none !important; }
.room.is-host .non-host { display: none !important; }

/* Leave room button */
.leave-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all var(--transition);
  line-height: 1;
}
.leave-btn:hover { color: var(--danger); background: rgba(229,57,53,0.1); }

/* Room content needs margin for fixed sidebar on desktop */
.view { margin-right: 230px; flex: 1; display: flex; flex-direction: column; }

/* Responsive */
@media (max-width: 900px) {
  .view { margin-right: 0; }
  .participants-panel {
    position: fixed;
    right: -260px;
    top: 0;
    bottom: 0;
    width: 260px;
    transition: right 300ms ease;
    box-shadow: -8px 0 30px rgba(0,0,0,0.5);
    z-index: 50;
  }
  .participants-panel.open { right: 0; }
  .participants-close-btn { display: block; }
  .participants-mobile-toggle { display: flex; }
  .participants-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }
  .participants-backdrop.open { opacity: 1; pointer-events: auto; }
}

@media (max-width: 768px) {
  .room-header-left h1 { font-size: 14px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .room-header { padding: 8px 12px; }
  .stealth-toggle .stealth-label { display: none; }
  .stories-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  .async-layout { flex-direction: column; }
  .story-detail { padding: 16px; }
  .topic-bar { padding: 12px 12px 4px; }
  .topic-input { font-size: 16px; padding: 10px 12px; }
  .table { padding: 16px 12px; }
  .participants-grid { gap: 12px; }
  .player-card { min-width: 60px; }
  .player-card-face { width: 52px; height: 72px; font-size: 18px; }
  .player-name { font-size: 10px; max-width: 60px; }
  .voting-section { padding: 14px 12px; }
  .deck-cards { gap: 6px; }
  .deck-card { width: 46px; height: 64px; font-size: 16px; }
  .deck-card::after { inset: 3px; }
  .host-controls { padding: 12px; }
  .results-grid { gap: 8px; }
  .result-card { padding: 10px 14px; min-width: 80px; }
  .result-value { font-size: 22px; }
  .stealth-banner { font-size: 12px; padding: 8px 12px; }
}

@media (max-width: 380px) {
  .deck-card { width: 40px; height: 56px; font-size: 14px; }
  .player-card-face { width: 44px; height: 62px; font-size: 16px; }
  .player-card { min-width: 50px; gap: 4px; }
  .player-name { font-size: 9px; max-width: 50px; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes goldGlow { 0%, 100% { box-shadow: 0 0 10px var(--gold-glow); } 50% { box-shadow: 0 0 25px var(--gold-glow); } }
.pulse { animation: pulse 400ms ease; }
