/* ============================================
   MAFIA - Midnight Noir
   Palette: Brass on midnight, phase-aware glow
   Type: Playfair Display (character) + Inter (utility)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* ---- Design Tokens ---- */
:root {
  --bg:           #0D0B0E;
  --surface:      #161219;
  --surface-2:    #1E1A22;
  --surface-3:    #262030;
  --border:       #2E2933;
  --border-hi:    #3D364A;

  --brass:        #C9A84C;
  --brass-dim:    #7A6330;
  --brass-glow:   rgba(201,168,76,0.14);

  --mafia:        #C0392B;
  --detective:    #9B59B6;
  --doctor:       #2ECC71;
  --town:         #4A90D9;

  --text:         #E8E0F0;
  --text-muted:   #8A7E94;
  --text-dim:     #4A4455;

  --danger:       #E74C3C;
  --success:      #27AE60;

  --radius:       8px;
  --radius-lg:    14px;
  --radius-xl:    20px;
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --t:            0.25s;
}

/* Phase atmosphere: class toggled by JS on body */
body.phase-night { --phase-bg: rgba(30, 0, 60, 0.35); --phase-border: rgba(120,0,200,0.25); }
body.phase-day   { --phase-bg: rgba(50, 35, 0, 0.25); --phase-border: rgba(201,168,76,0.20); }

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 1.2s ease;
}

body.phase-night { background: #0B0814; }
body.phase-day   { background: #0F0C07; }

/* ============================================
   LOADING
   ============================================ */

#loadingScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 15% 85%, rgba(201,168,76,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(80,0,120,0.10) 0%, transparent 55%);
}

.loading-card {
  text-align: center;
  animation: fadeUp 0.45s var(--ease) both;
}

.loading-logo {
  font-family: 'Playfair Display', serif;
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--brass);
  text-shadow: 0 0 50px rgba(201,168,76,0.25);
  line-height: 1;
  margin-bottom: 1.75rem;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brass);
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.loading-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  max-width: 280px;
  margin: 0 auto;
}

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

/* ============================================
   LANDING
   ============================================ */

#landingScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 15% 85%, rgba(201,168,76,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(80,0,120,0.10) 0%, transparent 55%);
}

.landing-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 40px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03);
  animation: fadeUp 0.45s var(--ease) both;
}

.landing-logo {
  font-family: 'Playfair Display', serif;
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--brass);
  text-shadow: 0 0 50px rgba(201,168,76,0.25);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.landing-tagline {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  text-align: left;
}

.field-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 1.1rem 0;
}
.or-divider::before,
.or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.join-row { display: flex; gap: 0.5rem; }

/* ============================================
   GAME SCREEN STRUCTURE
   ============================================ */

#gameScreen {
  height: 100vh;
  display: none;
  flex-direction: column;
}

/* ---- Header ---- */
.g-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.g-header-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--brass);
}

.phase-badge {
  padding: 0.22rem 0.65rem;
  border-radius: 100px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.5s var(--ease);
}

.phase-badge.night {
  background: rgba(60,0,100,0.45);
  border-color: rgba(130,0,220,0.4);
  color: #C084FC;
  box-shadow: 0 0 14px rgba(100,0,200,0.18);
  animation: phasePulse 3s ease-in-out infinite;
}

.phase-badge.day {
  background: rgba(100,68,0,0.35);
  border-color: rgba(201,168,76,0.45);
  color: var(--brass);
  box-shadow: 0 0 14px rgba(201,168,76,0.14);
}

@keyframes phasePulse {
  0%,100% { opacity:1; } 50% { opacity:0.65; }
}

.day-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  display: none;
}

.header-spacer { flex: 1; }

.room-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  user-select: all;
}
.room-pill:hover { color: var(--brass); border-color: var(--brass-dim); }

/* ---- Body Grid ---- */
.g-body {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 1fr;
  overflow: hidden;
  min-height: 0;
}

/* ---- Sidebar ---- */
.g-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0.85rem;
  gap: 0.4rem;
}

.sidebar-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.15rem;
  margin-top: 0.5rem;
}
.sidebar-label:first-child { margin-top: 0; }

.p-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid transparent;
  animation: slideIn 0.25s var(--ease) both;
  transition: all var(--t) var(--ease);
}

