:root {
    --bg-dark: #0a0a0f;
    --bg-card: #14141f;
    --accent: #e74c3c;
    --accent-glow: rgba(231, 76, 60, 0.3);
    --text: #e0e0e0;
    --text-dim: #888;
    --gold: #f1c40f;
    --night-bg: #05050d;
    --dawn-sky: #1a0a2e;
    --day-bg: #0d1117;
    --blood: #8b0000;
}

body {
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
}

.screen { display: none; width: 100vw; height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ═══════════════════════════════════════
   Phase Overlay & Transition System
   ═══════════════════════════════════════ */

.phase-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.phase-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.phase-overlay.night-transition {
    background: radial-gradient(ellipse at 50% 20%, #0d0d2b 0%, #050510 60%, #000 100%);
}

.phase-overlay.dawn-transition {
    background: linear-gradient(to top, #2d1b4e 0%, #1a0a2e 30%, #0d0520 60%, #050510 100%);
}

.phase-overlay.voting-transition {
    background: radial-gradient(ellipse at center, rgba(139,0,0,0.7) 0%, rgba(10,10,15,0.95) 100%);
}

.phase-overlay.execution-transition {
    background: #000;
}

.phase-overlay.gameover-transition {
    background: radial-gradient(ellipse at center, rgba(241,196,15,0.2) 0%, #0a0a0f 70%);
}

/* ═══════════════════════════════════════
   Stars Layer
   ═══════════════════════════════════════ */

.stars-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    pointer-events: none;
}

.stars-layer.visible {
    opacity: 1;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: twinkle var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

.star.bright {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.5);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* ═══════════════════════════════════════
   Phase Atmosphere on Game Screen
   ═══════════════════════════════════════ */

#game-screen {
    transition: background 1.5s ease;
    position: relative;
    z-index: 1;
}

#game-screen.phase-night {
    background: linear-gradient(180deg, #05050d 0%, #0a0a1a 40%, #0d0d25 100%);
}

#game-screen.phase-dawn {
    background: linear-gradient(180deg, #1a0a2e 0%, #2d1540 40%, #3d1a3a 70%, #4a2040 100%);
}

#game-screen.phase-day {
    background: linear-gradient(180deg, #0f1520 0%, #141e30 40%, #1a2740 100%);
}

#game-screen.phase-voting {
    background: linear-gradient(180deg, #1a0a0a 0%, #0f0808 50%, #0a0505 100%);
}

#game-screen.phase-execution {
    background: #050505;
}

#game-screen.phase-game_over {
    background: radial-gradient(ellipse at center, #1a1500 0%, #0a0a0f 70%);
}

/* Lobby — animated gradient background */
#lobby-screen {
    background:
        linear-gradient(135deg, #0a0a0f 0%, #12101f 25%, #0a0a0f 50%, #151020 75%, #0a0a0f 100%);
    background-size: 400% 400%;
    animation: lobbyGradient 15s ease infinite;
    padding: 2vh 3vw;
    justify-content: flex-start;
    gap: 1vh;
}

@keyframes lobbyGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.lobby-header {
    width: 100%;
    text-align: left;
    padding: 0 2vw;
    flex-shrink: 0;
}

.logo h1 {
    font-size: clamp(2.5rem, 4vw, 4.5rem);
    font-weight: 800;
    letter-spacing: 0.4em;
    color: var(--accent);
    text-shadow: 0 0 60px var(--accent-glow), 0 0 120px rgba(231, 76, 60, 0.15);
    margin-bottom: 0;
    text-align: left;
}

.subtitle {
    font-size: clamp(1rem, 1.5vw, 1.5rem);
    color: var(--text-dim);
    text-align: left;
    font-style: italic;
    margin-top: 0.2em;
}

.lobby-controls.lobby-pre-room {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 3rem;
}

.language-select-subtle {
    background: var(--bg-card);
    color: var(--text-dim);
    border: 1px solid #2a2a3e;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    font-size: 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition: all 0.2s;
    font-weight: 700;
}

.btn-primary:hover {
    background: #c0392b;
    box-shadow: 0 0 30px var(--accent-glow);
}

select {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid #333;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    border-radius: 8px;
}

#room-info {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* ── Lobby Main: QR + Round Table ── */
.lobby-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4vw;
    flex: 1;
    min-height: 0;
    padding: 0 2vw;
}

.qr-panel {
    text-align: center;
    background: var(--bg-card);
    padding: 2rem 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    max-width: 28vw;
}

#qr-code canvas {
    border: 4px solid var(--accent);
    border-radius: 12px;
}

