/* ============================================================
   MAFIA GAME — STYLE SHEET
   Beige-warm palette, dark/light modes, mobile-first
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  --beige-50:  #fdf8f0;
  --beige-100: #f7edda;
  --beige-200: #eddfc0;
  --beige-300: #dfc9a0;
  --beige-400: #c9a96e;
  --beige-500: #b8935a;
  --beige-600: #9a7840;
  --beige-700: #7a5c28;
  --beige-800: #5c4118;
  --beige-900: #3c280a;

  --red-mafia:    #c0392b;
  --red-bright:   #e74c3c;
  --gold-sheriff: #d4a017;
  --teal-angel:   #1a7a6e;
  --teal-bright:  #1abc9c;
  --slate-town:   #607d8b;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.12);
  --shadow-md:  0 6px 24px rgba(0,0,0,0.18);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.28);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- DARK THEME (default) ---- */
[data-theme="dark"] {
  --bg:           #1a1410;
  --bg-secondary: #231e18;
  --bg-tertiary:  #2d2620;
  --surface:      #332c24;
  --surface-2:    #3d352b;
  --border:       rgba(223, 201, 160, 0.15);
  --border-strong:rgba(223, 201, 160, 0.35);
  --text-primary: #f0e6d0;
  --text-secondary:#c4b08a;
  --text-muted:   #8a7660;
  --glass-bg:     rgba(50, 42, 32, 0.7);
  --glass-border: rgba(223, 201, 160, 0.2);
  --hero-gradient:linear-gradient(160deg, #2d1a0e 0%, #1a1410 50%, #0e1a1a 100%);
  --card-back:    linear-gradient(135deg, #2a2018 0%, #1e1810 50%, #0e1818 100%);
  --card-face:    linear-gradient(135deg, #332c24 0%, #2a2318 100%);
}


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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: -0.02em;
}


/* ---------- Phase (screen) ---------- */
.phase {
  min-height: 100vh;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
.hidden { display: none !important; }

/* ---------- Hero ---------- */
.hero {
  width: 100%;
  padding: 60px 20px 32px;
  text-align: center;
  background: var(--hero-gradient);
  border-radius: var(--radius-xl);
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(184, 147, 90, 0.2) 0%, transparent 70%);
}
.logo {
  font-size: clamp(2.4rem, 8vw, 3.5rem);
  font-weight: 700;
  color: var(--beige-200);
  text-shadow: 0 4px 24px rgba(0,0,0,0.5);
  position: relative;
}
.tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

/* ---------- Setup Form ---------- */
.setup-card h2 {
  font-size: 1.5rem;
  color: var(--beige-300);
  margin-bottom: 24px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}
.stepper-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--surface-2);
  color: var(--beige-400);
  font-size: 1.4rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:hover { background: var(--beige-700); color: var(--beige-100); }
.stepper input {
  width: 64px;
  height: 44px;
  border: none;
  border-left: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---------- Buttons ---------- */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--beige-600), var(--beige-500));
  color: #fff;
  box-shadow: 0 4px 16px rgba(184, 147, 90, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--beige-500), var(--beige-400));
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(184, 147, 90, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-accent {
  background: linear-gradient(135deg, #1a3a3a, #1a7a6e);
  color: #a8f0e8;
  box-shadow: 0 4px 16px rgba(26, 122, 110, 0.3);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26, 122, 110, 0.4);
}
.btn-danger {
  background: linear-gradient(135deg, #5c1a1a, #c0392b);
  color: #ffd0d0;
}
.btn-danger:hover { transform: translateY(-2px); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; }

/* ---------- Phase Header ---------- */
.phase-header {
  width: 100%;
  text-align: center;
  padding-top: 36px;
}
.phase-header h2 { font-size: 1.8rem; color: var(--beige-300); }
.phase-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 6px;
}
.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 8px;
  font-family: 'Inter', sans-serif;
  transition: color var(--transition);
}
.back-btn:hover { color: var(--beige-400); }

