/* ============================================
   Ma Sói — Dark Horror Theme CSS
   Premium dark design with moonlight effects
   ============================================ */

/* --- CSS Variables --- */
:root {
  /* Colors */
  --bg-primary: #0a0a12;
  --bg-secondary: #12121f;
  --bg-card: rgba(20, 20, 40, 0.85);
  --bg-glass: rgba(30, 30, 60, 0.6);
  --bg-glass-hover: rgba(40, 40, 70, 0.8);

  --text-primary: #e8e6f0;
  --text-secondary: #9896a8;
  --text-muted: #5c5a6e;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.4);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.3);
  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.3);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.3);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.3);
  --accent-moon: #c4b5fd;

  --border-subtle: rgba(139, 92, 246, 0.15);
  --border-glow: rgba(139, 92, 246, 0.4);

  /* Spacing */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Font */
  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 40px rgba(139, 92, 246, 0.05);
  --shadow-glow: 0 0 20px var(--accent-purple-glow), 0 0 60px rgba(139, 92, 246, 0.1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background: linear-gradient(180deg, #0a0a12 0%, #0f0f1e 40%, #141428 100%);
  position: relative;
}

/* Subtle fog overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 60%, rgba(196, 181, 253, 0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* --- Screen System --- */
.screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(12px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
  animation: screenFadeIn 0.5s ease forwards;
}

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

/* ===== LOADING SCREEN ===== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
}

.moon-glow {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.15) 0%, transparent 70%);
  position: absolute;
  top: 15%;
  animation: moonPulse 4s ease-in-out infinite;
}

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

.wolf-icon {
  font-size: 80px;
  margin-bottom: 16px;
  animation: wolfBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.5));
}

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

.game-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6, #6d28d9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin-bottom: 4px;
}

.game-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  border-radius: 3px;
  animation: loadingProgress 2s ease-in-out forwards;
}

@keyframes loadingProgress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

.loading-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 16px;
  flex-shrink: 0;
}

.room-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.room-code {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-purple);
  letter-spacing: 3px;
}

.player-count {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-glass);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
}

.phase-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.phase-icon {
  font-size: 22px;
}

.timer {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--bg-glass);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  min-width: 50px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.timer.urgent {
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
  animation: timerPulse 0.5s ease-in-out infinite;
}

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

/* ===== LOBBY ===== */
.lobby-content {
  flex: 1;
  overflow-y: auto;
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-moon));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  padding: 4px;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  animation: playerJoin 0.4s ease backwards;
}

.player-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.player-card.is-host {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

.player-card.is-dead {
  opacity: 0.4;
  filter: grayscale(0.8);
}

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

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  position: relative;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}

.badge-host {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
}

.badge-mayor {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
}

.badge-bot {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
}

.btn-remove-bot {
  font-size: 10px;
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 1px 6px;
  cursor: pointer;
  margin-top: 2px;
  transition: all 0.2s;
}

.btn-remove-bot:hover {
  background: rgba(239, 68, 68, 0.4);
}

.lobby-footer {
  padding: 16px 0;
  text-align: center;
  flex-shrink: 0;
}

.lobby-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lobby-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
  color: white;
  box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px var(--accent-purple-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent-purple);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: white;
  box-shadow: 0 4px 15px var(--accent-red-glow);
}

.btn-glow {
  animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 4px 15px var(--accent-purple-glow); }
  50% { box-shadow: 0 4px 30px var(--accent-purple-glow), 0 0 60px rgba(139, 92, 246, 0.2); }
}

.btn-icon {
  font-size: 18px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

/* ===== ROLE REVEAL ===== */
.role-reveal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 24px;
}

.role-card {
  width: 220px;
  height: 320px;
  perspective: 1000px;
  cursor: pointer;
}

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

.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: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.role-card-front {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  overflow: hidden;
}

.card-pattern {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(139, 92, 246, 0.03) 10px, rgba(139, 92, 246, 0.03) 20px);
}