.room-code {
    font-size: clamp(2rem, 3vw, 3.5rem);
    font-weight: 800;
    letter-spacing: 0.5em;
    margin-top: 1rem;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.3);
}

.join-url {
    color: var(--text-dim);
    font-size: clamp(0.8rem, 1vw, 1.1rem);
    margin-top: 0.3rem;
    word-break: break-all;
}

/* ── Round Table ── */
.table-area {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
}

.round-table {
    position: relative;
    width: min(48vw, 56vh);
    height: min(48vw, 56vh);
    border-radius: 50%;
    background: radial-gradient(ellipse at 40% 35%, #8B6914 0%, #654321 40%, #3E2723 80%, #2C1A0E 100%);
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.5),
        0 0 40px rgba(101, 67, 33, 0.3),
        0 0 80px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.table-center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.table-icon {
    font-size: clamp(2rem, 3vw, 4rem);
}

.table-text {
    font-size: clamp(0.8rem, 1.2vw, 1.2rem);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 600;
}

/* ── Table Seats (players around the table) ── */
.table-seat {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    pointer-events: none;
    opacity: 0;
    animation: seatAppear 0.5s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes seatAppear {
    0%   { opacity: 0; transform: var(--seat-transform) scale(0.3); }
    100% { opacity: 1; transform: var(--seat-transform) scale(1); }
}

@keyframes seatRemove {
    0%   { opacity: 1; transform: var(--seat-transform) scale(1); }
    100% { opacity: 0; transform: var(--seat-transform) scale(0); }
}

.table-seat.removing {
    animation: seatRemove 0.3s ease forwards;
}

.seat-avatar {
    width: clamp(28px, 3vw, 48px);
    height: clamp(28px, 3vw, 48px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.7rem, 1vw, 1.1rem);
    font-weight: 700;
    transition: all 0.4s ease;
    border: 2px solid transparent;
}

/* Not ready state */
.table-seat.not-ready .seat-avatar {
    background: rgba(100, 100, 100, 0.4);
    border-color: rgba(150, 150, 150, 0.3);
    color: var(--text-dim);
}

.table-seat.not-ready .seat-name {
    color: rgba(200, 200, 200, 0.4);
}

.table-seat.not-ready .seat-status {
    color: #e67e22;
    font-size: 0.55rem;
}

/* Ready state */
.table-seat.ready .seat-avatar {
    background: rgba(46, 204, 113, 0.25);
    border-color: #2ecc71;
    color: #2ecc71;
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.4), 0 0 24px rgba(46, 204, 113, 0.15);
}

.table-seat.ready .seat-name {
    color: #e0e0e0;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
}

.table-seat.ready .seat-status {
    color: #2ecc71;
    font-size: 0.65rem;
}

.seat-name {
    font-size: clamp(0.6rem, 0.9vw, 1rem);
    font-weight: 600;
    white-space: nowrap;
    max-width: 10vw;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.4s ease;
}

.seat-status {
    transition: color 0.4s ease;
    line-height: 1;
}

/* Adaptive seat sizing for many players */
.round-table.many-players .seat-avatar {
    width: clamp(22px, 2.2vw, 36px);
    height: clamp(22px, 2.2vw, 36px);
    font-size: clamp(0.55rem, 0.8vw, 0.85rem);
}

.round-table.many-players .seat-name {
    font-size: clamp(0.5rem, 0.7vw, 0.8rem);
    max-width: 7vw;
}

/* ── Lobby Footer ── */
.lobby-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 3vw;
    width: 100%;
    flex-shrink: 0;
}

.player-count-display {
    color: var(--text-dim);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
}

/* ── Auto-start Countdown Overlay ── */
.auto-start-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.auto-start-overlay.hidden {
    display: none !important;
}

.auto-start-content {
    text-align: center;
}

.auto-start-label {
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
}

.auto-start-number {
    font-size: clamp(8rem, 15vw, 16rem);
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 80px var(--accent-glow), 0 0 160px rgba(231, 76, 60, 0.3);
    animation: countdownPop 1s ease-in-out;
    line-height: 1;
}