/* ---------- Names Grid ---------- */
.names-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.name-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.name-input-wrapper label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.name-input-wrapper input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.name-input-wrapper input:focus {
  border-color: var(--beige-500);
  box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.15);
}
.name-input-wrapper input::placeholder { color: var(--text-muted); }

/* ---------- Player Selector Chips ---------- */
.player-selector {
  width: 100%;
  text-align: center;
}
.selector-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.player-chip {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.player-chip:hover:not(.done):not(.active) {
  border-color: var(--beige-500);
  color: var(--beige-400);
}
.player-chip.active {
  background: linear-gradient(135deg, var(--beige-700), var(--beige-600));
  color: var(--beige-100);
  border-color: var(--beige-500);
  box-shadow: 0 4px 12px rgba(184, 147, 90, 0.3);
}
.player-chip.done {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-color: transparent;
  cursor: default;
  text-decoration: line-through;
  opacity: 0.5;
}

/* ---------- Cards Grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  width: 100%;
  padding: 4px;
}

/* 3D flip card */
.card-wrapper {
  perspective: 800px;
  aspect-ratio: 3/4;
  cursor: pointer;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-md);
}
.card-inner.flipped { transform: rotateY(180deg); }
.card-front, .card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  gap: 8px;
  border: 1px solid var(--border-strong);
}
.card-back {
  background: var(--card-back);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.06);
}
.card-back-pattern {
  font-size: 2.4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.card-back-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--beige-400);
}
.card-front {
  background: var(--card-face);
  transform: rotateY(180deg);
  border-color: transparent;
}
.card-front .role-icon { font-size: 2.2rem; }
.card-front .role-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}
.card-front.mafia { border-color: var(--red-mafia); background: linear-gradient(135deg, #2a0a0a, #3c1010); }
.card-front.mafia .role-name { color: var(--red-bright); }
.card-front.sheriff { border-color: var(--gold-sheriff); background: linear-gradient(135deg, #2a2208, #3c3010); }
.card-front.sheriff .role-name { color: var(--gold-sheriff); }
.card-front.angel { border-color: var(--teal-angel); background: linear-gradient(135deg, #082a28, #0a3c38); }
.card-front.angel .role-name { color: var(--teal-bright); }
.card-front.town { border-color: var(--slate-town); background: linear-gradient(135deg, #161e22, #1e2c34); }
.card-front.town .role-name { color: #90afc0; }

.card-wrapper.selected .card-back {
  border-color: var(--beige-400);
  box-shadow: 0 0 0 2px var(--beige-600), var(--shadow-md);
}
.card-wrapper.used { opacity: 0.35; pointer-events: none; cursor: default; }

/* Seen overlay (×) */
.card-seen-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,0.7);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.card-wrapper.used .card-seen-overlay { opacity: 1; }

/* ---------- Complete Section ---------- */
.complete-section { width: 100%; }

/* ---------- Moderator Dashboard ---------- */
.mod-header {
  width: 100%;
  padding-top: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mod-header h2 {
  font-size: 1.5rem;
  color: var(--beige-300);
}
.round-badge {
  background: linear-gradient(135deg, var(--beige-700), var(--beige-600));
  color: var(--beige-100);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ---------- Tabs ---------- */
.tab-bar {
  width: 100%;
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.tab.active {
  background: linear-gradient(135deg, var(--beige-700), var(--beige-600));
  color: var(--beige-100);
  box-shadow: var(--shadow-sm);
}
.tab-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Players List ---------- */
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.player-row.dead {
  opacity: 0.45;
  background: var(--bg-secondary);
}
.player-row.dead .player-name { text-decoration: line-through; }
.player-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-town    { background: rgba(96, 125, 139, 0.25); color: #90afc0; }
.avatar-mafia   { background: rgba(192, 57, 43, 0.25);  color: var(--red-bright); }
.avatar-sheriff { background: rgba(212, 160, 23, 0.25); color: var(--gold-sheriff); }
.avatar-angel   { background: rgba(26, 122, 110, 0.25); color: var(--teal-bright); }
.player-info { flex: 1; min-width: 0; }
.player-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-role-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.tag-town    { color: #90afc0; }
.tag-mafia   { color: var(--red-bright); }
.tag-sheriff { color: var(--gold-sheriff); }
.tag-angel   { color: var(--teal-bright); }
.player-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}
.status-alive  { background: rgba(26, 122, 110, 0.2); color: var(--teal-bright); }
.status-dead   { background: rgba(192, 57, 43, 0.2);  color: var(--red-bright); }
.player-vote-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.player-vote-btn:hover { background: rgba(192, 57, 43, 0.2); border-color: var(--red-mafia); color: var(--red-bright); }

/* ---------- Legend ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-mafia   { background: var(--red-bright); }
.dot-sheriff { background: var(--gold-sheriff); }
.dot-angel   { background: var(--teal-bright); }
.dot-town    { background: var(--slate-town); }

/* ---------- Night Phase ---------- */
.night-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.night-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.night-role-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.night-role-icon { font-size: 1.4rem; }
.night-role-name {
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
}
.select-dropdown {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.select-dropdown:focus {
  border-color: var(--beige-500);
  box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.15);
}
.night-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- Sheriff Result ---------- */
.sheriff-result {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid;
}
.sheriff-result.mafia-found {
  background: rgba(192, 57, 43, 0.15);
  border-color: var(--red-mafia);
  color: #f08080;
}
.sheriff-result.innocent {
  background: rgba(26, 122, 110, 0.15);
  border-color: var(--teal-angel);
  color: var(--teal-bright);
}

/* ---------- History ---------- */
.history-round {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
}
.history-round-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--beige-400);
  margin-bottom: 10px;
  font-weight: 600;
}
.history-event {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.history-event:last-child { border-bottom: none; padding-bottom: 0; }
.history-event-icon { flex-shrink: 0; }

/* ---------- Day Bar ---------- */
.day-bar {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.day-bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.day-vote-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.vote-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}
.vote-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--red-mafia);
  background: transparent;
  color: var(--red-bright);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.vote-btn:hover { background: rgba(192, 57, 43, 0.2); }

/* ---------- Game Over Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  max-width: 480px;
  width: 100%;
  text-align: center;
  padding: 36px 28px;
}
.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 12px;
}
.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.95rem;
}
.role-reveal {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
}
.reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

/* ---------- Pulse / Glow Animations ---------- */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(184, 147, 90, 0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(184, 147, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 147, 90, 0); }
}
.pulsing { animation: pulse-ring 1.8s infinite; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.35s ease both; }

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .names-grid  { grid-template-columns: 1fr; }
}
@media (min-width: 500px) {
  .cards-grid  { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ============================================================
   MODERATOR DASHBOARD v2 — STEP-BY-STEP REDESIGN
   ============================================================ */

/* Phase-mod overrides the default phase padding/max-width */
.phase-mod {
  padding: 0 0 60px;
  max-width: 100%;
  gap: 0;
  align-items: stretch;
}

/* ── Sticky Top Bar ──────────────────────────────────────── */
.mod-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.mod-logo-sm {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--beige-400);
  white-space: nowrap;
}
.round-pill {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.pill-day {
  background: linear-gradient(135deg, #3a2e10, #5c4118);
  color: var(--beige-200);
  box-shadow: 0 2px 8px rgba(92,65,24,0.4);
}
.pill-night {
  background: linear-gradient(135deg, #0a1520, #1a2e4a);
  color: #a0c4f0;
  box-shadow: 0 2px 8px rgba(10,21,32,0.5);
}
.reset-btn {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  white-space: nowrap;
}
.reset-btn:hover {
  background: rgba(192, 57, 43, 0.15);
  border-color: var(--red-mafia);
  color: var(--red-bright);
}

/* ── Players Status Strip ─────────────────────────────────── */
.players-strip-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.players-strip-wrap::-webkit-scrollbar { display: none; }
.players-strip {
  display: flex;
  gap: 7px;
  width: max-content;
  min-width: 100%;
}
.pchip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-width: 52px;
  max-width: 68px;
  position: relative;
  transition: opacity var(--transition);
}
.pchip-alive { background: var(--surface); }
.pchip-dead  { background: var(--bg-tertiary); opacity: 0.38; }
.pchip-icon  { font-size: 1.05rem; line-height: 1; }
.pchip-name  {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.pchip-dead-x {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.58rem;
  color: var(--red-bright);
  font-weight: 700;
}

/* ── Phase Content Container ──────────────────────────────── */
.phase-content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 0;
}

/* ═══════════════════════════════════════════════════════════
   DAY PHASE
   ═══════════════════════════════════════════════════════════ */
.day-phase {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.day-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}
.day-sun { font-size: 2.4rem; flex-shrink: 0; line-height: 1; }
.day-banner-text { flex: 1; }
.day-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  color: var(--beige-300);
  margin-bottom: 5px;
  font-weight: 700;
}
.day-msg {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.vote-section { padding: 20px; }
.vote-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.vote-header-icon { font-size: 1.5rem; }
.vote-title-txt {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 3px;
}
.vote-sub-txt {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.vote-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vote-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vote-icon { font-size: 1rem; }
.vote-elim-btn {
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--red-mafia);
  background: transparent;
  color: var(--red-bright);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.vote-elim-btn:hover {
  background: rgba(192, 57, 43, 0.2);
  transform: scale(1.03);
}
.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
  font-size: 0.88rem;
}

/* Night button for day phase */
.btn-night {
  background: linear-gradient(135deg, #0a1520 0%, #142040 100%);
  color: #a0c4f0;
  border: 1px solid rgba(100, 150, 220, 0.25);
  box-shadow: 0 4px 16px rgba(10, 21, 32, 0.5);
}
.btn-night:hover {
  background: linear-gradient(135deg, #142040, #1e3460);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(10, 21, 32, 0.6);
}

/* ═══════════════════════════════════════════════════════════
   NIGHT PHASE — STEP WIZARD
   ═══════════════════════════════════════════════════════════ */
.night-wizard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Step Progress Bar */
.step-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 0 2px;
}
.step-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-active {
  transform: scale(1.12);
  color: white;
}
.step-done {
  background: var(--bg-tertiary);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}
/* Future step whose role has already been eliminated — shown faded */
.step-dead-role {
  opacity: 0.4;
}

/* Dead-role notice — only the moderator sees this */
.role-dead-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px dashed rgba(192, 57, 43, 0.35);
  border-radius: var(--radius-sm);
}
.role-dead-icon { font-size: 1.4rem; flex-shrink: 0; }
.role-dead-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e07070;
  margin-bottom: 3px;
}
.role-dead-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

.step-connector {
  height: 2px;
  width: 24px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 -1px;
}
.step-counter {
  text-align: center;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Preamble — moderator instruction card */
.preamble-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.preamble-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.preamble-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

/* Night action card */
.night-step-card {
  padding: 22px;
}
.night-role-header-new {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.night-big-icon { font-size: 2.2rem; line-height: 1; }
.night-role-info { display: flex; flex-direction: column; gap: 3px; }
.night-role-title-new {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
}
.night-role-close-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-style: italic;
}
.night-instruction-txt {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  padding: 11px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-strong);
  margin-bottom: 16px;
}
.night-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.night-dropdown-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Night nav buttons */
.night-nav-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 8px;
}
.night-nav-bar > * { flex: 1; }
.night-nav-bar > div { flex: 0 0 0px; } /* placeholder spacer */

/* ── History Drawer ───────────────────────────────────────── */
.history-drawer {
  width: 100%;
  max-width: 640px;
  margin: 20px auto 0;
  padding: 0 16px 20px;
}
.history-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.history-toggle-btn:hover { background: var(--surface-2); }
.history-toggle-btn.open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.history-badge {
  background: var(--beige-700);
  color: var(--beige-200);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}
.drawer-arrow {
  font-size: 1rem;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-muted);
}
.history-toggle-btn.open .drawer-arrow { transform: rotate(180deg); }
.history-drawer-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}

