:root {
    color-scheme: dark;
    --page-bg: #06101d;
    --page-bg-deep: #040b14;
    --surface: #0d1c2e;
    --surface-raised: #11243a;
    --surface-hover: #142a43;
    --border: rgba(148, 180, 211, 0.18);
    --border-accent: rgba(76, 175, 255, 0.3);
    --text: #f3f8fc;
    --text-secondary: #9db0c5;
    --accent: #59b9f5;
    --accent-soft: rgba(89, 185, 245, 0.12);
    --online: #4fd18b;
    --warning: #e5c452;
    --error: #f07182;
    --shadow-card: 0 14px 34px rgba(0, 0, 0, 0.2);
    --shadow-hero: 0 26px 66px rgba(0, 0, 0, 0.3);
    --radius-large: 28px;
    --radius-card: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page-bg);
}

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(40, 121, 181, 0.16), transparent 34rem),
        radial-gradient(circle at 90% 20%, rgba(40, 95, 155, 0.12), transparent 30rem),
        linear-gradient(180deg, var(--page-bg) 0%, var(--page-bg-deep) 100%);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    content: "";
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.app-shell {
    width: min(1440px, calc(100% - 64px));
    margin-inline: auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 32px 0 28px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 100%;
    min-width: 0;
}

.brand > div:last-child {
    min-width: 0;
}