@keyframes countdownPop {
    0%   { transform: scale(2); opacity: 0; }
    30%  { transform: scale(0.9); opacity: 1; }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 2rem;
    background: rgba(20, 20, 31, 0.85);
    backdrop-filter: blur(8px);
    width: 100%;
    font-size: 2rem;
    z-index: 2;
    transition: background 1s ease;
}

.phase-display {
    color: var(--gold);
    font-weight: bold;
    text-transform: uppercase;
}

.timer {
    color: var(--accent);
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.game-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.phase-view {
    text-align: center;
    animation: phaseEnter 0.8s ease-out;
}

.phase-view.hidden {
    display: none;
}

.phase-view.fade-out {
    animation: phaseFadeOut 0.4s ease forwards;
}

.phase-view.fade-in {
    animation: phaseFadeIn 0.5s ease forwards;
}

@keyframes phaseFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.96); }
}

@keyframes phaseFadeIn {
    from { opacity: 0; transform: scale(1.04); }
    to   { opacity: 1; transform: scale(1); }
}

.phase-view h2 {
    font-size: clamp(3rem, 5vw, 6rem);
}

.moon-icon, .sun-icon {
    font-size: clamp(6rem, 10vw, 12rem);
    margin-bottom: 1rem;
}

/* Narration text */
.narration {
    font-size: clamp(1.5rem, 2.5vw, 3rem);
    color: var(--text-dim);
    font-style: italic;
    animation: narratFade 1.5s ease-out;
}

@keyframes narratFade {
    from { opacity: 0; letter-spacing: 0.3em; }
    to { opacity: 1; letter-spacing: normal; }
}

@keyframes phaseEnter {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Night Phase ── */
.moon-icon {
    animation: moonFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(200, 200, 255, 0.4));
}

@keyframes moonFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.05); }
}

#night-view h2 {
    color: #b8c0ff;
    text-shadow: 0 0 30px rgba(184, 192, 255, 0.3);
}

/* ── Dawn Phase — Death Announcements ── */
#dawn-view .sun-icon {
    animation: sunRise 2s ease-out forwards;
}

@keyframes sunRise {
    from { transform: translateY(40px); opacity: 0.3; filter: brightness(0.5); }
    to { transform: translateY(0); opacity: 1; filter: brightness(1); }
}

#dawn-view h2 {
    color: #e8a87c;
    text-shadow: 0 0 20px rgba(232, 168, 124, 0.3);
}

#death-announcements {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.death-announcement {
    background: linear-gradient(135deg, rgba(139,0,0,0.3) 0%, rgba(20,20,31,0.8) 100%);
    border: 1px solid rgba(139,0,0,0.5);
    border-radius: 12px;
    padding: 1rem 2.5rem 1rem 3.5rem;
    font-size: 1.3rem;
    opacity: 0;
    transform: translateY(30px) scale(0.8);
    animation: deathReveal 0.8s ease-out forwards;
    animation-delay: var(--reveal-delay, 0s);
    position: relative;
    overflow: hidden;
}

.death-announcement::before {
    content: '💀';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0;
    animation: skullAppear 0.4s ease-out forwards;
    animation-delay: calc(var(--reveal-delay, 0s) + 0.5s);
}

.death-announcement::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(139,0,0,0.15), transparent);
    animation: bloodSweep 1.5s ease-out forwards;
    animation-delay: var(--reveal-delay, 0s);
}

@keyframes deathReveal {
    0% { opacity: 0; transform: translateY(30px) scale(0.8); }
    60% { opacity: 1; transform: translateY(-5px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes skullAppear {
    from { opacity: 0; transform: translateY(-50%) scale(0.3) rotate(-20deg); }
    to { opacity: 1; transform: translateY(-50%) scale(1) rotate(0); }
}

@keyframes bloodSweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.death-name {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--accent-glow);
}

.no-deaths {
    color: #7ec8a0;
    font-size: 1.3rem;
    font-style: italic;
    animation: peacefulFade 1s ease-out;
    text-shadow: 0 0 15px rgba(126, 200, 160, 0.3);
}

@keyframes peacefulFade {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ── Day Phase ── */
#day-view .sun-icon {
    animation: sunPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 25px rgba(255, 200, 50, 0.5));
}

@keyframes sunPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 25px rgba(255, 200, 50, 0.5)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 40px rgba(255, 200, 50, 0.7)); }
}

#day-view h2 {
    color: #f0d060;
    text-shadow: 0 0 20px rgba(240, 208, 96, 0.3);
}

