/* Shared tokens — Dark glass (default) */
:root,
html[data-theme="dark"] {
    --bg: #070b14;
    --bg-2: #0d1526;
    --text: #eef3ff;
    --muted: #9aa8c7;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-strong: rgba(255, 255, 255, 0.09);
    --border: rgba(255, 255, 255, 0.12);
    --accent: #6ec8ff;
    --accent-2: #7ef0c3;
    --accent-chip-text: #061018;
    --warn: #ffb454;
    --danger: #ff6b7a;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --radius: 22px;
    --font: "Outfit", system-ui, -apple-system, Segoe UI, sans-serif;
    --font-display: "Outfit", system-ui, sans-serif;
    --loading-bg: rgba(7, 11, 20, 0.92);
    --panel-soft: rgba(255, 255, 255, 0.03);
    --panel-soft-border: rgba(255, 255, 255, 0.06);
    --track: rgba(255, 255, 255, 0.08);
    --compass-ring: rgba(255, 255, 255, 0.14);
    --compass-inner: rgba(255, 255, 255, 0.03);
    --compass-stroke: rgba(110, 200, 255, 0.2);
    --needle-glow: drop-shadow(0 0 6px rgba(110, 200, 255, 0.55));
    --hum-ring: #7ef0c3;
    --chip-hover: rgba(255, 255, 255, 0.06);
    --group-bg: rgba(255, 255, 255, 0.03);
    --backdrop: rgba(0, 0, 0, 0.45);
    --error-border: rgba(255, 107, 122, 0.35);
    --error-bg: rgba(255, 70, 90, 0.12);
    --error-text: #ffd3d8;
    --brand-mark: radial-gradient(circle at 30% 30%, #fff6, transparent 40%),
        linear-gradient(135deg, #5bb8ff, #6b5cff 55%, #2ad4a4);
    --brand-shadow: 0 8px 24px rgba(80, 140, 255, 0.35);
    --sky: radial-gradient(1200px 700px at 15% -10%, rgba(80, 140, 255, 0.28), transparent 55%),
        radial-gradient(900px 600px at 85% 0%, rgba(90, 60, 180, 0.22), transparent 50%),
        radial-gradient(700px 500px at 50% 100%, rgba(20, 90, 120, 0.18), transparent 45%),
        linear-gradient(180deg, #0a1222 0%, #070b14 45%, #05080f 100%);
    --sky-day: radial-gradient(1100px 700px at 20% -5%, rgba(120, 190, 255, 0.35), transparent 55%),
        radial-gradient(800px 500px at 90% 10%, rgba(255, 190, 90, 0.18), transparent 50%),
        radial-gradient(700px 500px at 40% 110%, rgba(60, 180, 160, 0.12), transparent 45%),
        linear-gradient(180deg, #163057 0%, #0c1830 50%, #070b14 100%);
    --theme-color: #070b14;
    --blur: 18px;
    --card-radius: 22px;
}

/* Clean light meteorological station */
html[data-theme="light"] {
    --bg: #e8eef5;
    --bg-2: #f4f7fb;
    --text: #132033;
    --muted: #5a6b82;
    --glass: rgba(255, 255, 255, 0.82);
    --glass-strong: #ffffff;
    --border: rgba(19, 32, 51, 0.12);
    --accent: #1f6feb;
    --accent-2: #0f9d8a;
    --accent-chip-text: #ffffff;
    --warn: #c47a00;
    --danger: #c62828;
    --shadow: 0 12px 28px rgba(19, 40, 70, 0.08);
    --font: "Source Sans 3", system-ui, -apple-system, Segoe UI, sans-serif;
    --font-display: "Source Sans 3", system-ui, sans-serif;
    --loading-bg: rgba(232, 238, 245, 0.96);
    --panel-soft: rgba(19, 32, 51, 0.03);
    --panel-soft-border: rgba(19, 32, 51, 0.08);
    --track: rgba(19, 32, 51, 0.1);
    --compass-ring: rgba(19, 32, 51, 0.18);
    --compass-inner: rgba(31, 111, 235, 0.04);
    --compass-stroke: rgba(31, 111, 235, 0.35);
    --needle-glow: drop-shadow(0 0 4px rgba(31, 111, 235, 0.35));
    --hum-ring: #0f9d8a;
    --chip-hover: rgba(19, 32, 51, 0.06);
    --group-bg: rgba(255, 255, 255, 0.7);
    --backdrop: rgba(19, 32, 51, 0.35);
    --error-border: rgba(198, 40, 40, 0.35);
    --error-bg: rgba(198, 40, 40, 0.08);
    --error-text: #8b1e1e;
    --brand-mark: radial-gradient(circle at 30% 30%, #fff8, transparent 40%),
        linear-gradient(135deg, #1f6feb, #0f9d8a);
    --brand-shadow: 0 8px 20px rgba(31, 111, 235, 0.25);
    --sky: linear-gradient(180deg, #d9e6f5 0%, #e8eef5 40%, #f2f5f9 100%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            rgba(19, 32, 51, 0.03) 39px,
            rgba(19, 32, 51, 0.03) 40px
        );
    --sky-day: linear-gradient(180deg, #cfe0f4 0%, #e8eef5 45%, #f7f9fc 100%);
    --theme-color: #e8eef5;
    --blur: 8px;
    --card-radius: 14px;
    --radius: 14px;
}

/* Warm farm-inspired */
html[data-theme="farm"] {
    --bg: #1a2418;
    --bg-2: #243022;
    --text: #f3efe4;
    --muted: #b7c0a6;
    --glass: rgba(48, 62, 40, 0.72);
    --glass-strong: rgba(58, 74, 48, 0.9);
    --border: rgba(212, 176, 90, 0.22);
    --accent: #d4b05a;
    --accent-2: #7cb070;
    --accent-chip-text: #1a2418;
    --warn: #e0a04a;
    --danger: #e07a6a;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --font: "Outfit", system-ui, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --loading-bg: rgba(26, 36, 24, 0.94);
    --panel-soft: rgba(212, 176, 90, 0.06);
    --panel-soft-border: rgba(212, 176, 90, 0.14);
    --track: rgba(243, 239, 228, 0.12);
    --compass-ring: rgba(212, 176, 90, 0.35);
    --compass-inner: rgba(124, 176, 112, 0.08);
    --compass-stroke: rgba(212, 176, 90, 0.4);
    --needle-glow: drop-shadow(0 0 6px rgba(212, 176, 90, 0.45));
    --hum-ring: #7cb070;
    --chip-hover: rgba(243, 239, 228, 0.08);
    --group-bg: rgba(0, 0, 0, 0.18);
    --backdrop: rgba(10, 14, 8, 0.5);
    --error-border: rgba(224, 122, 106, 0.4);
    --error-bg: rgba(224, 122, 106, 0.12);
    --error-text: #ffd4cc;
    --brand-mark: radial-gradient(circle at 30% 30%, #fff5, transparent 40%),
        linear-gradient(135deg, #7cb070, #d4b05a 60%, #5a7a40);
    --brand-shadow: 0 8px 24px rgba(124, 176, 112, 0.3);
    --sky: radial-gradient(1000px 600px at 10% -5%, rgba(124, 176, 112, 0.22), transparent 55%),
        radial-gradient(800px 500px at 90% 5%, rgba(212, 176, 90, 0.16), transparent 50%),
        linear-gradient(180deg, #243022 0%, #1a2418 50%, #121810 100%);
    --sky-day: radial-gradient(1000px 600px at 20% 0%, rgba(212, 176, 90, 0.2), transparent 55%),
        radial-gradient(700px 500px at 80% 10%, rgba(124, 176, 112, 0.18), transparent 50%),
        linear-gradient(180deg, #2e3c28 0%, #1a2418 55%, #121810 100%);
    --theme-color: #1a2418;
    --blur: 14px;
    --card-radius: 18px;
    --radius: 18px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.4;
    transition: background-color 0.35s ease, color 0.25s ease;
}

body {
    position: relative;
    overflow-x: hidden;
}

.sky-wash {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--sky);
    transition: background 0.45s ease, opacity 0.45s ease;
}

body.is-day .sky-wash {
    background: var(--sky-day);
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: var(--loading-bg);
    backdrop-filter: blur(12px);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loading-screen.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
}

.loading-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.03em;
}

.loading-message {
    margin: 0.4rem 0 1.2rem;
    color: var(--muted);
}

.loading-bar {
    width: min(280px, 70vw);
    height: 4px;
    border-radius: 99px;
    background: var(--track);
    overflow: hidden;
}

.loading-bar span {
    display: block;
    width: 40%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    animation: loadSlide 1.1s ease-in-out infinite;
}

@keyframes loadSlide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.error-banner {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin: 0.75rem 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--error-border);
    border-radius: 14px;
    background: var(--error-bg);
    color: var(--error-text);
}

.error-banner[hidden] {
    display: none !important;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.1rem 1.25rem 0.5rem;
}

.brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--brand-mark);
    box-shadow: var(--brand-shadow);
}

.brand h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.5vw, 1.55rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.meta {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.unit-group,
.range-group {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--group-bg);
}

.theme-group {
    border-color: var(--accent);
}

.chip {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
    color: var(--text);
    background: var(--chip-hover);
}

.chip.active,
.unit-chip.active,
.range-chip.active,
.records-tab.active,
.theme-chip.active {
    color: var(--accent-chip-text);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.chip-accent {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--panel-soft);
}

.dashboard {
    display: grid;
    gap: 1rem;
    padding: 0.5rem 1.25rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.glass {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
}

html[data-theme="light"] .glass {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.hero {
    display: grid;
    grid-template-columns: auto 1.2fr 0.8fr;
    gap: 1.25rem;
    padding: 1.4rem 1.5rem;
    align-items: center;
}

html[data-theme="light"] .hero {
    border-top: 3px solid var(--accent);
}

.hero-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
}

.thermo {
    width: 52px;
    height: 150px;
}

.thermo-shell {
    fill: var(--panel-soft);
    stroke: var(--border);
    stroke-width: 1.5;
}

.thermo-fill {
    fill: url(#thermoGrad);
    transition: y 0.45s ease, height 0.45s ease;
}

.thermo-bulb {
    fill: var(--glass-strong);
    stroke: var(--border);
    stroke-width: 1.5;
}

.thermo-bulb-inner {
    fill: url(#thermoGrad);
}

.thermo-ticks line {
    stroke: var(--muted);
    stroke-width: 1.2;
}

.gauge-split {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
}

.baro-gauge,
.uv-gauge {
    width: 140px;
    max-width: 100%;
    height: auto;
}

.baro-track,
.uv-track,
.astro-path,
.wind-speed-arc {
    fill: none;
    stroke: var(--track);
    stroke-width: 8;
    stroke-linecap: round;
}

.baro-arc,
.uv-arc {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 176;
    stroke-dashoffset: 176;
    transition: stroke-dashoffset 0.45s ease;
}

.uv-arc {
    stroke: url(#) var(--warn);
    stroke: var(--warn);
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
}

.baro-ticks line,
.compass-ticks line,
.ring-ticks line {
    stroke: var(--muted);
    stroke-width: 1.4;
}

.gauge-caption {
    fill: var(--muted);
    font-size: 8px;
    font-family: var(--font);
}

.needle-hub {
    fill: var(--text);
}

.compass-ring-soft {
    fill: none;
    stroke: var(--panel-soft-border);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}

.rain-instrument {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.85rem;
    align-items: stretch;
}

.rain-columns {
    display: flex;
    gap: 0.35rem;
    align-items: flex-end;
    height: 110px;
}

.rain-col {
    width: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

.rain-col-fill {
    width: 100%;
    height: 0%;
    min-height: 2px;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    box-shadow: inset 0 0 0 1px var(--border);
    transition: height 0.45s ease;
}

.rain-col span {
    color: var(--muted);
    font-size: 0.65rem;
}

.vert-meter {
    display: grid;
    grid-template-columns: 18px auto;
    gap: 0.35rem;
    height: 110px;
}

.vert-meter-track {
    position: relative;
    width: 18px;
    height: 100%;
    border-radius: 99px;
    background: var(--track);
    border: 1px solid var(--border);
    overflow: hidden;
}

.vert-meter-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    border-radius: inherit;
    transition: height 0.45s ease;
}

.vert-meter-fill.solar {
    background: linear-gradient(180deg, #ffd36a, #ff8f4a);
}

.vert-meter-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.65rem;
    padding: 0.1rem 0;
}

.astro-arc {
    width: 100%;
    height: 58px;
    margin-bottom: 0.55rem;
}

.sun-marker {
    fill: #ffd36a;
    stroke: #ff8f4a;
    stroke-width: 1.5;
    filter: drop-shadow(0 0 6px rgba(255, 180, 70, 0.55));
    transition: cx 0.5s ease, cy 0.5s ease;
}

.moon-marker {
    fill: #dfe7ff;
    stroke: var(--accent);
    stroke-width: 1;
    transition: cx 0.5s ease, cy 0.5s ease;
}

.uv-legacy {
    margin-top: 0.55rem;
}

.wind-speed-arc {
    stroke: var(--accent-2);
    stroke-width: 4;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    transition: stroke-dashoffset 0.45s ease;
    opacity: 0.85;
}

.condition {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    text-transform: capitalize;
}

.temp-row {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    margin: 0.2rem 0;
}

.temp-value {
    font-family: var(--font-display);
    font-size: clamp(4.2rem, 12vw, 7rem);
    font-weight: 300;
    letter-spacing: -0.05em;
    line-height: 0.95;
}

html[data-theme="farm"] .temp-value {
    font-weight: 500;
    letter-spacing: -0.03em;
}

html[data-theme="light"] .temp-value {
    font-weight: 600;
    letter-spacing: -0.04em;
}

.temp-unit {
    margin-top: 0.85rem;
    font-size: 1.6rem;
    color: var(--muted);
}

.feels {
    margin: 0.2rem 0 0.8rem;
    color: var(--muted);
}

.hi-lo {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--muted);
}

.hi-lo strong,
.metric-meta strong,
.rain-grid strong,
.astro-grid strong,
.wind-nums strong {
    color: var(--text);
    font-weight: 600;
}

.hero-side {
    display: grid;
    gap: 0.75rem;
    align-content: center;
}

.stat-pill {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: var(--glass-strong);
    border: 1px solid var(--panel-soft-border);
}

.stat-pill .label,
.label,
.card-sub {
    color: var(--muted);
    font-size: 0.82rem;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

html[data-theme="light"] .metrics {
    gap: 0.75rem;
}

.card {
    position: relative;
    overflow: hidden;
    grid-column: span 3;
    padding: 1rem 1.1rem 1.15rem;
    min-height: 190px;
}

.card > *:not(.fx) {
    position: relative;
    z-index: 1;
}

.wind-card,
.sun-card {
    grid-column: span 3;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.card-head h2,
.charts-head h2,
.chart-panel h3,
.drawer-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

html[data-theme="light"] .card-head h2,
html[data-theme="light"] .charts-head h2,
html[data-theme="light"] .chart-panel h3 {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.78rem;
}

.metric-big {
    margin: 0.2rem 0 0.55rem;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 500;
    letter-spacing: -0.03em;
}

.metric-meta,
.rain-grid,
.astro-grid,
.wind-nums {
    display: grid;
    gap: 0.55rem 0.85rem;
}

.metric-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    color: var(--muted);
    font-size: 0.88rem;
}

.rain-grid,
.astro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rain-grid strong,
.astro-grid strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 1.15rem;
}

.wind-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.9rem;
    align-items: center;
}

.wind-compass {
    width: 112px;
    height: 112px;
}

.compass-ring {
    fill: none;
    stroke: var(--compass-ring);
    stroke-width: 2;
}

.compass-inner {
    fill: var(--compass-inner);
    stroke: var(--compass-stroke);
    stroke-width: 1;
}

.compass-label {
    fill: var(--muted);
    font-size: 8px;
    font-family: var(--font);
}

.needle {
    fill: var(--accent);
    filter: var(--needle-glow);
    transition: transform 0.4s ease;
}

.wind-nums {
    grid-template-columns: 1fr;
}

.wind-nums strong {
    display: block;
    font-size: 1.2rem;
}

.ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0.3rem auto 0;
}

.ring {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.ring-bg,
.ring-fg {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
}

.ring-bg {
    stroke: var(--track);
}

.ring-fg {
    stroke-dasharray: 301.6;
    stroke-dashoffset: 301.6;
    transition: stroke-dashoffset 0.5s ease;
}

.ring-fg.hum {
    stroke: var(--hum-ring);
}

.ring-value {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
}

.ring-value strong {
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1;
}

.ring-value span {
    color: var(--muted);
    font-size: 0.85rem;
}

.bar-track {
    margin-top: 0.85rem;
    height: 8px;
    border-radius: 99px;
    background: var(--track);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    transition: width 0.45s ease;
}

.bar-fill.solar {
    background: linear-gradient(90deg, #ffd36a, #ff8f4a);
}

.bar-fill.uv {
    background: linear-gradient(90deg, var(--hum-ring), #ffd36a 45%, var(--danger));
}

.charts {
    padding: 1rem 1.15rem 1.25rem;
}

.charts-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.chart-panel {
    padding: 0.85rem;
    border-radius: 18px;
    background: var(--panel-soft);
    border: 1px solid var(--panel-soft-border);
}

.chart-panel canvas {
    width: 100% !important;
    max-height: 220px;
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
}

.drawer.is-open {
    pointer-events: auto;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: var(--backdrop);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.drawer.is-open .drawer-backdrop {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(420px, 100%);
    height: 100%;
    padding: 1rem;
    border-radius: 0;
    border-left: 1px solid var(--border);
    transform: translateX(105%);
    transition: transform 0.28s ease;
    overflow: auto;
}

.drawer.is-open .drawer-panel {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.records-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.records-body {
    display: grid;
    gap: 0.65rem;
}

.record-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    background: var(--panel-soft);
    border: 1px solid var(--panel-soft-border);
}

.record-row .label {
    display: block;
    margin-bottom: 0.15rem;
}

.record-row .when {
    color: var(--muted);
    font-size: 0.78rem;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.25rem 1.25rem 1.4rem;
    color: var(--muted);
    font-size: 0.8rem;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1100px) {
    .card {
        grid-column: span 4;
    }
}

@media (max-width: 860px) {
    .hero {
        grid-template-columns: auto 1fr;
    }

    .hero-side {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .card,
    .wind-card,
    .sun-card {
        grid-column: span 6;
    }

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

@media (max-width: 560px) {
    .topbar,
    .dashboard,
    .footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .card,
    .wind-card,
    .sun-card {
        grid-column: span 12;
    }

    .unit-group {
        display: none;
    }

    .theme-group,
    .unit-group:nth-of-type(2),
    .unit-group:nth-of-type(3) {
        display: inline-flex;
    }
}

/* ---- Ambient instrument FX (visible but non-obstructive) ---- */
.fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    border-radius: inherit;
    opacity: 1;
}

.fx-wind span {
    position: absolute;
    left: -35%;
    height: 2px;
    width: 32%;
    border-radius: 99px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 6px rgba(31, 111, 235, 0.35);
    opacity: 0.55;
    animation: windDash 2.8s linear infinite;
}

html[data-theme="light"] .fx-wind span {
    height: 2.5px;
    opacity: 0.7;
    background: linear-gradient(90deg, transparent, #1f6feb, #5aa2ff, transparent);
    box-shadow: 0 0 8px rgba(31, 111, 235, 0.35);
}

.fx-wind span:nth-child(1) { top: 20%; animation-duration: 2.4s; width: 26%; }
.fx-wind span:nth-child(2) { top: 36%; animation-delay: -0.6s; animation-duration: 3.1s; opacity: 0.45; }
.fx-wind span:nth-child(3) { top: 52%; animation-delay: -1.2s; width: 38%; }
.fx-wind span:nth-child(4) { top: 66%; animation-delay: -1.8s; animation-duration: 2.6s; opacity: 0.4; }
.fx-wind span:nth-child(5) { top: 80%; animation-delay: -0.3s; width: 22%; }

.wind-card.fx-strong .fx-wind span { opacity: 0.85; animation-duration: 1.8s; }
.wind-card.fx-calm .fx-wind span { opacity: 0.35; animation-duration: 4.2s; }

@keyframes windDash {
    0% { transform: translateX(0); opacity: 0; }
    10% { opacity: 0.75; }
    70% { opacity: 0.45; }
    100% { transform: translateX(420%); opacity: 0; }
}

.fx-steam span {
    position: absolute;
    bottom: 8%;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08) 55%, transparent 70%);
    filter: blur(1.5px);
    animation: steamRise 3.6s ease-out infinite;
    opacity: 0;
}

html[data-theme="light"] .fx-steam span {
    background: radial-gradient(circle, rgba(80, 130, 170, 0.45), rgba(120, 160, 190, 0.12) 55%, transparent 72%);
    filter: blur(1px);
}

.fx-steam span:nth-child(1) { left: 16%; animation-delay: 0s; }
.fx-steam span:nth-child(2) { left: 38%; animation-delay: -0.9s; width: 28px; height: 28px; }
.fx-steam span:nth-child(3) { left: 56%; animation-delay: -1.7s; }
.fx-steam span:nth-child(4) { left: 72%; animation-delay: -2.4s; width: 16px; height: 16px; }

.humidity-card.fx-strong .fx-steam span { filter: blur(1px); }
.humidity-card.fx-calm .fx-steam span { animation-duration: 5.2s; }

@keyframes steamRise {
    0% { transform: translateY(8px) scale(0.55); opacity: 0; }
    20% { opacity: 0.7; }
    100% { transform: translateY(-105px) scale(1.55); opacity: 0; }
}

.fx-flex {
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px transparent;
    animation: pressureFlex 3.6s ease-in-out infinite;
}

.pressure-card.fx-high .fx-flex {
    animation-name: pressureStrainHigh;
    animation-duration: 2.4s;
}

.pressure-card.fx-low .fx-flex {
    animation-name: pressureStrainLow;
    animation-duration: 2.8s;
}

.pressure-card.fx-mid .fx-flex {
    animation-duration: 3s;
}

@keyframes pressureFlex {
    0%, 100% {
        box-shadow: inset 0 0 0 1px transparent, 0 0 0 0 transparent;
    }
    50% {
        box-shadow:
            inset 0 0 0 2px rgba(31, 111, 235, 0.35),
            0 0 0 3px rgba(31, 111, 235, 0.08),
            0 0 18px rgba(31, 111, 235, 0.18);
    }
}

@keyframes pressureStrainHigh {
    0%, 100% {
        box-shadow: inset 0 0 0 1px transparent, 0 0 0 0 transparent;
        transform: scale(1);
    }
    35% {
        box-shadow:
            inset 0 0 0 2px rgba(220, 60, 60, 0.55),
            0 0 0 3px rgba(220, 60, 60, 0.12),
            0 0 22px rgba(220, 60, 60, 0.22);
        transform: scale(1.012);
    }
    55% { transform: scale(0.996); }
}

@keyframes pressureStrainLow {
    0%, 100% {
        box-shadow: inset 0 0 0 1px transparent;
        transform: scale(1);
    }
    50% {
        box-shadow:
            inset 0 0 18px rgba(31, 111, 235, 0.2),
            inset 0 0 0 2px rgba(31, 111, 235, 0.4);
        transform: scale(0.988);
    }
}

.fx-rain span {
    position: absolute;
    top: -14%;
    width: 3px;
    height: 14px;
    border-radius: 99px;
    background: linear-gradient(180deg, transparent, #3d8bfd 35%, #1f6feb);
    opacity: 0.55;
    animation: rainFall 1.5s linear infinite;
}

html[data-theme="dark"] .fx-rain span,
html[data-theme="farm"] .fx-rain span {
    background: linear-gradient(180deg, transparent, var(--accent));
}

.fx-rain span:nth-child(1) { left: 12%; animation-delay: 0s; }
.fx-rain span:nth-child(2) { left: 24%; animation-delay: -0.25s; height: 10px; }
.fx-rain span:nth-child(3) { left: 36%; animation-delay: -0.55s; }
.fx-rain span:nth-child(4) { left: 48%; animation-delay: -0.1s; height: 16px; }
.fx-rain span:nth-child(5) { left: 60%; animation-delay: -0.9s; }
.fx-rain span:nth-child(6) { left: 70%; animation-delay: -0.4s; height: 9px; }
.fx-rain span:nth-child(7) { left: 80%; animation-delay: -1.15s; }
.fx-rain span:nth-child(8) { left: 90%; animation-delay: -0.7s; height: 12px; }

.rain-card.fx-dry .fx-rain { opacity: 0.45; }
.rain-card.fx-dry .fx-rain span { animation-duration: 2.4s; opacity: 0.4; }
.rain-card.fx-wet .fx-rain { opacity: 1; }
.rain-card.fx-wet .fx-rain span { animation-duration: 0.95s; opacity: 0.75; }

@keyframes rainFall {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    12% { opacity: 0.7; }
    100% { transform: translateY(150px) translateX(-10px); opacity: 0; }
}

.fx-solar .glow {
    position: absolute;
    width: 120px;
    height: 120px;
    right: -18px;
    top: -24px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 196, 70, 0.55), rgba(255, 160, 40, 0.18) 45%, transparent 70%);
    animation: solarPulse 2.4s ease-in-out infinite;
}

.fx-solar .ray {
    position: absolute;
    right: 34px;
    top: 28px;
    width: 3px;
    height: 42px;
    transform-origin: bottom center;
    background: linear-gradient(180deg, rgba(255, 170, 40, 0.9), rgba(255, 170, 40, 0.15), transparent);
    border-radius: 99px;
    animation: solarRay 2.8s ease-in-out infinite;
}

.fx-solar .ray:nth-child(1) { transform: rotate(-55deg); animation-delay: 0s; }
.fx-solar .ray:nth-child(2) { transform: rotate(-32deg); animation-delay: -0.3s; height: 48px; }
.fx-solar .ray:nth-child(3) { transform: rotate(-10deg); animation-delay: -0.6s; }
.fx-solar .ray:nth-child(4) { transform: rotate(12deg); animation-delay: -0.9s; height: 46px; }
.fx-solar .ray:nth-child(5) { transform: rotate(34deg); animation-delay: -1.2s; }
.fx-solar .ray:nth-child(6) { transform: rotate(56deg); animation-delay: -1.5s; height: 36px; }

.solar-card.fx-warm .fx-solar .glow {
    background: radial-gradient(circle, rgba(255, 170, 50, 0.6), transparent 70%);
}
.solar-card.fx-hot .fx-solar .glow {
    background: radial-gradient(circle, rgba(255, 90, 40, 0.62), rgba(255, 140, 40, 0.25) 40%, transparent 70%);
    animation-duration: 1.4s;
}
.solar-card.fx-hot .fx-solar .ray {
    background: linear-gradient(180deg, rgba(255, 70, 30, 0.95), rgba(255, 120, 40, 0.35), transparent);
    animation-duration: 1.8s;
    width: 3.5px;
}
.solar-card.fx-dim .fx { opacity: 0.35; }

@keyframes solarPulse {
    0%, 100% { transform: scale(0.88); opacity: 0.55; }
    50% { transform: scale(1.18); opacity: 1; }
}

@keyframes solarRay {
    0%, 100% { opacity: 0.25; filter: brightness(1); }
    50% { opacity: 0.95; filter: brightness(1.35); }
}

.fx-uv {
    background:
        radial-gradient(circle at 80% 20%, rgba(255, 90, 60, 0.18), transparent 45%),
        radial-gradient(circle at 20% 80%, rgba(255, 200, 60, 0.12), transparent 40%);
    opacity: 0;
}

.uv-card.fx-mid .fx-uv {
    animation: uvMeltSoft 7s ease-in-out infinite;
}

.uv-card.fx-high .fx-uv {
    animation: uvMelt 4.5s ease-in-out infinite;
}

.uv-card.fx-high {
    animation: uvWarble 4.5s ease-in-out infinite;
}

.uv-card.fx-extreme .fx-uv {
    animation: uvMelt 2.8s ease-in-out infinite;
}

.uv-card.fx-extreme {
    animation: uvWarble 2.8s ease-in-out infinite;
}

@keyframes uvMeltSoft {
    0%, 78%, 100% { opacity: 0; filter: blur(0); transform: scaleY(1); }
    84% {
        opacity: 0.35;
        filter: blur(1px);
        transform: scaleY(1.02) skewX(-0.8deg);
    }
    90% { opacity: 0.2; filter: blur(1.5px); }
}

@keyframes uvMelt {
    0%, 68%, 100% {
        opacity: 0;
        filter: blur(0);
        transform: scaleY(1);
    }
    76% {
        opacity: 0.7;
        filter: blur(1.5px);
        transform: scaleY(1.04) skewX(-1.5deg);
        background:
            radial-gradient(circle at 70% 30%, rgba(255, 70, 40, 0.4), transparent 50%),
            linear-gradient(180deg, rgba(255, 160, 40, 0.2), transparent 60%);
    }
    84% {
        opacity: 0.45;
        filter: blur(2.5px);
        transform: scaleY(1.06) skewX(1.8deg);
    }
}

@keyframes uvWarble {
    0%, 68%, 100% { border-color: var(--border); }
    76% { border-color: rgba(220, 60, 60, 0.7); }
    84% { border-color: rgba(255, 160, 50, 0.65); }
}

@media (prefers-reduced-motion: reduce) {
    .fx,
    .fx span,
    .fx .ray,
    .fx .glow,
    .uv-card.fx-high,
    .uv-card.fx-extreme,
    .uv-card.fx-mid,
    .pressure-card .fx-flex {
        animation: none !important;
        opacity: 0 !important;
    }
}