.p-card.is-me   { border-color: var(--brass-dim); background: var(--brass-glow); }
.p-card.dead    { opacity: 0.38; filter: grayscale(1); }

.p-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  text-transform: uppercase;
  border: 1px solid var(--border-hi);
}

.p-name {
  font-size: 0.8rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.p-card.dead .p-dot { background: var(--danger); }

.p-card.disconnected        { opacity: 0.7; }
.p-card.disconnected .p-dot { background: var(--warning, #e0a030); animation: pulse 1s ease-in-out infinite; }

.p-reconnect-badge {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  flex-shrink: 0;
  white-space: nowrap;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ---- Main Content ---- */
.g-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.g-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* ---- Role Card ---- */
.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: fadeUp 0.3s var(--ease) both;
}

.role-left {}
.role-eyebrow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.role-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 0.1rem 0 0.15rem;
  transition: color 0.4s var(--ease);
}
.role-title.mafia      { color: var(--mafia); }
.role-title.detective  { color: var(--detective); }
.role-title.doctor     { color: var(--doctor); }
.role-title.townie     { color: var(--town); }

.role-sub  { font-size: 0.72rem; color: var(--text-muted); }
.role-icon { font-size: 2.2rem; line-height: 1; flex-shrink: 0; }

/* ---- Lobby Panel ---- */
.lobby-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.lobby-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brass);
}

.lobby-heading::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

.lobby-count { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.lobby-hint  { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.6rem; }

/* ---- Action Panel (Night / Vote) ---- */
.action-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  animation: fadeUp 0.3s var(--ease) both;
}

.action-panel.night-panel { border-color: var(--phase-border, var(--border)); }

.action-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.action-heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: var(--brass);
  transition: color var(--t) var(--ease);
}
.timer.urgent { color: var(--danger); animation: timerBlink 0.55s ease-in-out infinite; }
@keyframes timerBlink { 0%,100%{opacity:1;} 50%{opacity:0.45;} }

.sleeping-msg { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

/* Target grid */
.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.target-opt { position: relative; }
.target-opt input[type="radio"] { position: absolute; opacity:0; pointer-events:none; }
.target-opt label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--t) var(--ease);
  user-select: none;
}
.target-opt label:hover { border-color: var(--border-hi); background: var(--surface-3); }
.target-opt input:checked + label {
  border-color: var(--brass);
  background: var(--brass-glow);
  color: var(--brass);
}

/* Vote row */
.vote-row { display: flex; gap: 0.5rem; align-items: center; }
.vote-row select { flex: 1; }

/* ---- Chat ---- */
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 160px;
  max-height: 220px;
}

.chat-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  animation: msgIn 0.2s var(--ease) both;
}
@keyframes msgIn { from{opacity:0;transform:translateY(3px);} to{opacity:1;transform:none;} }

.chat-msg .sender { font-weight: 600; color: var(--text); margin-right: 0.25rem; }
.chat-msg .phase-tag {
  display: inline-block;
  font-size: 0.6rem;
  background: var(--surface-3);
  color: var(--text-dim);
  border-radius: 100px;
  padding: 0.08rem 0.38rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.chat-msg.sys   { color: var(--brass); font-style: italic; font-size: 0.76rem; }
.chat-msg.kill  { color: var(--mafia); }

.chat-bar {
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid var(--border);
}
.chat-bar input { flex: 1; }

/* ============================================
   INPUTS & BUTTONS
   ============================================ */

input[type="text"], input[type="number"], select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  font-size: 0.83rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t) var(--ease);
  width: 100%;
}
input:focus, select:focus { border-color: var(--brass-dim); box-shadow: 0 0 0 3px rgba(201,168,76,0.08); }
input::placeholder { color: var(--text-dim); }
select option { background: var(--surface-2); }

button {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brass);
  color: #0D0B0E;
  border-color: var(--brass);
}
.btn-primary:hover { background: #d4b054; box-shadow: 0 0 18px rgba(201,168,76,0.25); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-hi); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }

/* ============================================
   SETTINGS MODAL
   ============================================ */

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: bgIn 0.2s ease both;
}
.modal-bg.open { display: flex; }
@keyframes bgIn { from{opacity:0;} to{opacity:1;} }