.brand-mark {
    display: grid;
    flex: 0 0 50px;
    height: 50px;
    place-items: center;
    border: 1px solid var(--border-accent);
    border-radius: 15px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #e8f6ff;
    background: var(--accent-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 3px;
    overflow-wrap: anywhere;
    font-size: clamp(1.3rem, 1.8vw, 1.7rem);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.location,
.status-details,
.hero-update,
.section-heading > p,
.card-caption {
    color: var(--text-secondary);
}

.location {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.88rem;
}

.topbar-status {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 8px 24px rgba(0, 0, 0, 0.12);
}

.status-pill::before {
    width: 8px;
    height: 8px;
    content: "";
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.status-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.74rem;
    line-height: 1.35;
    text-align: right;
}

main {
    padding-top: 32px;
}

.hero {
    position: relative;
    display: grid;
    min-height: 370px;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    align-items: center;
    gap: 40px;
    overflow: hidden;
    padding: clamp(40px, 5vw, 76px);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-large);
    background:
        radial-gradient(circle at 80% 42%, rgba(89, 185, 245, 0.14), transparent 25rem),
        linear-gradient(135deg, #112c46 0%, #0b1b2d 72%);
    box-shadow: var(--shadow-hero);
}

.hero::after {
    position: absolute;
    right: -110px;
    bottom: -260px;
    width: 520px;
    height: 520px;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.hero-content {
    position: relative;
    z-index: 2;
    min-width: 0;
}

.hero h2 {
    margin-bottom: 6px;
    font-size: clamp(1rem, 1.7vw, 1.25rem);
    font-weight: 600;
    color: #c3d6e8;
}

.hero-temperature {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 100%;
    margin: 12px 0 22px;
    line-height: 0.88;
}

#temp {
    min-width: 0;
    font-size: clamp(5.5rem, 10vw, 9rem);
    font-weight: 760;
    letter-spacing: -0.075em;
}

.hero-unit {
    padding-top: 10px;
    font-size: clamp(1.5rem, 2.8vw, 2.4rem);
    font-weight: 650;
    color: #c9ecff;
}

.hero-update {
    margin: 0;
    font-size: 0.88rem;
}

.hero-visual {
    position: relative;
    display: grid;
    min-height: 220px;
    place-items: center;
    min-width: 0;
}

.weather-condition {
    isolation: isolate;
}

.weather-condition__icon {
    position: relative;
    z-index: 2;
    display: grid;
    width: clamp(155px, 16vw, 205px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    font-size: clamp(4.3rem, 7vw, 6.4rem);
    background: rgba(255, 255, 255, 0.07);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 22px 56px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(10px);
}

.weather-condition__label {
    position: relative;
    z-index: 2;
    margin: 18px 0 0;
    font-size: 0.86rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    color: #d8efff;
}

.weather-symbol {
    position: absolute;
    display: block;
}

.weather-symbol--sun,
.weather-symbol--moon,
.weather-symbol--cloud {
    top: 50%;
    left: 50%;
    translate: -50% -50%;
}

.weather-symbol--sun {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background:
        radial-gradient(circle, #fff6c8 0 28%, #ffd363 58%, #ffb84d 100%);
    box-shadow:
        0 0 28px rgba(255, 206, 88, 0.42),
        0 0 56px rgba(255, 180, 60, 0.22);
    animation: weather-sun-spin 28s linear infinite;
}

.weather-symbol--sun::before,
.weather-symbol--sun::after {
    position: absolute;
    inset: -16px;
    content: "";
    border-radius: inherit;
    background:
        linear-gradient(#ffd978, #ffd978) 50% 0 / 5px 14px no-repeat,
        linear-gradient(#ffd978, #ffd978) 50% 100% / 5px 14px no-repeat,
        linear-gradient(90deg, #ffd978, #ffd978) 0 50% / 14px 5px no-repeat,
        linear-gradient(90deg, #ffd978, #ffd978) 100% 50% / 14px 5px no-repeat;
    opacity: 0.78;
}

.weather-symbol--sun::after {
    transform: rotate(45deg);
    opacity: 0.46;
}

.weather-symbol--sun-small {
    top: 42px;
    left: 42px;
    width: 68px;
    height: 68px;
}

.weather-symbol--moon {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: #e5efff;
    box-shadow:
        inset -24px -10px 0 #9fb6cf,
        0 0 34px rgba(181, 213, 255, 0.28);
}

.weather-symbol--moon::after {
    position: absolute;
    top: 18px;
    right: 24px;
    width: 10px;
    height: 10px;
    content: "";
    border-radius: 50%;
    background: rgba(89, 112, 138, 0.32);
    box-shadow:
        -28px 16px 0 rgba(89, 112, 138, 0.22),
        -4px 38px 0 rgba(89, 112, 138, 0.2);
}

.weather-symbol--cloud {
    width: 112px;
    height: 48px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f4f9ff, #b8cbe0);
    box-shadow:
        0 16px 28px rgba(0, 0, 0, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    animation: weather-cloud-float 5s ease-in-out infinite;
}

.weather-symbol--cloud::before,
.weather-symbol--cloud::after {
    position: absolute;
    content: "";
    border-radius: 50%;
    background: inherit;
}

.weather-symbol--cloud::before {
    left: 18px;
    bottom: 20px;
    width: 48px;
    height: 48px;
}

.weather-symbol--cloud::after {
    right: 20px;
    bottom: 15px;
    width: 62px;
    height: 62px;
}

.weather-symbol--rain-cloud {
    top: 72px;
}

.weather-symbol--rain {
    top: 122px;
    left: 50%;
    width: 76px;
    height: 54px;
    transform: translateX(-50%);
}

.weather-symbol--rain::before,
.weather-symbol--rain::after {
    position: absolute;
    inset: 0;
    content: "";
    background:
        linear-gradient(var(--accent), var(--accent)) 8px 0 / 3px 20px no-repeat,
        linear-gradient(var(--accent), var(--accent)) 36px 8px / 3px 20px no-repeat,
        linear-gradient(var(--accent), var(--accent)) 64px 0 / 3px 20px no-repeat;
    border-radius: 999px;
    opacity: 0.9;
    transform: skewX(-14deg);
    animation: weather-rain-fall 900ms linear infinite;
}

.weather-symbol--rain::after {
    animation-delay: 450ms;
    opacity: 0.45;
}

.weather-condition--night .weather-condition__icon {
    background: rgba(150, 179, 213, 0.08);
}

.weather-condition--sunny .weather-condition__icon,
.weather-condition--partly-cloudy .weather-condition__icon {
    background: rgba(255, 205, 91, 0.1);
}

.weather-condition--rain .weather-condition__icon {
    background: rgba(84, 184, 255, 0.1);
}

.weather-glow {
    position: absolute;
    width: 230px;
    height: 110px;
    border-radius: 50%;
    background: rgba(84, 184, 255, 0.18);
    filter: blur(42px);
}

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

@keyframes weather-cloud-float {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes weather-rain-fall {
    from {
        background-position:
            8px -22px,
            36px -14px,
            64px -22px;
    }

    to {
        background-position:
            8px 38px,
            36px 46px,
            64px 38px;
    }
}

.weather-status {
    margin: 20px 0 32px;
    padding: 9px 14px;
    border: 1px solid currentColor;
    border-radius: 12px;
    font-size: 0.76rem;
    font-weight: 650;
    line-height: 1.4;
    opacity: 0.84;
}

.weather-status.status-online {
    opacity: 0.65;
}

.metrics-section {
    padding: 14px 0 48px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.section-heading > div {
    min-width: 0;
}

.section-heading h2 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 2.5vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.section-heading > p {
    max-width: 420px;
    margin-bottom: 2px;
    font-size: 0.82rem;
    text-align: right;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.weather-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 196px;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: linear-gradient(145deg, var(--surface-raised), var(--surface));
    box-shadow: var(--shadow-card);
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease;
}

.weather-card::after {
    position: absolute;
    right: -44px;
    bottom: -54px;
    width: 126px;
    height: 126px;
    content: "";
    border-radius: 50%;
    background: rgba(84, 184, 255, 0.045);
}

.weather-card:hover {
    z-index: 1;
    transform: translateY(-3px);
    border-color: var(--border-accent);
    background: linear-gradient(145deg, var(--surface-hover), var(--surface));
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

.card-heading {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.card-icon {
    display: grid;
    flex: 0 0 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(84, 184, 255, 0.12);
    border-radius: 10px;
    font-size: 1rem;
    color: #dbf3ff;
    background: var(--accent-soft);
}

.weather-card__label {
    overflow-wrap: anywhere;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #bfd0e0;
}

.weather-card__reading {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
    margin-top: auto;
    padding-top: 24px;
}

.weather-card__value {
    min-width: 0;
    font-size: clamp(2.15rem, 3.4vw, 3rem);
    font-weight: 760;
    line-height: 1;
    letter-spacing: -0.055em;
}

.weather-card__unit {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.2;
    color: var(--text-secondary);
}

.card-caption {
    position: relative;
    z-index: 1;
    margin: 9px 0 0;
    overflow-wrap: anywhere;
    font-size: 0.72rem;
    line-height: 1.4;
}

.measurement-insight {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.rain-current {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 12px;
    color: var(--text-secondary);
}

.rain-current__label {
    font-size: 0.68rem;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rain-current__value {
    font-size: 1.15rem;
    font-weight: 750;
    color: var(--text);
}

.rain-current__unit {
    font-size: 0.72rem;
}

.measurement-insight__label {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid rgba(148, 180, 211, 0.16);
    border-radius: 999px;
    overflow-wrap: anywhere;
    font-size: 0.72rem;
    font-weight: 750;
    line-height: 1.25;
    color: #d9e8f5;
    background: rgba(255, 255, 255, 0.045);
}

.measurement-insight__bar {
    position: relative;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 180, 211, 0.14);
}

.measurement-insight__bar::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--meter-width, 18%);
    content: "";
    border-radius: inherit;
    background: var(--meter-color, var(--accent));
    box-shadow: 0 0 12px color-mix(in srgb, var(--meter-color, var(--accent)) 45%, transparent);
}

.rain-card::before,
.uv-card::before,
.solar-card::before {
    position: absolute;
    right: 20px;
    top: 78px;
    z-index: 0;
    width: 70px;
    height: 70px;
    content: "";
    border-radius: 50%;
    opacity: 0.34;
    pointer-events: none;
}

.rain-card::before {
    background:
        radial-gradient(circle at 30% 30%, rgba(111, 199, 255, 0.44), transparent 0.42rem),
        radial-gradient(circle at 62% 54%, rgba(111, 199, 255, 0.32), transparent 0.38rem),
        radial-gradient(circle at 44% 76%, rgba(111, 199, 255, 0.25), transparent 0.34rem);
}

.uv-card::before {
    border: 1px solid rgba(255, 213, 100, 0.26);
    background:
        radial-gradient(circle, rgba(255, 214, 93, 0.22), transparent 62%),
        conic-gradient(from 0deg, transparent, rgba(255, 214, 93, 0.32), transparent);
}

.solar-card::before {
    background:
        radial-gradient(circle, rgba(84, 184, 255, 0.24), transparent 64%),
        linear-gradient(135deg, transparent 42%, rgba(84, 184, 255, 0.22) 43% 57%, transparent 58%);
}

.level-unknown {
    --meter-width: 12%;
    --meter-color: var(--text-secondary);
}

.level-low {
    --meter-width: 20%;
    --meter-color: var(--online);
}

.level-moderate {
    --meter-width: 40%;
    --meter-color: #8fd7ff;
}

.level-high {
    --meter-width: 62%;
    --meter-color: var(--accent);
}

.level-very-high {
    --meter-width: 82%;
    --meter-color: var(--warning);
}

.level-extreme {
    --meter-width: 100%;
    --meter-color: var(--error);
}

.wind-card {
    grid-column: span 2;
    min-height: 264px;
    border-color: var(--border-accent);
    background:
        radial-gradient(circle at 82% 45%, rgba(89, 185, 245, 0.1), transparent 15rem),
        linear-gradient(145deg, #142d47, var(--surface));
}

.wind-card__content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(24px, 4vw, 56px);
    margin-top: 20px;
}

.wind-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(18px, 3vw, 40px);
}

.wind-value {
    min-width: 0;
}

.wind-value + .wind-value {
    padding-left: clamp(18px, 3vw, 40px);
    border-left: 1px solid var(--border);
}

.wind-value__label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.wind-card .weather-card__reading {
    margin-top: 9px;
    padding-top: 0;
}

.wind-direction {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wind-compass {
    position: relative;
    display: grid;
    flex: 0 0 116px;
    width: 116px;
    height: 116px;
    place-items: center;
    overflow: visible;
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    background:
        linear-gradient(90deg, transparent 49%, var(--border) 50%, transparent 51%),
        linear-gradient(transparent 49%, var(--border) 50%, transparent 51%),
        rgba(5, 16, 29, 0.42);
    box-shadow:
        inset 0 0 24px rgba(89, 185, 245, 0.08),
        0 12px 28px rgba(0, 0, 0, 0.13);
}

.wind-compass::after {
    position: absolute;
    inset: 12px;
    content: "";
    border: 1px solid rgba(148, 180, 211, 0.12);
    border-radius: 50%;
}

.wind-compass__point {
    position: absolute;
    z-index: 3;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-secondary);
}

.wind-compass__point--north {
    top: 7px;
    color: var(--accent);
}

.wind-compass__point--east {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

.wind-compass__point--south {
    bottom: 7px;
}

.wind-compass__point--west {
    top: 50%;
    left: 7px;
    transform: translateY(-50%);
}

.wind-compass__needle {
    position: absolute;
    inset: 10px;
    z-index: 2;
    opacity: 0.38;
    transform: rotate(0deg);
    transform-origin: 50% 50%;
    transition: transform 400ms ease, opacity 180ms ease;
}

.wind-compass__needle::before {
    position: absolute;
    top: 8px;
    left: 50%;
    content: "";
    width: 3px;
    height: calc(50% - 8px);
    border-radius: 999px;
    background: linear-gradient(to bottom, #c9edff, var(--accent));
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgba(84, 184, 255, 0.45);
}

.wind-compass__needle::after {
    position: absolute;
    top: 2px;
    left: 50%;
    content: "";
    border-right: 6px solid transparent;
    border-bottom: 11px solid var(--accent);
    border-left: 6px solid transparent;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 5px rgba(84, 184, 255, 0.45));
}

.wind-compass__needle.has-direction {
    opacity: 1;
}

.wind-compass__center {
    position: relative;
    z-index: 4;
    width: 11px;
    height: 11px;
    border: 2px solid #dff5ff;
    border-radius: 50%;
    background: var(--surface-raised);
}

.wind-direction__reading {
    display: flex;
    min-width: 52px;
    flex-direction: column;
}

.wind-direction__text {
    font-size: 1.35rem;
    font-weight: 750;
    color: var(--text);
}

.wind-direction__degrees {
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-online,
.status-pill.is-online {
    color: var(--online);
    background: rgba(79, 209, 139, 0.1);
}

.status-warning {
    color: var(--warning);
    background: rgba(229, 196, 82, 0.085);
}

.status-error,
.status-pill.is-offline {
    color: var(--error);
    background: rgba(240, 113, 130, 0.1);
}

.app-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 22px 0 34px;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
}

.app-footer span + span::before {
    margin-right: 10px;
    content: "\00b7";
}

@media (max-width: 1100px) {
    .app-shell {
        width: min(100% - 48px, 1100px);
    }

    .weather-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .app-shell {
        width: min(100% - 32px, 840px);
    }

    .topbar {
        align-items: flex-start;
        gap: 24px;
    }

    .topbar-status {
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
    }

    .hero {
        min-height: 320px;
        grid-template-columns: minmax(0, 1fr) minmax(170px, 0.42fr);
        gap: 24px;
        padding: 40px;
    }

    #temp {
        font-size: clamp(4.8rem, 13vw, 7.5rem);
    }

    .weather-condition__icon {
        width: clamp(138px, 20vw, 170px);
    }

    .weather-symbol--sun {
        width: 70px;
        height: 70px;
    }

    .weather-symbol--moon {
        width: 78px;
        height: 78px;
    }

    .weather-symbol--cloud {
        width: 100px;
        height: 44px;
    }

    .weather-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .wind-card {
        grid-column: span 2;
    }

    .wind-card__content {
        gap: 24px;
    }

    .wind-values {
        gap: 20px;
    }

    .wind-value + .wind-value {
        padding-left: 20px;
    }
}

@media (max-width: 600px) {
    .app-shell {
        width: min(100% - 24px, 560px);
    }

    .topbar {
        flex-direction: column;
        gap: 20px;
        padding: 22px 0;
    }

    .topbar-status {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 12px;
    }

    .status-details {
        width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
        text-align: left;
    }

    main {
        padding-top: 24px;
    }

    .hero {
        min-height: 360px;
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 32px 24px;
        border-radius: 22px;
    }

    #temp {
        font-size: clamp(4.2rem, 22vw, 6.2rem);
    }

    .hero-visual {
        min-height: 170px;
        opacity: 0.72;
        transform: none;
    }

    .weather-condition__icon {
        width: 132px;
    }

    .weather-condition__label {
        margin-top: 12px;
        font-size: 0.78rem;
    }

    .weather-status {
        margin-bottom: 26px;
        line-height: 1.4;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section-heading > p {
        max-width: none;
        text-align: left;
    }

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

    .weather-card {
        min-height: 166px;
        padding: 21px;
    }

    .weather-card__value {
        font-size: clamp(2rem, 11vw, 2.7rem);
    }

    .measurement-insight__label {
        white-space: normal;
    }

    .rain-current {
        flex-wrap: wrap;
    }

    .wind-card {
        grid-column: auto;
        min-height: 0;
    }

    .wind-card__content {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .wind-values {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .wind-value + .wind-value {
        padding-left: 16px;
    }

    .wind-direction {
        justify-content: space-between;
        padding-top: 18px;
        border-top: 1px solid var(--border);
    }

    .wind-compass {
        flex-basis: 104px;
        width: 104px;
        height: 104px;
    }

    .app-footer {
        flex-direction: column;
        gap: 4px;
    }

    .app-footer span + span::before {
        content: none;
    }
}

@media (max-width: 420px) {
    .app-shell {
        width: min(100% - 20px, 400px);
    }

    .topbar-status {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-details {
        text-align: left;
    }

    .hero {
        min-height: 335px;
        padding: 28px 20px;
    }

    .hero-temperature {
        gap: 7px;
    }

    #temp {
        font-size: clamp(3.7rem, 21vw, 5.4rem);
    }

    .hero-unit {
        padding-top: 7px;
        font-size: 1.35rem;
    }

    .weather-condition__icon {
        width: 112px;
    }

    .weather-symbol--sun {
        width: 58px;
        height: 58px;
    }

    .weather-symbol--moon {
        width: 64px;
        height: 64px;
    }

    .weather-symbol--cloud {
        width: 86px;
        height: 38px;
    }

    .weather-symbol--cloud::before {
        left: 14px;
        bottom: 16px;
        width: 40px;
        height: 40px;
    }

    .weather-symbol--cloud::after {
        right: 16px;
        bottom: 12px;
        width: 50px;
        height: 50px;
    }

    .weather-card {
        padding: 19px;
    }

    .weather-card__reading {
        gap: 5px;
    }

    .weather-card__unit {
        font-size: 0.74rem;
    }

    .wind-values {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .wind-value + .wind-value {
        padding-top: 16px;
        padding-left: 0;
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .wind-direction {
        align-items: flex-start;
        gap: 12px;
    }

    .wind-compass {
        flex-basis: 92px;
        width: 92px;
        height: 92px;
    }

    .wind-direction__text {
        font-size: 1.18rem;
    }

    .rain-current {
        gap: 5px;
    }

    .measurement-insight {
        margin-top: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .weather-card,
    .weather-symbol--sun,
    .weather-symbol--cloud,
    .weather-symbol--rain::before,
    .weather-symbol--rain::after {
        transition: none;
        animation: none;
    }
}

.history-section { margin-top: 48px; }
.today-summary { margin: 0 0 48px; }
.today-summary__heading { margin-bottom: 20px; }
.today-summary__grid { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); gap: 14px; }
.today-stat { position: relative; display: flex; min-width: 0; min-height: 154px; flex-direction: column; padding: 20px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg, var(--surface-raised), var(--surface)); box-shadow: var(--shadow-card); }
.today-stat__icon { position: absolute; top: 17px; right: 18px; font-size: 1.15rem; color: var(--accent); opacity: .8; }
.today-stat__label { padding-right: 28px; font-size: .68rem; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; color: var(--text-secondary); }
.today-stat__value { margin-top: auto; font-size: clamp(1.45rem, 2.5vw, 2rem); letter-spacing: -.04em; }
.today-stat small, .today-stat__split small { margin-top: 5px; font-size: .66rem; color: var(--text-secondary); }
.today-stat__split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: auto; }
.today-stat__split > div { display: flex; min-width: 0; flex-direction: column; }
.today-stat__split > div + div { padding-left: 14px; border-left: 1px solid var(--border); }
.today-stat__split span { font-size: .63rem; font-weight: 700; color: var(--text-secondary); }
.today-stat__split strong { margin-top: 5px; font-size: clamp(1.15rem, 2.1vw, 1.55rem); letter-spacing: -.035em; }
.trend-indicator { display: inline-flex; width: fit-content; max-width: 100%; align-items: center; margin: 10px 0 0; padding: 5px 9px; border: 1px solid rgba(148,180,211,.16); border-radius: 999px; overflow-wrap: anywhere; font-size: .66rem; font-weight: 720; line-height: 1.3; color: var(--text-secondary); background: rgba(255,255,255,.035); }
.trend-indicator--up { border-color: rgba(89,185,245,.28); color: #8fd7ff; background: rgba(89,185,245,.08); }
.trend-indicator--down { border-color: rgba(229,196,82,.25); color: #ead36f; background: rgba(229,196,82,.07); }
.trend-indicator--steady { color: var(--text-secondary); }
.trend-indicator--loading { opacity: .72; }
.hero .trend-indicator { position: relative; z-index: 2; margin-top: 14px; }
.weather-card > .trend-indicator { position: relative; z-index: 1; margin-top: 14px; }
.today-stat > .trend-indicator { margin-top: 8px; }
.history-heading { align-items: flex-end; margin-bottom: 26px; }
.history-ranges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.history-controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.history-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.history-metric { min-height: 38px; padding: 8px 15px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-secondary); font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; background: var(--surface); }
.history-metric:hover, .history-metric:focus-visible { border-color: var(--border-accent); color: var(--text); outline: none; }
.history-metric.is-active { border-color: var(--border-accent); color: var(--accent); background: var(--accent-soft); }
.history-metric:disabled { border-color: var(--border); color: var(--text-secondary); cursor: not-allowed; background: rgba(255,255,255,.02); opacity: .38; }
.history-calendar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin: 0; color: var(--text-secondary); font-size: .78rem; font-weight: 700; }
.history-calendar select, .history-calendar__button { min-height: 36px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); font: inherit; background: var(--surface); }
.history-calendar select { padding: 6px 30px 6px 10px; }
.history-calendar__button { padding: 7px 12px; cursor: pointer; }
.history-calendar__button:hover, .history-calendar__button:focus-visible { border-color: var(--border-accent); color: var(--accent); outline: none; }
.history-range { min-height: 36px; padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-secondary); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; background: rgba(255,255,255,.035); }
.history-range:hover, .history-range:focus-visible { border-color: var(--border-accent); color: var(--text); outline: none; }
.history-range.is-active { border-color: var(--accent); color: #06101d; background: var(--accent); }
.history-card { overflow: hidden; padding: clamp(20px,3vw,32px); border: 1px solid var(--border); border-radius: var(--radius-card); background: linear-gradient(145deg,var(--surface-raised),var(--surface)); box-shadow: var(--shadow-card); }
.history-summary { display: flex; flex-wrap: wrap; gap: 28px; margin-bottom: 22px; }
.history-summary > div { display: flex; flex-direction: column; gap: 3px; }
.history-summary__label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.history-summary strong { font-size: 1.15rem; }
.history-legend { display: flex; flex-wrap: wrap; gap: 18px; margin: -8px 0 16px; color: var(--text-secondary); font-size: .76rem; font-weight: 700; }
.history-legend[hidden] { display: none; }
.history-legend__item { display: inline-flex; align-items: center; gap: 7px; }
.history-legend__swatch { width: 24px; height: 4px; border-radius: 999px; background: var(--legend-color); }
.history-legend__swatch--area { height: 10px; opacity: .65; }
.history-chart { min-height: 280px; border-radius: 12px; background: rgba(4,11,20,.34); }
.history-chart--scrollable { overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.history-chart--scrollable svg { max-width: none; }
.history-chart svg { display: block; width: 100%; height: auto; min-height: 280px; }
.history-grid-line { stroke: rgba(157,176,197,.14); stroke-width: 1; }
.history-axis-label { fill: var(--text-secondary); font-size: 12px; }
.history-area { fill: url(#historyArea); }
.history-line { fill: none; stroke: var(--history-color, var(--accent)); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.history-secondary-line { fill: none; stroke: var(--history-secondary-color, #38bdf8); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .82; }
.history-bar { fill: var(--history-color, #38bdf8); opacity: .78; }
.history-bar:hover { opacity: 1; }
.history-message { display: grid; min-height: 280px; margin: 0; place-items: center; padding: 24px; text-align: center; color: var(--text-secondary); }
.history-status { margin: 12px 0 0; font-size: .78rem; color: var(--text-secondary); }
.history-records { margin-top: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
.history-records__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 26px; border-bottom: 1px solid var(--border); }
.history-records__heading h3 { margin: 0; font-size: 1.15rem; }
.history-records__heading > span { font-size: .75rem; color: var(--text-secondary); }
.history-records__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.history-record { min-width: 0; padding: 20px 26px; background: var(--surface); }
.history-record__title { margin: 0 0 14px; font-size: .78rem; font-weight: 750; color: var(--text-secondary); }
.history-record__values { display: flex; flex-wrap: wrap; gap: 18px; }
.history-record__value { display: flex; min-width: 110px; flex: 1; flex-direction: column; gap: 4px; }
.history-record__label { font-size: .65rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.history-record__number { font-size: 1.08rem; font-weight: 780; color: var(--text); }
.history-record__date { font-size: .7rem; color: var(--text-secondary); }
.history-records__loading { grid-column: 1 / -1; margin: 0; padding: 24px 26px; color: var(--text-secondary); background: var(--surface); }
@media (max-width: 700px) {
    .today-summary { margin-bottom: 34px; }
    .today-summary__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .today-stat { min-height: 142px; padding: 16px; }
    .today-stat--temperature { grid-column: 1 / -1; }
    .today-stat__value { font-size: clamp(1.25rem, 6vw, 1.7rem); }
    .history-section { margin-top: 34px; }
    .history-heading { align-items: flex-start; }
    .history-ranges { justify-content: flex-start; }
    .history-controls { flex-direction: column; align-items: stretch; gap: 14px; }
    .history-calendar { justify-content: flex-start; }
    .history-metric { flex: 1 0 auto; }
    .history-calendar label { flex-basis: auto; }
    .history-range { flex: 1 0 auto; }
    .history-summary { justify-content: space-between; gap: 12px; }
    .history-chart, .history-chart svg, .history-message { min-height: 230px; }
    .history-records__heading { align-items: flex-start; flex-direction: column; padding: 18px; }
    .history-records__grid { grid-template-columns: 1fr; }
    .history-record { padding: 18px; }
}

@media (max-width: 479px) {
    .today-summary__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .today-stat:last-child { grid-column: 1 / -1; }
}

@media (max-width: 380px) {
    .today-summary__grid { grid-template-columns: 1fr; }
    .today-stat--temperature { grid-column: auto; }
    .today-stat:last-child { grid-column: auto; }
}

/* Mobile dashboard refinement */
@media (max-width: 600px) {
    .topbar {
        gap: 16px;
        padding-top: 72px;
        padding-bottom: 18px;
    }

    .brand {
        align-items: flex-start;
    }

    .brand-mark {
        flex: 0 0 auto;
    }

    .brand h1 {
        font-size: clamp(1.25rem, 6vw, 1.65rem);
        line-height: 1.15;
    }

    .location {
        overflow-wrap: anywhere;
    }

    .topbar-status {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: 10px 14px;
    }

    .status-pill {
        min-height: 38px;
        justify-content: center;
    }

    .status-details {
        align-self: center;
        font-size: 0.68rem;
    }

    main {
        padding-top: 18px;
    }

    .hero {
        min-height: 250px;
        grid-template-columns: minmax(0, 1fr) 112px;
        align-items: center;
        gap: 12px;
        padding: 28px 22px;
    }

    .hero-content {
        min-width: 0;
    }

    .hero h2 {
        font-size: clamp(1.25rem, 6vw, 1.7rem);
    }

    #temp {
        font-size: clamp(4rem, 21vw, 5.5rem);
    }

    .hero-unit {
        font-size: 1.25rem;
    }

    .hero-update {
        max-width: 18rem;
        overflow-wrap: anywhere;
        font-size: 0.72rem;
        line-height: 1.45;
    }

    .hero-visual {
        min-height: 130px;
        opacity: 0.82;
    }

    .weather-condition__icon {
        width: 104px;
    }

    .weather-condition__label {
        max-width: 112px;
        margin-top: 8px;
        font-size: 0.68rem;
        line-height: 1.3;
        text-align: center;
    }

    .weather-status {
        margin: 14px 0 24px;
        padding: 10px 13px;
        font-size: 0.74rem;
    }

    .section-heading {
        margin-bottom: 18px;
    }

    .weather-card {
        min-height: 150px;
        padding: 19px;
    }

    .card-caption {
        font-size: 0.68rem;
    }

    .history-heading {
        gap: 14px;
        margin-bottom: 16px;
    }

    .history-ranges,
    .history-metrics {
        width: calc(100% + 24px);
        margin-right: -12px;
        margin-left: -12px;
        padding: 2px 12px 8px;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .history-range,
    .history-metric {
        min-height: 42px;
        flex: 0 0 auto;
        scroll-snap-align: start;
        touch-action: manipulation;
    }

    .history-controls {
        gap: 10px;
    }

    .history-calendar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px 10px;
    }

    .history-calendar select,
    .history-calendar__button {
        min-height: 42px;
    }

    .history-calendar__button {
        grid-column: 1 / -1;
        width: 100%;
        touch-action: manipulation;
    }

    .history-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 18px;
    }

    .history-card {
        padding: 18px 14px;
    }

    .history-chart,
    .history-chart svg,
    .history-message {
        min-height: 210px;
    }

    .history-axis-label {
        font-size: 10px;
    }

    .history-record__values {
        gap: 14px;
    }

    .history-record__value {
        min-width: 100px;
    }
}

@media (min-width: 480px) and (max-width: 600px) {
    .weather-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wind-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 420px) {
    .hero {
        min-height: 230px;
        grid-template-columns: minmax(0, 1fr) 88px;
        padding: 24px 18px;
    }

    #temp {
        font-size: clamp(3.65rem, 20vw, 4.8rem);
    }

    .weather-condition__icon {
        width: 84px;
    }

    .weather-condition__label {
        max-width: 88px;
        font-size: 0.62rem;
    }

    .wind-direction {
        align-items: center;
    }

    .history-record__values {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