.alive-players {
    background: rgba(20, 20, 31, 0.85);
    backdrop-filter: blur(8px);
    padding: 1rem 2rem;
    width: 100%;
    z-index: 2;
    transition: background 0.5s ease;
}

.alive-players h3 {
    text-align: center;
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
}

.alive-players ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    justify-content: center;
}

.alive-players li {
    background: rgba(26, 26, 46, 0.8);
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.6s ease;
}

.alive-players li.alive-enter {
    animation: aliveEnter 0.4s ease-out;
}

@keyframes aliveEnter {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

.alive-players li.dead {
    opacity: 0.25;
    text-decoration: line-through;
    background: rgba(139, 0, 0, 0.15);
    border-color: rgba(139, 0, 0, 0.2);
    transform: scale(0.9);
}

.alive-players li.just-died {
    animation: playerDeath 1s ease-out forwards;
}

@keyframes playerDeath {
    0% { opacity: 1; background: rgba(26, 26, 46, 0.8); transform: scale(1); }
    30% { background: rgba(200, 0, 0, 0.4); transform: scale(1.1); }
    100% { opacity: 0.25; background: rgba(139, 0, 0, 0.15); transform: scale(0.9); text-decoration: line-through; }
}

/* ── Voting Phase Atmosphere ── */
#voting-view h2 {
    animation: voteTextPulse 1.5s ease-in-out infinite;
}

@keyframes voteTextPulse {
    0%, 100% { text-shadow: 0 0 10px var(--accent-glow); }
    50% { text-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(231,76,60,0.15); }
}

/* ── Voting Header ── */
.voting-header {
    margin-bottom: 2rem;
}

.voting-icon {
    font-size: 4rem;
    animation: votePulse 2s ease-in-out infinite;
}

.voting-subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
    margin-top: 0.3rem;
}