.card-text {
  font-family: var(--font-display);
  font-size: 72px;
  color: var(--accent-purple);
  text-shadow: 0 0 40px var(--accent-purple-glow);
  animation: cardPulse 2s ease-in-out infinite;
}

@keyframes cardPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.role-card-back {
  background: linear-gradient(135deg, #1a1a2e, #0f0f1e);
  transform: rotateY(180deg);
  padding: 24px;
  gap: 12px;
}

.role-emoji {
  font-size: 56px;
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.5));
}

.role-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-moon));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.role-description {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
}

.role-team {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  margin-top: 4px;
}

.role-team.team-werewolf {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-team.team-village {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.role-team.team-neutral {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.role-hint {
  font-size: 13px;
  color: var(--text-muted);
  animation: hintPulse 2s ease-in-out infinite;
}

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

/* ===== MAYOR ELECTION ===== */
.mayor-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.phase-description {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

.phase-description strong {
  color: var(--accent-gold);
}

.candidate-list,
.vote-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-item,
.vote-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s ease;
}

.candidate-item:hover,
.vote-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glow);
  transform: translateX(4px);
}

.candidate-item.selected,
.vote-item.selected {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.15);
  box-shadow: 0 0 20px var(--accent-purple-glow);
}

.candidate-item .player-avatar,
.vote-item .player-avatar {
  width: 40px;
  height: 40px;
  font-size: 18px;
  flex-shrink: 0;
}

.candidate-info,
.vote-info {
  flex: 1;
}

.candidate-name,
.vote-name {
  font-size: 15px;
  font-weight: 600;
}

.vote-count {
  font-size: 12px;
  color: var(--text-muted);
}

.vote-bar {
  height: 3px;
  background: var(--bg-card);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.vote-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.vote-badge {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-purple);
  min-width: 30px;
  text-align: center;
}

.vote-status {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== NIGHT SCREEN ===== */
.screen-night {
  background: linear-gradient(180deg, #050510 0%, #0a0a1a 40%, #0f0f24 100%);
}

.night-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.night-sky {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.moon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f5f3ff, #c4b5fd, #8b5cf6);
  position: absolute;
  top: 60px;
  right: 30px;
  box-shadow: 0 0 40px rgba(196, 181, 253, 0.3), 0 0 80px rgba(196, 181, 253, 0.15);
  animation: moonFloat 6s ease-in-out infinite;
}

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

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 30% 15%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 50% 30%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 70% 10%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 85% 25%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 15% 45%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 60% 50%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.5), transparent);
  animation: starsTwinkle 3s ease-in-out infinite alternate;
}

@keyframes starsTwinkle {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.night-action-area {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

.night-role-label {
  text-align: center;
  padding: 12px;
}

.night-role-label .role-emoji {
  font-size: 40px;
}

.night-role-label .role-name {
  font-size: 18px;
}

.night-message {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px 16px;
  line-height: 1.6;
}

.night-targets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 4px;
}

.night-target-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(10, 10, 20, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.night-target-item:hover {
  background: rgba(30, 30, 60, 0.7);
  border-color: rgba(139, 92, 246, 0.3);
}

.night-target-item.selected {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 15px var(--accent-red-glow);
}

.night-target-item.selected-green {
  border-color: var(--accent-green);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 15px var(--accent-green-glow);
}

.night-target-item.selected-blue {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 15px var(--accent-blue-glow);
}

.sleeping-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
}

.sleeping-icon {
  font-size: 64px;
  animation: sleepFloat 3s ease-in-out infinite;
}

@keyframes sleepFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-3deg); }
  75% { transform: translateY(-4px) rotate(3deg); }
}

.sleeping-text {
  font-size: 16px;
  color: var(--text-muted);
  font-style: italic;
}

.zzz {
  font-size: 24px;
  opacity: 0;
  animation: zzzFloat 3s ease-in-out infinite;
}

.zzz:nth-child(2) { animation-delay: 1s; font-size: 18px; }
.zzz:nth-child(3) { animation-delay: 2s; font-size: 14px; }

