/* ── Tokens ────────────────────────────────────── */
:root {
  --bg: #0A0A0F;
  --bg-secondary: #12121A;
  --surface: #1A1A25;
  --surface-light: #222235;
  --toxic: #39FF14;
  --toxic-dim: #1A7A0A;
  --blood: #CC0000;
  --blood-glow: #FF0033;
  --bone: #E8E0D4;
  --ash: #6B6B7B;
  --text: #E8E0D4;
  --text-muted: #6B6B7B;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Storm Layer (Lightning) ───────────────────── */
.storm-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: transparent;
  opacity: 0;
  transition: opacity 0.05s;
}

.storm-layer.flash {
  animation: bolt 0.6s ease-out forwards;
}

@keyframes bolt {
  0%   { opacity: 0; background: rgba(200, 200, 255, 0.5); }
  8%   { opacity: 1; background: rgba(220, 220, 255, 0.6); }
  12%  { opacity: 0; background: transparent; }
  18%  { opacity: 1; background: rgba(200, 200, 255, 0.35); }
  24%  { opacity: 0; background: transparent; }
  30%  { opacity: 0.7; background: rgba(200, 200, 255, 0.2); }
  40%  { opacity: 0; background: transparent; }
  100% { opacity: 0; background: transparent; }
}

body.screen-shake {
  animation: shake 0.4s ease-out;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-3px, 2px); }
  30% { transform: translate(3px, -2px); }
  45% { transform: translate(-2px, 1px); }
  60% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 1px); }
}

/* ── Rain Layer ────────────────────────────────── */
.rain-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(
      transparent,
      transparent 4px,
      rgba(150, 160, 180, 0.04) 4px,
      rgba(150, 160, 180, 0.04) 5px
    );
  animation: rain-fall 0.6s linear infinite;
}

@keyframes rain-fall {
  0% { transform: translateY(-10px); }
  100% { transform: translateY(5px); }
}

/* ── Floating Background ───────────────────────── */
.floating-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.floater {
  position: absolute;
  bottom: -3rem;
  opacity: 0.06;
  animation: float-up linear infinite;
  filter: grayscale(0.5);
}

@keyframes float-up {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.06; }
  90% { opacity: 0.06; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

/* ── Screen Layout ─────────────────────────────── */
.screen {
  display: none;
  min-height: 100dvh;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* ── Scene Images ──────────────────────────────── */
.scene-img {
  width: 180px;
  height: auto;
  margin: 0 auto 0.5rem;
  display: block;
  border-radius: 12px;
  filter: drop-shadow(0 4px 16px rgba(57, 255, 20, 0.12));
}

.scene-img-sm { width: 130px; }

/* ── Card ──────────────────────────────────────── */
.card {
  background: rgba(20, 20, 35, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(57, 255, 20, 0.1);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md), 0 0 40px rgba(57, 255, 20, 0.03);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Typography ────────────────────────────────── */
.title {
  font-family: 'Creepster', cursive;
  font-size: clamp(3rem, 2rem + 5vw, 5rem);
  text-align: center;
  color: var(--toxic);
  text-shadow: 0 0 30px rgba(57, 255, 20, 0.4), 0 0 60px rgba(57, 255, 20, 0.15);
  line-height: 1;
  letter-spacing: 0.04em;
}

.subtitle {
  text-align: center;
  color: var(--ash);
  font-size: 1rem;
}

.screen-title {
  font-family: 'Creepster', cursive;
  font-size: 2rem;
  text-align: center;
  color: var(--toxic);
  text-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.modal-title {
  font-family: 'Creepster', cursive;
  font-size: 1.6rem;
  text-align: center;
  color: var(--toxic);
}

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--toxic-dim), var(--toxic));
  color: #0A0A0F;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.2);
}
.btn-primary:hover {
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.4);
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--toxic);
  color: var(--toxic);
}
.btn-outline:hover {
  background: rgba(57, 255, 20, 0.1);
}

.btn-full { width: 100%; }

