﻿/* ============================================
   Ocean SST - Sea Surface Temperature Styles
   Academic / Scientific Visualization Theme
   ============================================ */

:root {
    --sst-ink: #0b2f44;
    --sst-ink-2: #123f59;
    --sst-nav: #0f4965;
    --sst-header-a: #073246;
    --sst-header-b: #0d5367;
    --sst-header-c: #11606f;
    --sst-copper: #c55a32;
    --sst-accent: #2b9fbd;
    --sst-accent-2: #45b8ca;
    --sst-page: #eef4f7;
    --sst-card: #ffffff;
    --sst-card-soft: #f7fbfd;
    --sst-border: rgba(83, 118, 139, 0.2);
    --sst-shadow: 0 10px 28px rgba(15, 47, 68, 0.1);
    --sst-shadow-soft: 0 4px 14px rgba(15, 47, 68, 0.07);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--sst-page);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--sst-accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--sst-ink-2);
    text-decoration: underline;
}

/* --- Header --- */
.sst-header {
    background:
        linear-gradient(90deg, rgba(197, 90, 50, 0.12), transparent 25%, rgba(69, 184, 202, 0.12) 68%, transparent 100%),
        linear-gradient(135deg, var(--sst-header-a) 0%, var(--sst-header-b) 54%, var(--sst-header-c) 100%);
    color: #fff;
    padding: 0.58rem 1.25rem 0.68rem;
    text-align: left;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 -3px 0 rgba(197, 90, 50, 0.18);
}

.sst-header::before,
.sst-header::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sst-header::before {
    z-index: 0;
    background:
        linear-gradient(115deg, rgba(255, 255, 255, 0.055), transparent 28%, rgba(99, 184, 198, 0.11) 54%, transparent 76%),
        linear-gradient(75deg, transparent 0%, rgba(197, 90, 50, 0.08) 34%, transparent 62%);
    background-size: 190% 190%, 160% 160%;
    animation: headerFluidShift 14s ease-in-out infinite alternate;
}

.sst-header::after {
    z-index: 1;
    top: auto;
    height: 34px;
    background:
        repeating-linear-gradient(
            100deg,
            transparent 0,
            transparent 42px,
            rgba(255, 255, 255, 0.08) 43px,
            transparent 88px
        );
    opacity: 0.22;
    transform: translateY(6px);
    animation: headerCurrentDrift 18s linear infinite;
}

.header-content {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 58px;
}

.header-icon {
    font-size: 2.05rem;
    line-height: 1;
    opacity: 0.86;
    flex: 0 0 auto;
}

.header-copy {
    min-width: 0;
    text-align: left;
}

.header-title {
    font-size: 1.74rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    line-height: 1.12;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    margin: 0;
}

.header-subtitle {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.76;
    letter-spacing: 0.2px;
    margin: 0.08rem 0 0;
    line-height: 1.25;
}

/* Wave decoration at bottom of header */
.header-wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    display: none;
    height: 0;
    background: var(--sst-nav);
    clip-path: polygon(
        0% 60%,
        5% 55%, 10% 48%, 15% 42%, 20% 40%,
        25% 42%, 30% 48%, 35% 55%, 40% 60%,
        45% 58%, 50% 50%, 55% 42%, 60% 38%,
        65% 40%, 70% 48%, 75% 55%, 80% 58%,
        85% 55%, 90% 48%, 95% 44%, 100% 42%,
        100% 100%, 0% 100%
    );
    z-index: 2;
    animation: headerWaveBreath 8s ease-in-out infinite alternate;
}

@keyframes headerFluidShift {
    from {
        background-position: 0% 50%, 100% 50%;
    }
    to {
        background-position: 100% 50%, 0% 50%;
    }
}

@keyframes headerCurrentDrift {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 180px 0;
    }
}

@keyframes headerWaveBreath {
    from {
        clip-path: polygon(
            0% 62%,
            5% 56%, 10% 50%, 15% 44%, 20% 42%,
            25% 44%, 30% 50%, 35% 57%, 40% 61%,
            45% 59%, 50% 51%, 55% 43%, 60% 40%,
            65% 42%, 70% 49%, 75% 56%, 80% 60%,
            85% 57%, 90% 50%, 95% 45%, 100% 43%,
            100% 100%, 0% 100%
        );
    }
    to {
        clip-path: polygon(
            0% 55%,
            5% 50%, 10% 46%, 15% 42%, 20% 43%,
            25% 47%, 30% 53%, 35% 59%, 40% 62%,
            45% 58%, 50% 49%, 55% 42%, 60% 39%,
            65% 43%, 70% 51%, 75% 58%, 80% 59%,
            85% 54%, 90% 47%, 95% 43%, 100% 41%,
            100% 100%, 0% 100%
        );
    }
}

@media (prefers-reduced-motion: reduce) {
    .sst-header::before,
    .sst-header::after,
    .header-wave {
        animation: none;
    }
}

