:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #20322f;
    background: #f4f3ee;
    font-synthesis: none;
    --ink: #20322f;
    --muted: #788580;
    --line: rgba(32, 50, 47, 0.09);
    --green: #28675a;
    --orange: #dc9364;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 92% 2%, rgba(230, 196, 159, 0.26), transparent 25rem),
        radial-gradient(circle at 4% 46%, rgba(187, 214, 203, 0.3), transparent 28rem),
        #f4f3ee;
}

button {
    font: inherit;
}

.page-shell {
    width: min(1180px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 30px 38px 24px;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand__mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #f4f3ee;
    background: var(--ink);
    box-shadow: 0 5px 14px rgba(32, 50, 47, 0.14);
}

.brand__mark svg {
    width: 26px;
    height: 26px;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand div > span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #5d706a;
    background: rgba(255, 255, 255, 0.54);
    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6b9e82;
    box-shadow: 0 0 0 4px rgba(107, 158, 130, 0.12);
}

.status-pill.is-loading .status-dot {
    background: #d79a60;
    box-shadow: 0 0 0 4px rgba(215, 154, 96, 0.13);
    animation: pulse 1.4s ease-in-out infinite;
}

.status-pill.is-error .status-dot {
    background: #c97567;
    box-shadow: 0 0 0 4px rgba(201, 117, 103, 0.13);
}

main {
    flex: 1;
}

.intro {
    margin: 52px 0 30px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow,
.card-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    font-size: 10px;
    font-weight: 700;
}

.eyebrow {
    margin-bottom: 10px;
    color: #8a938e;
}

h1 {
    margin: 0;
    font-size: clamp(38px, 4.5vw, 54px);
    font-weight: 640;
    line-height: 1.05;
    letter-spacing: -0.055em;
}

.intro__date {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 13px;
    text-transform: capitalize;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(280px, 0.9fr);
    gap: 20px;
}

.outdoor-panel {
    position: relative;
    isolation: isolate;
    min-width: 0;
    padding: 29px;
    overflow: hidden;
    border-radius: 30px;
    color: #f3f8f5;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 45%),
        #1e4c43;
    box-shadow: 0 20px 50px rgba(34, 73, 63, 0.18);
}

.outdoor-panel__glow {
    position: absolute;
    z-index: -1;
    top: -110px;
    right: -85px;
    width: 330px;
    height: 330px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(238, 186, 117, 0.22), rgba(238, 186, 117, 0) 68%);
    pointer-events: none;
}

.outdoor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.location-label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(239, 248, 243, 0.78);
    font-size: 13px;
    font-weight: 600;
}

.location-label__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e8b780;
    box-shadow: 0 0 0 4px rgba(232, 183, 128, 0.1);
}

.weather-symbol {
    color: #f0c58f;
}

.weather-symbol svg {
    width: 43px;
    height: 43px;
    display: block;
}

.outdoor-current {
    margin: 3px 0 22px;
}

.outdoor-reading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.outdoor-reading__value {
    font-size: clamp(88px, 10vw, 124px);
    font-weight: 480;
    line-height: 0.98;
    letter-spacing: -0.075em;
    font-variant-numeric: tabular-nums;
}

.outdoor-reading__unit {
    padding-top: 13px;
    color: rgba(239, 248, 243, 0.67);
    font-size: 29px;
    font-weight: 450;
}

.outdoor-updated {
    margin: 10px 0 0 4px;
    color: rgba(235, 245, 239, 0.56);
    font-size: 12px;
}

.temperature-summary {
    display: flex;
    gap: 30px;
    margin-bottom: 24px;
}

.temperature-summary > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.temperature-summary span {
    color: rgba(235, 245, 239, 0.48);
    font-size: 10px;
}

.temperature-summary strong {
    font-size: 15px;
    font-weight: 550;
    font-variant-numeric: tabular-nums;
}

.chart-section {
    padding: 19px 19px 11px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 21px;
    background: rgba(8, 35, 29, 0.17);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.chart-header h2 {
    margin: 0;
    font-size: 12px;
    font-weight: 550;
    color: rgba(242, 248, 245, 0.78);
}

.range-switcher {
    display: flex;
    gap: 3px;
    padding: 3px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.12);
}

.range-switcher button {
    padding: 6px 9px;
    border: 0;
    border-radius: 7px;
    color: rgba(239, 248, 243, 0.48);
    background: transparent;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.range-switcher button.is-active {
    color: #244e45;
    background: #e8eee8;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.12);
}

.range-switcher button:focus-visible,
.refresh-button:focus-visible {
    outline: 3px solid rgba(232, 183, 128, 0.5);
    outline-offset: 2px;
}

.main-chart {
    position: relative;
    min-height: 215px;
    margin-top: 7px;
}

#main-chart {
    width: 100%;
    height: 215px;
    display: block;
    overflow: visible;
    touch-action: pan-y;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    margin: 0;
    color: rgba(239, 248, 243, 0.46);
    font-size: 12px;
    text-align: center;
}

.main-chart.is-empty .chart-empty {
    display: grid;
}

