body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    height: 100vh;
    overflow: hidden;
}

.container {
    padding: 0;
    height: 100vh;
    position: relative;
}

#map {
    height: 100vh;
    width: 100%;
    z-index: 1;
}

#map * {
    cursor: default !important;
    image-rendering: pixelated;
}

/* --- Control Panel Styling --- */
.control-panel {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 240px; /* Reduced width */
    
    background: rgba(255, 255, 255, 0.85); /* Slightly less transparent for readability */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Uniform spacing */
}

.control-panel h3 {
    margin: 0 0 5px 0;
    color: #1a252f;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 11px;
    font-weight: 600;
    color: #57606f;
    text-transform: uppercase;
}

/* Modern Select & Input Styling */
select, input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #dcdde1;
    border-radius: 4px;
    background-color: #fff;
    color: #2f3640;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    cursor: pointer;
}

select:focus, input:focus {
    border-color: #3498db;
}

select:disabled {
    background-color: #f1f2f6;
    color: #a4b0be;
    cursor: not-allowed;
}

/* --- Playback Section --- */
.playback-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.03); /* Subtle background for grouping */
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.05);
}

.playback-buttons {
    display: flex;
    gap: 4px;
}

.control-btn {
    background: #fff;
    border: 1px solid #dcdde1;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #2f3640;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: #f1f2f6;
    border-color: #bdc3c7;
}

.btn-playing {
    background-color: #3498db !important;
    color: white !important;
    border-color: #2980b9 !important;
}

.speed-control {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 35%;
}

.speed-control label {
    font-size: 9px;
    font-weight: bold;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.speed-control select {
    padding: 2px 4px;
    font-size: 11px;
    height: 24px;
}

/* --- Slider Styling --- */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-readout {
    font-size: 10px;
    color: #7f8c8d;
    font-family: monospace;
}

input[type=range] {
    -webkit-appearance: none; 
    width: 100%; 
    background: transparent; 
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    margin-top: -5px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #dfe6e9;
    border-radius: 2px;
}

/* --- Action Buttons --- */
.button-row {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.button-row button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.button-row button:active {
    transform: translateY(1px);
}

.primary-btn {
    background-color: #3498db;
    color: white;
}

.primary-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

.primary-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid #bdc3c7 !important;
    color: #7f8c8d;
}

.secondary-btn:hover {
    background-color: #ecf0f1;
    color: #2c3e50;
}

/* --- Legend & Loading (Minor Tweaks) --- */
.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    width: 180px;
}

.legend h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #2c3e50;
    text-align: center;
}

.color-bar {
    height: 12px;
    border-radius: 3px;
    margin-bottom: 5px;
}

.legend-labels {
    font-size: 10px;
    color: #7f8c8d;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 2000;
    display: none;
    text-align: center;
    font-size: 14px;
    color: #2c3e50;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .control-panel {
        width: calc(100% - 30px);
        left: 15px;
        right: 15px;
    }
}