/* --- Navigation --- */
.sst-nav {
    background:
        linear-gradient(90deg, rgba(197, 90, 50, 0.1), transparent 28%, rgba(69, 184, 202, 0.1) 78%),
        linear-gradient(90deg, #083247 0%, #0e5266 100%);
    box-shadow: 0 8px 22px rgba(11, 47, 68, 0.16);
    position: sticky;
    top: 0;
    z-index: 180;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(6, 31, 45, 0.22);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    gap: 0.9rem;
}

.nav-container::after {
    content: '';
    display: block;
    min-width: 260px;
    grid-column: 3;
}

.nav-brand {
    min-width: 260px;
    min-height: 47px;
    display: inline-flex;
    align-items: center;
    gap: 0.54rem;
    color: rgba(255, 255, 255, 0.94);
    text-decoration: none;
    flex: 0 0 auto;
    grid-column: 1;
    justify-self: start;
    opacity: 0;
    transform: translateY(-2px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.sst-nav.is-compact .nav-brand,
.sst-nav.nav-open .nav-brand {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-brand:hover,
.nav-brand:focus {
    color: #fff;
    text-decoration: none;
    outline: none;
}

.nav-brand i {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    color: #d7f4fa;
    font-size: 0.92rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-brand-copy {
    display: grid;
    gap: 0.02rem;
    min-width: 0;
    line-height: 1.1;
}

.nav-brand-title {
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.12px;
    white-space: nowrap;
}

.nav-brand-subtitle {
    color: rgba(216, 239, 244, 0.72);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-list {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0.12rem;
    flex: 0 0 auto;
    min-width: 0;
    grid-column: 2;
    justify-self: center;
}

.nav-item,
.nav-dropdown {
    position: relative;
}

.nav-link {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    padding: 0.58rem 1.18rem;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.1px;
    text-decoration: none;
    transition: color 0.28s ease, background-color 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
    border-bottom: 2px solid transparent;
    min-height: 39px;
}

.nav-link i {
    margin-right: 5px;
    font-size: 0.84rem;
}

.nav-item > .nav-link,
.nav-dropdown > .nav-link {
    height: 100%;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.nav-link:focus,
.nav-link:active {
    outline: none;
    text-decoration: none;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.62rem;
}

.nav-dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 8px;
}

.nav-caret {
    margin-right: 0;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-dropdown:hover > .nav-link,
.nav-dropdown.hover-open > .nav-link,
.nav-dropdown:focus-within > .nav-link,
.nav-dropdown.open > .nav-link,
.nav-item.active > .nav-link,
.nav-dropdown.active > .nav-link,
.nav-item > .nav-link:focus,
.nav-dropdown > .nav-link:focus {
    color: #fff;
    border-bottom-color: var(--sst-accent-2);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
    outline: none;
}

.nav-dropdown:hover .nav-caret,
.nav-dropdown.hover-open .nav-caret,
.nav-dropdown:focus-within .nav-caret,
.nav-dropdown.open .nav-caret {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    padding: 0.34rem 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--sst-shadow);
    border: 1px solid var(--sst-border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.985);
    transform-origin: top center;
    pointer-events: none;
    will-change: opacity, transform;
    transition:
        opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.14s;
}

.nav-dropdown:hover > .nav-submenu,
.nav-dropdown.hover-open > .nav-submenu,
.nav-dropdown:focus-within > .nav-submenu,
.nav-dropdown.open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    transition-delay: 0s, 0s, 0s;
}

.nav-subitem {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.nav-dropdown:hover .nav-subitem,
.nav-dropdown.hover-open .nav-subitem,
.nav-dropdown:focus-within .nav-subitem,
.nav-dropdown.open .nav-subitem {
    opacity: 1;
    transform: translateY(0);
}

.nav-subitem a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.62rem;
    padding: 0.58rem 0.82rem;
    color: #2c3e50;
    font-size: 0.84rem;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background-color 0.24s ease, color 0.24s ease, border-color 0.24s ease, transform 0.24s ease;
}

.nav-subitem a i {
    margin-right: 6px;
}

.nav-subitem a:hover {
    background: #edf7fa;
    color: var(--sst-ink-2);
    text-decoration: none;
    transform: translateX(2px);
}

.nav-subitem.active a {
    color: var(--sst-ink-2);
    background: #edf7fa;
    border-left-color: var(--sst-accent);
    font-weight: 600;
}

.nav-subitem.disabled a {
    color: #95a5a6;
    cursor: not-allowed;
}

.nav-subitem.disabled a:hover {
    background: #f8fafc;
    color: #7f8c8d;
}

.nav-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #a16207;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 1rem;
    cursor: pointer;
    float: right;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    transition: all 0.3s;
}

.nav-toggle:focus {
    outline: none;
}

/* --- Main Content --- */
.sst-main {
    max-width: 1880px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* --- Info Panel --- */
.info-panel {
    background: var(--sst-card);
    border-radius: 8px;
    padding: 0.62rem 0.78rem 0.7rem;
    margin-bottom: 0.72rem;
    box-shadow: var(--sst-shadow-soft);
    border: 1px solid var(--sst-border);
    border-top: 3px solid var(--sst-accent);
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.72rem;
    flex-wrap: wrap;
    margin-bottom: 0.42rem;
    padding-bottom: 0.42rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.info-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--sst-ink-2);
    flex: 1;
    min-width: 200px;
    line-height: 1.25;
}

.info-desc {
    font-size: 0.78rem;
    color: #52616f;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

/* Area Selection */
.area-select-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.area-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #627282;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.area-label i {
    color: var(--sst-accent);
    margin-right: 2px;
}

.area-select {
    appearance: none;
    -webkit-appearance: none;
    background: #f7f9fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid #d5dde5;
    border-radius: 6px;
    padding: 0.35rem 1.8rem 0.35rem 0.62rem;
    font-size: 0.82rem;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    width: 100%;
    min-height: 30px;
}

.area-select:hover {
    border-color: var(--sst-accent);
}

.area-select:focus {
    border-color: var(--sst-accent);
    box-shadow: 0 0 0 3px rgba(43, 159, 189, 0.16);
}

.info-tag {
    background: #e8f6f8;
    color: var(--sst-ink-2);
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.74rem;
}

.info-sep {
    margin: 0 2px;
    color: #ccc;
}

/* --- Chart Section --- */
.chart-section {
    margin-bottom: 0;
    flex: 1;
    display: flex;
    min-height: 0;
}

.chart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: clamp(420px, calc(100vh - 410px), 720px);
}

.chart-card {
    background: var(--sst-card);
    border-radius: 8px;
    box-shadow: var(--sst-shadow-soft);
    border: 1px solid var(--sst-border);
    padding: 1rem;
}

.chart-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
}

.chart-container {
    width: 100%;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

.globe-panel {
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(243, 250, 252, 0.94) 44%, rgba(230, 241, 246, 0.98) 100%),
        linear-gradient(90deg, rgba(43, 159, 189, 0.075) 1px, transparent 1px),
        linear-gradient(0deg, rgba(83, 118, 139, 0.06) 1px, transparent 1px);
    background-size: auto, 88px 88px, 88px 88px;
    border: 1px solid rgba(83, 118, 139, 0.2);
    box-shadow: var(--sst-shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    isolation: isolate;
}

.globe-panel::before,
.globe-panel::after {
    display: none;
}

.globe-canvas,
.globe-canvas canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.globe-canvas {
    z-index: 0;
    cursor: grab;
    touch-action: none;
}

.globe-canvas.is-dragging {
    cursor: grabbing;
}

.globe-canvas.cesium-map-host {
    cursor: grab;
    background:
        radial-gradient(circle at 50% 46%, rgba(207, 232, 239, 0.92) 0%, rgba(232, 246, 249, 0.96) 54%, rgba(248, 251, 253, 1) 100%);
}

.globe-canvas .cesium-viewer,
.globe-canvas .cesium-widget,
.globe-canvas .cesium-widget canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.globe-canvas .cesium-viewer-bottom {
    display: none;
}

.globe-canvas .cesium-credit-logoContainer,
.globe-canvas .cesium-credit-textContainer,
.globe-canvas .cesium-credit-expand-link,
.globe-canvas .cesium-toolbar-button,
.globe-canvas .cesium-viewer-toolbar {
    display: none !important;
}

.globe-canvas.is-loading-map::after,
.globe-canvas.is-loading-base-map::after,
.globe-canvas.cesium-map-fallback::after,
.globe-canvas.cesium-map-warning::after {
    content: 'Loading Cesium map...';
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    padding: 0.52rem 0.72rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--sst-ink-2);
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(15, 47, 68, 0.12);
    pointer-events: none;
}

.globe-canvas.is-loading-base-map::after {
    content: 'Loading Google satellite imagery...';
}

.globe-canvas.cesium-map-fallback::after {
    content: 'Cesium map unavailable';
}

.globe-canvas.cesium-map-warning::after {
    content: attr(data-map-message);
}

.globe-info-card,
.globe-date-chip {
    position: absolute;
    z-index: 3;
    border: 1px solid rgba(83, 118, 139, 0.18);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 8px 24px rgba(15, 47, 68, 0.1);
    backdrop-filter: blur(10px);
}

.globe-info-card {
    left: 18px;
    top: 18px;
    width: 220px;
    max-width: min(220px, calc(100% - 168px));
    padding: 0.58rem 0.72rem 0.62rem;
    border-radius: 8px;
}

.globe-info-title {
    color: var(--sst-ink);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: 0.1px;
}

.globe-info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.34rem;
    color: #526672;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
}

.globe-info-meta span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.14rem 0.42rem;
    border-radius: 999px;
    background: rgba(232, 246, 248, 0.9);
    border: 1px solid rgba(43, 159, 189, 0.14);
}