.btn-icon {
  background: rgba(57, 255, 20, 0.1);
  border: 1px solid rgba(57, 255, 20, 0.2);
  color: var(--toxic);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-icon:hover { background: rgba(57, 255, 20, 0.2); }

/* ── Vote Buttons ──────────────────────────────── */
.vote-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-vote {
  padding: 1rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-light);
  color: var(--text);
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1.4;
}

.btn-vote-a:hover {
  border-color: var(--toxic);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.15);
  background: rgba(57, 255, 20, 0.05);
}

.btn-vote-b:hover {
  border-color: var(--blood-glow);
  box-shadow: 0 0 15px rgba(255, 0, 51, 0.15);
  background: rgba(255, 0, 51, 0.05);
}

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

/* ── Input ─────────────────────────────────────── */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus { border-color: var(--toxic); }
.input::placeholder { color: var(--ash); }

.select {
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}

/* ── Home ──────────────────────────────────────── */
.home-card {
  text-align: center;
  padding: 3rem 2rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--ash);
  font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.join-row {
  display: flex;
  gap: 0.5rem;
}
.join-row .input { text-transform: uppercase; letter-spacing: 0.15em; text-align: center; }

/* ── Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-card { max-width: 380px; }

.error-msg {
  background: rgba(204, 0, 0, 0.15);
  border: 1px solid var(--blood);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--blood-glow);
}

/* ── Lobby ─────────────────────────────────────── */
.lobby-card { text-align: center; }

.code-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--bg);
  border: 1px solid rgba(57, 255, 20, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
}

.code-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ash);
}

.code-value {
  font-family: 'Creepster', cursive;
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  color: var(--toxic);
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

.lobby-meta { color: var(--ash); font-size: 0.9rem; }
.lobby-waiting { color: var(--blood-glow); font-size: 0.85rem; }
.lobby-hint { color: var(--ash); font-size: 0.8rem; font-style: italic; text-align: center; }

.player-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-light);
  border-radius: 20px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.host-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--toxic);
  letter-spacing: 0.06em;
}

.host-settings { text-align: left; }
.setting-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--ash);
}

.guest-msg {
  text-align: center;
  color: var(--ash);
  font-size: 0.9rem;
  font-style: italic;
}

/* ── Badge ─────────────────────────────────────── */
.badge {
  display: inline-block;
  align-self: center;
  background: rgba(57, 255, 20, 0.1);
  border: 1px solid rgba(57, 255, 20, 0.2);
  color: var(--toxic);
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Voting Screen ─────────────────────────────── */
.vote-card { text-align: center; }

.status-bar {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.status-humans { color: var(--bone); }
.status-zombies { color: var(--toxic); }

.zombie-badge {
  background: rgba(57, 255, 20, 0.1);
  border: 1px solid var(--toxic);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--toxic);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: zombie-pulse 2s ease-in-out infinite;
}

@keyframes zombie-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(57, 255, 20, 0.1); }
  50% { box-shadow: 0 0 25px rgba(57, 255, 20, 0.3); }
}

.situation-label {
  font-family: 'Creepster', cursive;
  font-size: 1.3rem;
  color: var(--ash);
}

.situation-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--bone);
}

.situation-sm { font-size: 1rem; }

.timer-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-light);
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--toxic);
  border-radius: 3px;
  transition: width 1s linear;
}
.timer-bar-fill.urgent { background: var(--blood-glow); }

.timer-text {
  font-family: 'Creepster', cursive;
  font-size: 2rem;
  color: var(--toxic);
  text-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.submitted-msg {
  color: var(--ash);
  font-style: italic;
  font-size: 0.9rem;
}

.vote-status {
  color: var(--ash);
  font-size: 0.85rem;
}

.zombie-intel {
  background: rgba(57, 255, 20, 0.05);
  border: 1px solid rgba(57, 255, 20, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
  animation: zombie-pulse 2s ease-in-out infinite;
}
.zombie-intel h3 {
  font-family: 'Creepster', cursive;
  font-size: 1rem;
  color: var(--toxic);
  margin-bottom: 0.3rem;
}
.zombie-intel p { font-size: 0.9rem; color: var(--bone); }

/* ── Reveal Screen ─────────────────────────────── */
.reveal-card { text-align: center; }

.flavor-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blood-glow);
}

