/* ─── Base ─────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --gold:    #c9a84c;
  --gold2:   #f0d080;
  --dark:    #0d0800;
  --wood:    #1a0d00;
  --wood2:   #2a1600;
  --felt:    #1b4d1b;
  --felt2:   #236b23;
  --cream:   #f5eddc;
  --parch:   #ede0c0;
  --red:     #8b1a1a;
  --red2:    #c0392b;
  --text:    #f0e6c8;
  --muted:   #8a7a5a;
  --shadow:  rgba(0,0,0,0.8);
  --green-ok: #2ecc71;
  --red-bad:  #e74c3c;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--dark);
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  image-rendering: pixelated;
}

/* ─── Screens ──────────────────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active { display: flex; flex-direction: column; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 10px 16px;
  border: 3px solid;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: transform 0.08s, filter 0.08s;
  image-rendering: pixelated;
  outline: none;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold {
  background: var(--gold);
  color: #1a0800;
  border-color: var(--gold2);
  box-shadow: 4px 4px 0 #7a5a10, inset 0 0 0 1px rgba(255,255,200,0.2);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.15); }

.btn-red {
  background: var(--red);
  color: var(--cream);
  border-color: #cc3333;
  box-shadow: 4px 4px 0 #4a0808;
}
.btn-red:hover { filter: brightness(1.15); }

.btn-lie {
  background: #aa0000;
  color: #fff;
  border-color: #ff4444;
  box-shadow: 4px 4px 0 #550000;
  font-size: 11px;
  padding: 12px 20px;
  animation: lie-pulse 1.2s ease-in-out infinite;
}
.btn-lie:hover { filter: brightness(1.2); animation: none; }

@keyframes lie-pulse {
  0%,100% { box-shadow: 4px 4px 0 #550000, 0 0 0 0 rgba(200,0,0,0.6); }
  50%      { box-shadow: 4px 4px 0 #550000, 0 0 18px 6px rgba(200,0,0,0.4); }
}


.error-msg {
  color: #ff6666;
  font-size: 8px;
  margin-top: 8px;
  min-height: 14px;
  text-align: center;
}

/* ─── Landing Screen ───────────────────────────────────────────────────────── */
#screen-landing {
  background: var(--wood);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.landing-bg {
  position: absolute; inset: 0;
  background:
    /* Lantern glow at top */
    radial-gradient(ellipse 280px 100px at 50% 0%, rgba(244,151,38,0.32), transparent 70%),
    /* Wood plank vertical grain */
    repeating-linear-gradient(90deg, transparent 0 124px, rgba(0,0,0,0.32) 124px 128px, transparent 128px 252px),
    /* Plank seams horizontal */
    repeating-linear-gradient(0deg, transparent 0 26px, rgba(0,0,0,0.22) 26px 29px, rgba(255,200,120,0.04) 29px 31px),
    /* Subtle wood texture */
    repeating-linear-gradient(180deg, rgba(255,200,120,0.04) 0 2px, transparent 2px 22px),
    /* Vignette */
    radial-gradient(ellipse at 50% 45%, #3a1d05 0%, #1a0c01 55%, #050200 100%);
  pointer-events: none;
}

/* Hanging lantern */
.landing-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 70px;
  background:
    /* Cord */
    linear-gradient(to bottom, #2a1500 0 18px, transparent 18px 100%),
    /* Lantern body via radial */
    radial-gradient(ellipse 14px 18px at 50% 48px, #f4a838 0%, #b85410 60%, transparent 75%),
    radial-gradient(ellipse 22px 24px at 50% 50px, rgba(244,151,38,0.5), transparent 70%);
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 0 14px rgba(244,151,38,0.5));
  animation: lantern-sway 4s ease-in-out infinite;
}
@keyframes lantern-sway {
  0%, 100% { transform: translateX(-50%) rotate(-1.2deg); }
  50%      { transform: translateX(-50%) rotate(1.2deg); }
}

/* Floating embers on landing */
.landing-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 2px at 12% 78%, rgba(255,180,80,0.7), transparent 70%),
    radial-gradient(circle 2px at 78% 84%, rgba(255,180,80,0.5), transparent 70%),
    radial-gradient(circle 2px at 35% 90%, rgba(255,180,80,0.6), transparent 70%),
    radial-gradient(circle 1px at 60% 70%, rgba(255,180,80,0.8), transparent 70%),
    radial-gradient(circle 2px at 88% 60%, rgba(255,180,80,0.5), transparent 70%);
  pointer-events: none;
  animation: ember-drift 8s ease-in-out infinite;
}
@keyframes ember-drift {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50%      { transform: translateY(-30px); opacity: 1; }
}

.landing-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
}

.game-title {
  text-align: center;
  line-height: 1;
}
.title-top {
  font-size: clamp(28px, 8vw, 52px);
  color: var(--gold2);
  text-shadow: 4px 4px 0 #7a5010, 0 0 30px rgba(200,160,60,0.5);
  letter-spacing: 0.15em;
}
.title-bottom {
  font-size: clamp(22px, 6vw, 40px);
  color: var(--gold);
  text-shadow: 3px 3px 0 #5a3a08;
  letter-spacing: 0.3em;
  margin-top: 4px;
}
.title-sub {
  font-size: 7px;
  color: var(--muted);
  margin-top: 12px;
  letter-spacing: 0.1em;
}

.landing-box {
  background: rgba(10,5,0,0.85);
  border: 3px solid var(--gold);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.6), inset 0 0 40px rgba(0,0,0,0.4);
  padding: 24px 28px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 8px; color: var(--gold); letter-spacing: 0.1em; }

input[type=text] {
  background: #0d0800;
  border: 2px solid var(--gold);
  color: var(--cream);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 8px 10px;
  width: 100%;
  outline: none;
}
input[type=text]:focus { border-color: var(--gold2); box-shadow: 0 0 8px rgba(200,160,60,0.4); }

.btn-row { display: flex; justify-content: center; }
.btn-row .btn { width: 100%; }

.divider { text-align: center; color: var(--muted); font-size: 8px; letter-spacing: 0.2em; }

/* ─── Landing mode toggle (Join vs Create) ─────────────────────────────────── */
.mode-tabs {
  display: flex;
  border: 2px solid var(--gold);
}
.mode-tab {
  flex: 1;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  letter-spacing: 0.06em;
  padding: 11px 6px;
  color: var(--muted);
  background: #0d0800;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.mode-tab + .mode-tab { border-left: 2px solid var(--gold); }
.mode-tab:hover { color: var(--cream); }
.mode-tab.active {
  background: var(--gold);
  color: #1a0800;
  text-shadow: none;
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mode-panel[hidden] { display: none; }

.panel-hint {
  font-size: 7px;
  line-height: 1.8;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ─── Lobby Screen ─────────────────────────────────────────────────────────── */
#screen-lobby {
  background:
    /* Top lantern glow */
    radial-gradient(ellipse 600px 120px at 50% 0%, rgba(244,151,38,0.2), transparent 70%),
    /* Wood panel verticals */
    repeating-linear-gradient(90deg, transparent 0 100px, rgba(0,0,0,0.28) 100px 103px, transparent 103px 206px),
    /* Wood grain horizontal */
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(0,0,0,0.18) 24px 26px, rgba(255,200,120,0.035) 26px 28px),
    radial-gradient(ellipse at 50% 50%, #2d1505 0%, #0e0500 100%);
  background-color: var(--wood);
  flex-direction: column;
  overflow: hidden;
}
/* Subtle smoke wisps */
#screen-lobby::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 200px 60px at 8% 28%, rgba(180,140,90,0.06), transparent 70%),
    radial-gradient(ellipse 240px 70px at 92% 62%, rgba(180,140,90,0.05), transparent 70%);
}

.lobby-header {
  background: rgba(0,0,0,0.6);
  border-bottom: 3px solid var(--gold);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.lobby-title { font-size: 14px; color: var(--gold2); }
.room-code-display {
  font-size: 11px;
  color: var(--cream);
  background: #0d0800;
  border: 2px solid var(--gold);
  padding: 6px 12px;
  letter-spacing: 0.2em;
}
.room-code-display span { color: var(--gold2); }
.lobby-subtitle { font-size: 7px; color: var(--muted); }

.lobby-main {
  flex: 1;
  display: flex;
  gap: clamp(16px, 2.5vw, 30px);
  padding: clamp(16px, 2.5vh, 28px) clamp(16px, 3vw, 36px);
  overflow: hidden;
  min-height: 0;
}

.lobby-players-section, .lobby-char-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.5vh, 16px);
  overflow: hidden;
  min-height: 0;
}
/* Player list fills available vertical space; start button anchors to bottom */
#lobby-player-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 14px);
  overflow-y: auto;
  align-content: flex-start;
}
.lobby-players-section #start-btn {
  margin-top: auto;
}
/* Char grid fills available space and centers when sparse */
#char-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 1.2vw, 14px);
  overflow-y: auto;
  align-content: center;
  justify-content: center;
}