.globe-date-chip {
    top: 18px;
    right: 18px;
    min-height: 34px;
    padding: 0.42rem 0.64rem;
    border-radius: 999px;
    color: var(--sst-ink-2);
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.globe-date-chip i {
    color: var(--sst-accent);
    font-size: 0.9rem;
}

.globe-actions {
    position: absolute;
    top: 64px;
    right: 18px;
    z-index: 3;
}

.globe-action-btn {
    border: 1px solid rgba(83, 118, 139, 0.18);
    background: rgba(255, 255, 255, 0.9);
    color: var(--sst-ink-2);
    box-shadow: 0 8px 24px rgba(15, 47, 68, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    min-height: 36px;
    padding: 0.42rem 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.globe-action-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(43, 159, 189, 0.32);
    box-shadow: 0 12px 28px rgba(15, 47, 68, 0.14);
}

.globe-action-btn:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    box-shadow: 0 6px 18px rgba(15, 47, 68, 0.08);
}

.globe-action-btn i {
    color: var(--sst-accent);
    font-size: 0.9rem;
}

.globe-legend {
    position: absolute;
    left: 50%;
    bottom: 18px;
    width: min(500px, calc(100% - 64px));
    transform: translateX(-50%);
    z-index: 3;
    padding: 0.62rem 0.72rem 0.54rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 30px rgba(15, 47, 68, 0.13);
    border: 1px solid rgba(83, 118, 139, 0.2);
    backdrop-filter: blur(12px);
}

.globe-legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.42rem;
    color: var(--sst-ink-2);
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.2;
}

#globeLegendRange {
    color: #526672;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.globe-legend-bar {
    display: block;
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, #30123b 0%, #4145ab 15%, #2ca7ef 32%, #32d2a4 47%, #a4fc3c 62%, #f6c53a 76%, #e94b1a 90%, #7a0402 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.72),
        0 0 0 1px rgba(83, 118, 139, 0.16);
}

