body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    background-color: #e5e3d7;
    font-family: "Roobert", Arial, sans-serif;
}

.sun-study-container {
    width: 100%;
    aspect-ratio: 16/9;
    position: relative;
}

canvas {
    width: 100%;
    height: 100%;
}

/* Bottom UI Container */
.ui-container {
    position: absolute;
    /* centered and responsive width */
    left: 50%;
    transform: translateX(-50%);
    width: min(960px, calc(100% - 24px));
    bottom: 32px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 8px;

    /* grid for consistent spacing */
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px 16px;
    align-items: center;
    z-index: 2;
}

/* allow children to size nicely */
.ui-compass {
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-image {
    width: clamp(36px, 6vw, 56px);
    height: auto;
}

.ui-timeline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* allow slider to shrink without overflow */
}

.time-label {
    font-size: 14px;
    color: #333;
    padding: 6px 0;
    white-space: nowrap;
}

.frame-slider {
    flex: 1 1 auto;
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: #ddd;
    outline: none;
    opacity: 0.95;
    transition: opacity 0.3s;
    border-radius: 999px;
}

.frame-slider:hover {
    opacity: 1;
}

.frame-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #c5a27f;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.frame-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #c5a27f;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
}

.ui-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.control-button {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.control-button:hover {
    background-color: #555;
}

.current-time {
    font-size: 14px;
    color: #333;
    margin-top: 5px;
}


/* Footer */
.footer {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #555;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Mobile layout */
@media (max-width: 680px) {
    .ui-container {
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 8px 10px;
        width: calc(100% - 16px);
        padding: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.88);
        bottom: 16px;
    }

    /* anchor sides, center middle */
    .ui-compass { justify-self: start; }
    .ui-controls { justify-self: end; }

    .ui-timeline {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;

        /* center the date/time between compass and play */
        justify-self: center;     /* center as grid item in the 1fr column */
        justify-content: center;  /* center contents inside */
        text-align: center;
    }

    /* hide slider and start/end on mobile */
    .ui-timeline #startTime,
    .ui-timeline #endTime,
    .ui-timeline .frame-slider {
        display: none;
    }

    .time-label {
        padding: 0;
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ui-controls {
        align-items: center;
        flex-direction: row;
    }
    .control-button {
        width: auto;
        padding: 8px 10px;
        font-size: 14px;
    }

    .compass-image {
        width: clamp(28px, 10vw, 40px);
    }

    .footer {
        z-index: 10;
        left: 0;
        right: 0;
        transform: translateX(0);
        bottom: 0;
        border-radius: 0;
        padding: 0 10px;
    }
}