.section-label {
  font-size: 8px;
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 6px;
  letter-spacing: 0.1em;
}
.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Small "add bots" button shown to the host in the lobby */
.btn-bots {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: var(--gold2);
  background: linear-gradient(180deg, rgba(62,34,4,0.95), rgba(24,12,0,0.95));
  border: 2px solid var(--gold);
  padding: 5px 8px;
  cursor: pointer;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: background 0.12s, transform 0.1s, box-shadow 0.12s;
}
.btn-bots:hover {
  background: linear-gradient(180deg, rgba(94,52,8,0.98), rgba(40,20,2,0.98));
  box-shadow: 0 0 10px rgba(200,160,60,0.4);
  transform: translateY(-1px);
}
.btn-bots:active { transform: translateY(1px); }

.lobby-player-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(200,160,60,0.3);
  padding: 8px 12px;
}
.lobby-player-entry.is-host { border-color: var(--gold); }
.lobby-player-entry canvas { flex-shrink: 0; }
.lobby-player-name { font-size: 8px; color: var(--cream); flex: 1; }
.lobby-player-host { font-size: 6px; color: var(--gold); }
.lobby-player-you { font-size: 6px; color: #7ec8e3; }
.lobby-player-bot { font-size: 6px; color: #6fc3d8; }

.lobby-kick-btn {
  flex-shrink: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 1;
  color: #e7a0a0;
  background: rgba(120,20,20,0.5);
  border: 2px solid rgba(200,70,70,0.55);
  padding: 6px 8px;
  cursor: pointer;
}
.lobby-kick-btn:hover {
  color: #fff;
  background: rgba(180,30,30,0.85);
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(231,76,60,0.6);
}

.char-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background:
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(255,200,120,0.03) 12px 13px),
    linear-gradient(160deg, rgba(20,10,2,0.85), rgba(8,4,0,0.85));
  border: 2px solid rgba(200,160,60,0.25);
  padding: 10px 6px 8px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
  position: relative;
}
.char-option:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 0 14px rgba(200,160,60,0.25);
}
.char-option.selected {
  border-color: var(--gold2);
  background:
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(255,200,120,0.05) 12px 13px),
    linear-gradient(160deg, rgba(60,32,4,0.85), rgba(20,10,0,0.85));
  box-shadow: 0 0 16px rgba(240,210,80,0.35), inset 0 0 12px rgba(200,160,60,0.18);
}
.char-option canvas {
  display: block;
  width: clamp(48px, 7.5vw, 76px);
  height: clamp(60px, 9.4vw, 95px);
}
.char-option-name { font-size: 7px; color: var(--gold); text-align: center; letter-spacing: 0.05em; }

/* ─── Intro Screen ─────────────────────────────────────────────────────────── */
#screen-intro {
  background:
    radial-gradient(ellipse 400px 160px at 50% 12%, rgba(244,151,38,0.18), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 110px, rgba(0,0,0,0.28) 110px 113px, transparent 113px 226px),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(0,0,0,0.18) 24px 27px),
    radial-gradient(ellipse at center, #1a0d00 0%, #050200 100%);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#screen-intro::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 2px at 18% 70%, rgba(255,180,80,0.6), transparent 70%),
    radial-gradient(circle 2px at 82% 80%, rgba(255,180,80,0.5), transparent 70%),
    radial-gradient(circle 2px at 50% 90%, rgba(255,180,80,0.7), transparent 70%);
  animation: ember-drift 7s ease-in-out infinite;
}

.intro-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vh, 44px);
  padding: clamp(20px, 4vh, 50px) clamp(16px, 4vw, 48px);
  width: 100%;
  max-width: min(900px, 92vw);
  flex: 1;
  min-height: 0;
}
#intro-deck-display, #intro-table-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vh, 32px);
  width: 100%;
  flex: 1;
}

.intro-title {
  font-size: clamp(20px, 4.5vw, 40px);
  color: var(--gold2);
  text-shadow: 0 0 24px rgba(200,160,60,0.85), 4px 4px 0 #5a3a08;
  letter-spacing: 0.22em;
  margin-bottom: clamp(8px, 2vh, 20px);
}

.intro-cards {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.6vh, 26px);
  align-items: center;
}

.intro-card-row {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 32px);
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.4s, transform 0.4s;
  background:
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(255,200,120,0.04) 14px 15px),
    linear-gradient(160deg, rgba(28,14,2,0.85), rgba(10,5,0,0.85));
  border: 2px solid rgba(200,160,60,0.32);
  padding: clamp(8px, 1.6vh, 16px) clamp(16px, 3vw, 32px);
  min-width: clamp(280px, 50vw, 540px);
  justify-content: center;
}
.intro-card-row.show { opacity: 1; transform: translateX(0); }