.chart-tooltip {
    position: absolute;
    z-index: 2;
    min-width: 105px;
    padding: 9px 11px;
    transform: translate(-50%, -100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #254d44;
    background: rgba(247, 249, 244, 0.96);
    box-shadow: 0 7px 20px rgba(5, 28, 22, 0.25);
    pointer-events: none;
    text-align: center;
}

.chart-tooltip strong,
.chart-tooltip span {
    display: block;
}

.chart-tooltip strong {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.chart-tooltip span {
    margin-top: 3px;
    color: #74867f;
    font-size: 10px;
}

.secondary-cards {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
}

.metric-card {
    min-width: 0;
    padding: 25px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 35px rgba(46, 65, 58, 0.06);
    backdrop-filter: blur(12px);
}

.metric-card--balcony {
    --metric-color: #4d8878;
    --metric-soft: #e5efe9;
}

.metric-card--pressure {
    --metric-color: #b47a57;
    --metric-soft: #f3e9df;
}

.metric-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.card-kicker {
    margin-bottom: 6px;
    color: #8a9691;
}

.metric-card h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 620;
    letter-spacing: -0.025em;
}

.metric-icon {
    width: 41px;
    height: 41px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    color: var(--metric-color);
    background: var(--metric-soft);
}

.metric-icon svg {
    width: 26px;
    height: 26px;
}

.metric-reading {
    margin-top: 13px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    white-space: nowrap;
}

.metric-reading__value {
    font-size: 51px;
    font-weight: 540;
    line-height: 1;
    letter-spacing: -0.06em;
    font-variant-numeric: tabular-nums;
}

.metric-reading__unit {
    padding-top: 4px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 500;
}

.metric-reading--pressure {
    display: block;
}

.metric-reading--pressure .metric-reading__value,
.metric-reading--pressure .metric-reading__unit {
    display: block;
}

.metric-reading--pressure .metric-reading__unit {
    margin-top: 6px;
    padding: 0;
    font-size: 11px;
}

.sparkline-wrap {
    height: 55px;
    margin: auto -3px 8px;
}

.sparkline {
    width: 100%;
    height: 55px;
    display: block;
    overflow: visible;
}

.metric-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #89958f;
    font-size: 10px;
}

.metric-card__footer strong {
    flex: 0 0 auto;
    color: var(--metric-color);
    font-size: 10px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.outdoor-panel.is-warning .outdoor-updated {
    color: #efbd83;
    font-weight: 600;
}

.outdoor-panel.is-critical .outdoor-updated {
    color: #ef9a8f;
    font-weight: 600;
}

.metric-card.is-warning [data-updated] {
    color: #b67a3c;
    font-weight: 650;
}

.metric-card.is-critical [data-updated] {
    color: #bd5b52;
    font-weight: 650;
}

.is-loading .outdoor-reading,
.is-loading .metric-reading {
    opacity: 0.5;
}

.update-bar {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.update-bar > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.update-bar__dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #91a69c;
}

.update-bar p {
    margin: 0;
    color: #84908b;
    font-size: 11px;
}

.refresh-button {
    min-height: 38px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #49645c;
    background: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 160ms ease;
}

.refresh-button:hover:not(:disabled) {
    background: #fff;
}

.refresh-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.refresh-button svg {
    width: 16px;
    height: 16px;
}

.refresh-button.is-loading svg {
    animation: spin 1s linear infinite;
}

.page-footer {
    margin-top: 30px;
    color: #9aa39f;
    text-align: center;
    font-size: 10px;
}

.noscript-message {
    padding: 16px;
    color: #8e4d43;
    background: #fff1ed;
    border-radius: 12px;
    text-align: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    50% { opacity: 0.4; }
}

@media (max-width: 950px) {
    .page-shell {
        padding: 27px;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .secondary-cards {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: none;
    }

    .metric-card {
        min-height: 255px;
    }
}

@media (max-width: 600px) {
    .page-shell {
        padding: 19px 15px;
    }

    .brand__mark {
        width: 39px;
        height: 39px;
    }

    .brand strong {
        font-size: 14px;
    }

    .status-pill {
        padding: 8px 10px;
        font-size: 10px;
    }

    .intro {
        margin: 42px 3px 25px;
        display: block;
    }

    h1 {
        font-size: 40px;
    }

    .intro__date {
        margin: 12px 0 0;
        font-size: 12px;
    }

    .outdoor-panel {
        padding: 22px 18px 18px;
        border-radius: 26px;
    }

    .outdoor-reading__value {
        font-size: 91px;
    }

    .outdoor-reading__unit {
        padding-top: 9px;
        font-size: 24px;
    }

    .temperature-summary {
        justify-content: space-between;
        gap: 15px;
    }

    .chart-section {
        padding: 15px 10px 8px;
        border-radius: 18px;
    }

    .chart-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .chart-header h2 {
        margin-left: 5px;
    }

    .range-switcher {
        width: 100%;
    }

    .range-switcher button {
        flex: 1;
        padding: 7px 5px;
    }

    .main-chart,
    #main-chart {
        height: 200px;
        min-height: 200px;
    }

    .secondary-cards {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .metric-card {
        min-height: 260px;
        padding: 23px;
        border-radius: 24px;
    }

    .metric-reading--pressure {
        display: flex;
    }

    .metric-reading--pressure .metric-reading__unit {
        max-width: 70px;
        margin-top: 0;
        padding-top: 4px;
    }

    .update-bar {
        align-items: flex-start;
    }

    .update-bar p {
        max-width: 210px;
        line-height: 1.5;
    }

    .refresh-button {
        width: 39px;
        padding: 0;
        flex: 0 0 auto;
    }

    .refresh-button span {
        display: none;
    }
}

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