/* ============================================
   CIDADE DORME - App Styles
   Paleta: Roxo, Laranja, Branco
   Inspiração: Envato Premium Templates
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #6C3FB5;
  --primary-dark: #5A2FA0;
  --primary-light: #8B5FD4;
  --secondary: #FF7A33;
  --secondary-dark: #E56A20;
  --secondary-light: #FF9A5C;
  --bg-dark: #0D0717;
  --bg-darker: #08040F;
  --bg-card: rgba(45, 27, 78, 0.6);
  --bg-card-solid: #2D1B4E;
  --bg-card-hover: rgba(60, 40, 100, 0.8);
  --text-primary: #FFFFFF;
  --text-secondary: #B8B5C4;
  --text-muted: #7A7490;
  --border-color: rgba(108, 63, 181, 0.3);
  --border-glow: rgba(108, 63, 181, 0.6);
  --death-red: #E53E3E;
  --victory-gold: #FFD700;
  --defeat-gray: #4A4A4A;
  --success-green: #38B2AC;
  --danger-red: #E53E3E;
  --team-lobisomem: #E53E3E;
  --team-cidade: #38B2AC;
  --team-neutro: #B8B5C4;
  --glass-bg: rgba(45, 27, 78, 0.4);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Background Particles ---------- */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-particles .star {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: twinkle var(--duration, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(108, 63, 181, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(255, 122, 51, 0.08) 0%, transparent 40%),
              radial-gradient(ellipse at 50% 100%, rgba(108, 63, 181, 0.1) 0%, transparent 50%),
              linear-gradient(180deg, #0D0717 0%, #1A0E2E 50%, #0D0717 100%);
  pointer-events: none;
}

/* ---------- Content Wrapper ---------- */
.content-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted-custom {
  color: var(--text-secondary) !important;
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(108, 63, 181, 0.1);
}

.glass-card-solid {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

/* ---------- Buttons ---------- */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.btn-primary-custom::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 63, 181, 0.4);
  color: var(--text-primary);
}

.btn-primary-custom:hover::before {
  left: 100%;
}

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

.btn-secondary-custom {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-secondary-custom::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-secondary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 122, 51, 0.4);
  color: var(--text-primary);
}

.btn-secondary-custom:hover::before {
  left: 100%;
}