.ic-rank {
  font-size: clamp(22px, 4.5vw, 44px);
  font-weight: bold;
  width: clamp(40px, 6.5vw, 80px);
  text-align: right;
  text-shadow: 0 0 14px currentColor;
}
.ic-rank.k { color: #e74c3c; }
.ic-rank.q { color: #9b59b6; }
.ic-rank.a { color: #f39c12; }
.ic-rank.j { color: #1abc9c; font-size: clamp(16px, 3.5vw, 32px); }

.ic-suit {
  font-size: clamp(16px, 3vw, 28px);
  color: var(--muted);
  letter-spacing: clamp(3px, 0.7vw, 8px);
  flex: 1;
  text-align: center;
}
.ic-count {
  font-size: clamp(12px, 2.2vw, 20px);
  color: var(--gold);
  min-width: clamp(40px, 6.5vw, 80px);
  text-align: left;
}

.intro-table-text {
  font-size: clamp(14px, 2.8vw, 24px);
  color: var(--gold);
  letter-spacing: 0.25em;
  margin-bottom: clamp(8px, 2vh, 20px);
}

.intro-table-name {
  font-size: clamp(40px, 9vw, 86px);
  letter-spacing: 0.25em;
  text-shadow: 0 0 40px currentColor, 6px 6px 0 rgba(0,0,0,0.6);
  animation: table-glow 0.9s ease-out;
}
.intro-table-name.kings { color: #e74c3c; }
.intro-table-name.queens { color: #9b59b6; }
.intro-table-name.aces { color: #f39c12; }

@keyframes table-glow {
  0% { opacity: 0; transform: scale(1.5); }
  100% { opacity: 1; transform: scale(1); }
}

/* ─── Game Screen Layout ───────────────────────────────────────────────────── */
#screen-game {
  flex-direction: column;
  background:
    radial-gradient(ellipse 62% 50% at 50% 48%, rgba(244,171,55,0.22) 0%, rgba(120,60,8,0.10) 42%, transparent 72%),
    radial-gradient(ellipse 115% 95% at 50% 50%, transparent 16%, rgba(0,0,0,0.66) 80%, rgba(0,0,0,0.9) 100%),
    repeating-linear-gradient(
      180deg,
      rgba(255,210,120,0.035) 0 2px,
      transparent 2px 25px,
      rgba(0,0,0,0.24) 25px 29px,
      rgba(255,190,78,0.055) 29px 31px,
      transparent 31px 58px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255,185,72,0.05) 0 1px,
      transparent 1px 124px,
      rgba(0,0,0,0.18) 124px 128px,
      transparent 128px 246px
    ),
    linear-gradient(175deg, #3a1905 0%, #160801 47%, #2b1304 100%);
  background-color: #211005;
  overflow: hidden;
  position: fixed;
  inset: 0;
  min-height: 0;
  isolation: isolate;
}

#screen-game::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
  background:
    /* Hanging lantern glows in corners and overhead */
    radial-gradient(circle 80px at 12% 18%, rgba(244,151,38,0.42), transparent 70%),
    radial-gradient(circle 80px at 88% 18%, rgba(244,151,38,0.42), transparent 70%),
    radial-gradient(ellipse 240px 90px at 50% 8%, rgba(244,151,38,0.18), transparent 70%),
    /* Side wood-grain warmth */
    radial-gradient(ellipse 110px 42px at 18% 32%, rgba(120,58,8,0.45), transparent 70%),
    radial-gradient(ellipse 150px 48px at 82% 72%, rgba(116,52,6,0.38), transparent 72%),
    /* Subtle smoke layers */
    repeating-linear-gradient(
      8deg,
      transparent 0 11px,
      rgba(255,202,102,0.035) 11px 12px,
      transparent 12px 24px,
      rgba(0,0,0,0.1) 24px 25px
    );
}

/* Bar decorations layer — lanterns hanging at top corners */
#screen-game::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 0;
  background:
    /* Left lantern */
    radial-gradient(ellipse 10px 14px at 12% 50px, #f4a838 0%, #b85410 55%, transparent 75%),
    /* Left cord */
    linear-gradient(to bottom, #2a1500 0 28px, transparent 28px 100%) 12% 0 / 2px 100% no-repeat,
    /* Right lantern */
    radial-gradient(ellipse 10px 14px at 88% 50px, #f4a838 0%, #b85410 55%, transparent 75%),
    /* Right cord */
    linear-gradient(to bottom, #2a1500 0 28px, transparent 28px 100%) 88% 0 / 2px 100% no-repeat;
  filter: drop-shadow(0 0 10px rgba(244,151,38,0.6));
}

#game-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

#game-hud,
#game-grid {
  position: relative;
  z-index: 2;
}

#game-hud {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.92) 0%, rgba(8,3,0,0.78) 100%);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 3px 18px rgba(0,0,0,0.6), inset 0 -1px 0 rgba(200,160,60,0.15);
  padding: 7px 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#hud-room { font-size: 7px; color: var(--muted); }
#hud-table { font-size: 9px; color: var(--gold2); flex: 1; text-align: center; }
#hud-msg { font-size: 7px; color: #7ec8e3; text-align: right; flex: 1; }

#game-grid {
  flex: 1;
  display: grid;
  grid-template-areas:
    "players"
    "table"
    "my-area";
  grid-template-rows: clamp(96px, 13vh, 148px) 1fr clamp(150px, 24vh, 220px);
  gap: clamp(6px, 1vh, 12px);
  padding: clamp(6px, 1vh, 12px) clamp(8px, 1.5vw, 18px);
  overflow: hidden;
  min-height: 0;
}

/* ─── Players Row (top strip) ─────────────────────────────────────────────── */
#players-row {
  grid-area: players;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 22px);
  min-height: 0;
  padding-top: 12px;  /* room for the floating ★ TURN ★ badge above each slot */
}

/* ─── Player Slots (compact horizontal panels) ────────────────────────────── */
.player-slot {
  position: relative;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: clamp(8px, 1.2vw, 14px);
  background:
    repeating-linear-gradient(
      180deg, transparent, transparent 18px,
      rgba(0,0,0,0.09) 18px, rgba(0,0,0,0.09) 19px
    ),
    radial-gradient(ellipse at 50% 0%, rgba(147,79,19,0.32), transparent 65%),
    linear-gradient(155deg, rgba(50,23,5,0.86) 0%, rgba(16,7,0,0.86) 100%);
  border: 2px solid rgba(217,174,74,0.36);
  box-shadow: inset 0 1px 0 rgba(255,220,150,0.08), inset 0 0 18px rgba(0,0,0,0.4),
              0 4px 0 rgba(0,0,0,0.55);
  padding: clamp(6px, 1vh, 10px) clamp(8px, 1.4vw, 16px);
  min-width: 0;
  flex: 1 1 0;
  max-width: clamp(180px, 24vw, 290px);
}
.player-slot.occupied { display: flex; }

.player-slot .char-portrait {
  width: clamp(44px, 5.5vw, 68px) !important;
  height: clamp(55px, 7vw, 85px) !important;
  flex-shrink: 0;
}

.slot-info {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.6vh, 6px);
  min-width: 0;
  flex: 1;
}

.player-slot.active-turn {
  border-color: var(--gold2);
  box-shadow:
    0 0 22px rgba(240,210,80,0.55),
    0 0 50px rgba(200,160,40,0.22),
    inset 0 0 14px rgba(220,180,50,0.18),
    0 4px 0 rgba(0,0,0,0.55);
  transform: translateY(-2px);
}

.slot-name {
  font-size: clamp(8px, 1.15vw, 12px);
  color: var(--cream);
  text-align: left;
  word-break: break-all;
  max-width: 100%;
  letter-spacing: 0.04em;
}

.slot-bullets {
  font-size: clamp(10px, 1.5vw, 14px);
  letter-spacing: 2px;
  text-align: left;
}

.slot-cards {
  font-size: clamp(7px, 1vw, 10px);
  color: var(--gold);
  text-align: left;
  letter-spacing: 0.06em;
}

.slot-active-badge {
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  background: var(--gold2);
  color: #1a0800;
  font-size: clamp(6px, 0.85vw, 8px);
  padding: 2px 6px;
  display: none;
  letter-spacing: 0.15em;
  text-shadow: none;
  border: 1px solid #5a3a08;
}
.player-slot.active-turn .slot-active-badge { display: block; }

.slot-eliminated-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 2.4vw, 26px);
  color: #ff4444;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 10px rgba(255,0,0,0.95), 0 0 24px rgba(255,0,0,0.55);
  letter-spacing: 0.1em;
}
.player-slot.eliminated .slot-eliminated-overlay { display: flex; }

/* ─── Center Table (the main stage) ───────────────────────────────────────── */
#table-center {
  grid-area: table;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  position: relative;
}

#table-felt {
  flex: 1;
  width: 100%;
  max-width: min(96vw, 1300px);
  margin: 0 auto;
  background:
    /* Felt weave crosshatch */
    repeating-linear-gradient(
      55deg, transparent, transparent 4px,
      rgba(0,0,0,0.065) 4px, rgba(0,0,0,0.065) 5px
    ),
    repeating-linear-gradient(
      -55deg, transparent, transparent 4px,
      rgba(0,0,0,0.045) 4px, rgba(0,0,0,0.045) 5px
    ),
    /* Felt base gradient */
    radial-gradient(ellipse at center, var(--felt2) 0%, var(--felt) 55%, #0e2b0e 100%);
  border: clamp(6px, 1vw, 10px) solid #3d2000;
  border-radius: clamp(20px, 4vw, 50px);
  box-shadow:
    inset 0 0 80px rgba(0,0,0,0.55),
    inset 0 0 0 3px rgba(120,70,0,0.4),
    0 0 0 3px var(--gold),
    0 0 0 6px rgba(200,160,60,0.2),
    0 18px 40px rgba(0,0,0,0.65),
    10px 10px 0 rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vh, 22px);
  padding: clamp(16px, 2.5vw, 36px);
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* ─── Ambient bar objects inside the felt ────────────────────────────────── */
.ambient {
  position: absolute;
  pointer-events: none;
  image-rendering: pixelated;
  opacity: 0.85;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6));
  z-index: 1;
}
.ambient-symbol {
  position: absolute;
  pointer-events: none;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(10px, 1.6vw, 16px);
  color: rgba(200,160,60,0.22);
  letter-spacing: 0.6em;
  text-shadow: 0 0 6px rgba(200,160,60,0.18);
  z-index: 1;
}

