/* Midway Weather — fixed 1920×1080 Raspberry Pi kiosk display. */
:root {
    --sky-top: #021b39;
    --sky-mid: #04385c;
    --sky-bottom: #07577b;
    --page-glow: rgba(16, 119, 157, 0.26);
    --accent: #ffc849;
    --accent-bright: #ffd86a;
    --accent-soft: rgba(255, 200, 73, 0.15);
    --sparkline-color: #ffc849;
    --sparkline-fill: rgba(255, 200, 73, 0.12);
    --hero-glow: rgba(255, 195, 63, 0.14);
    --ink: #f8fbff;
    --ink-dim: #c7d7e8;
    --ink-faint: #8ea8c1;
    --tile-top: rgba(21, 91, 130, 0.54);
    --tile-bottom: rgba(2, 42, 73, 0.76);
    --tile-bg: linear-gradient(145deg, var(--tile-top), var(--tile-bottom));
    --tile-bg-soft: linear-gradient(145deg, rgba(28, 104, 145, 0.45), rgba(3, 47, 79, 0.64));
    --tile-bd: rgba(145, 204, 234, 0.24);
    --tile-shadow: rgba(0, 12, 28, 0.18);
    --header-glow: rgba(35, 134, 174, 0.13);
    --hero-bg-start: rgba(19, 92, 130, 0.66);
    --hero-bg-end: rgba(2, 42, 72, 0.88);
    --hero-shadow: rgba(0, 15, 32, 0.24);
    --primary-bg-start: rgba(16, 91, 132, 0.72);
    --primary-bg-end: rgba(2, 41, 72, 0.88);
    --forecast-bg: linear-gradient(145deg, rgba(15, 76, 112, 0.68), rgba(3, 43, 73, 0.82));
    --forecast-card-bg: linear-gradient(150deg, rgba(48, 114, 151, 0.34), rgba(4, 48, 78, 0.36));
    --forecast-today-bg: linear-gradient(150deg, rgba(255, 200, 73, 0.16), rgba(14, 62, 90, 0.58));
    --forecast-card-bd: rgba(148, 203, 231, 0.1);
    --hero-stat-bg: linear-gradient(150deg, rgba(69, 130, 159, 0.3), rgba(4, 45, 75, 0.25));
    --hero-stat-bd: rgba(139, 201, 232, 0.13);
    --metric-icon: var(--accent);
    --weather-icon: var(--accent);
    --trend-bg: rgba(79, 139, 173, 0.28);
    --status-bg: linear-gradient(145deg, rgba(12, 70, 107, 0.7), rgba(2, 34, 65, 0.68));
    --status-bd: rgba(153, 210, 239, 0.38);
    --map-frame: rgba(255, 255, 255, 0.34);
    --tile-highlight: rgba(255, 255, 255, 0.06);
    --ok: #59dc8d;
    --warn: #ffc849;
    --bad: #ff8d82;
    --rain: #55c8ff;
    --radius: 20px;
    --gap: 16px;
    --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html[data-theme="clear-night"] {
    --sky-top: #010d25;
    --sky-mid: #05254a;
    --sky-bottom: #063d65;
    --accent: #ffd069;
}
html[data-theme="rain"] {
    --sky-top: #031629;
    --sky-mid: #073652;
    --sky-bottom: #07506c;
    --rain: #70d3ff;
}
html[data-theme="overcast"] {
    --sky-top: #071b31;
    --sky-mid: #0c3a55;
    --sky-bottom: #145873;
}
html[data-theme="hot"] {
    --sky-top: #031b38;
    --sky-mid: #073a5d;
    --sky-bottom: #086080;
    --accent: #ffc849;
    --accent-soft: rgba(255, 188, 54, 0.18);
}

/* Current-temperature moods coordinate every major chrome surface while
   leaving layout, map tiles, and semantic state colors untouched. */
html[data-temperature-mood="frigid"] {
    --sky-top: #02060d;
    --sky-mid: #0a1725;
    --sky-bottom: #172e3e;
    --page-glow: rgba(116, 205, 239, 0.2);
    --header-glow: rgba(211, 245, 255, 0.12);
    --accent: #d9f4ff;
    --accent-bright: #ffffff;
    --accent-soft: rgba(196, 239, 255, 0.2);
    --sparkline-color: #a9edff;
    --sparkline-fill: rgba(144, 226, 255, 0.2);
    --hero-glow: rgba(217, 247, 255, 0.2);
    --tile-top: rgba(35, 61, 80, 0.86);
    --tile-bottom: rgba(5, 17, 29, 0.96);
    --tile-bg-soft: linear-gradient(145deg, rgba(43, 70, 88, 0.78), rgba(7, 24, 38, 0.93));
    --tile-bd: rgba(190, 229, 244, 0.5);
    --tile-shadow: rgba(0, 4, 14, 0.52);
    --hero-bg-start: rgba(42, 72, 91, 0.94);
    --hero-bg-end: rgba(3, 14, 26, 0.98);
    --hero-shadow: rgba(0, 4, 15, 0.58);
    --primary-bg-start: rgba(38, 69, 90, 0.92);
    --primary-bg-end: rgba(4, 18, 31, 0.98);
    --forecast-bg: linear-gradient(145deg, rgba(30, 55, 74, 0.94), rgba(4, 17, 29, 0.98));
    --forecast-card-bg: linear-gradient(150deg, rgba(61, 89, 106, 0.52), rgba(10, 29, 43, 0.72));
    --forecast-today-bg: linear-gradient(150deg, rgba(172, 226, 246, 0.22), rgba(21, 48, 64, 0.86));
    --forecast-card-bd: rgba(198, 232, 245, 0.22);
    --hero-stat-bg: linear-gradient(150deg, rgba(87, 113, 127, 0.4), rgba(9, 27, 40, 0.5));
    --hero-stat-bd: rgba(200, 233, 245, 0.26);
    --metric-icon: #ddf6ff;
    --weather-icon: #f3fcff;
    --trend-bg: rgba(105, 145, 166, 0.34);
    --status-bg: linear-gradient(145deg, rgba(42, 67, 84, 0.9), rgba(5, 18, 30, 0.94));
    --status-bd: rgba(198, 231, 244, 0.48);
    --map-frame: rgba(205, 239, 250, 0.72);
    --ink-dim: #d7e5eb;
    --ink-faint: #9eb3be;
}
html[data-temperature-mood="cold"] {
    --sky-top: #06101f;
    --sky-mid: #14314c;
    --sky-bottom: #225978;
    --page-glow: rgba(83, 164, 211, 0.24);
    --header-glow: rgba(133, 199, 232, 0.15);
    --accent: #b8e2f8;
    --accent-bright: #e8f8ff;
    --accent-soft: rgba(157, 217, 247, 0.18);
    --sparkline-color: #87d9fa;
    --sparkline-fill: rgba(94, 192, 233, 0.18);
    --hero-glow: rgba(148, 215, 246, 0.17);
    --tile-top: rgba(43, 88, 119, 0.78);
    --tile-bottom: rgba(6, 31, 52, 0.94);
    --tile-bg-soft: linear-gradient(145deg, rgba(47, 95, 126, 0.7), rgba(8, 38, 61, 0.89));
    --tile-bd: rgba(160, 214, 240, 0.4);
    --tile-shadow: rgba(0, 12, 28, 0.38);
    --hero-bg-start: rgba(41, 91, 123, 0.88);
    --hero-bg-end: rgba(4, 27, 48, 0.97);
    --hero-shadow: rgba(0, 10, 26, 0.46);
    --primary-bg-start: rgba(38, 91, 125, 0.86);
    --primary-bg-end: rgba(5, 29, 50, 0.96);
    --forecast-bg: linear-gradient(145deg, rgba(31, 77, 108, 0.88), rgba(5, 29, 50, 0.95));
    --forecast-card-bg: linear-gradient(150deg, rgba(68, 121, 151, 0.46), rgba(10, 45, 69, 0.64));
    --forecast-today-bg: linear-gradient(150deg, rgba(143, 212, 242, 0.22), rgba(18, 65, 91, 0.78));
    --forecast-card-bd: rgba(175, 221, 241, 0.18);
    --hero-stat-bg: linear-gradient(150deg, rgba(77, 126, 153, 0.36), rgba(10, 42, 65, 0.42));
    --hero-stat-bd: rgba(170, 220, 242, 0.21);
    --metric-icon: #bde8fa;
    --weather-icon: #dff6ff;
    --trend-bg: rgba(76, 137, 171, 0.34);
    --status-bg: linear-gradient(145deg, rgba(33, 83, 116, 0.84), rgba(5, 28, 49, 0.91));
    --status-bd: rgba(163, 215, 240, 0.43);
    --map-frame: rgba(174, 224, 246, 0.62);
    --ink-dim: #cbdce7;
    --ink-faint: #91aabd;
}
html[data-temperature-mood="cool"] {
    --sky-top: #021c29;
    --sky-mid: #07505d;
    --sky-bottom: #0c777a;
    --page-glow: rgba(36, 202, 190, 0.24);
    --header-glow: rgba(74, 223, 210, 0.13);
    --accent: #77e2d4;
    --accent-bright: #b8fff5;
    --accent-soft: rgba(88, 224, 207, 0.18);
    --sparkline-color: #62eadf;
    --sparkline-fill: rgba(59, 219, 207, 0.18);
    --hero-glow: rgba(80, 231, 216, 0.17);
    --tile-top: rgba(24, 111, 124, 0.78);
    --tile-bottom: rgba(3, 42, 58, 0.92);
    --tile-bg-soft: linear-gradient(145deg, rgba(28, 121, 132, 0.68), rgba(3, 53, 66, 0.86));
    --tile-bd: rgba(111, 224, 216, 0.36);
    --tile-shadow: rgba(0, 30, 39, 0.34);
    --hero-bg-start: rgba(21, 119, 131, 0.88);
    --hero-bg-end: rgba(2, 37, 53, 0.96);
    --hero-shadow: rgba(0, 28, 37, 0.42);
    --primary-bg-start: rgba(19, 118, 132, 0.85);
    --primary-bg-end: rgba(2, 40, 56, 0.95);
    --forecast-bg: linear-gradient(145deg, rgba(15, 104, 117, 0.85), rgba(2, 42, 57, 0.94));
    --forecast-card-bg: linear-gradient(150deg, rgba(54, 147, 151, 0.44), rgba(5, 65, 76, 0.6));
    --forecast-today-bg: linear-gradient(150deg, rgba(100, 227, 212, 0.22), rgba(8, 82, 91, 0.76));
    --forecast-card-bd: rgba(118, 225, 216, 0.16);
    --hero-stat-bg: linear-gradient(150deg, rgba(55, 150, 153, 0.35), rgba(5, 61, 73, 0.4));
    --hero-stat-bd: rgba(114, 226, 216, 0.19);
    --metric-icon: #79eadc;
    --weather-icon: #91f2e7;
    --trend-bg: rgba(39, 146, 153, 0.34);
    --status-bg: linear-gradient(145deg, rgba(17, 104, 119, 0.84), rgba(3, 42, 58, 0.9));
    --status-bd: rgba(114, 224, 217, 0.4);
    --map-frame: rgba(106, 226, 215, 0.58);
    --ink-dim: #c8e0df;
    --ink-faint: #8fbab9;
}
html[data-temperature-mood="mild"] {
    --sky-top: #021b39;
    --sky-mid: #04385c;
    --sky-bottom: #07577b;
    --page-glow: rgba(16, 119, 157, 0.26);
    --accent: #ffc849;
    --accent-bright: #ffd86a;
    --accent-soft: rgba(255, 200, 73, 0.15);
    --sparkline-color: #ffc849;
    --sparkline-fill: rgba(255, 200, 73, 0.12);
    --hero-glow: rgba(255, 195, 63, 0.1);
    --tile-top: rgba(21, 91, 130, 0.54);
    --tile-bottom: rgba(2, 42, 73, 0.76);
    --tile-bd: rgba(145, 204, 234, 0.24);
    --tile-shadow: rgba(0, 12, 28, 0.18);
    --header-glow: rgba(35, 134, 174, 0.13);
    --hero-bg-start: rgba(19, 92, 130, 0.66);
    --hero-bg-end: rgba(2, 42, 72, 0.88);
    --hero-shadow: rgba(0, 15, 32, 0.24);
    --primary-bg-start: rgba(16, 91, 132, 0.72);
    --primary-bg-end: rgba(2, 41, 72, 0.88);
    --forecast-bg: linear-gradient(145deg, rgba(15, 76, 112, 0.68), rgba(3, 43, 73, 0.82));
    --forecast-card-bg: linear-gradient(150deg, rgba(48, 114, 151, 0.34), rgba(4, 48, 78, 0.36));
    --forecast-today-bg: linear-gradient(150deg, rgba(255, 200, 73, 0.16), rgba(14, 62, 90, 0.58));
    --forecast-card-bd: rgba(148, 203, 231, 0.1);
    --hero-stat-bg: linear-gradient(150deg, rgba(69, 130, 159, 0.3), rgba(4, 45, 75, 0.25));
    --hero-stat-bd: rgba(139, 201, 232, 0.13);
    --metric-icon: #ffc849;
    --weather-icon: #ffc849;
    --trend-bg: rgba(79, 139, 173, 0.28);
    --status-bg: linear-gradient(145deg, rgba(12, 70, 107, 0.7), rgba(2, 34, 65, 0.68));
    --status-bd: rgba(153, 210, 239, 0.38);
    --map-frame: rgba(255, 255, 255, 0.34);
    --ink-dim: #c7d7e8;
    --ink-faint: #8ea8c1;
}
html[data-temperature-mood="warm"] {
    --sky-top: #07213b;
    --sky-mid: #125071;
    --sky-bottom: #247b86;
    --page-glow: rgba(244, 183, 72, 0.22);
    --header-glow: rgba(255, 204, 96, 0.14);
    --accent: #f7ce67;
    --accent-bright: #ffe49a;
    --accent-soft: rgba(247, 197, 91, 0.2);
    --sparkline-color: #f7c85c;
    --sparkline-fill: rgba(244, 181, 65, 0.18);
    --hero-glow: rgba(251, 193, 71, 0.18);
    --tile-top: rgba(36, 105, 135, 0.76);
    --tile-bottom: rgba(7, 44, 70, 0.9);
    --tile-bg-soft: linear-gradient(145deg, rgba(43, 116, 143, 0.66), rgba(8, 53, 77, 0.83));
    --tile-bd: rgba(226, 197, 126, 0.34);
    --tile-shadow: rgba(3, 29, 43, 0.3);
    --hero-bg-start: rgba(54, 117, 140, 0.84);
    --hero-bg-end: rgba(8, 40, 65, 0.94);
    --hero-shadow: rgba(3, 25, 40, 0.38);
    --primary-bg-start: rgba(44, 112, 140, 0.82);
    --primary-bg-end: rgba(7, 42, 68, 0.94);
    --forecast-bg: linear-gradient(145deg, rgba(39, 105, 132, 0.82), rgba(7, 43, 68, 0.92));
    --forecast-card-bg: linear-gradient(150deg, rgba(74, 137, 158, 0.42), rgba(12, 62, 85, 0.58));
    --forecast-today-bg: linear-gradient(150deg, rgba(247, 199, 91, 0.25), rgba(31, 91, 105, 0.72));
    --forecast-card-bd: rgba(222, 194, 128, 0.14);
    --hero-stat-bg: linear-gradient(150deg, rgba(82, 142, 158, 0.34), rgba(14, 62, 83, 0.38));
    --hero-stat-bd: rgba(222, 194, 127, 0.17);
    --metric-icon: #f6cf70;
    --weather-icon: #ffda79;
    --trend-bg: rgba(109, 143, 151, 0.32);
    --status-bg: linear-gradient(145deg, rgba(34, 98, 127, 0.82), rgba(7, 42, 67, 0.89));
    --status-bd: rgba(221, 194, 132, 0.38);
    --map-frame: rgba(235, 203, 132, 0.5);
    --ink-dim: #d7dbd7;
    --ink-faint: #a9b5b0;
}
html[data-temperature-mood="hot"] {
    --sky-top: #10152a;
    --sky-mid: #29384a;
    --sky-bottom: #705739;
    --page-glow: rgba(255, 157, 45, 0.29);
    --header-glow: rgba(255, 186, 61, 0.18);
    --accent: #ffbd45;
    --accent-bright: #ffe07d;
    --accent-soft: rgba(255, 167, 45, 0.24);
    --sparkline-color: #ffc044;
    --sparkline-fill: rgba(255, 156, 35, 0.23);
    --hero-glow: rgba(255, 153, 33, 0.3);
    --tile-top: rgba(65, 85, 101, 0.83);
    --tile-bottom: rgba(17, 31, 48, 0.94);
    --tile-bg-soft: linear-gradient(145deg, rgba(72, 92, 105, 0.74), rgba(23, 39, 54, 0.9));
    --tile-bd: rgba(239, 177, 83, 0.43);
    --tile-shadow: rgba(19, 12, 20, 0.4);
    --hero-bg-start: rgba(98, 92, 88, 0.9);
    --hero-bg-end: rgba(20, 29, 46, 0.97);
    --hero-shadow: rgba(31, 17, 17, 0.52);
    --primary-bg-start: rgba(76, 88, 96, 0.88);
    --primary-bg-end: rgba(18, 31, 48, 0.96);
    --forecast-bg: linear-gradient(145deg, rgba(66, 76, 86, 0.91), rgba(20, 32, 48, 0.96));
    --forecast-card-bg: linear-gradient(150deg, rgba(108, 108, 103, 0.42), rgba(34, 46, 59, 0.64));
    --forecast-today-bg: linear-gradient(150deg, rgba(255, 176, 57, 0.3), rgba(76, 68, 63, 0.76));
    --forecast-card-bd: rgba(230, 172, 91, 0.18);
    --hero-stat-bg: linear-gradient(150deg, rgba(112, 111, 103, 0.38), rgba(35, 45, 57, 0.44));
    --hero-stat-bd: rgba(235, 176, 87, 0.22);
    --metric-icon: #ffc252;
    --weather-icon: #ffd064;
    --trend-bg: rgba(131, 111, 91, 0.4);
    --status-bg: linear-gradient(145deg, rgba(66, 75, 85, 0.9), rgba(20, 31, 47, 0.94));
    --status-bd: rgba(234, 173, 85, 0.48);
    --map-frame: rgba(245, 183, 86, 0.68);
    --ink-dim: #ddd4c8;
    --ink-faint: #b3a795;
}
html[data-temperature-mood="oppressive"] {
    --sky-top: #130b19;
    --sky-mid: #381b31;
    --sky-bottom: #633b39;
    --page-glow: rgba(211, 87, 42, 0.34);
    --header-glow: rgba(255, 150, 52, 0.2);
    --accent: #f5ac3f;
    --accent-bright: #ffd66e;
    --accent-soft: rgba(242, 132, 37, 0.28);
    --sparkline-color: #ffb23f;
    --sparkline-fill: rgba(228, 104, 31, 0.27);
    --hero-glow: rgba(237, 103, 34, 0.38);
    --tile-top: rgba(86, 52, 65, 0.88);
    --tile-bottom: rgba(25, 18, 31, 0.97);
    --tile-bg-soft: linear-gradient(145deg, rgba(91, 56, 69, 0.8), rgba(29, 22, 36, 0.94));
    --tile-bd: rgba(218, 137, 76, 0.5);
    --tile-shadow: rgba(11, 4, 13, 0.58);
    --hero-bg-start: rgba(113, 59, 57, 0.95);
    --hero-bg-end: rgba(27, 16, 29, 0.99);
    --hero-shadow: rgba(10, 3, 11, 0.68);
    --primary-bg-start: rgba(96, 54, 63, 0.94);
    --primary-bg-end: rgba(26, 18, 31, 0.98);
    --forecast-bg: linear-gradient(145deg, rgba(81, 45, 57, 0.96), rgba(25, 17, 30, 0.99));
    --forecast-card-bg: linear-gradient(150deg, rgba(123, 69, 72, 0.5), rgba(43, 29, 40, 0.72));
    --forecast-today-bg: linear-gradient(150deg, rgba(241, 137, 46, 0.34), rgba(91, 50, 55, 0.86));
    --forecast-card-bd: rgba(220, 136, 76, 0.24);
    --hero-stat-bg: linear-gradient(150deg, rgba(131, 74, 75, 0.46), rgba(43, 28, 39, 0.52));
    --hero-stat-bd: rgba(224, 139, 77, 0.27);
    --metric-icon: #f7b44e;
    --weather-icon: #ffc45b;
    --trend-bg: rgba(137, 75, 74, 0.46);
    --status-bg: linear-gradient(145deg, rgba(81, 44, 57, 0.95), rgba(25, 17, 30, 0.98));
    --status-bd: rgba(222, 137, 75, 0.54);
    --map-frame: rgba(238, 153, 75, 0.76);
    --ink-dim: #dfcec7;
    --ink-faint: #b79b94;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
    width: 1920px;
    height: 1080px;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
body {
    color: var(--ink);
    font-family: var(--font);
    background:
        radial-gradient(circle at 18% 8%, var(--page-glow), transparent 32%),
        linear-gradient(155deg, var(--sky-top) 0%, var(--sky-mid) 56%, var(--sky-bottom) 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, p, dl, dd, dt, ol, li, figure { margin: 0; padding: 0; }
ol { list-style: none; }

.display {
    width: 1920px;
    height: 1080px;
    display: grid;
    grid-template-rows: 90px minmax(0, 1fr) 218px;
    gap: 14px;
    padding: 22px;
}

.tile,
.forecast {
    position: relative;
    background: var(--tile-bg);
    border: 1px solid var(--tile-bd);
    box-shadow: inset 0 1px 0 var(--tile-highlight), 0 12px 30px var(--tile-shadow);
}
.tile { border-radius: var(--radius); padding: 20px 24px; }
.tile,
.forecast,
.brand-mark,
.hero-icon,
.forecast-icon,
.metric-head .icon,
.spark-line,
.spark-area {
    transition: border-color 240ms ease, color 240ms ease, opacity 240ms ease;
}

.topbar {
    display: grid;
    grid-template-columns: 515px minmax(0, 1fr) 475px;
    align-items: center;
    gap: 24px;
    padding: 0 4px;
    background: radial-gradient(ellipse at 50% 8%, var(--header-glow), transparent 66%);
}
.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand-mark { width: 72px; height: 72px; color: var(--accent); flex: none; }
.station-name { font-size: 39px; font-weight: 700; letter-spacing: -0.025em; line-height: 1; }
.location-name { margin-top: 7px; color: var(--ink-dim); font-size: 20px; line-height: 1; }
.location-name::after { content: " · Turner Home"; color: var(--ink-dim); }
.summary {
    align-self: center;
    color: #fff;
    font-size: 29px;
    font-style: italic;
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.18;
    text-align: center;
    text-wrap: balance;
}
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 24px; }
.clock { min-width: 224px; text-align: right; line-height: 1; }
.clock-time { display: block; font-size: 50px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.025em; }
.clock-date { display: block; margin-top: 7px; color: var(--ink-dim); font-size: 18px; }
.status {
    min-width: 166px;
    min-height: 72px;
    display: grid;
    grid-template-columns: 16px 1fr;
    align-items: start;
    column-gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--status-bd);
    border-radius: 19px;
    background: var(--status-bg);
}
.status-dot { width: 15px; height: 15px; margin-top: 3px; border-radius: 50%; background: var(--ink-faint); }
.status-copy { display: flex; flex-direction: column; gap: 8px; }
.status-text { font-size: 18px; font-weight: 700; line-height: 1; text-transform: uppercase; }
.status-age { color: var(--ink-dim); font-size: 14px; line-height: 1; white-space: nowrap; }
.status[data-freshness="fresh"] .status-dot { background: var(--ok); box-shadow: 0 0 14px rgba(89, 220, 141, 0.8); }
.status[data-freshness="delayed"] .status-dot { background: var(--warn); }
.status[data-freshness="stale"] .status-dot,
.status[data-freshness="no_data"] .status-dot { background: var(--bad); }
.status[data-freshness="stale"],
.status[data-freshness="no_data"] { border-color: rgba(255, 141, 130, 0.75); }

.main {
    min-height: 0;
    display: grid;
    grid-template-columns: 520px minmax(0, 1fr) 480px;
    gap: 20px;
}

.hero {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    background:
        radial-gradient(circle at 28% 17%, var(--hero-glow), transparent 30%),
        linear-gradient(150deg, var(--hero-bg-start), var(--hero-bg-end));
    box-shadow: inset 0 1px 0 var(--tile-highlight), 0 16px 34px var(--hero-shadow);
}
.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-icon {
    width: 150px;
    height: 150px;
    flex: none;
    color: var(--weather-icon);
    filter: drop-shadow(0 0 12px var(--hero-glow));
}
.hero-reading { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.hero-temp { font-size: 148px; font-weight: 700; line-height: 0.84; letter-spacing: -0.055em; font-variant-numeric: tabular-nums; }
.hero-feels { width: 100%; margin-top: 16px; color: var(--ink); font-size: 27px; text-align: center; }
.hero-feels strong { font-weight: 700; }
.hero-trends { display: flex; flex-direction: column; gap: 8px; padding: 1px 8px; }
.hero-spark { min-height: 110px; flex: 1 1 auto; display: flex; align-items: stretch; padding: 4px 0 0; }
.hero-spark .spark { height: 100%; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 13px; border-top: 1px solid rgba(133, 200, 233, 0.16); }
.hero-stat {
    min-width: 0;
    padding: 13px 4px 11px;
    border: 1px solid var(--hero-stat-bd);
    border-radius: 14px;
    background: var(--hero-stat-bg);
    text-align: center;
}
.hero-stat dt { color: var(--ink-dim); font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.hero-stat dd { margin-top: 4px; font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.metrics {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: 1.45fr 1fr 0.92fr;
    grid-template-areas:
        "wind wind rain rain"
        "humidity pressure uv solar"
        "indoor indoor battery battery";
    gap: var(--gap);
}
.metric { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 17px 20px; }
.metric:not(.metric--wind):not(.metric--rain) { background: var(--tile-bg-soft); }
.metric--wind { grid-area: wind; }
.metric--rain { grid-area: rain; }
.metric--humidity { grid-area: humidity; }
.metric--pressure { grid-area: pressure; }
.metric--uv { grid-area: uv; }
.metric--solar { grid-area: solar; }
.metric--indoor { grid-area: indoor; }
.metric--battery { grid-area: battery; }
.metric--wind,
.metric--rain { padding: 22px 28px; background: linear-gradient(145deg, var(--primary-bg-start), var(--primary-bg-end)); }
.metric--rain::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    background: radial-gradient(ellipse at 18% 10%, rgba(112, 211, 255, 0.6), transparent 38%);
}
.metric-head { display: flex; align-items: center; gap: 10px; color: var(--ink-dim); font-size: 17px; font-weight: 700; letter-spacing: 0.055em; text-transform: uppercase; }
.metric-head .icon { width: 23px; height: 23px; color: var(--metric-icon); }
.metric--rain .metric-head .icon { color: #e8f7ff; }
.metric-body { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.metric-body--split { justify-content: space-between; }
.metric-primary { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.metric-value { font-size: 52px; font-weight: 700; line-height: 0.95; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-unit { color: var(--ink-dim); font-size: 19px; white-space: nowrap; }
.metric-tag { align-self: center; padding: 5px 11px; border-radius: 999px; color: #123552; background: var(--warn); font-size: 16px; font-weight: 700; white-space: nowrap; }
.metric-foot { min-width: 0; margin-top: auto; padding-top: 9px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.metric-subs { display: flex; gap: 24px; min-width: 0; }
.metric-subs > div { min-width: 0; display: flex; flex-direction: column; }
.metric-subs dt { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.055em; text-transform: uppercase; white-space: nowrap; }
.metric-subs dd { color: var(--ink); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-subs dd small { color: var(--ink-dim); font-size: 14px; font-weight: 500; }
.metric > .metric-subs { margin-top: auto; }
.metric--wind .metric-body { position: relative; min-height: 135px; align-items: flex-start; }
.metric--wind .metric-value,
.metric--rain .metric-value { font-size: 66px; }
.metric--wind .metric-unit { padding-top: 29px; }
.wind-copy { margin-top: 39px; }
.wind-from { color: var(--ink-dim); font-size: 20px; white-space: nowrap; }
.wind-from strong { color: var(--ink); }
.wind-compass {
    position: absolute;
    top: -22px;
    right: 0;
    width: 132px;
    height: 132px;
    border: 4px solid rgba(173, 215, 239, 0.42);
    border-radius: 50%;
}
.wind-compass::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(173, 215, 239, 0.12); border-radius: 50%; }
.wind-cardinal { position: absolute; z-index: 2; color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1; }
.wind-cardinal--n { top: -7px; left: 50%; transform: translateX(-50%); background: #0b4971; padding: 0 4px; }
.wind-cardinal--e { right: -6px; top: 50%; transform: translateY(-50%); background: #0a456c; padding: 3px 0; }
.wind-cardinal--s { bottom: -7px; left: 50%; transform: translateX(-50%); background: #063657; padding: 0 4px; }
.wind-cardinal--w { left: -8px; top: 50%; transform: translateY(-50%); background: #0b486f; padding: 3px 0; }
.wind-tick { position: absolute; width: 7px; height: 2px; background: rgba(215, 236, 247, 0.56); }
.wind-tick--ne { top: 21px; right: 21px; transform: rotate(-45deg); }
.wind-tick--se { right: 21px; bottom: 21px; transform: rotate(45deg); }
.wind-tick--sw { left: 21px; bottom: 21px; transform: rotate(-45deg); }
.wind-tick--nw { top: 21px; left: 21px; transform: rotate(45deg); }
.wind-arrow { position: absolute; z-index: 3; top: 50%; left: 50%; width: 62px; height: 62px; color: var(--accent); transform-origin: 50% 50%; }
.metric--rain .metric-body { margin-top: 25px; }
.metric--rain .metric-foot { position: relative; z-index: 1; border-top: 1px solid rgba(139, 203, 235, 0.13); padding-top: 16px; }
.metric--rain[data-raining="true"] { border-color: var(--rain); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 22px rgba(85,200,255,.12); }
.metric--humidity .metric-value,
.metric--pressure .metric-value,
.metric--uv .metric-value,
.metric--solar .metric-value { font-size: 47px; }
.metric--humidity .metric-subs,
.metric--pressure .metric-subs { gap: 9px; }
.metric--humidity .metric-foot,
.metric--pressure .metric-foot { display: block; padding-top: 6px; }
.metric--humidity .metric-foot .trend,
.metric--pressure .metric-foot .trend { margin-top: 7px; float: right; }
.metric--uv .metric-body { flex-wrap: wrap; }
.metric--solar .metric-body { flex-direction: column; align-items: flex-start; gap: 8px; }
.metric--solar .metric-unit { font-size: 18px; }
.metric--indoor { padding-right: 16px; padding-left: 16px; }
.metric--indoor .metric-body,
.metric--indoor .metric-subs {
    width: min(100%, 286px);
    align-self: center;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric--indoor .metric-body { margin-top: 9px; }
.metric--indoor .metric-primary { width: auto; }
.metric--indoor .metric-primary + .metric-primary {
    padding-left: 18px;
    border-left: 1px solid rgba(152, 205, 232, 0.3);
}
.metric--indoor .metric-subs > div { width: auto; }
.metric--indoor .metric-subs > div + div { padding-left: 18px; }
.battery-status { color: var(--ok); font-size: 38px; font-weight: 700; line-height: 1; }
.metric--battery[data-ok="false"] { border-color: var(--bad); }
.metric--battery[data-ok="false"] .battery-status { color: var(--bad); }

.rail { min-height: 0; display: flex; }
.map-tile { width: 100%; padding: 0; overflow: hidden; border-color: var(--map-frame); }
.map { width: 100%; height: 100%; border-radius: var(--radius); background: #dce7e8; }
.map::after { content: ""; position: absolute; inset: 0; z-index: 400; pointer-events: none; box-shadow: inset 0 0 24px rgba(0, 25, 49, 0.18); border-radius: var(--radius); }
.map-radar-time { position: absolute; z-index: 500; top: 8px; left: 9px; padding: 4px 8px; border-radius: 7px; color: rgba(255,255,255,.94); background: rgba(0,0,0,.52); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.map-attrib { position: absolute; z-index: 500; right: 9px; bottom: 8px; padding: 2px 7px; border-radius: 6px; color: rgba(255,255,255,.86); background: rgba(0,0,0,.46); font-size: 12px; }
.leaflet-container { background: #dce7e8; font-family: var(--font); }
.leaflet-control-attribution { display: none; }
.map-marker {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #073552;
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(1, 30, 50, 0.34);
}
.map-marker svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; }

.trend { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-dim); font-size: 20px; }
.trend-arrow { width: 22px; height: 22px; flex: none; }
.trend-label { color: var(--ink); font-weight: 700; }
.trend-delta { font-variant-numeric: tabular-nums; }
.trend-when { color: var(--ink-dim); font-size: 17px; }
.trend[data-dir="rising"] .trend-arrow { color: var(--warn); }
.trend[data-dir="falling"] .trend-arrow { color: var(--rain); }
.trend[data-dir="steady"] .trend-arrow { color: var(--ink-faint); }
.trend[data-dir="unknown"] .trend-label { color: var(--ink-faint); }
.metric-foot .trend { flex: none; gap: 5px; padding: 5px 10px; border-radius: 999px; background: var(--trend-bg); font-size: 15px; white-space: nowrap; }
.metric-foot .trend-arrow { width: 17px; height: 17px; }
.metric-foot .trend-when { display: none; }
.metric-foot .trend-delta { color: var(--ink-dim); font-size: 14px; }

.spark { width: 100%; height: 44px; display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--sparkline-color); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--sparkline-fill); stroke: none; }

.forecast { min-height: 0; display: flex; flex-direction: column; gap: 9px; padding: 14px 22px 12px; border-radius: var(--radius); background: var(--forecast-bg); }
.forecast-head { display: flex; align-items: baseline; justify-content: space-between; }
.forecast-title { color: var(--ink-dim); font-size: 20px; font-weight: 700; letter-spacing: 0.045em; text-transform: uppercase; }
.forecast-source { color: var(--ink-dim); font-size: 15px; }
.forecast-source[data-stale="true"] { color: var(--warn); }
.forecast-source[data-stale="true"]::after { content: " · stale"; }
.forecast-days { min-height: 0; flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 11px; }
.forecast-day {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr auto auto auto;
    align-items: center;
    justify-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    border: 1px solid var(--forecast-card-bd);
    border-radius: 14px;
    background: var(--forecast-card-bg);
    text-align: center;
}
.forecast-day--today { border-color: var(--accent); background: var(--forecast-today-bg); }
.forecast-dow { font-size: 19px; font-weight: 700; }
.forecast-icon { width: 48px; height: 48px; color: var(--weather-icon); }
.forecast-cond { color: var(--ink-dim); font-size: 14px; line-height: 1.05; white-space: nowrap; }
.forecast-temps { display: flex; align-items: baseline; gap: 9px; }
.forecast-hi { font-size: 28px; font-weight: 700; }
.forecast-lo { color: var(--ink-dim); font-size: 21px; }
.forecast-pop { display: inline-flex; align-items: center; gap: 4px; color: var(--rain); font-size: 15px; }
.forecast-empty { grid-column: 1 / -1; align-self: center; color: var(--ink-faint); font-size: 22px; text-align: center; }

.icon, .brand-mark, .hero-icon, .forecast-icon, .wind-arrow, .trend-arrow {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}
.icon--sm { width: 16px; height: 16px; }
.display[data-state="stale"] .hero,
.display[data-state="stale"] .metrics { opacity: 0.64; }
.demo-badge { position: fixed; z-index: 900; right: 30px; bottom: 26px; padding: 4px 9px; border-radius: 6px; color: #06283e; background: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; opacity: 0.82; }
.offline-hint { position: fixed; z-index: 950; top: 12px; left: 50%; display: none; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 999px; transform: translateX(-50%); color: #22190d; background: var(--warn); font-size: 16px; box-shadow: 0 5px 18px rgba(0,0,0,.3); }
.display[data-connection="lost"] .offline-hint { display: inline-flex; }

.install-button {
    display: none;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 216, 106, 0.52);
    border-radius: 999px;
    color: #071d30;
    background: var(--accent);
    font: 800 14px/1 var(--font);
    letter-spacing: 0.015em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 12, 28, 0.24);
}
.install-button[hidden] { display: none !important; }
.install-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.install-button:focus-visible,
.pwa-dialog-close:focus-visible {
    outline: 3px solid var(--accent-bright);
    outline-offset: 3px;
}

.pwa-dialog {
    width: min(410px, calc(100vw - 28px));
    max-width: none;
    padding: 0;
    border: 1px solid rgba(145, 204, 234, 0.34);
    border-radius: 20px;
    color: var(--ink);
    background: linear-gradient(150deg, #0b486b, #031f38 78%);
    box-shadow: 0 24px 70px rgba(0, 10, 24, 0.62);
}
.pwa-dialog::backdrop { background: rgba(0, 10, 24, 0.72); }
.pwa-dialog-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 38px;
    align-items: start;
    gap: 12px;
    padding: 20px 18px 14px;
}
.pwa-dialog-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px;
    color: var(--accent);
    background: var(--accent-soft);
}
.pwa-dialog-mark svg,
.pwa-dialog-close svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.pwa-dialog-eyebrow {
    margin: 1px 0 4px;
    color: var(--accent);
    font: 800 11px/1.2 var(--font);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.pwa-dialog h2 {
    margin: 0;
    font: 750 20px/1.2 var(--font);
    letter-spacing: -0.015em;
}
.pwa-dialog-close {
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(145, 204, 234, 0.22);
    border-radius: 50%;
    color: var(--ink-dim);
    background: rgba(2, 27, 50, 0.56);
    cursor: pointer;
}
.pwa-install-steps {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 4px 24px 16px 52px;
    color: var(--ink);
    font: 600 16px/1.45 var(--font);
}
.pwa-install-steps li::marker { color: var(--accent); font-weight: 900; }
.pwa-dialog-note {
    margin: 0;
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(145, 204, 234, 0.16);
    color: var(--ink-dim);
    background: rgba(1, 20, 39, 0.36);
    font: 500 13px/1.45 var(--font);
}

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

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE / TABLET LAYER (additive — desktop kiosk CSS above is the default
   cascade and is never edited).

   Everything above targets the fixed 1920×1080 kiosk. On the kiosk the device
   width IS 1920px, so none of the max-width queries below match there and the
   layout renders byte-identically. On phones/tablets `width=device-width`
   (see the viewport meta) makes these blocks the active layout instead.

   Strategy: release the fixed 1920×1080 shell, stack the three grid regions
   into one scrolling column, and reorder to the mobile hierarchy
     header → hero → RADAR → metric cards → forecast
   using flex `order` (visual only; DOM/source order is untouched). The
   existing card styling, gradients, theme moods, shadows, and personality are
   all preserved — this is a re-flow, not a re-skin.

   Activation breakpoint is 1024px (the conventional tablet-landscape width): it
   captures every phone in portrait AND landscape (large phones are up to ~932px
   wide when rotated) plus tablets, while the 1920-wide kiosk stays on the
   desktop cascade above. Anything from 1025px to the kiosk width is treated as
   a laptop/desktop window, which is out of scope for this appliance.
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    /* Release the fixed shell: natural page height, vertical scroll only,
       and a hard stop on any horizontal overflow (belt-and-suspenders — the
       real fixes are the width/clamp overrides below). */
    html, body {
        width: auto;
        height: auto;
        min-height: 100vh;      /* fallback for browsers without svh */
        min-height: 100svh;     /* small-viewport height: content never hidden behind the URL bar */
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-text-size-adjust: 100%;
    }

    /* .display: grid → single flex column, full width, intrinsic height. */
    .display {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100svh;
        grid-template-rows: none;
        grid-template-columns: none;
        gap: 12px;
        padding: 14px;
        /* Honour notches/rounded corners when viewport-fit=cover is active.
           max() keeps a sensible floor on rectangular phones (env == 0). */
        padding-top: max(14px, env(safe-area-inset-top));
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    /* ── Header: 3-col grid → stacked, centered, wrapping ─────────────── */
    .topbar {
        display: flex;
        flex-direction: column;
        align-items: center;
        grid-template-columns: none;
        gap: 12px;
        padding: 4px 2px 2px;
        text-align: center;
        /* Keep the subtle header glow but let it span the full width. */
        background: radial-gradient(ellipse at 50% 0%, var(--header-glow), transparent 70%);
    }
    .brand { justify-content: center; gap: 14px; width: 100%; }
    .brand-mark { width: 54px; height: 54px; }
    .brand-text { min-width: 0; }
    .station-name { font-size: clamp(1.5rem, 7vw, 2.1rem); }
    .location-name { margin-top: 4px; font-size: clamp(0.9rem, 3.6vw, 1.15rem); }
    .summary {
        order: 3;                       /* phrase sits below the clock/status row */
        font-size: clamp(1.05rem, 4.6vw, 1.6rem);
        line-height: 1.28;
        max-width: 40ch;
        overflow-wrap: break-word;      /* never let a long phrase force sideways scroll */
        word-break: break-word;
    }
    .topbar-right {
        order: 2;
        justify-content: center;
        flex-wrap: wrap;
        gap: 14px 20px;
        width: 100%;
    }
    .clock { min-width: 0; text-align: center; }
    .clock-time { font-size: clamp(2rem, 9vw, 3.1rem); }
    .clock-date { margin-top: 5px; font-size: clamp(0.85rem, 3.4vw, 1.05rem); }
    .status {
        min-width: 0;
        min-height: 0;
        align-items: center;            /* LIVE/STALE badge stays compact + visible */
        padding: 10px 14px;
    }
    .install-button:not([hidden]) { display: inline-flex; }
    .install-button { order: 1; }

    /* ── Main: 3-col grid → single flex column with mobile hierarchy ──── */
    .main {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        min-height: 0;
        gap: 12px;
    }
    .hero    { order: 1; }
    .rail    { order: 2; }              /* RADAR promoted directly under the hero */
    .metrics { order: 3; }

    /* ── Hero: keep the styling, tame the huge display type ───────────── */
    .hero { gap: 12px; padding: 18px 20px; }
    .hero-top { justify-content: center; gap: 14px; }
    .hero-icon {
        width: clamp(88px, 24vw, 132px);
        height: clamp(88px, 24vw, 132px);
    }
    .hero-temp { font-size: clamp(4.25rem, 22vw, 8.5rem); }   /* max ≥ 2×min (WCAG 1.4.4) */
    .hero-feels { margin-top: 12px; font-size: clamp(1.1rem, 4.6vw, 1.55rem); }
    .hero-spark { min-height: 88px; }
    .hero-stat dt { font-size: clamp(0.8rem, 3.2vw, 1rem); }
    .hero-stat dd { font-size: clamp(1.5rem, 7vw, 2.25rem); }

    /* ── Metrics: fixed grid-template-areas → responsive 2-col flow ───── */
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-template-areas: none;
        grid-auto-rows: auto;
        gap: 10px;
    }
    /* Neutralise the desktop grid-area assignments so cards flow naturally. */
    .metric--wind,
    .metric--rain,
    .metric--humidity,
    .metric--pressure,
    .metric--uv,
    .metric--solar,
    .metric--indoor,
    .metric--battery { grid-area: auto; }
    /* Wind & rain are the "primary" cards — let them span the full width so the
       wind compass and rain totals stay legible. */
    .metric--wind,
    .metric--rain { grid-column: 1 / -1; }
    .metric { padding: 15px 16px; }
    .metric--wind,
    .metric--rain { padding: 16px 18px; }
    .metric-value { font-size: clamp(2rem, 9vw, 3.25rem); }
    .metric--wind .metric-value,
    .metric--rain .metric-value { font-size: clamp(2.5rem, 12vw, 4.125rem); }
    .metric--humidity .metric-value,
    .metric--pressure .metric-value,
    .metric--uv .metric-value,
    .metric--solar .metric-value { font-size: clamp(1.9rem, 8.5vw, 2.9rem); }
    .battery-status { font-size: clamp(1.5rem, 7vw, 2.375rem); }

    /* ── Right rail / map: needs an explicit height in the flex column ── */
    .rail { display: block; }
    .map-tile { height: clamp(230px, 48svh, 340px); }
    .map { height: 100%; }

    /* ── Forecast: fit every available day across the tablet width ─────── */
    .forecast { max-width: 100%; padding: 14px 16px 12px; }
    .forecast-days {
        display: grid;
        grid-template-columns: repeat(var(--forecast-day-count, 7), minmax(0, 1fr));
        gap: 10px;
        min-width: 0;
        overflow: hidden;
    }
    .forecast-day {
        min-width: 0;
        overflow: hidden;
        padding: 10px 6px 8px;
    }

    /* Trim the largest soft shadows on mobile (cheaper repaints on the Pi /
       low-power phones) without altering colour or card identity. */
    .tile, .forecast {
        box-shadow: inset 0 1px 0 var(--tile-highlight), 0 4px 14px var(--tile-shadow);
    }
    .hero {
        box-shadow: inset 0 1px 0 var(--tile-highlight), 0 5px 16px var(--hero-shadow);
    }

    /* Fixed-position chrome: keep clear of the safe-area insets. */
    .demo-badge { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* Phones get four forecast days across the available width. The short-height
   landscape clause catches modern phones wider than 600px without changing
   the full forecast on portrait or landscape tablets. */
@media (max-width: 600px),
       (max-width: 1024px) and (orientation: landscape) and (max-height: 500px) {
    .forecast { padding: 12px 10px 10px; }
    .forecast-head { align-items: flex-start; gap: 8px; }
    .forecast-title { flex: none; font-size: 0; }
    .forecast-title::after { content: attr(data-phone-label); font-size: 20px; }
    .forecast-source { max-width: 48%; line-height: 1.2; text-align: right; }
    .forecast-days {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        min-width: 0;
        overflow: hidden;
    }
    .forecast-day {
        min-width: 0;
        overflow: hidden;
        padding: 8px 2px 6px;
    }
    .forecast-day:nth-child(n + 5) { display: none; }
    .forecast-dow { font-size: 14px; letter-spacing: -0.025em; white-space: nowrap; }
    .forecast-day:nth-child(2) .forecast-dow { font-size: 0; }
    .forecast-day:nth-child(2) .forecast-dow::after { content: "Tomorrow"; font-size: 14px; }
    .forecast-icon { width: 44px; height: 44px; }
    .forecast-cond {
        min-height: 2.1em;
        display: grid;
        place-items: center;
        font-size: 12px;
        white-space: normal;
    }
    .forecast-temps { gap: 3px; }
    .forecast-hi { font-size: 24px; }
    .forecast-lo { font-size: 18px; }
    .forecast-pop { gap: 2px; font-size: 13px; }
}

/* At exactly 480px the paired Indoor values cannot retain their display size
   inside a half-width card. Give the two health cards a balanced full row
   rather than clipping either value. Wider devices keep the two-column flow. */
@media (max-width: 480px) {
    .metric--indoor,
    .metric--battery { grid-column: 1 / -1; }
}

/* Small phones (≤430px): tighten to a single metric column so nothing is
   cramped, and pull the biggest numbers down a touch. */
@media (max-width: 430px) {
    .metrics { grid-template-columns: 1fr; }
    .metric--wind,
    .metric--rain { grid-column: auto; }
    .display { padding: 12px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
    .metric-subs { gap: 14px; }
}

/* Phone landscape (short + wide): compact header + shorter map so the hero and
   radar are both reachable without a long scroll. */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 500px) {
    .topbar { flex-direction: row; flex-wrap: wrap; justify-content: space-between; text-align: left; }
    .brand { width: auto; }
    .summary { order: 0; flex: 1 1 100%; }
    .topbar-right { order: 0; width: auto; }
    .hero-top { justify-content: flex-start; }
    .map-tile { height: clamp(180px, 62svh, 240px); }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric--wind,
    .metric--rain { grid-column: auto; }
}