.turned-text {
  font-family: 'Creepster', cursive;
  font-size: 1.2rem;
  color: var(--toxic);
  text-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
  animation: turned-glow 1.5s ease-in-out infinite;
}

@keyframes turned-glow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 25px rgba(57, 255, 20, 0.6); }
}

.reveal-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.reveal-col {
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.col-safe {
  background: rgba(57, 255, 20, 0.06);
  border: 1px solid rgba(57, 255, 20, 0.15);
}

.col-bitten {
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.2);
}

.col-tie {
  background: rgba(107, 107, 123, 0.1);
  border: 1px solid rgba(107, 107, 123, 0.2);
}

.col-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.4;
  color: var(--bone);
}

.col-count {
  font-size: 0.7rem;
  color: var(--ash);
  display: block;
  margin-bottom: 0.4rem;
}

.reveal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.reveal-player {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  padding: 0.2rem 0;
  justify-content: center;
  flex-wrap: wrap;
}

.was-bitten { animation: bite-shake 0.5s ease-in-out; }

@keyframes bite-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.just-turned { animation: turn-zombie 1s ease-out; }

@keyframes turn-zombie {
  0% { text-shadow: none; }
  50% { text-shadow: 0 0 20px rgba(57, 255, 20, 0.8); color: var(--toxic); }
  100% { text-shadow: 0 0 10px rgba(57, 255, 20, 0.3); }
}

.zombie-tag, .turned-tag {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.zombie-tag { background: rgba(57, 255, 20, 0.15); color: var(--toxic); }
.turned-tag { background: var(--toxic); color: #0A0A0F; }
.bite-tag {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(204, 0, 0, 0.2);
  color: var(--blood-glow);
}

.status-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.status-player {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.status-player.zombie {
  opacity: 0.6;
  color: var(--toxic);
}

.lives { margin-left: auto; font-size: 0.8rem; letter-spacing: 0.1em; }
.status-player.zombie .lives {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Final Screen ──────────────────────────────── */
.final-card { text-align: center; }

.final-card.zombie-win {
  border-color: rgba(57, 255, 20, 0.3);
  box-shadow: var(--shadow-md), 0 0 60px rgba(57, 255, 20, 0.1);
}

.final-card.human-win {
  border-color: rgba(232, 224, 212, 0.2);
  box-shadow: var(--shadow-md), 0 0 60px rgba(232, 224, 212, 0.05);
}

.final-subtitle {
  color: var(--ash);
  font-size: 1rem;
  font-style: italic;
}

.scoreboard {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
}
.score-row.zombie { opacity: 0.5; }
.score-name { flex: 1; text-align: left; }
.score-status { font-size: 0.8rem; letter-spacing: 0.05em; }
.score-row.zombie .score-status {
  color: var(--toxic);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ── Player Colors ─────────────────────────────── */
.pcolor-blood   { background: #CC0000; }
.pcolor-toxic   { background: #39FF14; }
.pcolor-ash     { background: #6B6B7B; }
.pcolor-rust    { background: #8B4513; }
.pcolor-bone    { background: #E8E0D4; }
.pcolor-moss    { background: #2E5A2E; }
.pcolor-slate   { background: #4A5568; }
.pcolor-amber   { background: #D4A017; }
.pcolor-violet  { background: #6B3FA0; }
.pcolor-ice     { background: #7EC8E3; }

/* ── Music Toggle ─────────────────────────────── */
.music-toggle {
  position: fixed;
  bottom: 2.5rem;
  right: 1rem;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--toxic);
  background: var(--bg-secondary);
  color: var(--toxic);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.15);
}

.music-toggle:hover {
  background: var(--surface);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 500px) {
  .card { padding: 1.5rem 1rem; }
  .title { font-size: clamp(2.5rem, 2rem + 4vw, 4rem); }
  .reveal-split { grid-template-columns: 1fr; }
}