.globe-legend.is-anomaly .globe-legend-bar {
    background: linear-gradient(90deg, #053061 0%, #2166ac 16%, #67a9cf 32%, #d1e5f0 45%, #f7f7f7 50%, #fddbc7 56%, #ef8a62 72%, #b2182b 88%, #67001f 100%);
}

.globe-legend-ticks {
    display: flex;
    justify-content: space-between;
    gap: 0.2rem;
    margin-top: 0.34rem;
    color: #5d6d77;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
}

@media (max-width: 900px) {
    .globe-info-card {
        width: 240px;
        max-width: calc(100% - 148px);
    }
}

@media (max-width: 520px) {
    .globe-info-card {
        left: 12px;
        right: 12px;
        top: 12px;
        max-width: none;
    }
    .globe-date-chip {
        top: 78px;
        right: 12px;
        min-height: 30px;
        font-size: 0.72rem;
    }
    .globe-actions {
        top: 116px;
        right: 12px;
    }
    .globe-action-btn {
        min-height: 32px;
        font-size: 0.72rem;
        padding: 0.38rem 0.66rem;
    }
    .globe-legend {
        bottom: 12px;
        width: calc(100% - 28px);
        padding: 0.54rem 0.58rem 0.48rem;
    }
    .globe-legend-header {
        font-size: 0.68rem;
    }
    .globe-legend-ticks {
        font-size: 0.6rem;
    }
}

/* --- Marine Heatwave 2D Map --- */
.mhw-section {
    width: 100%;
    margin: 1rem 0 0;
}

.mhw-shell {
    background: var(--sst-card);
    border: 1px solid var(--sst-border);
    border-radius: 8px;
    box-shadow: var(--sst-shadow-soft);
    padding: 0.9rem;
}

.mhw-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.66rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.mhw-title-block {
    min-width: 0;
}

.mhw-kicker {
    color: #7a4b08;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}

.mhw-title {
    margin: 0.18rem 0 0;
    color: var(--sst-ink);
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.2;
}

.mhw-status {
    min-height: 28px;
    max-width: 360px;
    padding: 0.34rem 0.58rem;
    border-radius: 999px;
    background: #edf8fb;
    border: 1px solid rgba(43, 159, 189, 0.18);
    color: var(--sst-ink-2);
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: right;
}

.mhw-status.is-warn {
    background: #fff8e8;
    border-color: rgba(216, 162, 76, 0.32);
    color: #8a5a05;
}

.mhw-status.is-error {
    background: #fff1f0;
    border-color: rgba(201, 79, 69, 0.32);
    color: #9f2f27;
}

.mhw-toolbar {
    display: grid;
    grid-template-columns: minmax(120px, 0.9fr) minmax(140px, 1.1fr) minmax(160px, 1.1fr) minmax(190px, 1.35fr) minmax(140px, 0.75fr) auto;
    gap: 0.54rem;
    align-items: end;
    padding: 0.72rem 0 0.82rem;
}

.mhw-field {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.mhw-field span {
    color: #627282;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.mhw-field select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 32px;
    border: 1px solid #d5dde5;
    border-radius: 6px;
    background: #f7f9fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: #263845;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.36rem 1.75rem 0.36rem 0.56rem;
    outline: none;
}

.mhw-field select:hover,
.mhw-field select:focus {
    border-color: rgba(43, 159, 189, 0.62);
    box-shadow: 0 0 0 3px rgba(43, 159, 189, 0.13);
}

.mhw-opacity-field input {
    width: 100%;
    height: 32px;
    accent-color: #d9531e;
}

.mhw-toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    justify-content: flex-end;
}

.mhw-icon-btn {
    width: 34px;
    height: 32px;
    border: 1px solid rgba(83, 118, 139, 0.24);
    border-radius: 6px;
    background: #fff;
    color: var(--sst-ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(15, 47, 68, 0.06);
    transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.mhw-icon-btn:hover,
.mhw-icon-btn:focus {
    transform: translateY(-1px);
    border-color: rgba(216, 83, 30, 0.45);
    background: #fff8f2;
    outline: none;
}

.mhw-map-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 0.82rem;
    align-items: stretch;
    min-height: 520px;
}

.mhw-map-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.95rem;
}

.mhw-map-panel {
    min-width: 0;
}

.mhw-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    min-height: 32px;
    margin-bottom: 0.44rem;
    color: var(--sst-ink-2);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1.2;
}

.mhw-panel-head span:last-child {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mhw-map-stage {
    position: relative;
    min-height: 520px;
    height: clamp(520px, 54vh, 780px);
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(83, 118, 139, 0.24);
    background:
        linear-gradient(180deg, #e9f5f8 0%, #d8edf3 100%),
        linear-gradient(90deg, rgba(15, 73, 101, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15, 73, 101, 0.08) 1px, transparent 1px);
    background-size: auto, 72px 72px, 72px 72px;
}

.mhw-map-host,
.mhw-map-host .maplibregl-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.mhw-map-host {
    cursor: grab;
}

.mhw-map-host .maplibregl-canvas {
    outline: none;
}

.mhw-heat-canvas {
    display: none;
}

.mhw-map-host .maplibregl-ctrl-top-right {
    top: 10px;
    right: 10px;
}

.mhw-map-host .maplibregl-ctrl-group {
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(15, 47, 68, 0.14);
    overflow: hidden;
}

.mhw-map-host .maplibregl-ctrl-attrib {
    border-radius: 4px 0 0 0;
    color: #526672;
    font-size: 0.66rem;
    font-weight: 700;
}

.mhw-map-tooltip {
    position: absolute;
    z-index: 4;
    min-width: 150px;
    padding: 0.46rem 0.56rem;
    border-radius: 6px;
    border: 1px solid rgba(83, 118, 139, 0.22);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 24px rgba(15, 47, 68, 0.16);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.mhw-map-tooltip strong {
    display: block;
    color: #9f2f27;
    font-size: 0.9rem;
    line-height: 1.1;
}

.mhw-map-tooltip span {
    display: block;
    margin-top: 0.18rem;
    color: #526672;
    font-size: 0.72rem;
    font-weight: 800;
}

.mhw-tooltip-grid {
    display: grid;
    gap: 0.18rem;
    margin-top: 0.42rem;
}

.mhw-tooltip-grid div {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 0.46rem;
    align-items: baseline;
}

.mhw-tooltip-grid span {
    margin-top: 0;
    color: #6f7f8e;
    font-size: 0.66rem;
    text-transform: uppercase;
}

.mhw-tooltip-grid b {
    min-width: 0;
    color: var(--sst-ink);
    font-size: 0.78rem;
    font-weight: 900;
    text-align: right;
}

.mhw-map-message {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 5;
    width: min(340px, calc(100% - 32px));
    min-height: 48px;
    transform: translate(-50%, -50%);
    padding: 0.72rem 0.86rem;
    border-radius: 8px;
    border: 1px solid rgba(83, 118, 139, 0.2);
    background: rgba(255, 255, 255, 0.94);
    color: #526672;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 12px 28px rgba(15, 47, 68, 0.16);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.mhw-side-panel {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 0.72rem;
    min-width: 0;
}

.mhw-readout,
.mhw-layer-meta,
.mhw-legend {
    border: 1px solid rgba(83, 118, 139, 0.18);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    box-shadow: 0 4px 12px rgba(15, 47, 68, 0.045);
    min-height: 112px;
}

.mhw-readout {
    padding: 0.72rem;
    display: flex;
    flex-direction: column;
}

.mhw-readout-label {
    color: #627282;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mhw-readout-value {
    margin-top: 0.34rem;
    color: var(--sst-ink);
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.32;
    min-height: calc(0.84rem * 1.32 * 3);
    overflow: hidden;
    word-break: break-word;
}

.mhw-layer-meta {
    display: grid;
    grid-auto-rows: minmax(17px, auto);
    align-content: start;
    gap: 0.26rem;
    padding: 0.68rem 0.72rem;
    color: #526672;
    font-size: 0.76rem;
    font-weight: 800;
}

.mhw-layer-meta span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mhw-legend {
    align-self: start;
    padding: 0.72rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mhw-legend-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    color: var(--sst-ink-2);
    font-size: 0.74rem;
    font-weight: 900;
    margin-bottom: 0.48rem;
    min-height: 18px;
}

.mhw-legend-bar {
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffffcc 0%, #feb24c 28%, #fd8d3c 52%, #f03b20 76%, #bd0026 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.72),
        0 0 0 1px rgba(83, 118, 139, 0.16);
}

.mhw-category-legend .mhw-legend-bar {
    background: linear-gradient(90deg, #ffffff 0%, #ffffff 16%, #f4cf60 16%, #f4cf60 36%, #feb20f 36%, #feb20f 56%, #f58363 56%, #f58363 76%, #8b0000 76%, #8b0000 100%);
}

.mhw-observation-anomaly-legend .mhw-legend-bar {
    background: linear-gradient(90deg, #08306b 0%, #2171b5 23%, #9ecae1 40%, #f7f7f7 50%, #fdae61 62%, #d73027 82%, #a50026 100%);
}

.mhw-observation-occurrence-legend .mhw-legend-bar {
    background: linear-gradient(90deg, #f2f7f9 0%, #f2f7f9 50%, #d73027 50%, #d73027 100%);
}

.mhw-legend-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.38rem;
    color: #64748b;
    font-size: 0.66rem;
    font-weight: 800;
}

.mhw-observation-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.58rem;
    padding-top: 0.52rem;
    border-top: 1px solid rgba(83, 118, 139, 0.16);
}

.mhw-observation-toggle > span {
    min-width: 0;
    color: #526672;
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
}

.mhw-segmented {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.18rem;
    padding: 0.16rem;
    border: 1px solid rgba(83, 118, 139, 0.2);
    border-radius: 6px;
    background: #f7fbfd;
}

.mhw-segmented button {
    min-width: 48px;
    min-height: 26px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #0f4965;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.mhw-segmented button.is-active {
    background: #07152f;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(7, 21, 47, 0.18);
}

/* Research display refinement for the MHW map page. */
.mhw-section {
    margin-top: 0.65rem;
}

.mhw-shell {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.mhw-header-row {
    align-items: center;
    padding: 0.18rem 0 0.74rem;
    border-bottom-color: rgba(83, 118, 139, 0.16);
}

.mhw-kicker {
    color: #a43d20;
    letter-spacing: 0.11em;
}

.mhw-title {
    color: #082f44;
    font-size: 1.22rem;
    letter-spacing: 0;
}

.mhw-status {
    background: rgba(238, 248, 250, 0.92);
    border-color: rgba(43, 159, 189, 0.24);
    color: #0f4965;
}

.mhw-toolbar {
    margin-top: 0.7rem;
    margin-bottom: 0.96rem;
    padding: 0.68rem;
    border: 1px solid rgba(83, 118, 139, 0.18);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(244, 250, 252, 0.94) 100%);
    box-shadow: 0 8px 22px rgba(15, 47, 68, 0.06);
}

.mhw-map-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: clamp(0.82rem, 1vw, 1.35rem);
}

.mhw-map-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0.78rem;
    border: 1px solid rgba(83, 118, 139, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 26px rgba(15, 47, 68, 0.08);
}

.mhw-map-panel.is-reference {
    border-top: 4px solid #c4472d;
}

.mhw-map-panel.is-observation {
    order: 1;
    border-top-color: #c4472d;
}

.mhw-map-panel.is-probability {
    order: 2;
    border-top: 4px solid #2b9fbd;
}

.mhw-panel-head {
    min-height: 38px;
    margin-bottom: 0.6rem;
    padding-bottom: 0.52rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 0.9rem;
    color: #082f44;
}

.mhw-panel-head span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.46rem;
}

.mhw-panel-head span:first-child::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2b9fbd;
    box-shadow: 0 0 0 4px rgba(43, 159, 189, 0.12);
    flex: 0 0 auto;
}

.mhw-map-panel.is-reference .mhw-panel-head span:first-child::before {
    background: #c4472d;
    box-shadow: 0 0 0 4px rgba(196, 71, 45, 0.12);
}

.mhw-map-panel.is-probability {
    box-shadow: 0 8px 20px rgba(15, 47, 68, 0.06);
}

.mhw-map-panel.is-probability .mhw-panel-head {
    color: #123f59;
}

.mhw-map-workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) auto;
    gap: 0.72rem;
    min-height: 0;
    flex: 1 1 auto;
}