.btn-outline-custom {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-outline-custom:hover {
  border-color: var(--primary);
  background: rgba(108, 63, 181, 0.15);
  color: var(--text-primary);
}

.btn-danger-custom {
  background: linear-gradient(135deg, var(--death-red), #C53030);
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-danger-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 62, 62, 0.4);
  color: var(--text-primary);
}

.btn-success-custom {
  background: linear-gradient(135deg, var(--success-green), #2C9A8F);
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-success-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 178, 172, 0.4);
  color: var(--text-primary);
}

.btn-sm-custom {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg-custom {
  padding: 16px 40px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--glass-bg);
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ---------- Form Elements ---------- */
.form-control-custom {
  background: rgba(13, 7, 23, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 1rem;
  transition: var(--transition);
  font-family: var(--font-body);
}

.form-control-custom:focus {
  background: rgba(13, 7, 23, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 63, 181, 0.2);
  color: var(--text-primary);
  outline: none;
}

.form-control-custom::placeholder {
  color: var(--text-muted);
}

.form-select-custom {
  background: rgba(13, 7, 23, 0.6);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 1rem;
  transition: var(--transition);
  cursor: pointer;
}

.form-select-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 63, 181, 0.2);
  color: var(--text-primary);
  outline: none;
}

.form-select-custom option {
  background: var(--bg-card-solid);
  color: var(--text-primary);
}

.form-label-custom {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

/* ---------- Badges ---------- */
.badge-team {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-lobisomem {
  background: rgba(229, 62, 62, 0.2);
  color: #FC8181;
  border: 1px solid rgba(229, 62, 62, 0.3);
}

.badge-cidade {
  background: rgba(56, 178, 172, 0.2);
  color: #4FD1C5;
  border: 1px solid rgba(56, 178, 172, 0.3);
}

.badge-neutro {
  background: rgba(184, 181, 196, 0.2);
  color: #B8B5C4;
  border: 1px solid rgba(184, 181, 196, 0.3);
}

.badge-alive {
  background: rgba(56, 178, 172, 0.2);
  color: #4FD1C5;
  border: 1px solid rgba(56, 178, 172, 0.3);
}

.badge-dead {
  background: rgba(229, 62, 62, 0.2);
  color: #FC8181;
  border: 1px solid rgba(229, 62, 62, 0.3);
}

.badge-connected {
  background: rgba(72, 187, 120, 0.2);
  color: #68D391;
}

.badge-disconnected {
  background: rgba(160, 160, 160, 0.2);
  color: #A0A0A0;
}

.badge-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
}

.badge-day {
  background: linear-gradient(135deg, rgba(255, 200, 50, 0.2), rgba(255, 160, 50, 0.2));
  color: #FFD700;
  border: 1px solid rgba(255, 200, 50, 0.3);
}

.badge-night {
  background: linear-gradient(135deg, rgba(108, 63, 181, 0.3), rgba(30, 15, 60, 0.3));
  color: #B8A5E0;
  border: 1px solid rgba(108, 63, 181, 0.4);
}

/* ---------- Player Card ---------- */
.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(13, 7, 23, 0.4);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.player-card:hover {
  background: rgba(13, 7, 23, 0.6);
  border-color: var(--border-color);
}

.player-card.dead {
  opacity: 0.5;
  position: relative;
}

.player-card.dead::after {
  content: '💀';
  position: absolute;
  right: 16px;
  font-size: 1.2rem;
}

.player-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.player-avatar.master {
  background: linear-gradient(135deg, var(--secondary), #FF5500);
  box-shadow: 0 0 12px rgba(255, 122, 51, 0.4);
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-role {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.player-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- Role Card ---------- */
.role-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(13, 7, 23, 0.4);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  cursor: grab;
}

.role-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
}

.role-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.role-card .role-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.role-card .role-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.role-card .role-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.role-card .role-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ---------- Phase Indicator ---------- */
.phase-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
  font-weight: 600;
  transition: var(--transition-slow);
}

.phase-day {
  background: linear-gradient(135deg, rgba(255, 200, 50, 0.15), rgba(255, 160, 50, 0.1));
  border: 1px solid rgba(255, 200, 50, 0.2);
  color: #FFD700;
}

.phase-night {
  background: linear-gradient(135deg, rgba(60, 30, 120, 0.4), rgba(20, 10, 50, 0.4));
  border: 1px solid rgba(108, 63, 181, 0.3);
  color: #C4B5FD;
}

/* ---------- Modals ---------- */
.modal-content-custom {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
}

.modal-header-custom {
  border-bottom: 1px solid var(--glass-border);
  padding: 20px 24px;
}

.modal-body-custom {
  padding: 24px;
}

.modal-footer-custom {
  border-top: 1px solid var(--glass-border);
  padding: 16px 24px;
}

.modal-backdrop {
  backdrop-filter: blur(4px);
}

/* ---------- Toast / Notifications ---------- */
.toast-container-custom {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-custom {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideInRight 0.4s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}

.toast-success {
  background: linear-gradient(135deg, #38B2AC, #2C9A8F);
  border-left: 4px solid #68D391;
}

.toast-error {
  background: linear-gradient(135deg, #E53E3E, #C53030);
  border-left: 4px solid #FC8181;
}

.toast-info {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-left: 4px solid var(--primary-light);
}

.toast-warning {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  border-left: 4px solid var(--secondary-light);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ---------- Room Code Display ---------- */
.room-code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 8px;
  padding: 16px 32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(108, 63, 181, 0.2), rgba(255, 122, 51, 0.1));
  border: 2px solid rgba(108, 63, 181, 0.3);
  display: inline-block;
  user-select: all;
  cursor: pointer;
  transition: var(--transition);
}

.room-code:hover {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(108, 63, 181, 0.3);
}

/* ---------- QR Code Container ---------- */
.qr-container {
  display: inline-flex;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
}

.qr-container img {
  border-radius: var(--radius-sm);
}

/* ---------- Section Headers ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.section-title .icon {
  font-size: 1.3rem;
}

/* ---------- Turn Order List ---------- */
.turn-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: turn;
}

.turn-list-item {
  counter-increment: turn;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(13, 7, 23, 0.3);
  border: 1px solid transparent;
  margin-bottom: 6px;
  transition: var(--transition);
  cursor: grab;
}

.turn-list-item:hover {
  border-color: var(--border-color);
}

.turn-list-item.active {
  border-color: var(--secondary);
  background: rgba(255, 122, 51, 0.1);
}

.turn-list-item::before {
  content: counter(turn);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- History Log ---------- */
.history-log {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.history-log::-webkit-scrollbar {
  width: 4px;
}

.history-log::-webkit-scrollbar-track {
  background: transparent;
}

.history-log::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.85rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.history-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ---------- Loading / Spinner ---------- */
.loader {
  position: relative;
  width: 60px;
  height: 60px;
}

.loader-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 12px;
}

/* ---------- Waiting Screen ---------- */
.waiting-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  padding: 20px;
}

.waiting-icon {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* ---------- Role Reveal (Card Flip) ---------- */
.card-flip-container {
  perspective: 1000px;
  width: 280px;
  height: 400px;
  margin: 0 auto;
  cursor: pointer;
}

.card-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card-flip.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.card-front {
  background: linear-gradient(135deg, var(--primary-dark), var(--bg-card-solid));
  border: 2px solid var(--border-color);
}

.card-front .card-logo {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
}

.card-front .card-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-back {
  background: linear-gradient(135deg, var(--bg-card-solid), #1A0E2E);
  border: 2px solid var(--secondary);
  transform: rotateY(180deg);
  text-align: center;
}

.card-back .role-reveal-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.card-back .role-reveal-name {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-back .role-reveal-team {
  margin-bottom: 16px;
}

.card-back .role-reveal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

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

/* ---------- Death Overlay ---------- */
.death-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(229, 62, 62, 0);
  opacity: 0;
  pointer-events: none;
  transition: all 1s ease;
}

.death-overlay.active {
  background: rgba(100, 10, 10, 0.95);
  opacity: 1;
  pointer-events: all;
}

.death-overlay .death-icon {
  font-size: 6rem;
  animation: deathPulse 1.5s ease-in-out infinite;
}

.death-overlay .death-text {
  font-size: 2rem;
  font-weight: 700;
  color: #FC8181;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: 4px;
}

.death-overlay .death-role {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 8px;
}

@keyframes deathPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ---------- Victory / Defeat Overlay ---------- */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.8s ease;
  padding: 20px;
}

.result-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.result-overlay.victory {
  background: radial-gradient(ellipse at center, rgba(45, 27, 78, 0.98), rgba(13, 7, 23, 0.99));
}

.result-overlay.defeat {
  background: radial-gradient(ellipse at center, rgba(30, 15, 15, 0.98), rgba(10, 5, 5, 0.99));
}

.result-icon {
  font-size: 5rem;
  margin-bottom: 16px;
}

.result-text {
  font-size: 2.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 6px;
  margin-bottom: 12px;
}

.result-overlay.victory .result-text {
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: victoryGlow 2s ease-in-out infinite;
}

.result-overlay.defeat .result-text {
  color: #666;
  animation: shake 0.6s ease-in-out;
}

.result-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.result-players-reveal {
  max-width: 400px;
  width: 100%;
  max-height: 40vh;
  overflow-y: auto;
}

.result-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.9rem;
}

@keyframes victoryGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3) drop-shadow(0 0 20px rgba(255, 215, 0, 0.4)); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ---------- Scrollbar Global ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(13, 7, 23, 0.3);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ---------- Utility Classes ---------- */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in-left {
  animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

.bounce-in {
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.scale-in {
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Connection Status ---------- */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 20px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.connection-dot.online {
  background: #68D391;
  box-shadow: 0 0 6px #68D391;
  animation: blink 2s ease-in-out infinite;
}

.connection-dot.offline {
  background: #666;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- Night Overlay Effect ---------- */
.night-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 15, 0);
  z-index: 100;
  pointer-events: none;
  transition: background 2s ease;
}

.night-overlay.active {
  background: rgba(5, 2, 15, 0.4);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .room-code {
    font-size: 1.8rem;
    letter-spacing: 5px;
    padding: 12px 20px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-flip-container {
    width: 240px;
    height: 340px;
  }

  .result-text {
    font-size: 1.8rem;
    letter-spacing: 3px;
  }

  .death-overlay .death-icon {
    font-size: 4rem;
  }

  .death-overlay .death-text {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }

  .player-card {
    padding: 10px 12px;
  }

  .btn-primary-custom,
  .btn-secondary-custom {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .room-code {
    font-size: 1.5rem;
    letter-spacing: 4px;
    padding: 10px 16px;
  }

  .card-flip-container {
    width: 220px;
    height: 310px;
  }

  .card-back .role-reveal-name {
    font-size: 1.4rem;
  }

  .card-back .role-reveal-icon {
    font-size: 3rem;
  }

  .result-text {
    font-size: 1.5rem;
  }
}

/* ---------- Navbar Custom ---------- */
.navbar-custom {
  background: rgba(13, 7, 23, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 0;
}

.navbar-brand-custom {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary) !important;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.navbar-brand-custom .brand-icon {
  font-size: 1.5rem;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state .empty-text {
  font-size: 0.95rem;
}

/* ---------- Drag Over ---------- */
.drag-over {
  border: 2px dashed var(--secondary) !important;
  background: rgba(255, 122, 51, 0.05) !important;
}

/* ---------- Confetti Canvas ---------- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
}
