:root {
    --bg-dark: #1a1a1a;
    --bg-panel: rgba(0, 0, 0, 0.9);
    --text-main: #e0e0e0;
    --accent: #ffcc00;
    --accent-hover: #e6b800;
    --accent-green: #4caf50;
    --accent-red: #f44336;
    --border: #444;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 0;
    background: #000;
}

/* --- MAIN MENU --- */
#main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(2px);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.menu-content {
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.game-title {
    font-family: 'Roboto Mono', monospace;
    font-size: 3rem;
    color: var(--accent);
    margin: 0 0 10px 0;
    letter-spacing: -2px;
}

.version-tag {
    font-size: 0.8rem;
    color: #666;
    vertical-align: super;
    cursor: pointer;
    text-decoration: underline;
}

.game-subtitle {
    color: #888;
    margin-bottom: 40px;
    font-size: 1rem;
}

.menu-buttons button {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    cursor: pointer;
}

/* --- HUD --- */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 320px;
    max-width: 90vw;
    background: var(--bg-panel);
    backdrop-filter: blur(5px);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    transition: transform 0.3s ease, height 0.3s ease;
}

#hud-toggle {
    position: absolute;
    top: 0px;
    right: 50%;
    width: 30px;
    height: 30px;
    background: transparent;
    color: #888;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    display: none; /* Hidden on desktop by default */
}

/* HUD Header (Score/Year) */
.hud-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
    margin-bottom: 15px;
}

.hud-header {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* HUD Body (Minimap + Controls) */
#hud-body {
    transition: opacity 0.3s ease;
}

#hud.collapsed #hud-body {
    display: none;
}

#hud.collapsed .hud-top-row {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* --- MINIMAP --- */
#minimap {
    width: 100%;
    aspect-ratio: 2 / 1;
    background-color: #000;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ea/Equirectangular-projection.jpg');
    background-size: 100% 100%;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

#minimap-crosshair {
    position: absolute;
    width: 0; height: 0;
    transform: translate(-50%, -50%);
}
#minimap-crosshair::before, #minimap-crosshair::after {
    content: ''; position: absolute; background: var(--accent-red);
}
#minimap-crosshair::before { top: 0; left: -512px; width: 1024px; height: 1px; }
#minimap-crosshair::after { top: -512px; left: 0; width: 1px; height: 1024px; }

/* --- CONTROLS --- */
select, input[type="text"] {
    width: 100%;
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid var(--border);
    color: white;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 1rem;
}

button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #111;
    border: none;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    transition: all 0.2s;
}
button:hover { background: var(--accent-hover); transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button:disabled { background: #444; color: #888; cursor: not-allowed; transform: none; }

.btn-secondary { background: #333; color: #ccc; }
.btn-secondary:hover { background: #444; }

.btn-outline { background: transparent; border: 1px solid #666; color: #aaa; }
.btn-outline:hover { border-color: #ccc; color: #fff; background: transparent; }

/* Slider */
.slider-container { margin: 15px 0 25px 0; text-align: center; }
input[type=range] { width: 100%; cursor: pointer; accent-color: var(--accent); }
.slider-value {
    font-family: 'Roboto Mono', monospace;
    color: var(--accent);
    font-size: 1.3rem;
    margin-top: 5px;
}

/* --- MODALS GENERAL --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal-box {
    background: #222;
    padding: 30px;
    border: 1px solid #444;
    width: 500px;
    max-width: 90%;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    text-align: center;
}
.modal-title { color: var(--accent); margin-top: 0; }

/* --- INFOBOX (End Round) --- */
#infobox-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 2000;
    display: none; justify-content: center; align-items: center;
}
#infobox {
    width: 400px; max-width: 90%;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #555;
    display: flex; flex-direction: column;
    position: absolute; top: 20px; right: 20px;
    border-radius: 8px;
    overflow: hidden;
}

#attribution {
    font-family: "Alegreya", serif;
    color: #eee;
    margin-top: -1em;
}

#attribution a {
    color: #fff;
    font-weight: 100;
    transition: 1s;
}

#attribution a:hover {
    color: gold;
    font-weight: 900;
    transition: 1s;
}

.ib-header { background: #2a2a2a; padding: 15px; border-bottom: 1px solid #444; position: relative; }
.ib-score-display { position: absolute; top: 15px; right: 15px; font-family: 'Roboto Mono', monospace; font-weight: bold; }
.ib-title { margin: 0; font-size: 1.4rem; padding-right: 80px; }
.ib-subtitle { color: #aaa; font-size: 0.9rem; margin-top: 4px; }
.ib-content { padding: 15px; }
.ib-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ib-table td { padding: 8px 0; border-bottom: 1px solid #333; }
.ib-label { color: #888; }
.ib-val { text-align: right; color: #fff; }
.ib-footer {
    display: flex;
    justify-content: center;
    gap: 10px; /* Adds space between the Play Again and Leaderboard buttons */
    margin-top: 15px;
    padding: 15px;
    border-top: 1px solid #444;
    background: #222;
}

/* UTILS */
.hidden { display: none !important; }
.feedback { margin-top: 10px; font-size: 0.9rem; min-height: 1.2em; font-weight: bold; text-align: center; }
.error { color: var(--accent-red); }
.success { color: var(--accent-green); }

/* --- MOBILE SPECIFIC --- */
@media (max-width: 600px) {
    #hud {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 15px 15px 0 0;
        border-left: none;
        border-top: 4px solid var(--accent);
        padding: 15px 20px 20px 20px; /* More padding at bottom for safe area */
        box-sizing: border-box;
    }

    #hud-toggle {
        display: block; /* Show collapse button on mobile */
        top: -25px; /* Stick it slightly above or inside */
        right: 50%;
        top: 0px;
        font-size: 1.2rem;
    }

    /* When collapsed on mobile, it slides down */
    #hud.collapsed {
        transform: translateY(calc(100% - 60px)); /* Keep header visible */
    }

    #infobox {
        top: auto; bottom: 20px; right: 20px; left: 20px;
        width: auto;
    }

    #main-menu {
        padding: 20px;
        box-sizing: border-box;
    }
}