/* Beer mug — amber body with white foam, leather strap handle */
.ambient-mug {
  width: clamp(20px, 2.6vw, 32px);
  height: clamp(26px, 3.4vw, 42px);
  background:
    /* Foam */
    linear-gradient(to bottom, #f4eee0 0 22%, transparent 22%),
    /* Amber body */
    linear-gradient(to bottom, transparent 22%, #c8810e 22% 55%, #8a5a08 55% 100%),
    /* Highlight stripe */
    linear-gradient(to right, transparent 70%, rgba(255,220,150,0.35) 75%, transparent 85%);
  border: 1px solid #3a1f02;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 0 0 1px rgba(0,0,0,0.6);
}
.ambient-mug::before {
  content: '';
  position: absolute;
  right: -7px; top: 30%;
  width: 8px; height: 50%;
  border: 2px solid #3a1f02;
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: transparent;
}

/* Candle in a wood holder with a flickering flame */
.ambient-candle {
  width: clamp(14px, 1.8vw, 22px);
  height: clamp(30px, 4vw, 50px);
  background:
    /* Wax body */
    linear-gradient(to bottom, transparent 22%, #f1e3b8 22% 78%, #8a6a20 78% 88%, #4a2c08 88% 100%);
  border: 1px solid #3a1f02;
}
.ambient-candle::before {
  content: '';
  position: absolute;
  top: -8px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 12px;
  background: radial-gradient(circle, #ffe8a0 0%, #f4a838 50%, transparent 80%);
  border-radius: 50%;
  filter: drop-shadow(0 0 6px #f4a838) drop-shadow(0 0 12px rgba(244,151,38,0.5));
  animation: flame-flicker 0.8s ease-in-out infinite alternate;
}
@keyframes flame-flicker {
  0%   { transform: translateX(-50%) scale(1, 1);   opacity: 0.95; }
  100% { transform: translateX(-50%) scale(0.9, 1.15); opacity: 1; }
}

/* Stack of gold coins */
.ambient-coins {
  width: clamp(22px, 2.8vw, 36px);
  height: clamp(16px, 2vw, 26px);
  background:
    linear-gradient(to bottom,
      #d4a020 0 18%, #8a6a08 18% 22%,
      #d4a020 22% 40%, #8a6a08 40% 44%,
      #d4a020 44% 62%, #8a6a08 62% 66%,
      #d4a020 66% 84%, #8a6a08 84% 88%,
      transparent 88%);
  border: 1px solid #3a1f02;
  border-bottom: none;
}

/* Pair of dice */
.ambient-dice {
  width: clamp(22px, 2.8vw, 34px);
  height: clamp(11px, 1.4vw, 17px);
  background:
    /* Left die */
    radial-gradient(circle 1.2px at 22% 35%, #1a1a1a 100%, transparent),
    radial-gradient(circle 1.2px at 22% 65%, #1a1a1a 100%, transparent),
    radial-gradient(circle 1.2px at 38% 50%, #1a1a1a 100%, transparent),
    linear-gradient(to right, #fafafa 0 48%, transparent 48% 52%,
                    /* Right die */
                    #fafafa 52% 100%),
    radial-gradient(circle 1.2px at 70% 50%, #1a1a1a 100%, transparent);
  border: 1px solid #3a1f02;
}

/* Wine/whiskey bottle */
.ambient-bottle {
  width: clamp(12px, 1.5vw, 18px);
  height: clamp(36px, 4.8vw, 60px);
  background:
    linear-gradient(to bottom,
      #4a2010 0 18%,           /* cork */
      #1a4a2a 18% 28%,         /* neck */
      transparent 28% 30%,     /* neck/body seam */
      #1e5a30 30% 60%,         /* body upper */
      #143a20 60% 100%);       /* body lower */
  border: 1px solid #050a05;
  border-radius: 4px 4px 1px 1px;
  box-shadow: inset -2px 0 0 rgba(0,0,0,0.35), inset 2px 0 0 rgba(255,255,255,0.08);
}

/* Smoking pipe */
.ambient-pipe {
  width: clamp(24px, 3vw, 36px);
  height: clamp(14px, 1.8vw, 22px);
  background:
    /* Stem */
    linear-gradient(to right, #3a1f02 0 70%, transparent 70%),
    /* Bowl (round at right end) */
    radial-gradient(circle at 82% 35%, #1a0d00 0 30%, transparent 32%);
  border-radius: 50% 0 0 50% / 50% 0 0 50%;
}
.ambient-pipe::after {
  content: '';
  position: absolute;
  top: -6px; right: 8%;
  width: 6px; height: 6px;
  background: radial-gradient(circle, rgba(200,200,200,0.45), transparent 70%);
  border-radius: 50%;
  animation: smoke-puff 2.2s ease-in-out infinite;
}
@keyframes smoke-puff {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  40%  { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-22px) scale(1.6); }
}

/* Overflowing ashtray with a smouldering cigarette */
.ambient-ashtray {
  width: clamp(20px, 2.6vw, 32px);
  height: clamp(10px, 1.3vw, 16px);
  background:
    radial-gradient(ellipse 58% 64% at 50% 26%, #9a978c 0 38%, #6a675c 38% 100%),
    linear-gradient(to bottom, #2c2c2c 0 34%, #161616 34% 100%);
  border: 1px solid #050505;
  border-radius: 2px 2px 8px 8px;
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.75), inset 0 -1px 0 rgba(140,140,140,0.18);
}
.ambient-ashtray::before {
  content: '';
  position: absolute;
  top: 4%; left: -20%;
  width: 66%; height: 24%;
  background: linear-gradient(to right, #ece6d4 0 64%, #d8442f 64% 82%, #2a2a2a 82% 100%);
  border: 1px solid rgba(0,0,0,0.55);
  transform: rotate(-19deg);
}
/* Smoke particle wisps drifting up from the ashtray */
.ashtray-smoke {
  position: absolute;
  bottom: 62%;
  width: clamp(3px, 0.5vw, 5px);
  height: clamp(3px, 0.5vw, 5px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214,214,214,0.55), rgba(180,180,180,0) 72%);
  pointer-events: none;
  animation: ashtray-smoke-rise 3.6s ease-in infinite;
}
@keyframes ashtray-smoke-rise {
  0%   { opacity: 0;    transform: translate(0, 0) scale(0.5); }
  18%  { opacity: 0.55; }
  100% { opacity: 0;    transform: translate(10px, -42px) scale(2.6); }
}

/* Scattered face-down card(s) */
.ambient-fcard {
  width: clamp(16px, 2vw, 26px);
  height: clamp(23px, 2.9vw, 37px);
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.28) 0 3px, transparent 3px 6px),
    linear-gradient(135deg, #8e2222 0%, #571111 100%);
  border: 2px solid #e7d8a2;
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.6);
}
.ambient-fcard-stack {
  position: absolute;
  inset: 0;
  left: 32%; top: 26%;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.28) 0 3px, transparent 3px 6px),
    linear-gradient(135deg, #8e2222 0%, #571111 100%);
  border: 2px solid #e7d8a2;
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.6);
  transform: rotate(15deg);
}

/* ─── Bar backdrop — shelves + neon sign behind the table ─────────────────── */
#bar-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* Dimly-lit liquor shelves tucked into the top corners of the wall */
.bar-shelf {
  position: absolute;
  top: clamp(46px, 7vh, 80px);
  width: clamp(94px, 13vw, 168px);
  height: clamp(56px, 8.5vh, 96px);
  background: linear-gradient(180deg, rgba(22,11,2,0.62) 0%, rgba(8,4,0,0.74) 100%);
  border: 1px solid rgba(0,0,0,0.6);
  border-top: 2px solid rgba(74,44,16,0.85);
  box-shadow: inset 0 0 18px rgba(0,0,0,0.7);
}
.bar-shelf-left  { left:  clamp(-8px, 0.4vw, 8px); }
.bar-shelf-right { right: clamp(-8px, 0.4vw, 8px); }
/* Wooden front plank */
.bar-shelf::after {
  content: '';
  position: absolute;
  left: -3px; right: -3px; bottom: 0;
  height: clamp(6px, 0.9vh, 11px);
  background: linear-gradient(180deg, #4c2e11 0%, #2a1808 58%, #150b03 100%);
  box-shadow: 0 4px 9px rgba(0,0,0,0.7), inset 0 1px 0 rgba(150,100,40,0.32);
}
/* Faint warm glow pooled on the shelf */
.bar-shelf::before {
  content: '';
  position: absolute;
  left: 50%; bottom: 2px;
  width: 86%; height: 70%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 88%, rgba(244,151,38,0.16), transparent 74%);
}
.shelf-bottle {
  position: absolute;
  bottom: clamp(6px, 0.9vh, 11px);
  width: clamp(7px, 0.95vw, 12px);
  border-radius: 3px 3px 1px 1px;
  border: 1px solid rgba(0,0,0,0.6);
  box-shadow: inset -2px 0 0 rgba(0,0,0,0.4), inset 2px 0 0 rgba(255,255,255,0.12);
}
.shelf-bottle::before {
  content: '';
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 40%; height: 9px;
  background: inherit;
  border-radius: 2px 2px 0 0;
}

/* Flickering neon sign — mounted on the right wall, below the shelf,
   in the empty gutter beside the upper player row */
#neon-sign {
  position: absolute;
  top: clamp(104px, 16.5vh, 200px);
  right: clamp(10px, 3vw, 84px);
  z-index: 1;
  width: clamp(46px, 6vw, 72px);
  height: clamp(58px, 8.5vh, 92px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(4px, 0.7vh, 8px) clamp(3px, 0.5vw, 6px);
  border: clamp(2px, 0.35vw, 4px) solid #ff3b6b;
  border-radius: 6px;
  color: #ff6f92;
  font-family: 'Press Start 2P', monospace;
  pointer-events: none;
  box-shadow:
    0 0 8px #ff2d5e,
    0 0 22px rgba(255,45,94,0.7),
    0 0 40px rgba(255,45,94,0.4),
    inset 0 0 14px rgba(255,45,94,0.45);
  text-shadow: 0 0 6px #ff2d5e, 0 0 15px rgba(255,45,94,0.85);
  transition: opacity 0.05s linear;
}
#neon-sign .neon-rank { font-size: clamp(11px, 1.5vw, 18px); align-self: flex-start; }
#neon-sign .neon-rank.btm { align-self: flex-end; transform: rotate(180deg); }
#neon-sign .neon-pip { font-size: clamp(18px, 2.6vw, 32px); line-height: 1; }

/* ─── Spotlight vignette — corners fade to black, table stays lit ─────────── */
#table-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse 82% 74% at 50% 52%,
    transparent 44%,
    rgba(0,0,0,0.14) 68%,
    rgba(0,0,0,0.36) 87%,
    rgba(0,0,0,0.6) 100%);
}

#table-round-label {
  font-size: clamp(12px, 2vw, 22px);
  color: var(--gold2);
  text-shadow: 0 0 14px rgba(200,160,60,0.7), 3px 3px 0 #5a3a08;
  letter-spacing: 0.2em;
  flex-shrink: 0;
  z-index: 2;
}

#played-area, #claim-display, #lie-reveal-overlay, #roulette-overlay {
  z-index: 2;
}

#played-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#claim-display { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 1.8vh, 18px); }
#claim-text {
  font-size: clamp(14px, 2.5vw, 26px);
  color: var(--gold2);
  text-shadow: 0 0 12px rgba(200,160,60,0.6), 3px 3px 0 #5a3a08;
  text-align: center;
  animation: claim-pop 0.3s ease-out;
  letter-spacing: 0.08em;
}
@keyframes claim-pop {
  0%   { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

#no-play-text {
  font-size: clamp(9px, 1.5vw, 14px);
  color: rgba(200,160,60,0.4);
  letter-spacing: 0.12em;
  font-style: italic;
}

#played-cards-row, #reveal-cards-row {
  display: flex;
  gap: clamp(8px, 1.4vw, 18px);
  flex-wrap: nowrap;
  justify-content: center;
}
/* Bigger cards in the table reveal/play area so they fill the felt */
#played-cards-row .card, #reveal-cards-row .card, #played-cards-row .flip-card, #reveal-cards-row .flip-card {
  width: clamp(72px, 10vw, 130px);
  height: clamp(104px, 14.5vw, 188px);
}
#played-cards-row .card-rank, #reveal-cards-row .card-rank {
  font-size: clamp(18px, 2.8vw, 32px);
}
#played-cards-row .card-suit, #reveal-cards-row .card-suit {
  font-size: clamp(14px, 2.2vw, 24px);
}

/* ─── Lie Reveal Overlay ───────────────────────────────────────────────────── */
#lie-reveal-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 45%, rgba(40,20,2,0.6), transparent 70%),
    rgba(0,0,0,0.88);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.5vh, 24px);
  padding: clamp(10px, 2.5vh, 24px) 14px;
}
#lie-reveal-overlay.show { display: flex; }