.mhw-map-panel.is-reference .mhw-map-stage {
    min-height: 360px;
    height: clamp(380px, 46vh, 660px);
}

.mhw-map-panel.is-probability .mhw-map-stage {
    min-height: 360px;
    height: clamp(380px, 46vh, 660px);
}

.mhw-side-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 0.66rem;
    align-items: stretch;
}

.mhw-readout,
.mhw-layer-meta,
.mhw-legend {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
    height: 112px;
    min-height: 112px;
}

.mhw-readout-value {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.mhw-layer-meta {
    overflow: hidden;
}

.mhw-legend {
    align-self: stretch;
}

.mhw-map-panel.is-observation .mhw-legend {
    height: auto;
    min-height: 132px;
}

.mhw-map-panel.is-reference .mhw-readout-value {
    color: #8b2f20;
}

.mhw-map-panel.is-probability .mhw-readout-value {
    color: #0f4965;
}

@media (min-width: 2200px) {
    .sst-main {
        max-width: 2440px;
        padding-left: 1.6rem;
        padding-right: 1.6rem;
    }
    .mhw-title {
        font-size: 1.34rem;
    }
    .mhw-toolbar {
        grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(210px, 1fr) minmax(250px, 1.2fr) minmax(170px, 0.7fr) auto;
    }
    .mhw-map-panel.is-reference .mhw-map-stage {
        height: clamp(560px, 44vh, 800px);
    }
    .mhw-map-panel.is-probability .mhw-map-stage {
        height: clamp(560px, 44vh, 800px);
    }
}

@media (min-width: 3200px) {
    .sst-main {
        max-width: 3440px;
    }
    .mhw-map-stack {
        gap: 1.5rem;
    }
    .mhw-map-panel {
        padding: 0.92rem;
    }
    .mhw-map-panel.is-reference .mhw-map-stage {
        height: clamp(700px, 42vh, 900px);
    }
    .mhw-map-panel.is-probability .mhw-map-stage {
        height: clamp(700px, 42vh, 900px);
    }
}

@media (max-width: 1180px) {
    .mhw-map-stack {
        grid-template-columns: 1fr;
    }
    .mhw-map-panel.is-reference .mhw-map-stage,
    .mhw-map-panel.is-probability .mhw-map-stage {
        height: clamp(420px, 52vh, 680px);
    }
}

/* --- About Section --- */
.about-section {
    max-width: 960px;
    margin: 0 auto;
}

.about-card {
    background: var(--sst-card);
    border-radius: 8px;
    box-shadow: var(--sst-shadow-soft);
    border: 1px solid var(--sst-border);
    padding: 2rem 2.5rem;
}

.about-block {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}
.about-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.about-block h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--sst-ink-2);
    margin-bottom: 0.75rem;
}

.about-block h3 i {
    margin-right: 8px;
    color: var(--sst-accent);
}

.about-block p {
    color: #444;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.about-block ul {
    padding-left: 1.2rem;
    color: #444;
}

.about-block li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

/* --- Footer --- */
.sst-footer {
    background: var(--sst-ink);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
}

