/* ===== Base layout ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;   /* disable double-tap zoom on iOS Safari */
}

html, body {
    width: 100%;
    height: 100%;
    background: #000000;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== Intro 3D scene ===== */
#intro-scene {
    width: 100%;
    height: 100%;
    perspective: 1200px;
    perspective-origin: 50% 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#intro-tilt {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(80deg) scale(0.65);
    transition: none;
}

#intro-tilt.intro-done {
    transform: rotateX(0deg) scale(1);
}

/* ===== Map container ===== */
#map {
    width: 100%;
    height: 100%;
}

/* ===== Dome canvas ===== */
#dome-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;

}

/* ===== UI elements hidden during intro ===== */
.ui-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.6s ease-out;
}

/* ===== Top bar (search + toolbar) ===== */
#top-bar {
    position: absolute;
    top: 16px;
    left: 8px;
    right: 8px;
    z-index: 1000;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 8px;
}

/* ===== Search bar ===== */
#search-container {
    flex: 1 1 260px;
    min-width: 80px;
    max-width: 260px;
}

#search-input {
    width: 100%;
    padding: 10px 16px;
    font-size: 16px;
    border: none;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    outline: none;
    color: #222;
}

#search-input:focus {
    box-shadow: 0 2px 16px rgba(60, 130, 255, 0.4);
}

#search-input::placeholder {
    color: #888;
}

#search-result {
    margin-top: 6px;
    padding: 4px 12px;
    font-size: 13px;
    color: #111;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    text-align: center;
    min-height: 18px;
}
#search-result:empty {
    display: none;
}

/* ===== Toolbar buttons ===== */
#toolbar {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 8px;
}

#toolbar button {
    padding: 8px 14px;
    font-size: 14px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    color: #222;
    transition: background 0.15s, box-shadow 0.15s;
    height: 40px;
    line-height: 1;
    display: flex;
    align-items: center;
}

#toolbar button:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 14px rgba(60, 130, 255, 0.35);
}

#toolbar button.active {
    background: rgba(60, 130, 255, 0.9);
    color: #fff;
}

/* ===== Help button ===== */
#help-btn {
    font-weight: bold;
    font-size: 16px;
    width: 40px;
    font-family: serif;
    justify-content: center;
}

/* ===== Help overlay ===== */
#help-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#help-content {
    position: relative;
    background: rgba(20, 22, 35, 0.96);
    backdrop-filter: blur(12px);
    color: #dde;
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    line-height: 1.6;
}

#help-content h2 {
    margin: 0 0 16px;
    font-size: 20px;
    color: #fff;
}

#help-content h3 {
    margin: 16px 0 6px;
    font-size: 15px;
    color: #8ab4ff;
}

#help-content p {
    margin: 0 0 8px;
    font-size: 14px;
}

#help-content hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 16px 0;
}

#help-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

#help-close-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ===== Rotation control ===== */
#rotation-control {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#rotate-reset-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: transform 0.3s;
}

#rotate-reset-btn:hover {
    transform: scale(1.2);
}

#rotate-slider {
    width: 160px;
    accent-color: #3c82ff;
    cursor: pointer;
}

#rotate-label {
    font-size: 13px;
    color: #444;
    min-width: 32px;
    text-align: right;
}

/* ===== Timeline slider ===== */
#timeline-control {
    position: absolute;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#timeline-slider {
    width: 240px;
    accent-color: #ff9800;
    cursor: pointer;
}

#timeline-label {
    font-size: 13px;
    color: #444;
    min-width: 110px;
    white-space: nowrap;
    text-align: center;
    font-weight: 500;
}

#timeline-play-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: transform 0.3s;
}

#timeline-play-btn:hover {
    transform: scale(1.2);
}

#timeline-play-btn.active {
    color: #ff9800;
}

#timeline-reset-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: transform 0.3s;
}

#timeline-reset-btn:hover {
    transform: scale(1.2);
}

/* ===== Measure tooltip ===== */
.tooltip {
    position: absolute;
    z-index: 1001;
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(6px);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ===== OpenLayers control overrides ===== */
.ol-zoom {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.ol-zoom .ol-zoom-in,
.ol-zoom .ol-zoom-out {
    background: rgba(255, 255, 255, 0.88);
    color: #222;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    margin: 4px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.ol-zoom .ol-zoom-in:hover,
.ol-zoom .ol-zoom-out:hover {
    background: #fff;
}

.ol-attribution {
    background: rgba(0, 0, 0, 0.4) !important;
    border-radius: 8px;
    font-size: 11px;
}

.ol-attribution a {
    color: rgba(180, 210, 255, 0.8);
}

/* ===== Narrow screens ===== */
@media (max-width: 600px) {
    /* Icon-only toolbar buttons */
    .btn-label {
        display: none;
    }

    #toolbar button {
        padding: 6px 10px;
        font-size: 16px;
        min-width: 36px;
        text-align: center;
    }

    /* Shrink zoom buttons */
    .ol-zoom {
        left: 8px;
    }

    .ol-zoom .ol-zoom-in,
    .ol-zoom .ol-zoom-out {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }

    /* Compact bottom controls */
    #rotation-control,
    #timeline-control {
        max-width: calc(100vw - 16px);
        padding: 4px 10px;
        gap: 6px;
    }

    #rotation-control {
        bottom: 8px;
    }

    #timeline-control {
        bottom: 48px;
    }

    #rotate-slider {
        width: 80px;
    }

    #timeline-slider {
        width: 100px;
    }

    #rotate-reset-btn,
    #timeline-play-btn,
    #timeline-reset-btn {
        font-size: 15px;
    }

    #rotate-label,
    #timeline-label {
        font-size: 11px;
    }

    #timeline-label {
        min-width: 65px;
    }

    /* Tighter search */
    #search-container {
        max-width: 180px;
    }
    #search-input {
        padding: 8px 12px;
        font-size: 16px; /* must be ≥16px to prevent iOS auto-zoom */
    }
}