.modal-box {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  animation: boxIn 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes boxIn { from{opacity:0;transform:scale(0.9) translateY(16px);} to{opacity:1;transform:none;} }

.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.3rem;
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.sf { display: flex; flex-direction: column; gap: 0.3rem; }
.sf label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sf input { text-align: center; }

.modal-ft {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ============================================
   GAME OVER OVERLAY
   ============================================ */

#gameOver {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(10px);
  text-align: center;
  padding: 1rem;
}
#gameOver.open { display: flex; animation: bgIn 0.4s ease both; }

.go-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2rem, 8vw, 3.5rem);
  font-weight: 900;
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.15s both;
}
.go-title.town-wins  { color: var(--town); text-shadow: 0 0 50px rgba(74,144,217,0.35); }
.go-title.mafia-wins { color: var(--mafia); text-shadow: 0 0 50px rgba(192,57,43,0.35); }

@keyframes popIn { from{opacity:0;transform:scale(0.4);} to{opacity:1;transform:scale(1);} }

.go-sub { color: var(--text-muted); font-size: 1rem; animation: fadeUp 0.4s ease 0.4s both; }

/* ============================================
   TOASTS
   ============================================ */

#toasts {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  max-width: 260px;
  animation: toastIn 0.25s var(--ease) both;
  pointer-events: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