.footer-text {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.footer-copy {
    font-size: 0.75rem;
    opacity: 0.6;
}

.sst-toast {
    position: fixed;
    right: 20px;
    bottom: 24px;
    max-width: 320px;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: rgba(11, 47, 68, 0.94);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 12px 30px rgba(11, 47, 68, 0.24);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 300;
}

.sst-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .header-icon {
        font-size: 1.82rem;
    }
    .header-title {
        font-size: 1.46rem;
        letter-spacing: 0.4px;
    }
    .chart-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .chart-container {
        height: 440px;
    }
    .globe-panel {
        min-height: 440px;
    }
    .nav-link {
        padding: 0.56rem 0.92rem;
        font-size: 0.84rem;
    }
    .nav-container {
        gap: 0.45rem;
    }
    .nav-container::after {
        min-width: 210px;
    }
    .nav-brand {
        min-width: 210px;
    }
    .nav-brand-subtitle {
        display: none;
    }
}

@media (max-width: 900px) {
    .chart-layout {
        grid-template-columns: 1fr;
    }
    .globe-panel {
        min-height: 400px;
    }
}

/* Small Tablet / Large Phone */
@media (max-width: 768px) {
    .sst-header {
        padding: 0.36rem 1rem 0.62rem;
    }
    .header-icon {
        font-size: 1.55rem;
    }
    .header-title {
        font-size: 1.2rem;
        letter-spacing: 0.2px;
    }
    .header-subtitle {
        font-size: 0.7rem;
    }

    /* Mobile nav */
    .nav-container {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        min-height: 48px;
    }
    .nav-container::after {
        display: none;
    }
    .nav-brand {
        min-width: 0;
        flex: 1 1 auto;
        min-height: 48px;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    .nav-brand-title {
        font-size: 0.82rem;
        white-space: normal;
    }
    .nav-toggle {
        display: flex;
        padding: 0.72rem 0.3rem 0.72rem 0.9rem;
        flex: 0 0 auto;
        float: none;
    }
    .nav-list {
        display: none;
        flex-direction: column;
        width: 100%;
        clear: both;
        flex: 0 0 100%;
    }
    .nav-list.open {
        display: flex;
    }
    .nav-item,
    .nav-dropdown {
        width: 100%;
    }
    .nav-dropdown::after {
        display: none;
    }
    .nav-link {
        padding: 0.68rem 1.1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-left: 2px solid transparent;
    }
    .nav-item.active > .nav-link,
    .nav-dropdown.active > .nav-link {
        border-bottom-color: rgba(255, 255, 255, 0.1);
        border-left-color: var(--sst-accent-2);
    }
    .nav-submenu {
        position: static;
        min-width: 0;
        padding: 0;
        background: rgba(11, 47, 68, 0.28);
        border-radius: 0;
        box-shadow: none;
        border: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.28s ease;
    }
    .nav-dropdown:hover > .nav-submenu,
    .nav-dropdown.hover-open > .nav-submenu,
    .nav-dropdown:focus-within > .nav-submenu {
        max-height: 0;
    }
    .nav-dropdown.open > .nav-submenu {
        max-height: 320px;
    }
    .nav-subitem {
        opacity: 1;
        transform: none;
    }
    .nav-subitem a {
        padding: 0.62rem 1.7rem;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.86);
        background: transparent;
    }
    .nav-subitem a:hover,
    .nav-subitem.active a {
        color: #fff;
        background: rgba(255, 255, 255, 0.08);
        transform: none;
    }
    .nav-subitem.disabled a,
    .nav-subitem.disabled a:hover {
        color: rgba(255, 255, 255, 0.55);
        background: transparent;
    }
    .nav-badge {
        background: rgba(255, 255, 255, 0.16);
        color: #fff;
    }

    .chart-container {
        height: 360px;
    }
    .globe-panel {
        min-height: 360px;
    }

    .info-panel {
        padding: 0.8rem 1rem;
    }
    .info-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .info-title {
        font-size: 0.9rem;
    }
    .area-select-wrap {
        width: 100%;
    }
    .area-select {
        flex: 1;
        max-width: none;
    }
    .info-desc {
        font-size: 0.8rem;
    }

    .about-card {
        padding: 1.5rem;
    }
    .about-block {
        padding-bottom: 1.5rem;
    }
}

/* Phone */
@media (max-width: 480px) {
    .sst-header {
        padding: 0.32rem 0.72rem 0.58rem;
    }
    .header-icon {
        font-size: 1.36rem;
    }
    .header-title {
        font-size: 1.02rem;
    }
    .header-subtitle {
        font-size: 0.66rem;
    }

    .sst-main {
        padding: 1rem 0.5rem;
    }
    .chart-container {
        height: 300px;
    }
    .globe-panel {
        min-height: 300px;
    }
    .chart-card {
        padding: 0.5rem;
        border-radius: 6px;
    }

    .nav-link,
    .nav-subitem a {
        padding: 0.58rem 0.88rem;
        font-size: 0.82rem;
    }

    .sst-toast {
        left: 12px;
        right: 12px;
        bottom: 16px;
        max-width: none;
    }

    .about-card {
        padding: 1rem;
    }
    .about-block h3 {
        font-size: 1rem;
    }
}

/* Extra small */
@media (max-width: 360px) {
    .chart-container {
        height: 270px;
    }
    .globe-panel {
        min-height: 270px;
    }
    .header-icon {
        font-size: 1.22rem;
    }
    .header-title {
        font-size: 0.94rem;
    }
}

/* Print styles */
@media print {
    .sst-nav, .sst-footer, .nav-toggle {
        display: none;
    }
    .sst-header {
        background: var(--sst-ink-2);
        padding: 1.5rem 1rem;
    }
    .chart-container {
        height: 400px;
    }
}

/* Info controls row */
.info-controls {
    display: grid;
    grid-template-columns: minmax(210px, 0.18fr) minmax(300px, 0.26fr) minmax(0, 1fr);
    gap: 0.52rem;
    align-items: stretch;
}
.info-control-group {
    min-width: 0;
    min-height: 82px;
    padding: 0.48rem 0.56rem;
    border: 1px solid var(--sst-border);
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    box-shadow: 0 4px 12px rgba(15, 47, 68, 0.045);
}
.mode-control-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.36rem;
    align-content: start;
}
.history-control-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.36rem;
    align-content: start;
}
.history-control-group .area-select-wrap {
    min-width: 0;
}
.history-control-group .area-select {
    min-width: 0;
}
.control-group-title {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0;
    color: var(--sst-ink-2);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    align-self: start;
    min-height: 18px;
}
.control-group-title i {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e8f6f8;
    color: var(--sst-accent);
    font-size: 0.68rem;
}
.forecast-control-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}
.forecast-board {
    display: grid;
    grid-template-columns: minmax(300px, 0.58fr) minmax(650px, 1.42fr);
    gap: 0.66rem;
    align-items: start;
    min-width: 0;
}
.forecast-section {
    display: grid;
    gap: 0.26rem;
    align-content: start;
    min-width: 0;
}
.forecast-reference-section {
    padding-right: 0.66rem;
    border-right: 1px solid var(--sst-border);
}
.forecast-block-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    min-height: 16px;
    color: #526672;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}