#reveal-msg {
  font-size: clamp(10px, 1.8vw, 16px);
  text-align: center;
  line-height: 1.7;
  min-height: clamp(60px, 12vh, 100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4vh, 14px);
}
.reveal-claim {
  font-size: clamp(10px, 1.6vw, 16px);
  color: var(--cream);
  letter-spacing: 0.06em;
}
.reveal-claim-count {
  color: var(--gold2);
  font-size: 1.25em;
}
.reveal-claim-name {
  color: var(--gold);
  letter-spacing: 0.12em;
}
.reveal-suspense {
  font-size: clamp(8px, 1.2vw, 12px);
  color: var(--muted);
  letter-spacing: 0.1em;
  animation: suspense-pulse 1.1s ease-in-out infinite;
}
@keyframes suspense-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}
.reveal-verdict {
  font-size: clamp(22px, 5vw, 46px);
  letter-spacing: 0.2em;
  animation: verdict-slam 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-lie {
  color: #e74c3c;
  text-shadow: 0 0 24px rgba(231,76,60,0.9), 4px 4px 0 #4a0000;
}
.reveal-truth {
  color: #2ecc71;
  text-shadow: 0 0 24px rgba(46,204,113,0.9), 4px 4px 0 #14532d;
}
.reveal-shooter {
  font-size: clamp(11px, 2vw, 18px);
  color: var(--cream);
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(255,255,255,0.3);
}
@keyframes verdict-slam {
  0%   { opacity: 0; transform: scale(2.2); filter: blur(8px); }
  60%  { opacity: 1; transform: scale(0.94); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}

/* Flip card for lie reveal — single element, scaleX-folds at the midpoint */
.flip-card {
  pointer-events: none;
  transform-origin: center center;
  animation: flip-card-enter 0.32s ease-out;
}
.flip-card:hover { transform: none; }
@keyframes flip-card-enter {
  0%   { opacity: 0; transform: translateY(-16px); }
  100% { opacity: 1; transform: translateY(0); }
}
.flip-card.flipping {
  animation: flip-fold 0.48s ease-in-out;
}
@keyframes flip-fold {
  0%   { transform: scaleX(1); }
  50%  { transform: scaleX(0); filter: brightness(1.5); }
  100% { transform: scaleX(1); }
}

.flip-card.valid {
  background: #d4ffda !important;
  border-color: #2ecc71 !important;
  box-shadow: 0 0 22px rgba(46,204,113,0.85), inset 0 0 18px rgba(46,204,113,0.25);
  animation: green-pulse 0.55s ease-out;
}
.flip-card.invalid {
  background: #ffd4d4 !important;
  border-color: #e74c3c !important;
  box-shadow: 0 0 22px rgba(231,76,60,0.85), inset 0 0 18px rgba(231,76,60,0.25);
  animation: red-pulse 0.55s ease-out;
}
@keyframes green-pulse {
  0%   { filter: drop-shadow(0 0 0 transparent); }
  50%  { filter: drop-shadow(0 0 20px rgba(46,204,113,0.95)); }
  100% { filter: drop-shadow(0 0 8px rgba(46,204,113,0.4)); }
}
@keyframes red-pulse {
  0%   { filter: drop-shadow(0 0 0 transparent); }
  50%  { filter: drop-shadow(0 0 20px rgba(231,76,60,0.95)); }
  100% { filter: drop-shadow(0 0 8px rgba(231,76,60,0.4)); }
}

/* ─── Roulette Overlay ─────────────────────────────────────────────────────── */
#roulette-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(40,8,8,0.35), transparent 70%),
    rgba(0,0,0,0.94);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6vh, 18px);
  padding: clamp(12px, 2vh, 24px) clamp(12px, 2vw, 24px);
  min-height: 0;
}
#roulette-overlay.show { display: flex; }

#roulette-msg {
  font-size: clamp(10px, 1.6vw, 16px);
  color: var(--cream);
  text-align: center;
  line-height: 1.55;
  flex-shrink: 0;
}
#roulette-msg .roulette-shooter {
  font-size: clamp(14px, 2.6vw, 26px);
  line-height: 1.2;
  text-shadow: 0 0 14px currentColor;
}
#roulette-msg .roulette-sub {
  margin-top: clamp(4px, 1vh, 10px);
  letter-spacing: 0.08em;
}
#roulette-msg .roulette-chambers {
  margin-top: clamp(3px, 0.8vh, 8px);
  font-size: clamp(8px, 1.1vw, 12px);
  color: var(--gold);
  letter-spacing: 0.15em;
}
#gun-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(95%, 720px);
  flex: 1 1 auto;
  min-height: 0;
}
#gun-canvas {
  image-rendering: pixelated;
  width: 100% !important;
  height: auto;
  max-height: 100%;
  aspect-ratio: 320 / 180;
  object-fit: contain;
}

