/* ========================================
   SPY GAME - PREMIUM DARK THEME
   Modern Glassmorphism + Animations
======================================== */

:root {
  /* Colors - Rich Teal/Violet palette */
  --bg-primary: #080b1a;
  --bg-secondary: #0d1025;
  --bg-card: rgba(20, 25, 50, 0.65);
  --bg-card-hover: rgba(30, 40, 80, 0.8);
  --bg-input: rgba(0, 0, 0, 0.35);

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-teal: #14b8a6;
  --accent-cyan: #22d3ee;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --accent-gradient-teal: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
  --accent-gradient-warm: linear-gradient(135deg, #f97316 0%, #ef4444 100%);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Shadows & Effects */
  --glow-primary: 0 0 25px rgba(99, 102, 241, 0.35);
  --glow-teal: 0 0 25px rgba(20, 184, 166, 0.35);
  --glow-danger: 0 0 25px rgba(239, 68, 68, 0.35);
  --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-btn: 0 4px 20px rgba(0, 0, 0, 0.4);

  /* Sizes */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Prompt', sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(20, 184, 166, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%236366f1' fill-opacity='0.025'%3E%3Cpath d='M20 20.5V18H0v-2h20v-2l2 3.5-2 3zM0 20h2v2H0z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  animation: bgScroll 60s linear infinite;
}

@keyframes bgScroll {
  from { transform: translateY(0); }
  to { transform: translateY(-100px); }
}

/* ========================================
   CONNECTION BAR
======================================== */

.connection-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  z-index: 9999;
  transition: all 0.4s ease;
  backdrop-filter: blur(10px);
}

.connection-bar.connected {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  transform: translateY(-100%);
}

.connection-bar.disconnected {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
  transform: translateY(0);
  animation: pulse-bar 2s infinite;
}

.connection-bar.reconnecting {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  transform: translateY(0);
}

@keyframes pulse-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ========================================
   CONTAINER
======================================== */

.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ========================================
   SECTIONS
======================================== */

.section {
  display: none;
  animation: sectionIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.active {
  display: block;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================
   GLASSMORPHISM CARD
======================================== */

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

/* ========================================
   LOGO
======================================== */

.logo {
  text-align: center;
  padding: 30px 0 25px;
  position: relative;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(30px);
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.logo-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
  position: relative;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-2deg); }
  75% { transform: translateY(-4px) rotate(2deg); }
}

.logo h1 {
  font-size: 2.8rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.25em;
  position: relative;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 6px;
  font-weight: 300;
}

/* ========================================
   BACK HOME
======================================== */

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 25px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.back-home:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  transform: translateX(-4px);
}

/* ========================================
   INPUTS
======================================== */

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 1;
}

.input-group .input-wrapper input {
  padding-left: 52px;
}

.input-group input,
.room-code-input {
  width: 100%;
  padding: 15px 18px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.room-code-input {
  text-transform: uppercase;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.6rem;
  padding: 16px;
}

.input-group input:focus,
.room-code-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--glow-primary);
  background: rgba(0, 0, 0, 0.45);
}

.input-group input::placeholder,
.room-code-input::placeholder {
  color: var(--text-muted);
}

/* ========================================
   BUTTONS
======================================== */

.button-group {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 24px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all 0.5s ease;
  transform: translate(-50%, -50%);
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--glow-primary), var(--shadow-btn);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.5), 0 8px 30px rgba(0,0,0,0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--accent-gradient-teal);
  color: white;
  box-shadow: var(--glow-teal), var(--shadow-btn);
}

.btn-accent:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 35px rgba(20, 184, 166, 0.5), 0 8px 30px rgba(0,0,0,0.4);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-2px);
}

.btn-large {
  padding: 18px 32px;
  font-size: 1.15rem;
  width: 100%;
  border-radius: var(--radius-lg);
}

