:root {
    --bg-dark: #1a1a1a;
    --bg-panel: rgba(0, 0, 0, 0.85);
    --text-main: #e0e0e0;
    --accent: #ffcc00;
    --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;
}

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

/* New Flex Row for Score/Year */
.hud-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

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

.hud-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* MINIMAP STYLES */
#minimap {
    width: 100%;
    /* Enforce 2:1 aspect ratio to match Equirectangular projection */
    aspect-ratio: 2 / 1;
    margin-top: 15px;
    background-color: #000;
    /* Public domain Equirectangular map */
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ea/Equirectangular-projection.jpg');
    /* Stretch to fit container exactly so coordinates match */
    background-size: 100% 100%;
    background-position: center;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

#minimap-crosshair {
    position: absolute;
    width: 0;
    height: 0;
    transform: translate(-50%, -50%);
}

#minimap-crosshair::before, #minimap-crosshair::after {
    content: '';
    position: absolute;
    background: red;
}

#minimap-crosshair::before {
    top: 0;
    left: -512px;
    width: 1024px;
    height: 1px;
}

#minimap-crosshair::after {
    top: -512px;
    left: 0;
    width: 1px;
    height: 1024px;
}

.game-stage {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

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

button {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: black;
    border: none;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.2s;
}

button:hover {
    background: #e6b800;
}

/* Slider Styling */
.slider-container {
    margin: 10px 0 20px 0;
    text-align: center;
}

input[type=range] {
    width: 100%;
    cursor: pointer;
}

.slider-value {
    font-family: 'Roboto Mono', monospace;
    color: var(--accent);
    font-size: 1.2rem;
    margin-top: 5px;
}

/* Modal / Infobox */
#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(0.2,0.2,0.2,0.8);
    border: 1px solid #444;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
    position: absolute;
    top: 20px;
    right: 20px;
}

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

.ib-header {
    background: #333;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.ib-score-display {
    position: absolute;
    top: 15px;
    right: 15px;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    font-size: 1.1rem;
}

.ib-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    padding-right: 80px;
}

.ib-subtitle {
    color: #aaa;
    margin-top: 5px;
    font-size: 0.9rem;
}

.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;
    font-weight: 500;
    width: 40%;
}

.ib-val {
    text-align: right;
    color: #fff;
}

.cf-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.85rem;
}

.cf-high { background: rgba(76, 175, 80, 0.2); color: #81c784; border: 1px solid #4caf50; }
.cf-low { background: rgba(255, 235, 59, 0.1); color: #fff176; border: 1px solid #fdd835; }
.cf-mid { color: #fff; }

.ib-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
}

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

/* Mobile Adjustments */
@media (max-width: 600px) {
    #hud {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 4px solid var(--accent);
        border-radius: 0;
    }
    
    /* Center and constrain minimap on mobile */
    #minimap {
        max-width: 260px;
        margin: 10px auto;
    }

    .slider-value { font-size: 1rem; }
}

/* Ensure tables inside the leaderboard look good */
#lb-lists h3 {
    font-size: 1rem;
    color: var(--accent);
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 10px;
}
#lb-lists table td {
    padding: 5px;
    color: #ccc;
    border-bottom: 1px solid #333;
}