#roulette-result-msg {
  font-size: clamp(14px, 2.8vw, 28px);
  text-align: center;
  min-height: 1.2em;
  flex-shrink: 0;
}
.result-survived { color: var(--green-ok); text-shadow: 0 0 10px rgba(46,204,113,0.8); }
.result-died { color: var(--red-bad); text-shadow: 0 0 16px rgba(231,76,60,0.9); }

.flash-red {
  animation: flash-r 0.3s ease-out;
}
@keyframes flash-r {
  0%   { background: rgba(200,0,0,0.7); }
  100% { background: transparent; }
}

/* ─── My Area (bottom strip) ──────────────────────────────────────────────── */
#my-area {
  grid-area: my-area;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(10px, 1.8vw, 22px);
  background:
    repeating-linear-gradient(
      180deg, transparent, transparent 18px,
      rgba(0,0,0,0.12) 18px, rgba(0,0,0,0.12) 19px
    ),
    radial-gradient(ellipse at 50% 0%, rgba(168,93,22,0.38), transparent 65%),
    linear-gradient(0deg, rgba(12,5,0,0.92) 0%, rgba(45,20,4,0.86) 100%);
  border: 2px solid rgba(222,178,76,0.55);
  border-radius: clamp(8px, 1vw, 14px);
  box-shadow:
    0 -6px 24px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(200,160,60,0.3),
    inset 0 0 24px rgba(0,0,0,0.4);
  padding: clamp(8px, 1.2vh, 14px) clamp(14px, 2vw, 24px);
  overflow: hidden;
  min-height: 0;
}
#my-area.active-turn {
  border-color: var(--gold2);
  box-shadow:
    0 -6px 30px rgba(200,200,60,0.4),
    inset 0 0 22px rgba(200,160,60,0.18);
}

#my-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(8px, 1.2vw, 14px);
  flex-shrink: 0;
  position: relative;
}

#my-portrait {
  width: clamp(60px, 8vw, 96px) !important;
  height: clamp(75px, 10vw, 120px) !important;
}

#my-details { display: flex; flex-direction: column; gap: clamp(4px, 0.8vh, 8px); align-items: flex-start; }
#my-name { font-size: clamp(9px, 1.4vw, 14px); color: var(--cream); text-align: left; letter-spacing: 0.04em; }
#my-bullets { font-size: clamp(12px, 1.8vw, 18px); letter-spacing: 3px; }
#my-active-badge {
  position: absolute;
  top: -10px; right: -10px;
  font-size: clamp(7px, 1vw, 10px);
  background: var(--gold2);
  color: #1a0800;
  padding: 3px 7px;
  border: 1px solid #5a3a08;
  letter-spacing: 0.15em;
  display: none;
}
#my-area.active-turn #my-active-badge { display: block; }

#my-hand {
  display: flex;
  gap: clamp(6px, 1vw, 14px);
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: clamp(6px, 1vh, 12px) 4px;
  align-items: center;
  justify-content: center;
  height: 100%;
  scrollbar-width: none;
  min-width: 0;
}
#my-hand::-webkit-scrollbar { display: none; }

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  width: clamp(54px, 7.5vw, 86px);
  height: clamp(78px, 10.7vw, 124px);
  border: 2px solid;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.12s, box-shadow 0.12s;
  user-select: none;
}
.card:hover { transform: translateY(-8px); }
.card.selected {
  border-color: var(--gold2) !important;
  box-shadow: 0 0 16px rgba(200,200,60,0.8), 0 -10px 0 var(--gold2);
  transform: translateY(-14px);
}

.card-rank {
  font-size: clamp(15px, 2.5vw, 26px);
  font-weight: bold;
  line-height: 1;
}
.card-suit { font-size: clamp(11px, 1.8vw, 18px); }