@keyframes votePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.votes-cast-counter {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ── Vote Bars ── */
#vote-bars {
    width: 90%;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.vote-bar {
    display: grid;
    grid-template-columns: 140px 1fr 50px;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    background: rgba(20, 20, 31, 0.6);
    transition: transform 0.4s cubic-bezier(.34,1.56,.64,1),
                box-shadow 0.4s ease,
                background 0.4s ease;
    position: relative;
    overflow: hidden;
}

.vote-bar.entering {
    animation: barEnter 0.5s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes barEnter {
    from { opacity: 0; transform: translateX(-40px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.vote-bar.leader {
    background: rgba(231, 76, 60, 0.1);
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.25), inset 0 0 20px rgba(231, 76, 60, 0.05);
    transform: scale(1.03);
    animation: leaderGlow 1.8s ease-in-out infinite;
}

@keyframes leaderGlow {
    0%, 100% { box-shadow: 0 0 25px rgba(231, 76, 60, 0.25), inset 0 0 20px rgba(231, 76, 60, 0.05); }
    50%      { box-shadow: 0 0 40px rgba(231, 76, 60, 0.45), inset 0 0 30px rgba(231, 76, 60, 0.1); }
}

.vote-bar-name {
    font-size: 1.15rem;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vote-bar-track {
    height: 34px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.vote-bar-fill {
    height: 100%;
    border-radius: 6px;
    min-width: 6px;
    transition: width 0.6s cubic-bezier(.25,.8,.25,1),
                background 0.6s ease;
    position: relative;
}

/* Color coding by vote intensity */
.vote-bar-fill.heat-low {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.3);
}

.vote-bar-fill.heat-med {
    background: linear-gradient(90deg, #f39c12, #f1c40f);
    box-shadow: 0 0 12px rgba(241, 196, 15, 0.3);
}

.vote-bar-fill.heat-high {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.4);
}

.vote-bar-fill.heat-max {
    background: linear-gradient(90deg, #c0392b, #8e0000);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
}

.vote-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 60%, rgba(255,255,255,0.15));
    border-radius: 6px;
}

.vote-bar-count {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: transform 0.3s ease;
}

.vote-bar-count.bumped {
    animation: countBump 0.35s ease;
}

@keyframes countBump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.5); color: var(--gold); }
    100% { transform: scale(1); }
}

/* Voter names under each bar */
.vote-bar-voters {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
    padding-top: 0.2rem;
}

.voter-chip {
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-dim);
    animation: chipIn 0.3s ease both;
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Execution / Reveal ── */
.execution-reveal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.reveal-countdown {
    font-size: 8rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 60px var(--accent-glow);
    animation: countdownPulse 0.8s ease-in-out;
}

@keyframes countdownPulse {
    0%   { transform: scale(2); opacity: 0; }
    50%  { transform: scale(1); opacity: 1; }
    90%  { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0; }
}

.reveal-spotlight {
    text-align: center;
    animation: spotlightIn 1.2s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes spotlightIn {
    0%   { transform: scale(0.3); opacity: 0; filter: blur(20px); }
    60%  { transform: scale(1.1); opacity: 1; filter: blur(0); }
    100% { transform: scale(1); opacity: 1; filter: blur(0); }
}

.reveal-label {
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
}

.reveal-name {
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.reveal-name.eliminated {
    color: var(--accent);
    text-shadow: 0 0 50px var(--accent-glow), 0 0 100px var(--accent-glow);
    animation: eliminatedPulse 2s ease-in-out infinite;
}

@keyframes eliminatedPulse {
    0%, 100% { text-shadow: 0 0 50px var(--accent-glow), 0 0 100px var(--accent-glow); }
    50%      { text-shadow: 0 0 80px rgba(231,76,60,0.8), 0 0 140px rgba(231,76,60,0.4); }
}

.reveal-name.safe {
    color: var(--text-dim);
}

.reveal-subtitle {
    font-size: 1.4rem;
    margin-top: 0.5rem;
}

.reveal-subtitle.eliminated {
    color: var(--accent);
}

.reveal-subtitle.safe {
    color: var(--text-dim);
    font-style: italic;
}

/* Full-screen flash on reveal */
.screen-flash {
    position: fixed;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    animation: screenFlash 0.6s ease-out;
}

@keyframes screenFlash {
    0%   { opacity: 0.7; }
    100% { opacity: 0; }
}

.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Game Over — Golden Victory ── */
#gameover-view {
    animation: victoryEnter 1.5s ease-out;
}

#gameover-view h2 {
    color: var(--gold);
    font-size: 3.5rem;
    text-shadow:
        0 0 20px rgba(241, 196, 15, 0.5),
        0 0 60px rgba(241, 196, 15, 0.2);
    animation: goldenPulse 2s ease-in-out infinite;
}

@keyframes victoryEnter {
    0% { opacity: 0; transform: scale(0.5); }
    60% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes goldenPulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(241,196,15,0.5), 0 0 60px rgba(241,196,15,0.2);
    }
    50% {
        text-shadow: 0 0 40px rgba(241,196,15,0.7), 0 0 100px rgba(241,196,15,0.3), 0 0 150px rgba(241,196,15,0.1);
    }
}

#role-reveals {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.role-reveal-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a30 100%);
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    min-width: 150px;
    text-align: center;
    border: 1px solid #2a2a3e;
    opacity: 0;
    animation: cardReveal 0.5s ease-out forwards;
    animation-delay: var(--card-delay, 0s);
    transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.role-reveal-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.3);
}

@keyframes cardReveal {
    from { opacity: 0; transform: rotateY(90deg) scale(0.8); }
    to { opacity: 1; transform: rotateY(0) scale(1); }
}

.role-reveal-card.dead {
    opacity: 0;
    animation: cardRevealDead 0.5s ease-out forwards;
    animation-delay: var(--card-delay, 0s);
}

@keyframes cardRevealDead {
    from { opacity: 0; transform: rotateY(90deg) scale(0.8); }
    to { opacity: 0.45; transform: rotateY(0) scale(1); }
}

.role-reveal-card .player-name {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.role-reveal-card .role-name { color: var(--accent); font-weight: bold; font-size: 1.2rem; }

/* ====== Mini-game overlay (host) ====== */

.minigame-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 10, 15, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mgFadeIn 0.4s ease;
}

.minigame-overlay.hidden { display: none !important; }