@keyframes toastIn { from{opacity:0;transform:translateX(14px);} to{opacity:1;transform:none;} }
.toast.err  { border-color: rgba(231,76,60,0.5); color: #FF7B6E; }
.toast.ok   { border-color: rgba(39,174,96,0.5); color: #5DDB9A; }
.toast.info { border-color: rgba(201,168,76,0.5); color: var(--brass); }

/* ============================================
   SHARED UTILITIES
   ============================================ */

@keyframes fadeUp   { from{opacity:0;transform:translateY(18px);} to{opacity:1;transform:none;} }
@keyframes slideIn  { from{opacity:0;transform:translateX(-8px);} to{opacity:1;transform:none;} }

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

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
  .g-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .g-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-height: 130px;
    overflow-y: auto;
  }
  .sidebar-label { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .landing-card { padding: 1.75rem 1.25rem; }
}

/* ============================================
   3-COLUMN DAY LAYOUT (vote tally right panel)
   ============================================ */

body.phase-day .g-body { grid-template-columns: 200px 1fr 200px; }

.g-right {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 0.85rem;
  gap: 0.5rem;
  overflow-y: auto;
}
body.phase-day .g-right { display: flex; }

/* ============================================
   VOTE TALLY PANEL
   ============================================ */

.vt-tally {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.vt-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vt-name {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text);
  width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.vt-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.vt-bar {
  height: 100%;
  background: var(--brass);
  border-radius: 3px;
  transition: width 0.45s var(--ease);
  min-width: 0;
}

.vt-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.vt-sep {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

.vt-pending-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.vt-pending-names {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.vt-all-voted {
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 600;
}

/* ============================================
   VOTE FORM STATE
   ============================================ */

.vote-row { display: flex; gap: 0.5rem; align-items: center; }
.vote-row select { flex: 1; }

.vote-row.submitted {
  opacity: 0.4;
  pointer-events: none;
}

/* Eliminated players see but can't interact with the phase panel */
.panel-disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.4);
}

.vote-cast-msg {
  font-size: 0.78rem;
  color: var(--success);
  margin-top: 0.35rem;
  font-weight: 500;
  display: none;
}

.chat-msg.vote .vote-announce { color: var(--brass); }

/* ============================================
   PHASE TRANSITION OVERLAY
   ============================================ */

.phase-transition {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(5, 3, 8, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  animation: bgIn 0.4s ease both;
}

.phase-transition.fading {
  animation: bgIn 0.45s ease reverse both;
  pointer-events: none;
}

.tr-icon {
  font-size: 3.5rem;
  margin-bottom: 0.8rem;
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
  line-height: 1;
}

.tr-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.5rem;
  animation: fadeUp 0.4s ease 0.2s both;
  max-width: 480px;
}

.tr-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  animation: fadeUp 0.4s ease 0.3s both;
}

.tr-hint {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  animation: fadeUp 0.4s ease 0.4s both;
}

.tr-killed    { color: var(--mafia); font-weight: 700; }
.tr-eliminated { color: var(--brass); font-weight: 700; }

/* Suspense hold before a voted-out player's role is revealed */
.reveal-suspense {
  font-style: italic;
  animation: fadeUp 0.4s ease 0.3s both, suspensePulse 1s ease-in-out 0.3s infinite;
}
@keyframes suspensePulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.reveal-pop {
  animation: revealPop 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes revealPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.reveal-role-name.mafia      { color: var(--mafia); }
.reveal-role-name.detective  { color: var(--detective); }
.reveal-role-name.doctor     { color: var(--doctor); }
.reveal-role-name.townie     { color: var(--town); }

/* Tally bars */
.tr-tally {
  margin-top: 1.1rem;
  width: 100%;
  max-width: 380px;
  animation: fadeUp 0.4s ease 0.35s both;
}

.tr-tally-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.tr-tally-name {
  font-size: 0.82rem;
  color: var(--text);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tr-tally-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.tr-tally-bar {
  height: 100%;
  background: var(--brass);
  border-radius: 4px;
  min-width: 0;
  transition: width 0.5s var(--ease);
}

.tr-tally-bar.leader { background: var(--mafia); }

.tr-tally-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}

/* ============================================
   MAFIA COORDINATION PANEL
   ============================================ */

.mafia-coord {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.22);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
}

.mafia-coord-title {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #FF7B6E;
  margin-bottom: 0.45rem;
}

.mafia-coord-rows {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mafia-coord-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.79rem;
  color: var(--text-muted);
}

.mafia-coord-name { color: var(--text); font-weight: 500; }

.mafia-coord-status         { font-size: 0.72rem; font-weight: 600; }
.mafia-coord-status.previewing { color: var(--text-dim); }
.mafia-coord-status.confirmed  { color: #FF7B6E; }

/* ============================================
   MAFIA CHAT PANEL
   ============================================ */

.mafia-chat-panel {
  background: rgba(192, 57, 43, 0.06);
  border: 1px solid rgba(192, 57, 43, 0.18);
  border-radius: var(--radius);
  margin-top: 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mafia-chat-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #FF7B6E;
  padding: 0.5rem 0.75rem 0.4rem;
  border-bottom: 1px solid rgba(192, 57, 43, 0.14);
  flex-shrink: 0;
}

.mafia-chat-msgs {
  padding: 0.5rem 0.75rem;
  min-height: 72px;
  max-height: 130px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1;
}

.mafia-chat-msg {
  font-size: 0.79rem;
  color: var(--text-muted);
  animation: msgIn 0.2s var(--ease) both;
  line-height: 1.4;
}
@keyframes msgIn { from{opacity:0;transform:translateY(3px);} to{opacity:1;transform:none;} }

.mafia-sender {
  font-weight: 600;
  color: #FF7B6E;
  margin-right: 0.2rem;
}

.mafia-chat-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border-top: 1px solid rgba(192, 57, 43, 0.14);
  flex-shrink: 0;
}

.mafia-chat-bar input { flex: 1; }

/* ============================================
   BUTTON ADDITIONS
   ============================================ */

.btn-danger {
  background: rgba(192,57,43,0.12);
  color: #FF7B6E;
  border-color: rgba(192,57,43,0.3);
}
.btn-danger:hover {
  background: rgba(192,57,43,0.22);
  border-color: rgba(192,57,43,0.5);
}

/* ============================================
   GAME OVER - animation only on .open class
   ============================================ */

#gameOver .go-title { animation: none; }
#gameOver .go-sub   { animation: none; }
#gameOver.open .go-title {
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.15s both;
}
#gameOver.open .go-sub {
  animation: fadeUp 0.4s ease 0.4s both;
}

@keyframes popIn {
  from { opacity:0; transform: scale(0.4); }
  to   { opacity:1; transform: scale(1); }
}

/* ============================================
   RESPONSIVE — mobile day layout
   ============================================ */

@media (max-width: 700px) {
  body.phase-day .g-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  body.phase-day .g-right {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 160px;
    overflow-y: auto;
  }
}