body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background-color: #FFFDE7; /* Light cream */
    color: #424242; /* Dark gray */
}
#map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
#webgl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
}
#webgl-canvas:active {
    cursor: grabbing;
}
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
}
#controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.85);
    padding: 20px;
    border-radius: 10px;
    z-index: 2;
    color: #424242;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transition: transform 0.3s ease-in-out;
}

#controls.collapsed {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

#controls.collapsed > *:not(#toggle-controls-btn) {
    display: none;
}

#address-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 5px;
    background-color: #fff;
}
.address-result-item {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}
.address-result-item:hover {
    background-color: #f0f0f0;
}
.address-result-item:last-child {
    border-bottom: none;
}

#toggle-controls-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.85);
    color: #424242;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 24px;
    line-height: 40px;
    text-align: center;
    z-index: 3;
}
.control-group {
    margin-bottom: 15px;
}
.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.control-group input, .control-group button {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #424242;
    box-sizing: border-box;
}
.control-group input[type="number"] {
    margin-bottom: 10px;
}
.control-group input[type="range"] {
    padding: 0;
}
.coord-inputs {
    display: flex;
    gap: 10px;
}
.coord-inputs > div {
    flex: 1;
}
.time-slider-container {
    position: relative;
    margin-bottom: 5px;
    height: 20px; /* Provide space for the slider thumb */
    display: flex;
    align-items: center;
}
.time-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 14px; /* Taller than the slider track */
    z-index: 1; /* Below thumb, above track */
    pointer-events: none; /* Allow clicking through to the slider */
    border-radius: 1px;
}
#sunrise-indicator {
    background-color: #FFD700; /* Gold */
    border: 1px solid #c7a200;
}
#sunset-indicator {
    background-color: #FF4500; /* OrangeRed */
    border: 1px solid #b33100;
}
#time-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ccc; /* Fallback, will be replaced by JS */
    outline: none;
    margin: 0;
    cursor: pointer;
}
#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FF9800;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
    margin-top: -5px; /* Vertically center thumb on track */
    position: relative;
    z-index: 2;
}
#time-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FF9800;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.control-group button {
    background-color: #FF9800; /* Orange */
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
    border-color: #E65100;
}
.control-group button:hover {
    background-color: #FB8C00; /* Lighter orange on hover */
}
.animation-controls {
    display: flex;
    justify-content: space-between;
}
.animation-controls button {
    width: 48%;
}
#info-display {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
#info-display p {
    margin: 5px 0;
}
.time-jump-icon {
    cursor: pointer;
    display: inline-block;
    margin-left: 8px;
    visibility: hidden; /* Hidden until a valid time is available */
}
#loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #424242;
    z-index: 3;
    font-size: 1.2em;
    background: rgba(255, 255, 255, 0.85);
    padding: 15px 25px;
    border-radius: 10px;
    display: none;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
#progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 10px;
    height: 20px;
    overflow: hidden;
}
#progress-bar {
    width: 0%;
    height: 100%;
    background-color: #FF9800;
    transition: width 0.2s ease-in-out;
}
#compass {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
#compass-needle {
    width: 80%;
    height: 80%;
    transition: transform 0.2s ease-out;
}
#report-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.85);
    padding: 20px;
    border-radius: 10px;
    z-index: 2;
    color: #424242;
    max-width: 650px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transition: transform 0.3s ease-in-out;
    display: none; /* Hidden by default */
    border: 1px solid rgba(0,0,0,0.1);
}

#report-panel.collapsed {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

#report-panel.collapsed > *:not(#toggle-report-btn) {
    display: none;
}

#toggle-report-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.85);
    color: #424242;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 24px;
    line-height: 40px;
    text-align: center;
    z-index: 3;
}
#report-content {
    background-color: #ffffff;
    margin: auto;
    padding: 20px;
    border: 1px solid #ccc;
    width: 80%;
    max-width: 800px;
    border-radius: 10px;
    position: relative;
}
#close-report-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
#close-report-btn:hover,
#close-report-btn:focus {
    color: #000;
    text-decoration: none;
}
#report-table-container {
    margin-top: 20px;
    max-height: 60vh;
    overflow: auto; /* Allow both vertical and horizontal scrolling */
}
#report-table-container table {
    width: 100%;
    border-collapse: collapse;
}
#report-table-container th, #report-table-container td {
    white-space: nowrap; /* Prevent table cell content from wrapping */
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
#report-table-container th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
}

@media (max-width: 768px) {
    /* General adjustments for panels on small screens */
    #controls, #report-panel {
        max-width: none;
        width: auto; /* Let left/right define width */
        left: 10px;
        right: 10px;
        box-sizing: border-box;
    }

    /* Position controls at the bottom */
    #controls {
        top: auto;
        bottom: 10px;
        max-height: 50vh;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    /* Position report at the top, respecting safe area */
    #report-panel {
        top: 10px;
        max-height: 80vh;
        padding-top: calc(10px + env(safe-area-inset-top));
    }

    /* Position the collapsed controls button at the bottom-right */
    #controls.collapsed {
        top: auto;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: auto; /* Override the left: 10px */
        right: 10px;
        width: 40px;
        height: 40px;
        padding: 0; /* Override padding */
    }

    /* Position the collapsed report button at the top-left */
    #report-panel.collapsed {
        top: calc(10px + env(safe-area-inset-top));
        left: 10px;
        right: auto; /* Override the right: 10px */
        bottom: auto;
        width: 40px;
        height: 40px;
        padding: 0; /* Override padding */
    }
}