.card.rank-K { border-color: #cc3333; background: #fff5f5; }
.card.rank-K .card-rank { color: #cc2222; }
.card.rank-K .card-suit { color: #993333; }

.card.rank-Q { border-color: #8833cc; background: #faf5ff; }
.card.rank-Q .card-rank { color: #8822bb; }
.card.rank-Q .card-suit { color: #664499; }

.card.rank-A { border-color: #cc8822; background: #fffbf0; }
.card.rank-A .card-rank { color: #bb7711; }
.card.rank-A .card-suit { color: #996633; }

.card.rank-J { border-color: #22aa88; background: #f0fffc; }
.card.rank-J .card-rank { color: #11997a; font-size: 10px; }
.card.rank-J .card-suit { color: #22aa88; }

.card.face-down {
  background: linear-gradient(140deg, #1c2470 0%, #0d1245 50%, #1a2268 100%);
  border-color: #3f52c0;
  cursor: default;
}
.card.face-down::before {
  content: '✦';
  position: absolute; inset: 4px;
  border: 1px solid rgba(120,140,220,0.5);
  background:
    repeating-linear-gradient(
      45deg, transparent, transparent 5px,
      rgba(90,110,200,0.14) 5px, rgba(90,110,200,0.14) 6px
    ),
    repeating-linear-gradient(
      -45deg, transparent, transparent 5px,
      rgba(90,110,200,0.10) 5px, rgba(90,110,200,0.10) 6px
    );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 2.8vw, 24px);
  color: rgba(160,180,255,0.30);
}

/* Reveal states */
.card.valid-card { background: #d4ffda !important; border-color: #2ecc71 !important; }
.card.invalid-card { background: #ffd4d4 !important; border-color: #e74c3c !important; }

.card-appear {
  animation: card-deal 0.35s ease-out;
}
@keyframes card-deal {
  0%   { opacity: 0; transform: translateY(-40px) scale(0.7); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mini face-down cards for other players */
.mini-card {
  width: 20px;
  height: 28px;
  background: linear-gradient(140deg, #1c2470 0%, #0d1245 100%);
  border: 1px solid #4050c0;
  display: inline-block;
  margin: 0 1px;
  position: relative;
}
.mini-card::before {
  content: '';
  position: absolute; inset: 2px;
  border: 1px solid rgba(100,120,200,0.3);
}

/* ─── Action Row ───────────────────────────────────────────────────────────── */
#action-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  align-items: stretch;
}

.action-btn {
  min-width: clamp(120px, 14vw, 190px);
  font-size: clamp(8px, 1.2vw, 11px);
  padding: clamp(10px, 1.5vh, 16px) clamp(12px, 1.8vw, 22px);
}

/* ─── Bullet Counter ───────────────────────────────────────────────────────── */
.bullet-pip {
  display: inline-block;
  font-size: 12px;
}
.bullet-loaded { color: #e74c3c; }
.bullet-empty  { color: #444; }

/* ─── Character Portrait ───────────────────────────────────────────────────── */
.char-portrait {
  image-rendering: pixelated;
  display: block;
}

/* ─── Game Over ────────────────────────────────────────────────────────────── */
#screen-gameover {
  background:
    radial-gradient(ellipse 480px 200px at 50% 0%, rgba(244,151,38,0.18), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 110px, rgba(0,0,0,0.3) 110px 113px, transparent 113px 226px),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(0,0,0,0.2) 24px 27px, rgba(255,200,120,0.03) 27px 29px),
    radial-gradient(ellipse at center, #1a0d00 0%, #050200 100%);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#screen-gameover::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 2px at 22% 78%, rgba(255,180,80,0.7), transparent 70%),
    radial-gradient(circle 2px at 72% 84%, rgba(255,180,80,0.6), transparent 70%),
    radial-gradient(circle 2px at 45% 90%, rgba(255,180,80,0.5), transparent 70%);
  animation: ember-drift 6s ease-in-out infinite;
}

.gameover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 36px 42px;
  background:
    repeating-linear-gradient(90deg, transparent 0 60px, rgba(0,0,0,0.18) 60px 62px, transparent 62px 124px),
    linear-gradient(160deg, rgba(40,18,2,0.92), rgba(15,7,0,0.95));
  border: 3px solid var(--gold);
  box-shadow:
    0 0 50px rgba(200,160,60,0.4),
    inset 0 0 30px rgba(0,0,0,0.5),
    inset 0 0 0 2px rgba(120,70,0,0.35);
  position: relative;
  z-index: 2;
}
.gameover-content::before, .gameover-content::after {
  content: '★';
  position: absolute;
  font-size: 14px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(200,160,60,0.6);
}
.gameover-content::before { top: 10px; left: 14px; }
.gameover-content::after  { top: 10px; right: 14px; }

.gameover-title {
  font-size: clamp(20px, 5vw, 32px);
  color: var(--gold2);
  text-shadow: 0 0 20px rgba(200,160,60,0.8);
  letter-spacing: 0.2em;
}

#winner-portrait { image-rendering: pixelated; }

.winner-label { font-size: 8px; color: var(--muted); letter-spacing: 0.2em; }

.winner-name {
  font-size: clamp(14px, 4vw, 22px);
  color: var(--gold2);
  text-shadow: 0 0 15px rgba(200,160,60,0.7);
}

/* ─── Particles ────────────────────────────────────────────────────────────── */
#particles {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}
.particle {
  position: absolute;
  width: 6px; height: 6px;
  animation: particle-fall 1.2s ease-in forwards;
}
@keyframes particle-fall {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(200px) rotate(360deg); }
}

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0d0800; }
::-webkit-scrollbar-thumb { background: var(--gold); }

/* ─── Responsive tweaks ────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  #game-grid {
    grid-template-rows: clamp(70px, 10vh, 100px) 1fr clamp(130px, 22vh, 180px);
    gap: 5px;
    padding: 5px;
  }
  .player-slot {
    padding: 6px 8px;
    gap: 6px;
  }
  .player-slot .char-portrait {
    width: clamp(40px, 11vw, 56px) !important;
    height: clamp(50px, 14vw, 70px) !important;
  }
  #my-portrait {
    width: clamp(48px, 13vw, 72px) !important;
    height: clamp(60px, 16.25vw, 90px) !important;
  }
  .card {
    width: clamp(46px, 12vw, 64px);
    height: clamp(66px, 17vw, 92px);
  }
  .card-rank { font-size: clamp(11px, 3.2vw, 16px); }
  .card-suit { font-size: clamp(8px, 2.3vw, 12px); }
  #my-area { gap: 8px; padding: 8px 10px; }
  .action-btn { min-width: clamp(80px, 22vw, 140px); font-size: 7px; padding: 8px 10px; }
  .slot-name { font-size: clamp(7px, 1.8vw, 10px); }
  .slot-bullets { font-size: clamp(9px, 2.5vw, 13px); }
  .slot-cards { font-size: 7px; }
  /* Lobby stacks on narrow screens */
  .lobby-main { flex-direction: column; gap: 14px; padding: 14px; }
  .lobby-header { padding: 10px 14px; gap: 12px; }
  .lobby-title { font-size: 12px; }
}

@media (max-height: 550px) {
  #game-grid {
    grid-template-rows: 70px 1fr 130px;
  }
  .player-slot .char-portrait { width: 40px !important; height: 52px !important; }
}

/* ─── Spectate Banner ──────────────────────────────────────────────────────── */
#spectate-banner {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: rgba(180, 20, 20, 0.88);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(7px, 1.1vw, 11px);
  text-align: center;
  padding: 7px;
  z-index: 50;
  letter-spacing: 0.18em;
  display: none;
}

/* ─── "First Up" round callout ────────────────────────────────────────────── */
.first-up-callout {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -20px) scale(0.92);
  z-index: 600;
  background:
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(255,200,120,0.05) 14px 15px),
    linear-gradient(160deg, rgba(40,20,2,0.96), rgba(15,7,0,0.96));
  border: 3px solid var(--gold);
  box-shadow: 0 0 30px rgba(200,160,60,0.5), 6px 6px 0 rgba(0,0,0,0.7);
  padding: 14px 36px;
  text-align: center;
  letter-spacing: 0.15em;
  pointer-events: none;
  opacity: 0;
  animation: fu-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.first-up-callout.fade { animation: fu-fade 0.9s ease-in forwards; }
.first-up-callout.is-me { border-color: var(--green-ok); box-shadow: 0 0 30px rgba(46,204,113,0.45), 6px 6px 0 rgba(0,0,0,0.7); }
.fu-label { font-size: 9px; color: var(--gold); margin-bottom: 6px; }
.first-up-callout.is-me .fu-label { color: var(--green-ok); }
.fu-name {
  font-size: clamp(14px, 2.8vw, 22px);
  color: var(--gold2);
  text-shadow: 0 0 12px rgba(200,160,60,0.7);
}
.first-up-callout.is-me .fu-name { color: #fff; text-shadow: 0 0 12px rgba(46,204,113,0.8); }
@keyframes fu-pop {
  0%   { opacity: 0; transform: translate(-50%, -20px) scale(0.85); }
  60%  { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes fu-fade {
  0%   { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -8px) scale(0.95); }
}

/* ─── Camera Shake on Gunshot ─────────────────────────────────────────────── */
#game-grid.shake { animation: cam-shake 0.36s ease-out; }
@keyframes cam-shake {
  0%   { transform: translate(0, 0); }
  15%  { transform: translate(-5px, 2px); }
  30%  { transform: translate(4px, -3px); }
  45%  { transform: translate(-3px, 4px); }
  60%  { transform: translate(3px, -2px); }
  75%  { transform: translate(-2px, 1px); }
  100% { transform: translate(0, 0); }
}

/* ─── Gunshot Flash (brief screen flash on muzzle fire) ───────────────────── */
.gunshot-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 700;
  pointer-events: none;
  opacity: 1;
  animation: gunshot-fade 0.22s ease-out forwards;
}
.gunshot-flash.strong { animation: gunshot-fade-strong 0.08s ease-out forwards; }
@keyframes gunshot-fade {
  0%   { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes gunshot-fade-strong {
  0%   { opacity: 1; }
  100% { opacity: 1; }
}

/* ─── Elimination Flash + Overlay ─────────────────────────────────────────── */
#elim-flash {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: none;
  pointer-events: none;
}

#eliminated-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background:
    radial-gradient(ellipse 520px 280px at 50% 36%, rgba(80,12,12,0.4), transparent 65%),
    radial-gradient(ellipse at center, #1a0303 0%, #000 80%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  display: none;
}
#eliminated-overlay.show {
  display: flex;
  animation: elim-reveal 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes elim-reveal {
  0%   { opacity: 0; transform: scale(0.94); filter: blur(6px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* Blood-drip accent at top */
#eliminated-overlay::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 36px;
  background:
    radial-gradient(ellipse 20px 30px at 22% 0%, #8b0000, transparent 70%),
    radial-gradient(ellipse 14px 20px at 58% 0%, #5a0000, transparent 70%),
    radial-gradient(ellipse 24px 36px at 78% 0%, #8b0000, transparent 70%);
  pointer-events: none;
}

.elim-skull {
  font-size: clamp(48px, 8vw, 80px);
  animation: skull-pulse 1.8s ease-in-out infinite;
}
@keyframes skull-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.7; }
  50%       { transform: scale(1.08); opacity: 1; }
}

.elim-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(24px, 5vw, 52px);
  color: #e74c3c;
  text-shadow: 0 0 30px rgba(231,76,60,0.9), 0 0 60px rgba(231,76,60,0.4);
  letter-spacing: 0.08em;
}

.elim-sub {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(7px, 1.3vw, 12px);
  color: #7f8c8d;
  text-align: center;
}

.elim-btns {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ─── Ambient Particles ────────────────────────────────────────────────────── */
.ambient-particle {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,226,128,1) 0%, rgba(244,151,38,0.9) 48%, rgba(191,62,18,0) 78%);
  box-shadow: 0 0 8px rgba(244,151,38,0.75);
  pointer-events: none;
  mix-blend-mode: screen;
  animation: ambient-rise linear forwards;
}
@keyframes ambient-rise {
  0%   { transform: translateY(0) translateX(0)   scale(1);   opacity: 0; }
  8%   { opacity: 0.95; }
  60%  { opacity: 0.72; }
  100% { transform: translateY(-220px) translateX(var(--dx, 0px)) scale(0.25); opacity: 0; }
}

/* ─── Round History Button + Panel ─────────────────────────────────────────── */
#history-btn {
  flex-shrink: 0;
  margin-left: auto;   /* hug the right edge of the HUD bar */
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(6px, 0.95vw, 9px);
  letter-spacing: 0.08em;
  color: var(--cream, #f0e6d2);
  background: linear-gradient(180deg, rgba(40,20,4,0.95), rgba(15,7,0,0.95));
  border: 2px solid var(--gold, #d9ae4a);
  box-shadow: 0 2px 0 rgba(0,0,0,0.6), inset 0 0 8px rgba(0,0,0,0.5);
  padding: 6px 9px;
  cursor: pointer;
}
#history-btn:hover { color: #fff; border-color: var(--gold2, #f0d264); box-shadow: 0 0 12px rgba(240,210,80,0.5); }

#history-modal {
  position: absolute;
  inset: 0;
  z-index: 65;
  display: none;
  justify-content: flex-end;
  background: rgba(0,0,0,0.55);
}
#history-modal.open { display: flex; }

#history-panel {
  width: min(86%, 340px);
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,200,120,0.04) 22px 23px),
    linear-gradient(160deg, rgba(34,16,2,0.98), rgba(12,6,0,0.98));
  border-left: 3px solid var(--gold, #d9ae4a);
  box-shadow: -8px 0 30px rgba(0,0,0,0.7);
  animation: history-slide 0.22s ease-out;
}
@keyframes history-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }

#history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 2px solid rgba(217,174,74,0.4);
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(8px, 1.2vw, 12px);
  color: var(--gold2, #f0d264);
  letter-spacing: 0.12em;
  flex-shrink: 0;
}
#history-close {
  background: none;
  border: none;
  color: #c9b89a;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
#history-close:hover { color: #fff; }

#history-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.history-entry {
  font-size: clamp(7px, 1vw, 10px);
  line-height: 1.5;
  color: #d8cbb2;
  padding: 6px 8px;
  border-left: 3px solid rgba(217,174,74,0.35);
  background: rgba(0,0,0,0.28);
}
.history-entry .h-name { color: var(--cream, #f0e6d2); }
.history-entry .h-count { color: var(--gold2, #f0d264); }
.history-entry .h-final { color: #e67e22; }
.history-round {
  text-align: center;
  color: var(--gold, #d9ae4a);
  border-left: none;
  background: none;
  letter-spacing: 0.1em;
  font-size: clamp(7px, 1vw, 10px);
}
.history-lie   { border-left-color: var(--red-bad, #e74c3c); }
.history-lie b { color: var(--red-bad, #e74c3c); }
.history-truth { border-left-color: var(--green-ok, #2ecc71); }
.history-truth b { color: var(--green-ok, #2ecc71); }
.history-empty { color: #7f8c8d; font-size: clamp(7px, 1vw, 10px); text-align: center; padding: 20px 0; }

/* ─── Player Speech Bubbles (taunts) ───────────────────────────────────────── */
/* Rendered in a fixed full-screen layer and positioned over a slot via JS, so
   they're never clipped by the grid's overflow or covered by other panels. */
#bubble-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 90;
}
.speech-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 180px;
  width: max-content;
  background: #fbf3df;
  color: #1a0d00;
  border: 2px solid #5a3a08;
  border-radius: 9px;
  padding: 6px 9px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(6px, 0.9vw, 8px);
  line-height: 1.45;
  text-align: center;
  white-space: normal;
  box-shadow: 0 3px 0 rgba(0,0,0,0.45);
  animation: bubble-pop 0.2s ease-out;
}
.speech-bubble.sus { background: #ffe1d6; border-color: #a83019; color: #5a1505; }
.speech-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #5a3a08;
}
.speech-bubble.sus::after { border-top-color: #a83019; }
.speech-bubble.leaving { animation: bubble-fade 0.4s ease-in forwards; }
@keyframes bubble-pop {
  0%   { opacity: 0; transform: translate(-50%, -100%) translateY(6px) scale(0.7); }
  100% { opacity: 1; transform: translate(-50%, -100%) translateY(0)   scale(1);   }
}
@keyframes bubble-fade {
  to { opacity: 0; transform: translate(-50%, -100%) translateY(-6px) scale(0.9); }
}

/* ─── Pre-Gunshot Tension ──────────────────────────────────────────────────── */
#tension-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse 78% 70% at 50% 50%, transparent 26%, rgba(120,0,0,0.5) 82%, rgba(0,0,0,0.85) 100%);
}
#tension-overlay.active {
  animation: tension-pulse 1.1s ease-in-out infinite;
}
#tension-overlay.peak {
  background: radial-gradient(ellipse 64% 58% at 50% 50%, transparent 14%, rgba(150,0,0,0.66) 74%, rgba(0,0,0,0.94) 100%);
  animation: tension-pulse 0.42s ease-in-out infinite;
}
@keyframes tension-pulse {
  0%, 100% { opacity: 0.28; }
  50%      { opacity: 0.78; }
}
/* ─── Death Aftermath ──────────────────────────────────────────────────────── */
#death-vignette {
  position: fixed;
  inset: 0;
  z-index: 75;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, transparent 34%, rgba(110,0,0,0.72) 88%, rgba(40,0,0,0.92) 100%);
}
#death-vignette.show {
  opacity: 1;
  transition: opacity 0.35s ease-out;
  animation: death-throb 2.6s ease-in-out infinite;
}
#death-vignette.fade {
  opacity: 0;
  animation: none;
  transition: opacity 4.8s ease-in;
}
@keyframes death-throb {
  0%, 100% { filter: brightness(0.9); }
  50%      { filter: brightness(1.25); }
}
.death-name { color: #ff5a4a; text-shadow: 0 0 12px rgba(231,76,60,0.9); }

.tremble { animation: tremble 0.18s linear infinite; }
.tremble-hard { animation: tremble-hard 0.08s linear infinite; }
@keyframes tremble {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(0.6px, -0.6px); }
  50%  { transform: translate(-0.6px, 0.5px); }
  75%  { transform: translate(0.5px, 0.6px); }
  100% { transform: translate(0, 0); }
}
@keyframes tremble-hard {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(1.5px, -1.2px); }
  40%  { transform: translate(-1.4px, 1.3px); }
  60%  { transform: translate(1.3px, 1.4px); }
  80%  { transform: translate(-1.5px, -1.1px); }
  100% { transform: translate(0, 0); }
}

/* ─── Plain "Boss" Mode ────────────────────────────────────────────────────── */
/* Looks like a plain text document so a glance reads as "work", not a game. */
#boss-btn {
  position: fixed;
  left: 6px;
  bottom: 6px;
  z-index: 200;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  line-height: 1;
  color: #888;
  background: rgba(20,12,4,0.4);
  border: 1px solid rgba(150,150,150,0.25);
  padding: 4px 6px;
  opacity: 0.3;
  cursor: pointer;
}
#boss-btn:hover { opacity: 0.85; color: #ddd; }

#plain-mode {
  position: fixed;
  inset: 0;
  z-index: 3000;            /* above every game overlay */
  display: none;
  flex-direction: column;
  background: #ffffff;
  color: #1f1f1f;
  font-family: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}
#plain-mode.open { display: flex; }

.pm-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #f0f0f0;
  border-bottom: 1px solid #d4d4d4;
  padding: 4px 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  color: #333;
  flex-shrink: 0;
  user-select: none;
}
.pm-title { font-weight: 600; }
.pm-menu { color: #555; }

.pm-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.65;
}
.pm-doc { white-space: pre-wrap; }

.pm-muted { color: #8a8a8a; }
.pm-note { color: #b00020; margin-top: 6px; }

.pm-roulette {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  font-size: 14px;
}
.pm-alive { color: #2e7d32; font-weight: 700; }
.pm-dead  { color: #b00020; font-weight: 700; letter-spacing: 0.04em; }

/* Animated trailing dots — keeps tension during the trigger pull */
.pm-dots::after {
  content: '';
  animation: pm-dots 1.1s steps(1, end) infinite;
}
@keyframes pm-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

.pm-hand-label { margin-top: 16px; color: #555; }
.pm-hand { margin-top: 4px; }
.pm-card {
  display: inline-block;
  border: 1px solid #bdbdbd;
  background: #fafafa;
  color: #222;
  padding: 2px 7px;
  margin: 3px 4px 3px 0;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
}
.pm-card:hover { border-color: #888; }
.pm-card.sel { background: #e6e6e6; border-color: #1f1f1f; font-weight: 700; }

.pm-actions { margin-top: 12px; }
.pm-act {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  border: 1px solid #999;
  background: #f3f3f3;
  color: #222;
  padding: 4px 12px;
  margin: 0 8px 6px 0;
  cursor: pointer;
}
.pm-act:hover:not([disabled]) { background: #e7e7e7; }
.pm-act[disabled] { color: #aaa; border-color: #ccc; cursor: default; }

#pm-exit {
  position: fixed;
  right: 10px;
  bottom: 8px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  color: #bbb;
  cursor: pointer;
  user-select: none;
}
#pm-exit:hover { color: #777; text-decoration: underline; }
