* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0a0e1a;
    color: #dde6f0;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: grid;
    grid-template-columns: 1fr 5px var(--sidebar-width, 50%);
    height: 100vh;
}

#resizer {
    background: #1d3556;
    cursor: col-resize;
    transition: background 0.15s;
}
#resizer:hover,
body.resizing #resizer {
    background: #2585c4;
}

body.resizing {
    cursor: col-resize;
    user-select: none;
}

/* ── Map panel ── */

#map-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

#map {
    flex: 1;
}

#map .leaflet-tile-pane {
    filter: grayscale(100%);
}

#time-control {
    background: #0c1326;
    border-top: 1px solid #1d3556;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#time-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

#play-btn {
    background: #1a6fa8;
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#play-btn:hover {
    background: #2585c4;
}

#time-slider {
    flex: 1;
    accent-color: #2585c4;
    cursor: pointer;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}
#time-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: #1d3556;
    border-radius: 3px;
}
#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2585c4;
    margin-top: -7px;
    cursor: pointer;
}
#time-slider::-moz-range-track {
    height: 6px;
    background: #1d3556;
    border-radius: 3px;
}
#time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2585c4;
    border: none;
    cursor: pointer;
}

#time-label {
    font-size: 12px;
    color: #8aaccc;
    white-space: nowrap;
    text-align: right;
}

#legend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
#legend-canvas {
    border-radius: 2px;
}
.legend-labels {
    display: flex;
    justify-content: space-between;
    width: 180px;
    font-size: 10px;
    color: #6a8299;
}
.legend-title {
    font-size: 10px;
    color: #6a8299;
}

/* ── Sidebar ── */

#sidebar {
    background: #0c1326;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#info-panel {
    padding: 14px 16px 12px;
    border-bottom: 1px solid #1d3556;
    flex-shrink: 0;
}

#info-panel h1 {
    font-size: 15px;
    font-weight: 600;
    color: #6db8e8;
    margin-bottom: 4px;
}

#status-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

#status {
    font-size: 11px;
    color: #52718f;
    min-height: 14px;
}

#instructions {
    font-size: 12px;
    color: #527090;
    font-style: italic;
}
#instructions .dot {
    font-style: normal;
}
#instructions .dot.primary {
    color: #4285f4;
}
#instructions .dot.comparison {
    color: #ffd700;
}

#selected-info {
    font-size: 12px;
    color: #8aaccc;
    min-height: 16px;
}

/* ── GitHub link ── */

.data-source {
    text-align: center;
    font-size: 11px;
    color: #527090;
    text-decoration: none;
}
#data-sources {
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 4px;
}
.data-source-sep {
    font-size: 11px;
    color: #527090;
}
.data-source:hover {
    color: #8aaccc;
}

/* ── Charts ── */

#charts-panel {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-container {
    background: #101828;
    border: 1px solid #1d3556;
    border-radius: 8px;
    padding: 10px 12px;
}

.chart-container h3 {
    font-size: 12px;
    font-weight: 500;
    color: #6db8e8;
    margin-bottom: 6px;
}

.chart-container canvas {
    max-height: 160px;
}
#chart-height {
    max-height: 220px;
}

#dive-sites {
    display: flex;
    gap: 8px;
}
#dive-sites select {
    flex: 1;
    min-width: 0;
    background: #0c1326;
    color: #dde6f0;
    border: 1px solid #1d3556;
    border-left-width: 3px;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
#dive-sites select.forecast {
    border-left-color: #527090;
}
#dive-sites select.primary {
    border-left-color: #4285f4;
}
#dive-sites select.comparison {
    border-left-color: #ffd700;
}
#dive-sites select:hover,
#dive-sites select:focus {
    outline: none;
    border-color: #2585c4;
}
#dive-sites select.forecast:hover,
#dive-sites select.forecast:focus {
    border-left-color: #527090;
}
#dive-sites select.primary:hover,
#dive-sites select.primary:focus {
    border-left-color: #4285f4;
}
#dive-sites select.comparison:hover,
#dive-sites select.comparison:focus {
    border-left-color: #ffd700;
}

/* ── Responsive ── */

@media (max-width: 720px) {
    body {
        overflow: auto;
    }
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh 1fr;
        height: auto;
        min-height: 100vh;
    }
    #map-panel {
        height: 55vh;
    }
    #resizer {
        display: none;
    }
    #sidebar {
        border-top: 1px solid #1d3556;
    }
}

/* ── Embed toggles (hide* URL params) ── */

body.hide-map #map-panel,
body.hide-sidebar #sidebar,
body.hide-map #resizer,
body.hide-sidebar #resizer {
    display: none;
}
body.hide-map #app,
body.hide-sidebar #app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}
body.hide-sidebar #map-panel {
    height: auto;
}
body.hide-header #info-panel,
body.hide-selectors #dive-sites,
body.hide-time-control #time-control,
body.hide-footer #github-link,
body.hide-footer #noaa-link {
    display: none;
}