.forecast-block-title i {
    color: var(--sst-accent);
    font-size: 0.72rem;
}
.forecast-comparison-section .forecast-block-title {
    justify-content: space-between;
}
.forecast-block-title span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    min-width: 0;
}
.forecast-picker-row {
    display: grid;
    gap: 0.36rem;
    align-items: end;
}
.forecast-primary-row {
    grid-template-columns: minmax(120px, 0.72fr) minmax(150px, 1fr);
}
.forecast-compare-row {
    grid-template-columns: minmax(120px, 0.72fr) minmax(150px, 1fr) 34px;
}
.forecast-comparison-content {
    display: grid;
    grid-template-columns: minmax(330px, 0.86fr) minmax(400px, 1.14fr);
    gap: 0.44rem;
    align-items: end;
    min-width: 0;
}
.model-select-wrap,
.method-select-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}
.model-select-wrap .area-select,
.method-select-wrap .area-select {
    width: 100%;
    min-width: 0;
}
.forecast-add-btn {
    width: 34px;
    height: 30px;
    border: 1px solid #1a88a4;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--sst-accent-2) 0%, var(--sst-accent) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(43, 159, 189, 0.24);
    transition: transform 0.18s ease, border-color 0.2s, box-shadow 0.2s, filter 0.2s;
}
.forecast-add-btn:hover,
.forecast-add-btn:focus {
    border-color: #167990;
    box-shadow: 0 0 0 3px rgba(43, 159, 189, 0.16), 0 6px 14px rgba(43, 159, 189, 0.28);
    filter: brightness(1.03);
    outline: none;
    transform: translateY(-1px);
}
.forecast-add-btn:disabled {
    cursor: not-allowed;
    opacity: 0.46;
    box-shadow: none;
    filter: none;
    transform: none;
}
.forecast-multi-select {
    position: relative;
    min-width: 0;
}
.forecast-multi-toggle {
    width: 100%;
    min-height: 30px;
    border: 1px solid #d5dde5;
    border-radius: 6px;
    background: #f7f9fb;
    color: #2c3e50;
    padding: 0.35rem 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.forecast-multi-toggle:hover {
    border-color: var(--sst-accent);
}
.forecast-multi-toggle:focus,
.forecast-multi-toggle.is-open {
    outline: none;
    border-color: var(--sst-accent);
    box-shadow: 0 0 0 3px rgba(43, 159, 189, 0.16);
    background: #fff;
}
.forecast-multi-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}
.forecast-multi-toggle i {
    color: #60707f;
    font-size: 0.88rem;
    flex: 0 0 auto;
    transition: transform 0.18s ease;
}
.forecast-multi-toggle.is-open i {
    transform: rotate(180deg);
}
.forecast-multi-toggle span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.forecast-multi-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 240;
    display: grid;
    gap: 0.18rem;
    padding: 0.45rem;
    border: 1px solid rgba(83, 118, 139, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 36px rgba(15, 47, 68, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    pointer-events: none;
    max-height: 248px;
    overflow-y: auto;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.forecast-multi-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
.forecast-multi-option {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.45rem 0.52rem;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.forecast-multi-option:hover {
    background: #eef8fb;
    border-color: rgba(43, 159, 189, 0.22);
}
.forecast-multi-option-main {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    min-width: 0;
}
.forecast-multi-option-main input {
    margin: 0;
    flex: 0 0 auto;
}
.forecast-multi-option-label {
    color: #1f2937;
    font-size: 0.78rem;
    font-weight: 700;
}
.forecast-multi-option-meta {
    color: #7b8794;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}
.forecast-multi-empty {
    padding: 0.5rem 0.55rem;
    color: #7b8794;
    font-size: 0.76rem;
}
.value-type-toggle {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.22rem;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    min-height: 0;
}
.value-type-btn {
    border: 1px solid #d5dde5;
    border-radius: 6px;
    background: #f7f9fb;
    color: #526672;
    padding: 0.3rem 0.52rem;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.value-type-btn:hover,
.value-type-btn:focus {
    border-color: rgba(43, 159, 189, 0.54);
    color: var(--sst-ink-2);
    outline: none;
}
.value-type-btn.active {
    border-color: #1a88a4;
    background: linear-gradient(180deg, var(--sst-accent-2) 0%, var(--sst-accent) 100%);
    color: #fff;
    box-shadow: 0 3px 8px rgba(43, 159, 189, 0.2);
}
.forecast-count {
    min-width: 18px;
    height: 18px;
    padding: 0 0.32rem;
    border-radius: 999px;
    background: #e8f6f8;
    color: var(--sst-ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
}
.forecast-combo-list {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 0.3rem;
    height: 30px;
    margin: 0;
    padding: 0.18rem 0.3rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 1px 2px rgba(15, 47, 68, 0.035);
    overflow: visible;
    min-width: 0;
}
.forecast-combo-list.has-more {
    grid-template-columns: minmax(0, 1fr) auto;
}
.forecast-summary-chips {
    display: flex;
    align-items: center;
    gap: 0.26rem;
    min-width: 0;
    height: 22px;
    overflow: hidden;
}
.forecast-empty-state {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    color: #7b8794;
    font-size: 0.74rem;
    line-height: 1.2;
    padding: 0 0.3rem;
    white-space: nowrap;
}
.forecast-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 220px;
    min-width: 0;
    min-height: 22px;
    padding: 0.1rem 0.24rem 0.1rem 0.42rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #334155;
    font-size: 0.76rem;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}
.forecast-chip.is-compact {
    flex: 0 1 auto;
    max-width: 178px;
}
.forecast-chip.is-loading {
    opacity: 0.72;
}
.forecast-chip.has-error,
.forecast-chip.is-empty {
    border-color: #d8a24c;
    background: #fff8e8;
}
.forecast-chip-swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.forecast-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.forecast-chip-remove {
    width: 17px;
    height: 17px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.forecast-chip-remove:hover,
.forecast-chip-remove:focus {
    background: rgba(15, 23, 42, 0.08);
    color: #1f2937;
    outline: none;
}
.forecast-more-btn,
.forecast-clear-btn {
    border: 1px solid rgba(43, 159, 189, 0.28);
    border-radius: 6px;
    background: #edf8fb;
    color: var(--sst-ink-2);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}
.forecast-more-btn {
    min-height: 22px;
    padding: 0.15rem 0.48rem;
}
.forecast-more-btn:hover,
.forecast-more-btn:focus,
.forecast-clear-btn:hover,
.forecast-clear-btn:focus {
    border-color: rgba(43, 159, 189, 0.58);
    background: #e2f3f7;
    outline: none;
}
.forecast-combo-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 220;
    width: min(520px, 82vw);
    padding: 0.58rem;
    border: 1px solid rgba(83, 118, 139, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 36px rgba(15, 47, 68, 0.16);
}
.forecast-combo-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 28px;
    width: 10px;
    height: 10px;
    border-left: 1px solid rgba(83, 118, 139, 0.24);
    border-top: 1px solid rgba(83, 118, 139, 0.24);
    background: rgba(255, 255, 255, 0.98);
    transform: rotate(45deg);
}
.forecast-combo-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding-bottom: 0.48rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.forecast-combo-popover-title {
    color: var(--sst-ink-2);
    font-size: 0.78rem;
    font-weight: 800;
}
.forecast-clear-btn {
    padding: 0.28rem 0.54rem;
}
.forecast-combo-popover-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.36rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.18rem;
}
.forecast-combo-popover .forecast-chip {
    max-width: 100%;
    width: 100%;
    justify-content: flex-start;
}
.chart-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}
.chart-toolbar-main {
    min-width: 0;
}
.chart-toolbar-title {
    color: var(--sst-ink-2);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.15;
}
.chart-toolbar-subtitle {
    margin-top: 0.18rem;
    color: #667786;
    font-size: 0.74rem;
    line-height: 1.35;
}
.chart-toolbar-actions {
    min-width: min(430px, 54%);
    display: grid;
    justify-items: end;
    gap: 0.42rem;
}
.chart-forecast-select {
    width: min(430px, 100%);
}

@media (max-width: 1024px) {
    .info-controls {
        grid-template-columns: minmax(120px, 0.28fr) minmax(220px, 0.72fr);
    }
    .mhw-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .mhw-toolbar-actions {
        justify-content: flex-start;
    }
    .mhw-map-workbench {
        grid-template-columns: 1fr;
    }
    .mhw-side-panel {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 0.8fr);
        grid-template-rows: auto;
    }
    .mhw-readout,
    .mhw-layer-meta,
    .mhw-legend {
        height: 118px;
        min-height: 118px;
    }
    .forecast-control-group {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr);
    }
    .forecast-board {
        grid-template-columns: minmax(260px, 0.68fr) minmax(430px, 1.32fr);
    }
    .forecast-comparison-content {
        grid-template-columns: minmax(330px, 0.9fr) minmax(320px, 1.1fr);
    }
    .mode-control-group {
        grid-template-columns: 1fr;
    }
    .value-type-toggle {
        grid-template-columns: 1fr 1fr;
    }
    .forecast-picker-row {
        grid-template-columns: minmax(160px, 1fr) minmax(150px, 1fr) 36px;
    }
    .forecast-primary-row {
        grid-template-columns: minmax(130px, 0.76fr) minmax(150px, 1fr);
    }
    .chart-toolbar-actions {
        min-width: min(360px, 58%);
    }
}

@media (max-width: 768px) {
    .info-header {
        gap: 0.5rem;
    }
    .mhw-shell {
        padding: 0.72rem;
    }
    .mhw-header-row {
        flex-direction: column;
        gap: 0.55rem;
    }
    .mhw-status {
        max-width: none;
        width: 100%;
        text-align: left;
    }
    .mhw-toolbar {
        grid-template-columns: 1fr;
    }
    .mhw-toolbar-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
    .mhw-icon-btn {
        width: 100%;
    }
    .mhw-map-stage {
        min-height: 380px;
        height: 420px;
    }
    .mhw-side-panel {
        grid-template-columns: 1fr;
    }
    .mhw-readout,
    .mhw-layer-meta,
    .mhw-legend {
        height: auto;
        min-height: 96px;
    }
    .mhw-readout-value {
        min-height: calc(0.84rem * 1.32 * 2);
    }
    .info-desc {
        justify-content: flex-start;
    }
    .info-controls {
        grid-template-columns: 1fr;
    }
    .info-control-group {
        padding: 0.55rem;
    }
    .mode-control-group {
        grid-template-columns: 1fr;
    }
    .history-control-group,
    .forecast-control-group {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }
    .forecast-board {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }
    .forecast-reference-section {
        padding-right: 0;
        padding-bottom: 0.52rem;
        border-right: 0;
        border-bottom: 1px solid var(--sst-border);
    }
    .forecast-comparison-content {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    .forecast-picker-row {
        grid-template-columns: 1fr;
    }
    .area-select-wrap,
    .model-select-wrap,
    .method-select-wrap {
        width: 100%;
    }
    .forecast-add-btn {
        width: 100%;
        height: 32px;
    }
    .forecast-combo-list {
        grid-column: auto;
        width: 100%;
    }
    .chart-panel {
        gap: 0.7rem;
    }
    .chart-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .chart-toolbar-actions {
        min-width: 0;
        justify-items: stretch;
    }
    .chart-forecast-select {
        width: 100%;
    }
    .forecast-multi-menu {
        position: static;
        margin-top: 0.35rem;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        display: none;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    .forecast-multi-menu.is-open {
        display: grid;
    }
    .forecast-chip {
        max-width: 100%;
    }
}

@media (max-width: 1024px) {
    .mhw-shell {
        padding: 0;
    }
    .mhw-map-panel {
        padding: 0.64rem;
    }
    .mhw-map-panel.is-reference .mhw-map-stage {
        min-height: 440px;
        height: 480px;
    }
    .mhw-map-panel.is-probability .mhw-map-stage {
        min-height: 400px;
        height: 430px;
    }
}

@media (max-width: 768px) {
    .mhw-shell {
        padding: 0;
    }
    .mhw-panel-head {
        align-items: flex-start;
        flex-direction: column;
        min-height: 0;
    }
    .mhw-map-panel.is-reference .mhw-map-stage {
        min-height: 380px;
        height: 420px;
    }
    .mhw-map-panel.is-probability .mhw-map-stage {
        min-height: 360px;
        height: 390px;
    }
}

@media (max-width: 480px) {
    .mhw-map-panel {
        padding: 0.5rem;
    }
    .mhw-map-panel.is-reference .mhw-map-stage,
    .mhw-map-panel.is-probability .mhw-map-stage {
        min-height: 330px;
        height: 350px;
    }
}
