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

:root {
  --liberal: #3a6bc4;
  --fascist: #c0392b;
  --hitler: #8b0000;
  --bg: #1a1a2e;
  --card-bg: #16213e;
  --surface: #0f3460;
  --text: #e0e0e0;
  --text-dim: #9aa0a8;
  --accent: #e94560;
  --green: #27ae60;
  --yellow: #f39c12;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  touch-action: manipulation;
}

/* ── Screens ───────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 20px;
  gap: 14px;
  text-align: center;
}
.screen.active { display: flex; }

/* ── Logo ──────────────────────────────────────────────────────── */
.logo {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Phase label ───────────────────────────────────────────────── */
.phase-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── Inputs ────────────────────────────────────────────────────── */
input[type="text"] {
  width: 100%;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--surface);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: var(--accent); }

/* ── Buttons ───────────────────────────────────────────────────── */
button {
  width: 100%;
  max-width: 320px;
  padding: 15px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: opacity 0.15s, transform 0.1s;
}
button:active { opacity: 0.8; transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Divider ───────────────────────────────────────────────────── */
.divider {
  color: var(--text-dim);
  font-size: 0.9rem;
  position: relative;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

/* ── Hints / Labels ────────────────────────────────────────────── */
.hint {
  color: var(--text-dim);
  font-size: 0.9rem;
  max-width: 320px;
}
.sub-hint {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ── Big status text ───────────────────────────────────────────── */
.big-status {
  font-size: 1.15rem;
  font-weight: 600;
  max-width: 320px;
  line-height: 1.4;
}

/* ── Error ─────────────────────────────────────────────────────── */
.error {
  color: var(--accent);
  font-size: 0.9rem;
  max-width: 320px;
}

/* ── Lobby player count ────────────────────────────────────────── */
.lobby-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--yellow);
  letter-spacing: 0.06em;
}

/* ── Room code display ─────────────────────────────────────────── */
.room-code-display {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--yellow);
}

/* ── Player list ───────────────────────────────────────────────── */
.player-list {
  list-style: none;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.player-list li {
  background: var(--card-bg);
  border: 2px solid var(--surface);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-list.selectable {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.player-list.selectable li {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  justify-content: center;
  text-align: center;
}
.player-list.selectable li:hover,
.player-list.selectable li:active {
  border-color: var(--accent);
  background: var(--surface);
}

/* ── Role card ─────────────────────────────────────────────────── */
.role-card {
  width: 220px;
  min-height: 140px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.role-card.liberal { background: var(--liberal); color: #fff; }
.role-card.fascist { background: var(--fascist); color: #fff; }
.role-card.hitler  { background: var(--hitler); color: #fff; }
.role-card .party-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  opacity: 0.85;
  text-transform: uppercase;
}

/* ── Night info (fascist knowledge) ───────────────────────────── */
.night-info {
  max-width: 320px;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.night-info strong { color: var(--text); }

/* ── Vote area ─────────────────────────────────────────────────── */
.vote-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.candidates {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.6;
}
.vote-buttons {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}
.vote-btn {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 900;
}
.vote-btn.ja   { background: var(--green); }
.vote-btn.nein { background: var(--fascist); }
.vote-btn:disabled { opacity: 0.35; }

/* ── Policy tiles ──────────────────────────────────────────────── */
.tile-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.policy-tile {
  width: 88px;
  height: 120px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  color: #fff;
}
.policy-tile.liberal { background: var(--liberal); }
.policy-tile.fascist { background: var(--fascist); }
.policy-tile:hover   { border-color: #fff; transform: scale(1.05); }
.policy-tile.selected { border-color: var(--yellow); transform: scale(1.05); }

/* Face-down state — shown before reveal animation */
.policy-tile.face-down {
  background: #1c2b3a;
  border-color: #2d4055;
  pointer-events: none;
  cursor: default;
}
.policy-tile.face-down::after {
  content: '?';
  font-size: 2.2rem;
  color: #2d4055;
  font-style: normal;
}

/* ── Reveal all button ─────────────────────────────────────────── */
.reveal-btn {
  background: #2a3a50;
  border: 1px solid #3a5a7a;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 700;
  max-width: 160px;
  padding: 10px;
  letter-spacing: 0.08em;
}
.reveal-btn:active { opacity: 0.7; }
.reveal-btn.hidden { display: none !important; }

/* ── Veto button ───────────────────────────────────────────────── */
.veto-btn {
  background: #555;
  font-size: 0.9rem;
  max-width: 220px;
}

/* ── Executive target picker ───────────────────────────────────── */
#exec-target-list li .role-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Game over ─────────────────────────────────────────────────── */
.gameover-headline {
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.gameover-headline.liberal { color: var(--liberal); }
.gameover-headline.fascist { color: var(--fascist); }

.role-reveal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  max-height: 35dvh;
  overflow-y: auto;
}
.role-reveal-row {
  display: flex;
  justify-content: space-between;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
}
.role-reveal-row .role-badge {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}
.role-badge.liberal { color: #6fa8dc; }
.role-badge.fascist { color: #e06666; }
.role-badge.hitler  { color: #ff0000; }

/* ── Reconnect button ──────────────────────────────────────────── */
.reconnect-btn {
  position: fixed;
  top: 48px;
  right: 14px;
  z-index: 999;
  width: 32px;
  height: 32px;
  min-width: unset;
  max-width: unset;
  border-radius: 50%;
  background: rgba(15, 52, 96, 0.85);
  border: 1px solid var(--surface);
  color: var(--text-dim);
  font-size: 1rem;
  padding: 0;
  backdrop-filter: blur(6px);
}
.reconnect-btn:active { opacity: 0.7; transform: scale(0.94); }

/* ── Role info button ──────────────────────────────────────────── */
.role-info-btn {
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 999;
  width: 32px;
  height: 32px;
  min-width: unset;
  max-width: unset;
  border-radius: 50%;
  background: rgba(15, 52, 96, 0.85);
  border: 1px solid var(--surface);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 900;
  padding: 0;
  backdrop-filter: blur(6px);
  font-style: italic;
}
.role-info-btn:active { opacity: 0.7; transform: scale(0.94); }

/* ── Role tooltip modal ────────────────────────────────────────── */
.role-tooltip-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.role-tooltip-card {
  background: var(--card-bg);
  border: 2px solid var(--surface);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.7;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}
.role-tooltip-card .rt-role {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.role-tooltip-card .rt-role.liberal { color: var(--liberal); }
.role-tooltip-card .rt-role.fascist { color: var(--fascist); }
.role-tooltip-card .rt-role.hitler  { color: #ff4444; }
.role-tooltip-card .rt-section {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 10px;
}
.role-tooltip-card .rt-section strong { color: var(--text); }
.role-tooltip-card .rt-dismiss {
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.6;
}

/* ── Room badge ────────────────────────────────────────────────── */
.room-badge {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 52, 96, 0.85);
  border: 1px solid var(--surface);
  border-radius: 20px;
  padding: 4px 10px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.room-badge-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
.room-badge #room-badge-code {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--yellow);
}

/* ── Utilities ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
.card-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