@keyframes mgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.minigame-enter .mg-card {
    animation: mgSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mgSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mg-card {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 2.5rem 3rem;
    max-width: 700px;
    width: 90vw;
    text-align: center;
}

.mg-title {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.mg-desc {
    color: var(--text-dim);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.mg-subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.mg-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.mg-participant {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 1rem;
}

.mg-waiting-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #333;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1rem auto 0.5rem;
}

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

.mg-waiting-text { color: var(--text-dim); font-size: 0.9rem; }

/* Prisoner's Dilemma result */
.mg-pd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 1.5rem auto;
    max-width: 400px;
}

.mg-pd-cell { padding: 0.8rem; border-radius: 8px; }
.mg-pd-header { color: var(--gold); font-weight: bold; font-size: 1.1rem; }

.mg-pd-outcome {
    grid-column: span 2;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 1rem;
}

.mg-pd-choices {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.2rem;
}

.mg-pd-scores {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.mg-pd-score {
    font-size: 1.2rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
}

.mg-pd-score.positive { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.mg-pd-score.negative { background: rgba(231, 76, 60, 0.15); color: var(--accent); }

/* Trust Circle chart */
.mg-tc-chart {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.mg-tc-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.mg-tc-name {
    width: 120px;
    text-align: right;
    font-size: 1rem;
    flex-shrink: 0;
}

.mg-tc-fill-track {
    flex: 1;
    height: 24px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.mg-tc-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.mg-tc-rank {
    width: 40px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Alibi Challenge result */
.mg-spotlight-name {
    font-size: 2rem;
    color: var(--gold);
    margin: 0.5rem 0 1.5rem;
}

.mg-alibi-bars {
    display: flex;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.mg-alibi-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 60px;
}

.mg-alibi-bar.up { background: rgba(46, 204, 113, 0.3); color: #2ecc71; }
.mg-alibi-bar.down { background: rgba(231, 76, 60, 0.3); color: var(--accent); }

.mg-alibi-verdict {
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Interrogation result */
.mg-int-players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
    font-size: 1.1rem;
}

.mg-int-role { color: var(--gold); font-weight: bold; }
.mg-int-vs { color: var(--text-dim); font-style: italic; }

.mg-int-transcript {
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.mg-int-qa {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    animation: mgFadeIn 0.3s ease;
}

.mg-int-q { font-size: 1.05rem; margin-bottom: 0.3rem; }
.mg-int-num { color: var(--accent); font-weight: bold; margin-right: 0.4rem; }
.mg-int-a { font-size: 1.1rem; font-weight: bold; padding-left: 1.8rem; }
.mg-int-a.yes { color: #2ecc71; }
.mg-int-a.no { color: var(--accent); }

/* ═══════════════════════════════════════
   Narration Overlay (GM Voice)
   ═══════════════════════════════════════ */

.narration-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    transition: opacity 0.6s ease;
}

.narration-overlay.hidden {
    display: none !important;
}

.narration-text {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 700;
    text-align: center;
    color: #fff;
    max-width: 80vw;
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-shadow:
        0 0 30px rgba(231, 76, 60, 0.35),
        0 0 60px rgba(255, 255, 255, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.8);
    opacity: 0;
    animation: narrationFadeIn 0.6s ease forwards;
}

@keyframes narrationFadeIn {
    0%   { opacity: 0; transform: translateY(12px) scale(0.97); letter-spacing: 0.15em; }
    100% { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 0.02em; }
}

@keyframes narrationFadeOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-12px) scale(0.97); }
}

.narration-text.fade-out {
    animation: narrationFadeOut 0.4s ease both;
}

.narration-indicator {
    font-size: 1.1rem;
    color: var(--text-dim);
    animation: indicatorPulse 1.5s ease-in-out infinite;
}

@keyframes indicatorPulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

.narration-next-btn {
    margin-top: 1rem;
    font-size: 1.2rem;
    padding: 0.8rem 2.5rem;
    cursor: pointer;
    animation: narrationFadeIn 0.4s ease forwards;
}

.narration-next-btn.hidden {
    display: none;
}

/* ═══════════════════════════════════════
   Narration Subtitle (bottom bar)
   ═══════════════════════════════════════ */

.narration-subtitle {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 400;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 60%, transparent);
    padding: 2.5rem 2rem 1.5rem;
    text-align: center;
    pointer-events: none;
}

.narration-subtitle.hidden { display: none !important; }

.narration-subtitle p {
    font-size: 1.6rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    margin: 0;
    animation: subtitleSlideUp 0.4s ease forwards;
}

@keyframes subtitleSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   Volume Slider
   ═══════════════════════════════════════ */

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-control label {
    color: var(--text-dim);
    font-size: 1rem;
    white-space: nowrap;
    cursor: default;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    transition: transform 0.15s ease;
}

#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    border: none;
    cursor: pointer;
}
