:root {
    --bg-dark: #070a12;
    --bg-panel: #0d1526;
    --bg-panel-border: #1e293b;
    --accent-red: #dc2626;
    --accent-blue: #0284c7;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-purple: #9333ea;
    --text-main: #f3f4f6;
    --text-muted: #94a3b8;
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Cinzel', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    line-height: 1.5;
}

.game-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    max-width: 1440px;
    margin: 0 auto;
}

/* App Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.badge-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent-blue);
    background: rgba(2, 132, 199, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 4px;
}

.app-header h1 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    letter-spacing: 1px;
}

.accent-red { color: var(--accent-red); }

.phase-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #141f36;
    border: 1px solid var(--accent-blue);
    padding: 8px 18px;
    border-radius: 30px;
}

.phase-icon { font-size: 1.4rem; }
.phase-box h3 { font-family: var(--font-serif); font-size: 1rem; color: var(--text-main); }
.subtitle { font-size: 0.78rem; color: var(--text-muted); }

.header-actions { display: flex; gap: 10px; }

.btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--bg-panel-border);
    background: #1e293b;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.btn:hover { background: #334155; border-color: var(--accent-blue); }
.btn-primary { background: var(--accent-blue); color: #fff; border: none; }
.btn-primary:hover { background: #0369a1; }
.btn-secondary { background: #141f36; color: var(--text-muted); }
.btn-accent { background: var(--accent-red); color: #fff; border: none; }
.btn-accent:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; font-family: var(--font-mono); }
.btn-block { width: 100%; }

/* Main Grid */
.game-grid {
    display: grid;
    grid-template-columns: 320px 1fr 360px;
    gap: 20px;
    flex: 1;
}

@media (max-width: 1200px) {
    .game-grid { grid-template-columns: 1fr; }
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.panel-header h3 {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--accent-blue);
    letter-spacing: 0.5px;
}

.my-role-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: rgba(220, 38, 38, 0.15);
    color: var(--accent-red);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Roster */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 480px;
}

.player-card {
    background: #121c2e;
    border: 1px solid var(--bg-panel-border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.player-card:hover {
    border-color: var(--accent-blue);
    background: #182740;
}

.player-card.active-selected {
    border-color: var(--accent-yellow);
    background: rgba(245, 158, 11, 0.08);
}

.player-card.eliminated {
    opacity: 0.4;
    filter: grayscale(1);
    cursor: not-allowed;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.player-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.role-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: #1e293b;
}

/* Night Action Card */
.night-action-card {
    background: rgba(147, 51, 234, 0.08);
    border: 1px dashed var(--accent-purple);
    border-radius: 8px;
    padding: 12px;
}

.night-action-card h4 {
    font-family: var(--font-serif);
    color: var(--accent-purple);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.night-action-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-select {
    width: 100%;
    background: #121c2e;
    border: 1px solid var(--bg-panel-border);
    color: var(--text-main);
    padding: 8px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* Terminal & Chat */
.terminal-panel { flex: 1; }

.day-counter-pill {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: #1e293b;
    padding: 2px 8px;
    border-radius: 12px;
}

.chat-feed {
    flex: 1;
    min-height: 360px;
    max-height: 480px;
    background: #040810;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.system-msg {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-yellow);
    background: rgba(245, 158, 11, 0.08);
    padding: 6px 10px;
    border-left: 3px solid var(--accent-yellow);
    border-radius: 0 4px 4px 0;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-speaker {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--accent-blue);

    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-text {
    background: #0e1726;
    border: 1px solid var(--bg-panel-border);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #e2e8f0;
}

.input-bar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.input-bar input {
    flex: 1;
    background: #121c2e;
    border: 1px solid var(--bg-panel-border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.88rem;
}

/* Voting Box */
.voting-box {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 14px;
    margin-top: 10px;
}

.voting-box h4 {
    font-family: var(--font-serif);
    color: var(--accent-red);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.vote-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Brain Panel */
.brain-panel { background: #0a1120; }

.inspector-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 6px;
}

.brain-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brain-header strong { font-size: 0.95rem; color: var(--accent-yellow); }

.brain-section h4 {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;

    text-transform: uppercase;
}

.brain-text {
    font-size: 0.85rem;
    color: #e2e8f0;
    background: #121c2e;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--bg-panel-border);
}

.suspicion-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.suspicion-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

.suspicion-header {
    display: flex;
    justify-content: space-between;
}

.suspicion-bar {
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    overflow: hidden;
}

.suspicion-fill {
    height: 100%;
    background: var(--accent-red);
    transition: width 0.3s ease;
}

.memory-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    max-height: 160px;
    overflow-y: auto;
}

.memory-list li {
    background: #121c2e;
    padding: 6px 8px;
    border-left: 2px solid var(--accent-blue);
    border-radius: 0 4px 4px 0;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 8, 16, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-card {
    background: var(--bg-panel);
    border: 2px solid var(--accent-red);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-card h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
}

.modal-reveal {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: #121c2e;
    padding: 12px;
    border-radius: 8px;
    text-align: left;
}

/* Author Details Footer */
.author-footer {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.footer-card {
    background: rgba(13, 21, 37, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px 28px;
    text-align: center;
    max-width: 850px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.developed-by { font-size: 0.9rem; color: #94a3b8; }
.developed-by .author-name { color: #00f0ff; font-weight: 700; }
.developed-by .heart { color: #ef4444; display: inline-block; animation: heartPulse 1.5s infinite; }
@keyframes heartPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.footer-links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; font-size: 0.85rem; }
.footer-link { color: #00f0ff; text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.footer-links .dot { color: #475569; }
.tech-badges { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.badge-pill { background: rgba(6, 182, 212, 0.08); border: 1px solid rgba(6, 182, 212, 0.3); color: #38bdf8; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-family: var(--font-mono); display: inline-flex; align-items: center; gap: 4px; }
.copyright-text { font-size: 0.75rem; color: #64748b; }
