:root {
    --bg-color: #1a1a1d;
    --card-bg: #2b2b33;
    --accent-blue: #4ecca3;
    --accent-red: #e63946;
    --text-main: #eeeeee;
    --text-dim: #a0a0a0;
    --gold: #ffd700;
}

* { box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* UI COMPONENTS */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

h1, h2, h3 { text-align: center; text-transform: uppercase; letter-spacing: 2px; }
h1 { color: var(--accent-blue); text-shadow: 0 0 10px rgba(78, 204, 163, 0.3); margin-bottom: 5px; }

.status-bar { text-align: center; margin-bottom: 20px; color: var(--text-dim); font-size: 0.9em; }

.btn {
    background: var(--accent-blue);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 1rem;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(78, 204, 163, 0.4); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-red { background: var(--accent-red); color: white; }
.btn-red:hover { box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4); }

.btn-outline { background: transparent; border: 2px solid var(--text-dim); color: var(--text-dim); }
.btn-outline:hover { border-color: var(--text-main); color: var(--text-main); }

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; color: var(--text-dim); }
select, input {
    width: 100%;
    padding: 12px;
    background: #222;
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
    font-size: 1rem;
}

.alert-box {
    background: rgba(230, 57, 70, 0.1);
    border-left: 4px solid var(--accent-red);
    padding: 10px;
    font-size: 0.9em;
}

/* GAME BOARD */
.mission-track {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allow wrapping on very small screens if needed */
}
.mission-node {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    background: #222;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Responsiveness for Mission Nodes */
@media (max-width: 400px) {
    .mission-node {
        width: 35px;
        height: 35px;
        font-size: 0.8em;
    }
}

.mission-success { background: var(--accent-blue); border-color: var(--accent-blue); color: #000; box-shadow: 0 0 10px var(--accent-blue); }
.mission-fail { background: var(--accent-red); border-color: var(--accent-red); box-shadow: 0 0 10px var(--accent-red); }
.mission-current { border-color: white; transform: scale(1.1); }

.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

/* On mobile, allow smaller cards to fit 2 columns */
@media (max-width: 400px) {
    .player-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.player-card {
    background: #333;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none; /* Prevent text selection on rapid taps */
}

.player-card:hover { background: #3d3d3d; }
.player-card.is-leader { border-color: var(--gold); }
.player-card.selected { border-color: var(--accent-blue); background: #3a4a40; }
.player-card.is-me { font-weight: bold; color: white; background: #383842; }

.badge {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #555;
    margin-top: 5px;
    display: inline-block;
}
.role-spy { color: var(--accent-red); border: 1px solid var(--accent-red); }
.role-res { color: var(--accent-blue); border: 1px solid var(--accent-blue); }

/* SCREENS & ANIMATION */
.screen { display: none; }
.screen.active { display: block; }
/* Animation handled by JS Anime.js now, remove pure CSS animation to avoid conflict? */
/* Actually, keeping it as fallback or initial state is fine, but let's remove slideUp to let Anime.js take over fully if we want. */

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;700&display=swap');

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image:
        linear-gradient(rgba(26, 26, 29, 0.95), rgba(26, 26, 29, 0.95)),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232b2b33' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: 'Exo 2', sans-serif;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
@keyframes glow { from { box-shadow: 0 0 5px var(--accent-blue); } to { box-shadow: 0 0 20px var(--accent-blue); } }

/* POLISH */
.mission-current {
    border-color: white;
    transform: scale(1.1);
    animation: pulse 2s infinite;
}

.player-card {
    background: linear-gradient(145deg, #2b2b33, #222);
    border: 1px solid #444;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.player-card:hover {
    transform: translateY(-5px);
    border-color: var(--text-dim);
    box-shadow: 0 8px 12px rgba(0,0,0,0.5);
}

.player-card.selected {
    border-color: var(--accent-blue);
    background: linear-gradient(145deg, #3a4a40, #2d3832);
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.2);
}

.player-card.is-me {
    border-left: 4px solid var(--gold);
}

/* Card Badge Polish */
.badge {
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Chat Polish */
#chat-input {
    border-radius: 4px 0 0 4px;
    border-right: none;
}
#btn-send-chat {
    border-radius: 0 4px 4px 0;
    width: auto;
}

/* MOBILE BOTTOM SHEET FOR ACTIONS */
@media (max-width: 600px) {
    #action-area {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #2b2b33;
        border-top: 4px solid var(--accent-blue);
        border-radius: 12px 12px 0 0;
        z-index: 100;
        padding: 15px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
        margin-bottom: 0;
    }

    /* Push content up so it's not hidden behind the fixed action area */
    #screen-game {
        padding-bottom: 140px;
    }

    .player-grid {
        /* Make grid smaller on mobile to fit more */
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .player-card {
        padding: 8px;
        font-size: 0.8rem;
    }

    minidenticon-svg {
        width: 40px !important;
        height: 40px !important;
    }
}

/* LOG */
#game-log {
    height: 200px;
    overflow-y: auto;
    background: #111;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    border: 1px solid #333;
    color: #ccc;
    border-radius: 4px;
}
.log-entry { margin-bottom: 6px; border-bottom: 1px solid #222; padding-bottom: 2px; }
.log-bad { color: var(--accent-red); }
.log-good { color: var(--accent-blue); }

.role-reveal {
    font-size: 1.2em;
    font-weight: bold;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    border: 2px dashed #444;
}