@keyframes zzzFloat {
  0% { opacity: 0; transform: translateY(0) translateX(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px) translateX(20px); }
}

/* Night action buttons */
.night-action-buttons {
  display: flex;
  gap: 8px;
  padding: 12px 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-night-action {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.btn-night-action:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glow);
}

.btn-night-action.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent-purple);
}

.btn-night-action.btn-heal {
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--accent-green);
}

.btn-night-action.btn-heal.active {
  background: rgba(34, 197, 94, 0.15);
}

.btn-night-action.btn-poison {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.btn-night-action.btn-poison.active {
  background: rgba(239, 68, 68, 0.15);
}

.btn-night-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Witch info */
.witch-potions-status {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 8px;
}

.potion-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--bg-glass);
}

.potion-item.used {
  opacity: 0.4;
  text-decoration: line-through;
}

/* ===== DAY SCREEN ===== */
.screen-day {
  background: linear-gradient(180deg, #1a1520 0%, #12121f 40%, #0f0f1e 100%);
}

.day-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.death-announcement {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  animation: deathReveal 0.8s ease;
}

@keyframes deathReveal {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.death-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.death-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-red);
  margin-bottom: 4px;
}

.death-message {
  font-size: 13px;
  color: var(--text-secondary);
}

.no-death {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
}

.no-death .death-icon {
  font-size: 40px;
}

.no-death .death-name {
  color: var(--accent-green);
}

.discussion-area {
  padding: 16px 0;
}

.discussion-area h3 {
  font-family: var(--font-display);
  font-size: 16px;
  text-align: center;
  margin-bottom: 8px;
}

.discussion-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

.alive-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

/* ===== VOTE RESULT ===== */
.vote-result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

.vote-result-icon {
  font-size: 64px;
  animation: resultBounce 0.6s ease;
}

@keyframes resultBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.vote-result-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-red);
}

.vote-result-message {
  font-size: 14px;
  color: var(--text-secondary);
}

.vote-result-role {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  padding: 8px 20px;
  background: var(--bg-glass);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

/* ===== GAME OVER ===== */
.gameover-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  gap: 20px;
  padding: 24px 16px;
  text-align: center;
}

.gameover-icon {
  font-size: 80px;
  animation: gameoverPop 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes gameoverPop {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.gameover-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
}

.gameover-title.win-werewolf {
  background: linear-gradient(135deg, var(--accent-red), #f87171);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gameover-title.win-village {
  background: linear-gradient(135deg, var(--accent-green), #86efac);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gameover-title.win-tanner {
  background: linear-gradient(135deg, var(--accent-gold), #fcd34d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gameover-reason {
  font-size: 14px;
  color: var(--text-secondary);
}

.gameover-roles {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.gameover-role-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-glass);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}

.gameover-role-item.dead {
  opacity: 0.5;
}

.gameover-role-item .role-emoji {
  font-size: 20px;
  filter: none;
}

.gameover-role-item .player-name {
  flex: 1;
  text-align: left;
  font-size: 13px;
}

.gameover-role-item .role-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  animation: toastSlideIn 0.4s ease forwards;
  pointer-events: auto;
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast-success { border-color: rgba(34, 197, 94, 0.3); }
.toast-error { border-color: rgba(239, 68, 68, 0.3); }
.toast-info { border-color: rgba(59, 130, 246, 0.3); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

/* ===== DEAD OVERLAY ===== */
.dead-overlay {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.dead-badge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.4);
}

/* ===== CONFIRM BUTTON FLOATING ===== */
.confirm-btn-container {
  position: sticky;
  bottom: 0;
  padding: 12px 0;
  background: linear-gradient(0deg, var(--bg-primary) 60%, transparent);
  z-index: 10;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 360px) {
  .game-title { font-size: 32px; letter-spacing: 4px; }
  .player-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); gap: 8px; }
  .player-avatar { width: 40px; height: 40px; font-size: 18px; }
  .role-card { width: 180px; height: 260px; }
}

@media (min-width: 500px) {
  .player-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