.btn-small {
  padding: 10px 18px;
  font-size: 0.85rem;
  flex: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Icon Action Buttons */
.btn-icon-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-icon-action:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* ========================================
   JOIN ROOM
======================================== */

.join-room {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 20px;
  animation: slideDown 0.3s ease;
}

.hidden {
  display: none !important;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   CREATE ROOM OPTIONS
======================================== */

.create-room-options {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 20px;
  animation: slideDown 0.3s ease;
}

.password-option {
  margin-bottom: 15px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  position: relative;
}

.checkbox-label:hover {
  background: rgba(0, 0, 0, 0.3);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.password-option input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  margin-top: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.password-option input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--glow-primary);
}

/* ========================================
   RULES PREVIEW
======================================== */

.rules-preview {
  padding: 22px;
  margin-top: 20px;
}

.rules-preview h3,
.room-lobby h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 1.1rem;
}

.rules-grid {
  display: grid;
  gap: 12px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
}

.rule-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
}

.rule-item p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

.rule-item strong {
  color: var(--text-primary);
}

/* ========================================
   ROOM LOBBY
======================================== */

.room-lobby {
  margin-top: 20px;
  padding: 22px;
}

.room-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.room-list::-webkit-scrollbar { width: 5px; }
.room-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.room-list::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 3px; }

.no-rooms {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 0.9rem;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
}

.room-item:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent-primary);
  transform: translateX(5px);
}

.room-info { display: flex; flex-direction: column; gap: 3px; }
.room-code { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.15em; color: var(--accent-secondary); }
.room-host { font-size: 0.8rem; color: var(--text-secondary); }
.room-meta { display: flex; align-items: center; gap: 10px; }
.room-players { font-size: 0.85rem; color: var(--text-secondary); }
.room-locked, .room-open { font-size: 1.1rem; }

/* ========================================
   ROOM HEADER
======================================== */

.room-header {
  text-align: center;
  margin-bottom: 24px;
}

.room-code-display {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 40px;
  gap: 8px;
  position: relative;
}

.room-code-display .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 500;
}

.room-code-display .code {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.room-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* ========================================
   PLAYER LIST
======================================== */

.player-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s ease;
  animation: playerIn 0.3s ease;
}

@keyframes playerIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.player-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.95rem;
}

