body, html { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: #000; }

/* HUD */
#hud {
    position: absolute; top: 0; left: 0; width: 100%; height: 90px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    color: white; z-index: 10;
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 15px 25px; box-sizing: border-box;
    pointer-events: none; 
}
#hud > * { pointer-events: auto; }

.logo-container { display: flex; align-items: center; gap: 12px; }
.instrument-circle {
    width: 42px; height: 42px; border: 2px solid #d32f2f; border-radius: 50%; position: relative;
    background: rgba(20, 0, 0, 0.6); display: flex; justify-content: center; align-items: center;
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.4);
}
.crosshair-v { position: absolute; width: 2px; height: 100%; background: #d32f2f; opacity: 0.8; }
.crosshair-h { position: absolute; width: 100%; height: 2px; background: #d32f2f; opacity: 0.8; }
.rnp-text { z-index: 2; font-size: 11px; font-weight: 900; color: #fff; background: #000; padding: 0 3px; border-radius: 2px; }
.logo-text { font-size: 24px; font-weight: 800; letter-spacing: 1px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.version-text { font-size: 12px; color: #d32f2f; font-weight: bold; margin-left: 5px;}

.hud-center { flex-grow: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; }

#timer-container {
    background: rgba(0,0,0,0.5); padding: 2px 15px; border-radius: 4px;
    border: 1px solid #d32f2f; font-size: 14px;
}
#timer-display { font-family: monospace; font-size: 24px; font-weight: bold; color: #d32f2f; text-shadow: 0 0 5px #d32f2f; }

#compass-container {
    width: 50px; height: 50px; position: relative; background: rgba(0, 0, 0, 0.6);
    border: 2px solid #888; border-radius: 50%; box-shadow: 0 0 10px rgba(0,0,0,0.5); overflow: hidden;
}
#compass-face {
    width: 100%; height: 100%; position: absolute; top: 0; left: 0; background: transparent;
    background-image: linear-gradient(to bottom, #d32f2f 4px, transparent 4px), linear-gradient(to top, #fff 4px, transparent 4px), linear-gradient(to right, #fff 4px, transparent 4px), linear-gradient(to left, #fff 4px, transparent 4px);
    background-size: 100% 100%; transition: none !important; 
}
#compass-n { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: bold; color: #d32f2f; }
#compass-marker { position: absolute; top: -5px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid #fff; z-index: 5; }

/* ROUND DISPLAY */
.status { 
    font-size: 18px; font-weight: 400; font-family: monospace; color: #ddd; align-self: center; text-align: right;
    background: transparent; padding: 0; border: none;
}

/* GYRO TOGGLE SWITCH */
#gyro-controls { margin-top: 5px; display: none; align-items: center; gap: 8px; font-size: 12px; color: #ccc; font-weight: bold; text-transform: uppercase; }
.switch { position: relative; display: inline-block; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #444; transition: .4s; border-radius: 18px; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #d32f2f; }
input:checked + .slider:before { transform: translateX(16px); }
.toggle-label { font-size: 10px; color: #aaa; }

#cesiumContainer { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }

#map-container {
    position: absolute; bottom: 20px; right: 20px; width: 300px; height: 350px;
    z-index: 20; background: white; padding: 10px; border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 10px;
}
#map { flex-grow: 1; border-radius: 4px; border: 1px solid #ccc; cursor: crosshair; }

/* GENERIC BUTTON STYLE */
button { 
    padding: 8px 16px; font-size: 13px; cursor: pointer; border-radius: 4px; 
    color: white; border: none; margin: 0 5px; 
    background: #444; touch-action: manipulation; 
}
#download-btn { background: #2196f3; }
#highscore-btn { background: #ff9800; color: #000; font-weight: bold; }
#confirm-btn { 
    width: 100%; padding: 12px; background: #d32f2f; color: white;
    border: none; border-radius: 4px; font-weight: bold; font-size: 14px; letter-spacing: 1px;
    cursor: pointer; transition: background 0.3s; 
}
#confirm-btn:disabled { background: #ccc; cursor: not-allowed; color: #666; }
#confirm-btn:hover:not(:disabled) { background: #b71c1c; }

.close-btn { background: #666; color: white; font-weight: bold; margin-top: 15px; width: 100px; border: 1px solid #888; }

/* MOBILE STYLES */
@media (max-width: 600px) {
    #hud { padding: 8px 12px; height: auto; flex-wrap: wrap; background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%); }
    .logo-container { transform: scale(0.85); transform-origin: left top; }
    .status { position: absolute; bottom: 42%; right: 10px; font-size: 14px; background: rgba(0,0,0,0.6); padding: 4px 10px; border-radius: 4px; z-index: 50; border: 1px solid #555; }
    .hud-center { order: 3; width: 100%; flex-direction: row; justify-content: center; margin-top: 0; gap: 15px; position: absolute; top: 50px; left: 0; pointer-events: none; }
    .hud-center > * { pointer-events: auto; } 
    #gyro-controls { display: flex; } 
    .modal-content { width: 90%; padding: 15px; max-height: 85vh; overflow-y: auto; }
    #score-table th, #score-table td { padding: 3px; font-size: 10px; }
}

/* PORTRAIT */
@media (max-width: 600px) and (orientation: portrait) {
    #cesiumContainer { height: 60% !important; bottom: 40% !important; border-bottom: 2px solid #d32f2f; }
    #map-container { width: 100% !important; height: 40% !important; bottom: 0 !important; right: 0 !important; left: 0 !important; border-radius: 0 !important; padding: 0 !important; display: block; }
    #map { width: 100%; height: 100%; border-radius: 0 !important; }
    #confirm-btn { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); width: 90%; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.5); opacity: 0.9; }
}

/* LANDSCAPE */
@media (max-height: 500px) and (orientation: landscape) {
    #hud { width: 60%; padding: 5px 15px; height: 60px; }
    .logo-container { transform: scale(0.7); transform-origin: left center; }
    .hud-center { flex-direction: row; gap: 15px; } 
    #timer-container { font-size: 12px; padding: 2px 10px; }
    #timer-display { font-size: 18px; }
    #compass-container { width: 35px; height: 35px; }
    #compass-n { font-size: 8px; top: 1px; }
    .status { bottom: 10px; right: 42%; font-size: 12px; } 
    #gyro-controls { display: flex; }
    #cesiumContainer { width: 60% !important; height: 100% !important; right: auto !important; left: 0 !important; border-right: 2px solid #d32f2f; }
    #map-container { width: 40% !important; height: 100% !important; top: 0 !important; right: 0 !important; left: auto !important; bottom: auto !important; border-radius: 0 !important; padding: 0 !important; display: block; }
    #map { width: 100%; height: 100%; border-radius: 0 !important; border: none !important; }
    #confirm-btn { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); width: 90%; z-index: 1000; opacity: 0.9; }
    .modal-content { width: 80%; max-height: 90vh; overflow-y: auto; padding: 10px; }
}

.hidden { display: none !important; }
.modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 200; display: flex; justify-content: center; align-items: center; }
.modal-content { background: #1e1e1e; color: white; padding: 20px; border-radius: 12px; text-align: center; width: 95%; max-width: 700px; border: 1px solid #444; box-shadow: 0 0 30px rgba(0,0,0,0.8); position: relative; }
#final-score-container { margin: 10px 0; padding: 10px; background: #2b2b2b; border-radius: 8px; border: 2px solid #d32f2f; display: flex; justify-content: space-around; align-items: center; }
.score-box .value { font-size: 36px; font-weight: bold; display: block; color: #d32f2f; }
.table-container { margin: 10px 0; width: 100%; }
#score-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; color: #ddd; }
#score-table th { border-bottom: 1px solid #666; color: #888; font-weight: 600; padding: 4px 8px; text-transform: uppercase; font-size: 10px; }
#score-table td { border-bottom: 1px solid #333; padding: 6px 8px; vertical-align: top; }
.miss-text { color: #ff5252; font-weight: bold; }
.hit-text { color: #4caf50; font-weight: bold; }
#summary-map { height: 200px; width: 100%; margin: 15px 0 10px 0; background: #eee; border-radius: 4px; border: 2px solid #444; }
.red-x-icon { color: red; font-family: sans-serif; font-weight: 900; font-size: 20px; text-align: center; line-height: 20px; text-shadow: 0 0 3px black; }
.blue-dot-icon { background: #2196f3; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 2px black; }

/* START SCREEN */
.input-group { margin: 20px 0; }
input[type="text"] { padding: 10px; font-size: 16px; border-radius: 4px; border: 1px solid #555; background: #333; color: white; width: 250px; text-align: center; }
#start-btn-easy { background: #4caf50; font-size: 16px; padding: 10px 20px; margin: 5px; }
#start-btn-hard { background: #d32f2f; font-size: 16px; padding: 10px 20px; margin: 5px; }
.mode-desc { font-size: 12px; color: #aaa; margin-bottom: 15px; display: block;}

/* NEW DUAL COLUMN LEADERBOARD */
.hs-list { 
    list-style: none; padding: 0; text-align: left; 
    max-height: 300px; overflow-y: auto; 
    border: 1px solid #333; border-radius: 4px;
}
.hs-list li { 
    background: #222; margin-bottom: 2px; padding: 5px 10px; 
    display: flex; justify-content: space-between; 
    font-size: 12px;
}
.hs-list li:nth-child(odd) { background: #2a2a2a; }
.hs-rank { color: #888; width: 20px; }
.hs-name { flex-grow: 1; font-weight: bold; }
.hs-score { color: #ddd; font-family: monospace; }
.loading-text { color: #888; font-style: italic; padding: 10px; text-align: center; }

#shame-container { position: absolute; top: -30px; right: -30px; width: 80px; height: 80px; display: none; z-index: 150; }
.beanie-svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5)); }
.propeller-blade { transform-origin: 50px 35px; animation: spin 0.2s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* BUTTON ROW IN MODAL */
.modal-buttons { display: flex; justify-content: center; gap: 5px; margin-top: 15px; flex-wrap: wrap; }