:root {
    --bg: #08111f;
    --panel: #111d2e;
    --panel-alt: #17263a;
    --border: #263950;
    --text: #f4f7fb;
    --muted: #91a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --hot: #fb7185;
    --hot-strong: #ef4444;
    --cold: #60a5fa;
    --rain: #22d3ee;
    --sun: #fbbf24;
    --success: #34d399;
    --shadow: 0 18px 55px rgba(2, 8, 23, 0.32);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background:
        radial-gradient(circle at 9% 4%, rgba(56, 189, 248, 0.12), transparent 28rem),
        radial-gradient(circle at 91% 18%, rgba(251, 113, 133, 0.09), transparent 25rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select, input { font: inherit; }

.app {
    width: min(1420px, calc(100% - 36px));
    margin: 0 auto;
    padding: 20px 0 52px;
}

header nav { flex-wrap: wrap; }

.season-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 30px;
    align-items: center;
    overflow: hidden;
    min-height: 200px;
    padding: 34px 38px;
    border: 1px solid rgba(125, 211, 252, 0.2);
    border-radius: 24px;
    background:
        linear-gradient(118deg, rgba(8, 17, 31, 0.2), rgba(8, 17, 31, 0.8)),
        linear-gradient(135deg, #15304a, #17253d 55%, #351f34);
    box-shadow: var(--shadow);
}

.season-hero::before,
.season-hero::after {
    position: absolute;
    z-index: -1;
    content: "";
    border-radius: 999px;
    filter: blur(3px);
}

.season-hero::before {
    width: 330px;
    height: 330px;
    right: 24%;
    top: -240px;
    background: rgba(56, 189, 248, 0.22);
}

.season-hero::after {
    width: 250px;
    height: 250px;
    right: -70px;
    bottom: -180px;
    background: rgba(251, 113, 133, 0.2);
}

.eyebrow,
.card-kicker,
.control-label,
.identity-label {
    display: block;
    margin-bottom: 7px;
    color: #8fdcff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.season-hero h2 {
    margin: 0;
    max-width: 750px;
    font-size: clamp(2rem, 4vw, 3.75rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.season-hero p {
    max-width: 720px;
    margin: 16px 0 0;
    color: #c0cede;
    font-size: clamp(1rem, 1.5vw, 1.16rem);
    line-height: 1.65;
}

.station-identity {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 22px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    background: rgba(5, 12, 24, 0.48);
    backdrop-filter: blur(14px);
}

.station-identity strong { font-size: 1.25rem; }
.station-identity > span:last-child { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

.season-controls {
    display: grid;
    grid-template-columns: minmax(480px, 1fr) minmax(180px, 230px) minmax(180px, 230px);
    gap: 16px;
    align-items: end;
    margin: 18px 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(17, 29, 46, 0.9);
    box-shadow: 0 10px 32px rgba(2, 8, 23, 0.2);
}

.season-pills {
    display: grid;
    grid-template-columns: repeat(4, minmax(105px, 1fr));
    gap: 7px;
}

.season-pill {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 7px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    background: #0b1625;
    cursor: pointer;
    font-weight: 750;
    text-align: left;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease;
}

.season-pill:hover { border-color: #46617e; color: var(--text); transform: translateY(-1px); }
.season-pill.active { border-color: rgba(56, 189, 248, 0.7); color: white; background: linear-gradient(135deg, rgba(14, 165, 233, 0.24), rgba(99, 102, 241, 0.16)); }
.season-pill > span { grid-row: 1 / 3; font-size: 1.25rem; }
.season-pill small { color: #7890aa; font-size: 0.66rem; font-weight: 650; }

.control-field { min-width: 0; }
.control-field select {
    width: 100%;
    min-height: 44px;
    padding: 9px 36px 9px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: #0b1625;
}
.control-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12); }
.control-field select:disabled { cursor: wait; opacity: 0.6; }

.notice,
.loading-state {
    margin: 20px 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel);
}

.error-notice { padding: 18px 20px; border-color: rgba(251, 113, 133, 0.48); color: #fecdd3; }

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    min-height: 190px;
    color: var(--muted);
}
.loading-state strong, .loading-state small { display: block; }
.loading-state strong { margin-bottom: 5px; color: var(--text); }
.loading-orb {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(56, 189, 248, 0.18);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.focus-strip {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin: 25px 2px 16px;
}

.focus-title-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.focus-title-line h2 { margin: 0; font-size: clamp(1.55rem, 2.5vw, 2.25rem); letter-spacing: -0.025em; }
.status-pill { padding: 5px 9px; border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 999px; color: #6ee7b7; background: rgba(16, 185, 129, 0.12); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.status-pill.provisional { border-color: rgba(251, 191, 36, 0.4); color: #fcd34d; background: rgba(245, 158, 11, 0.11); }
.focus-context { display: flex; flex-direction: column; align-items: end; color: var(--muted); font-size: 0.82rem; }
.focus-context strong { color: var(--text); }

.analysis-tabs {
    position: sticky;
    z-index: 20;
    top: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 16px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(8, 17, 31, 0.88);
    backdrop-filter: blur(15px);
}

.analysis-tab {
    min-height: 44px;
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 800;
    transition: color 160ms ease, background 160ms ease;
}
.analysis-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.analysis-tab.active { color: white; background: linear-gradient(135deg, #087eae, #4f46b9); box-shadow: 0 6px 18px rgba(14, 165, 233, 0.18); }

.analysis-panel { display: none; }
.analysis-panel.active { display: block; animation: panel-in 180ms ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.metric-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(23, 38, 58, 0.96), rgba(13, 25, 40, 0.96));
    box-shadow: 0 12px 26px rgba(2, 8, 23, 0.17);
}
.metric-card.hot { border-color: rgba(251, 113, 133, 0.3); }
.metric-card.cold { border-color: rgba(96, 165, 250, 0.3); }
.metric-card.rain { border-color: rgba(34, 211, 238, 0.3); }
.metric-card.sun { border-color: rgba(251, 191, 36, 0.28); }
.metric-label { min-height: 2.3em; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.metric-value { margin: 7px 0 5px; font-size: clamp(1.5rem, 2.5vw, 2.15rem); font-weight: 850; letter-spacing: -0.04em; white-space: nowrap; }
.metric-sub { min-height: 1.3em; color: var(--muted); font-size: 0.76rem; }
.delta-hot { color: #fda4af; }
.delta-cold { color: #93c5fd; }
.delta-neutral { color: #c4d2e1; }

.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.content-grid-wide { grid-template-columns: minmax(0, 1.8fr) minmax(285px, 0.7fr); }

.data-card,
.method-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(17, 29, 46, 0.94);
    box-shadow: 0 14px 34px rgba(2, 8, 23, 0.18);
}
.data-card { padding: 20px; }

.card-heading {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: start;
    margin-bottom: 14px;
    padding-bottom: 13px;
    border-bottom: 1px solid rgba(145, 163, 184, 0.13);
}
.card-heading h3 { margin: 0; font-size: 1.03rem; }
.card-kicker { margin-bottom: 4px; color: var(--muted); font-size: 0.64rem; }
.chart-hint { color: var(--muted); font-size: 0.72rem; text-align: right; }
.chart-wrap { position: relative; height: 365px; }
.chart-wrap-tall { height: 410px; }

.insight-card { display: flex; flex-direction: column; }
.insight-lead { margin: 0; font-size: 1.2rem; line-height: 1.45; font-weight: 760; }
.insight-list { display: grid; gap: 11px; margin: 20px 0 0; padding: 0; list-style: none; }
.insight-list li { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid rgba(145, 163, 184, 0.12); color: var(--muted); font-size: 0.84rem; }
.insight-list strong { color: var(--text); text-align: right; }

.ranking-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.ranking-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: rgba(8, 17, 31, 0.58); }
.ranking-row.focused { outline: 1px solid rgba(56, 189, 248, 0.48); background: rgba(14, 165, 233, 0.09); }
.rank-number { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); background: rgba(255,255,255,0.05); font-size: 0.75rem; font-weight: 850; }
.ranking-row:nth-child(1) .rank-number { color: #fde68a; background: rgba(245, 158, 11, 0.15); }
.rank-season { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; font-weight: 700; }
.rank-value { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.empty-value { padding: 25px 5px; color: var(--muted); text-align: center; }

.detail-list { display: grid; gap: 0; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid rgba(145, 163, 184, 0.12); color: var(--muted); font-size: 0.86rem; }
.detail-row:last-child { border-bottom: 0; }
.detail-row strong { color: var(--text); text-align: right; }

.ranking-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.65fr);
    gap: 16px;
    margin-bottom: 16px;
}

.ranking-chart-heading { align-items: center; }
.ranking-chart-heading > div:first-child { min-width: 0; }
.ranking-chart-heading h3 { overflow-wrap: anywhere; }
.ranking-metric-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}
.ranking-metric {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--muted);
    background: #0b1625;
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 800;
    transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.ranking-metric:hover { color: var(--text); border-color: #46617e; }
.ranking-metric.active { color: white; border-color: rgba(56, 189, 248, 0.7); background: rgba(14, 165, 233, 0.18); }
.chart-wrap-ranking { height: 430px; }

.ranking-spotlight {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 100% 0, rgba(56, 189, 248, 0.14), transparent 45%),
        rgba(17, 29, 46, 0.94);
}
.ranking-position {
    display: flex;
    align-items: end;
    gap: 10px;
    margin: 8px 0 5px;
}
.ranking-position strong { font-size: clamp(2.8rem, 5vw, 4.4rem); line-height: 0.9; letter-spacing: -0.07em; }
.ranking-position span { padding-bottom: 5px; color: var(--muted); font-size: 0.82rem; }
.ranking-focus-value { color: #dbeafe; font-size: 1.05rem; font-weight: 800; }
.ranking-focus-note { margin: 7px 0 18px; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.podium-title { margin: auto 0 9px; padding-top: 15px; border-top: 1px solid rgba(145, 163, 184, 0.13); color: var(--muted); font-size: 0.67rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.podium-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.podium-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 9px; border-radius: 10px; background: rgba(8, 17, 31, 0.58); font-size: 0.78rem; }
.podium-item.focused { outline: 1px solid rgba(56, 189, 248, 0.45); }
.podium-medal { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: #fef3c7; background: rgba(245, 158, 11, 0.18); font-size: 0.7rem; font-weight: 900; }
.podium-item:nth-child(2) .podium-medal { color: #e2e8f0; background: rgba(148, 163, 184, 0.16); }
.podium-item:nth-child(3) .podium-medal { color: #fed7aa; background: rgba(194, 120, 70, 0.18); }
.podium-season { overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.podium-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.table-scroll {
    max-height: 570px;
    overflow: auto;
    border: 1px solid rgba(145, 163, 184, 0.12);
    border-radius: 12px;
}
.season-table { width: 100%; border-collapse: collapse; font-size: 0.81rem; font-variant-numeric: tabular-nums; }
.season-table thead { position: sticky; z-index: 2; top: 0; background: #152438; }
.season-table th { padding: 0; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.season-table th:first-child { text-align: left; }
.season-table th button { width: 100%; padding: 12px 10px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 0.72rem; font-weight: 800; text-align: inherit; text-transform: uppercase; }
.season-table th button:hover { color: white; }
.season-table td { padding: 10px; border-bottom: 1px solid rgba(145, 163, 184, 0.08); text-align: right; white-space: nowrap; }
.season-table td:first-child { text-align: left; font-weight: 760; }
.season-table tbody tr { cursor: pointer; transition: background 120ms ease; }
.season-table tbody tr:hover { background: rgba(255,255,255,0.035); }
.season-table tbody tr.focused { background: rgba(56, 189, 248, 0.09); box-shadow: inset 3px 0 0 var(--accent); }
.quality-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--success); }
.quality-dot.partial { background: var(--sun); }

.method-card { margin-top: 16px; padding: 0 18px; color: var(--muted); font-size: 0.85rem; line-height: 1.6; }
.method-card summary { padding: 15px 0; color: var(--text); cursor: pointer; font-weight: 760; }
.method-card p { max-width: 1000px; }

[hidden] { display: none !important; }

@media (max-width: 1100px) {
    .season-controls { grid-template-columns: 1fr 1fr; }
    .season-choice { grid-column: 1 / -1; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid-wide { grid-template-columns: 1fr; }
    .ranking-dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app { width: min(100% - 22px, 1420px); padding-top: 12px; }
    .season-hero { grid-template-columns: 1fr; min-height: 0; padding: 25px 21px; border-radius: 18px; }
    .station-identity { padding: 16px; }
    .season-controls { grid-template-columns: 1fr; padding: 13px; }
    .season-choice { grid-column: auto; }
    .season-pills { grid-template-columns: repeat(2, 1fr); }
    .focus-strip { align-items: start; flex-direction: column; gap: 10px; }
    .focus-context { align-items: start; }
    .analysis-tabs { grid-template-columns: repeat(2, 1fr); position: static; }
    .metric-grid { gap: 9px; }
    .metric-card { padding: 14px; }
    .metric-value { font-size: 1.5rem; }
    .content-grid { grid-template-columns: 1fr; }
    .data-card { padding: 15px; }
    .card-heading { flex-direction: column; }
    .chart-hint { text-align: left; }
    .chart-wrap, .chart-wrap-tall { height: 330px; }
    .ranking-chart-heading { align-items: start; }
    .ranking-metric-pills { justify-content: flex-start; }
    .chart-wrap-ranking { height: 420px; }
}

@media (max-width: 430px) {
    .metric-grid { grid-template-columns: 1fr; }
    .season-pills { grid-template-columns: 1fr 1fr; }
    .season-pill { grid-template-columns: auto 1fr; padding: 9px; }
    .analysis-tab { padding: 8px 5px; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