.player-badge {
  font-size: 0.7rem;
  padding: 4px 12px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.player-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-status.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.player-status.offline {
  background: var(--text-muted);
}

/* ========================================
   LOBBY ACTIONS
======================================== */

.lobby-actions {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.waiting-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.waiting-dots {
  display: inline-flex;
  gap: 4px;
}

.waiting-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: dotPulse 1.4s infinite;
}

.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

.min-players-text {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 8px;
}

/* Timer Settings */
.timer-settings {
  margin-bottom: 20px;
}

.timer-settings label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.timer-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timer-option {
  flex: 1;
  min-width: 60px;
  padding: 10px 8px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.timer-option:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.timer-option.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: var(--glow-primary);
}

/* ========================================
   GAME SECTION - CIRCULAR TIMER
======================================== */

.game-header {
  text-align: center;
  margin-bottom: 24px;
}

.timer-container {
  position: relative;
  display: inline-block;
  width: 140px;
  height: 140px;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}

.timer-ring-progress {
  fill: none;
  stroke: url(#timerGrad);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

.timer-ring-progress.warning {
  stroke: var(--warning);
}

.timer-ring-progress.danger {
  stroke: var(--danger);
  animation: ringPulse 1s infinite;
}

@keyframes ringPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.timer-text.warning { color: var(--warning); }
.timer-text.danger { color: var(--danger); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ========================================
   ROLE CARD - 3D FLIP
======================================== */

.role-card {
  perspective: 1200px;
  margin-bottom: 20px;
}

.role-card-inner {
  position: relative;
  width: 100%;
  height: 280px;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  cursor: pointer;
}

.role-card.flipped .role-card-inner {
  transform: rotateY(180deg);
}

.role-card-front,
.role-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.role-card-front {
  background: var(--accent-gradient);
  box-shadow: var(--glow-primary);
}

.tap-hint {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 12px;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.card-icon {
  font-size: 5rem;
  animation: cardFloat 2.5s ease-in-out infinite;
}

@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.role-card-back {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 2px solid var(--accent-primary);
  transform: rotateY(180deg);
  padding: 30px;
}

.role-display {
  text-align: center;
  margin-bottom: 20px;
}

.role-icon {
  font-size: 3.2rem;
  display: block;
  margin-bottom: 10px;
}

.role-name {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-secondary);
}

.location-display {
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  width: 100%;
}

.location-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.location-name {
  font-size: 1.7rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.role-card-back.spy {
  border-color: var(--danger);
  box-shadow: var(--glow-danger);
}

.role-card-back.spy .role-name { color: var(--danger); }
.role-card-back.spy .location-name {
  background: var(--accent-gradient-warm);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Spy Card - taller for fake locations */
.role-card.spy-card .role-card-inner {
  height: 420px;
}

.role-card.spy-card .role-card-back {
  padding: 20px 16px;
  justify-content: flex-start;
  overflow-y: auto;
}

.role-card.spy-card .role-display {
  margin-bottom: 8px;
}

.role-card.spy-card .role-icon {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.role-card.spy-card .role-name {
  font-size: 1.1rem;
}

.role-card.spy-card .location-label {
  font-size: 0.65rem;
  margin-bottom: 2px;
}

/* Fake Locations List (Spy hint) */
.fake-locations-list {
  width: 100%;
  margin-top: 2px;
  -webkit-text-fill-color: initial;
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
}

.fake-locations-title {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: 0.5px;
}

.fake-locations-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
}

.fake-location-item {
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 0.7rem;
  color: #f1f5f9;
  text-align: center;
  transition: all 0.2s ease;
}

.fake-location-item:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Fake locations inside modal */
.modal-card .fake-locations-list {
  margin-top: 8px;
}

.modal-card .fake-locations-grid {
  gap: 8px;
}

.modal-card .fake-location-item {
  padding: 8px 10px;
  font-size: 0.8rem;
}

/* Game Info */
.game-info-card { margin-bottom: 20px; padding: 20px; }
.game-info-card h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.game-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-player-chip {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ========================================
   VOTING SECTION
======================================== */

.voting-header {
  text-align: center;
  margin-bottom: 20px;
}

.voting-header h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.voting-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.voting-header-actions {
  margin-top: 12px;
}

.voting-timer-bar {
  text-align: center;
  margin-bottom: 16px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.voting-timer-text {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.voting-timer-text.warning { color: var(--warning); }
.voting-timer-text.danger { color: var(--danger); animation: pulse 1s infinite; }

.voting-players {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.voting-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.voting-player:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.voting-player.selected {
  border-color: var(--accent-teal);
  box-shadow: var(--glow-teal);
  background: rgba(20, 184, 166, 0.08);
}

.voting-player.voted {
  opacity: 0.45;
  pointer-events: none;
  transform: none;
}

.voting-player.confirmed {
  border-color: var(--success);
  opacity: 0.6;
  pointer-events: none;
}

/* Vote Status */
.vote-status {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 16px 20px;
}

.vote-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}

.vote-progress-bar {
  height: 100%;
  background: var(--accent-gradient-teal);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ========================================
   RESULTS SECTION
======================================== */

.result-content {
  text-align: center;
  padding: 10px 0;
}

.result-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  display: block;
  animation: resultBounce 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes resultBounce {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-title.win { color: var(--success); }
.result-title.lose { color: var(--danger); }

.result-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.result-details {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.result-row:last-child { border-bottom: none; }
.result-label { color: var(--text-secondary); font-size: 0.9rem; }
.result-value { font-weight: 600; font-size: 0.95rem; }
.result-value.highlight { color: var(--accent-secondary); }
.result-value.spy { color: var(--danger); }
.result-value.success { color: var(--success); }

/* Vote Details */
.vote-details-section {
  margin-top: 16px;
}

.vote-details-section h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.vote-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.vote-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Player Roles Reveal */
.roles-section {
  margin-top: 16px;
}

.roles-section h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.role-reveal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.role-reveal-item.is-spy {
  border-left: 3px solid var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.role-reveal-name { font-weight: 500; }
.role-reveal-role { color: var(--text-secondary); }
.role-reveal-role.spy { color: var(--danger); font-weight: 600; }

/* ========================================
   MODAL
======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal.hidden { display: none; }

.modal-content {
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-xl);
  padding: 30px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: var(--glow-primary), var(--shadow-card);
  animation: modalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalIn {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card { padding: 20px; }
.modal-card.spy { border-color: var(--danger); }
.modal-card.spy .role-name { color: var(--danger); }
.modal-card.spy .location-name {
  background: var(--accent-gradient-warm);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ========================================
   FLOATING CHAT WIDGET
======================================== */

.floating-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.chat-icon-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 4px 25px rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-icon-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 35px rgba(99, 102, 241, 0.6);
}

.unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  background: var(--danger);
  color: white;
  border-radius: 11px;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  animation: pulse 2s infinite;
  font-family: 'Prompt', sans-serif;
}

.chat-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: chatSlideUp 0.3s ease;
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 600;
  color: var(--accent-secondary);
  font-size: 0.9rem;
}

.btn-close-chat {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  transition: color 0.2s ease;
  line-height: 1;
}

.btn-close-chat:hover { color: var(--danger); }

.chat-messages {
  height: 250px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.chat-messages::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 2px; }

.chat-message {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  max-width: 85%;
  align-self: flex-start;
}

.chat-message.me {
  background: rgba(99, 102, 241, 0.15);
  align-self: flex-end;
  text-align: right;
}

.chat-name {
  display: block;
  font-weight: 600;
  color: var(--accent-secondary);
  font-size: 0.72rem;
  margin-bottom: 3px;
}

.chat-message.me .chat-name { color: var(--accent-primary); }

.chat-text {
  display: block;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.chat-time {
  display: block;
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-input-area {
  display: flex;
  padding: 10px;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.chat-input-area input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.btn-send-chat {
  padding: 10px 18px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-send-chat:hover {
  transform: scale(1.05);
  box-shadow: var(--glow-primary);
}

/* SweetAlert2 customization */
.swal-toast { font-family: 'Prompt', sans-serif !important; }

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 480px) {
  .container { padding: 15px; }
  .logo h1 { font-size: 2.2rem; }
  .room-code-display .code { font-size: 2.4rem; }
  .timer-container { width: 120px; height: 120px; }
  .timer-text { font-size: 1.6rem; }
  .role-card-inner { height: 260px; }
  .role-card.spy-card .role-card-inner { height: 400px; }
  .room-code-input { font-size: 1.5rem; letter-spacing: 0.4rem; }

  .floating-chat { bottom: 15px; right: 15px; }
  .chat-icon-btn { width: 52px; height: 52px; font-size: 1.4rem; }
  .chat-panel { width: calc(100vw - 30px); bottom: 62px; }
  .chat-panel .chat-messages { height: 200px; }

  .timer-options { gap: 6px; }
  .timer-option { padding: 8px 6px; font-size: 0.8rem; min-width: 50px; }
}

@media (max-width: 360px) {
  .container { padding: 12px; }
  .logo h1 { font-size: 1.8rem; }
  .button-group { flex-direction: column; }
  .room-code-display { padding: 20px 30px; }
  .room-code-display .code { font-size: 2rem; letter-spacing: 0.25em; }
}

/* ========================================
   VIDEO CHAT GRID (WebRTC)
======================================== */

.video-grid {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(8, 11, 26, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  z-index: 500;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.video-grid.hidden {
  display: none;
}

.video-item {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.3s ease;
}

.video-item.local {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.video-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-item.local video {
  transform: scaleX(-1);
}

.video-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: var(--text-primary);
  font-size: 0.65rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  font-size: 2rem;
}

.video-status {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.video-status.disconnected {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* Video Controls */

.video-controls {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 501;
  padding: 8px 16px;
  background: rgba(8, 11, 26, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.video-controls.hidden {
  display: none;
}

.video-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

.video-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.35);
  transform: scale(1.05);
}

.video-toggle-btn.toggled-off {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.video-toggle-btn.toggled-off:hover {
  background: rgba(239, 68, 68, 0.4);
}

.toggle-off-line {
  position: absolute;
  top: 50%;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--danger);
  transform: rotate(-45deg);
  transform-origin: center;
  pointer-events: none;
}

/* Responsive Video Grid */

@media (max-width: 480px) {
  .video-grid {
    top: 28px;
    gap: 6px;
    padding: 8px 10px;
  }

  .video-item {
    width: 80px;
    height: 60px;
  }

  .video-label {
    font-size: 0.55rem;
  }

  .video-controls {
    bottom: 80px;
    gap: 10px;
    padding: 6px 12px;
  }

  .video-toggle-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .video-item {
    width: 65px;
    height: 50px;
  }

  .video-placeholder {
    font-size: 1.4rem;
  }
}