/* Last Days — Core Layout & Screens */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-panel: rgba(20, 20, 30, 0.9);
    --text-primary: #c8c8d0;
    --text-secondary: #888;
    --text-muted: #555;
    --accent: #ff4444;
    --accent-glow: rgba(255, 68, 68, 0.4);
    --border: #222;
    --green: #4caf50;
    --amber: #ff9800;
    --red: #f44336;
    --font-main: 'Courier New', monospace;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Screen system */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* Buttons */
.btn {
    font-family: var(--font-main);
    font-size: 0.9rem;
    padding: 0.7rem 1.8rem;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-secondary { border-color: #444; color: var(--text-secondary); }
.btn-secondary:hover { background: #444; color: #fff; box-shadow: none; }

/* Title Screen */
#screen-title {
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--bg-primary) 70%);
    text-align: center;
    padding: 2rem;
}
.title-container h1 {
    font-size: 4rem;
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
    margin-bottom: 0.5rem;
    letter-spacing: 0.3em;
    animation: titlePulse 3s ease-in-out infinite;
}
@keyframes titlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; text-shadow: 0 0 50px rgba(255, 68, 68, 0.8); }
}
.title-container .tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-style: italic;
}
.title-buttons { display: flex; flex-direction: column; gap: 1rem; align-items: center; }

/* Role Select */
#screen-role-select { padding: 2rem; align-items: center; }
#screen-role-select h2 { font-size: 2rem; color: var(--accent); margin-bottom: 0.5rem; }
#screen-role-select .subtitle { color: var(--text-secondary); margin-bottom: 2rem; }
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
    max-width: 1400px;
    width: 100%;
    padding: 0 1rem;
}
.role-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 1.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.role-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px var(--accent-glow);
}
.role-card .role-icon { font-size: 2.2rem; margin-bottom: 0.4rem; }
.role-card h3 { color: #fff; margin-bottom: 0.3rem; font-size: 1.2rem; }
.role-card .role-identity { color: var(--text-secondary); font-size: 0.8rem; margin-bottom: 0.8rem; }
.role-card .role-desc { color: #aaa; font-size: 0.8rem; line-height: 1.5; margin-bottom: 0.8rem; }
.role-card .role-strengths { font-size: 0.75rem; color: var(--green); margin-bottom: 0.3rem; }
.role-card .role-weaknesses { font-size: 0.75rem; color: #ff6b6b; margin-bottom: 0.3rem; }
.role-card .role-risk { font-size: 0.7rem; color: var(--accent); font-style: italic; border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.5rem; }

/* Prologue */
#screen-prologue { justify-content: center; align-items: center; padding: 2rem; background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--bg-primary) 70%); }
.prologue-container { max-width: 700px; text-align: center; }
.prologue-role-header { margin-bottom: 2rem; }
.prologue-icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.prologue-container h2 { color: var(--accent); font-size: 1.8rem; }
.prologue-text { color: #bbb; line-height: 1.9; font-size: 0.95rem; text-align: left; margin-bottom: 2rem; white-space: pre-line; }

/* Game Layout */
.game-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr;
    height: 100vh;
}
.top-bar {
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--accent);
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.countdown { display: flex; align-items: center; gap: 1.5rem; }
.countdown-day { font-size: 1.3rem; color: var(--accent); font-weight: bold; }
.countdown-remaining { font-size: 0.9rem; color: var(--text-secondary); }
.countdown-remaining strong { color: #ff6b6b; font-size: 1.2rem; }
.countdown-remaining.urgent strong { color: var(--accent); animation: urgentPulse 1s infinite; }
@keyframes urgentPulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
.top-bar-right { display: flex; align-items: center; gap: 1.5rem; }
.current-role { font-size: 0.85rem; color: var(--text-secondary); }
.population-display { font-size: 0.85rem; color: var(--text-primary); }

.main-area { padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.sidebar {
    background: #0d0d14;
    border-left: 1px solid var(--border);
    padding: 1rem;
    overflow-y: auto;
}
.sidebar h3 { color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.8rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }

/* Game Controls */
.game-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.game-controls .btn { padding: 0.4rem 0.8rem; font-size: 0.75rem; }

/* Defeat Screen */
#screen-defeat { justify-content: center; align-items: center; padding: 2rem; background: radial-gradient(ellipse at center, #1a0a0a 0%, var(--bg-primary) 70%); }
.defeat-container { max-width: 600px; text-align: center; }
.defeat-container h2 { color: var(--accent); font-size: 2rem; margin-bottom: 1.5rem; }
.defeat-narrative { color: #aaa; line-height: 1.8; font-size: 0.95rem; margin-bottom: 2rem; white-space: pre-line; }

/* Back button */
.back-button {
    position: fixed; top: 10px; left: 10px; z-index: 100;
    font-family: var(--font-main); font-size: 0.75rem;
    padding: 0.4rem 0.8rem; background: rgba(10,10,15,0.9);
    border: 1px solid #444; color: var(--text-secondary);
    text-decoration: none; transition: all 0.3s ease;
}
.back-button:hover { border-color: var(--accent); color: var(--accent); }

/* Responsive */
@media (max-width: 900px) {
    .game-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
    .sidebar { border-left: none; border-top: 1px solid var(--border); max-height: 180px; }
    .roles-grid { grid-template-columns: 1fr; }
    .title-container h1 { font-size: 2.5rem; }
}

/* News Feed */
.news-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #1a1a2e;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #aaa;
    animation: newsSlide 0.3s ease;
}
@keyframes newsSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.news-day {
    color: var(--accent);
    font-weight: bold;
    font-size: 0.65rem;
    margin-right: 0.4rem;
}

/* Day Transition */
.day-fade-out {
    animation: dayFadeOut 0.3s ease forwards;
}
.day-fade-in {
    animation: dayFadeIn 0.4s ease forwards;
}
@keyframes dayFadeOut {
    from { opacity: 1; }
    to { opacity: 0.3; filter: brightness(0.5); }
}
@keyframes dayFadeIn {
    from { opacity: 0.3; filter: brightness(0.5); }
    to { opacity: 1; filter: brightness(1); }
}
