:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-synthesis: none;
  color-scheme: dark;
  color: #fff;
  background: #2974b4;
  --muted: #d1e8f9;
  --rain: #b4eeff;
  --snow: #f1e8ff;
  --line: #ffffff15;
  --panel: #164f863f;
  --panel-top: #ffffff0d;
  --sun: #ffe199;
  --current: #ffffff13;
  --header-height: 54px;
  --content-gap: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 85% 2%, #b3dff756, transparent 54%), linear-gradient(158deg, #205993 0%, #3989bf 57%, #72b4d5 100%);
  background-attachment: fixed;
  position: relative;
  isolation: isolate;
}
body.night {
  --muted: #c1cde8;
  --panel: #101b443f;
  --panel-top: #ffffff08;

}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 85% 2%, #34446424, transparent 54%), linear-gradient(158deg, #080f20, #101b30 60%, #1a2a43 100%);
  opacity: 0;
}
body.night::before { opacity: 1; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#viewport { width: 100%; height: 100vh; height: 100dvh; display: grid; place-items: center; padding: 12px; }
#fit-box { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; }
#sheet { position: absolute; top: 0; left: 0; width: 1380px; height: 720px; display: grid; grid-template-columns: minmax(0, 1fr) 252px; gap: 12px; }
.weather-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--content-gap); }
header { height: var(--header-height); flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 6px; gap: 12px; }
.current { display: flex; align-items: center; gap: 18px; min-width: 0; font-variant-numeric: tabular-nums; }
.current-source { display: grid; grid-template-columns: auto auto; grid-template-rows: 17px 19px; align-items: center; column-gap: 8px; }
.current-name { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 12px; line-height: 17px; white-space: nowrap; text-decoration: none; width: fit-content; }
.current-name:hover, .current-name:focus, .current-name:visited { text-decoration: none; }
.current-name:hover { color: #fff; }
.current-temp { grid-column: 1; grid-row: 1 / 3; font-size: 34px; font-weight: 400; line-height: 36px; letter-spacing: -.045em; }
.current-rain { grid-column: 2; grid-row: 2; font-size: 15px; line-height: 19px; color: var(--rain); transform: translateY(-2px); }
.current-source small { font-size: 12px; margin-left: 3px; font-weight: 400; letter-spacing: 0; }
.current-temp small { font-size: 14px; vertical-align: 3px; }
.header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; white-space: nowrap; }
h1 { margin: 0 0 0 2px; font-size: 23px; font-weight: 500; letter-spacing: .05em; }
#settings-open { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: #ffffff12; }
#settings-open:hover { background: #ffffff26; }
#forecast { flex: 1; min-height: 0; display: grid; grid-auto-rows: minmax(0, 1fr); gap: 8px; }
.day-card {
  min-height: 0; display: flex; align-items: stretch; gap: 4px;
  border: 1px solid #ffffff22; border-radius: 13px;
  background: linear-gradient(110deg, var(--panel-top), transparent 70%), var(--panel);
  box-shadow: 0 4px 14px #09284c08;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  padding: 7px 8px 7px 5px;
}
.day-rail { flex: 0 0 56px; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-weight: 400; }
.day-marker { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--sun); color: #3d4756; font-size: 15px; font-weight: 500; }
.day-marker { box-shadow: 0 2px 9px #ffc94d14; }
.date { font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 22px; }
.weekday { font-size: 16px; color: var(--muted); line-height: 20px; }
.forecast-table { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: 21px repeat(3, minmax(0, 1fr)); font-variant-numeric: tabular-nums; }
.forecast-row { display: grid; grid-template-columns: 54px repeat(24, minmax(0, 1fr)); min-height: 0; align-items: stretch; }
.source-name, .source-title { display: flex; align-items: center; white-space: nowrap; font-size: 12px; font-weight: 400; justify-content: flex-end; text-align: right; padding: 0 5px 0 0; }
.source-title { color: var(--muted); }
.source-name a { color: inherit; text-decoration: none; }
.source-name a:hover { color: var(--rain); }
.hour { position: relative; display: grid; place-items: start center; font-size: 12px; line-height: 16px; color: var(--muted); }
.weather-cell { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; min-width: 0; min-height: 0; border-top: 1px solid var(--line); }
.temp { color: #fff; font-size: 16px; font-weight: 500; line-height: 1.1; letter-spacing: -.025em; }
.rain { font-size: 15px; color: var(--rain); line-height: 1.15; font-weight: 500; min-height: 1.15em; }
.current-rain.rain { font-weight: 400; line-height: 19px; }
.rain.snow, .current-rain.snow { color: var(--snow); }
.snow-icon { font-size: .7em; margin-right: 1px; vertical-align: 1px; }
.rain.missing, .temp.missing { color: #ffffff66; }
.current-rain.missing { color: var(--muted); }
.now { background: transparent; }
.hour.now { color: #fff; font-weight: 600; border-radius: 5px 5px 0 0; }
.outside { color: var(--muted); }
.weather-cell.outside { background: transparent; }
.missing { font-size: 13px; color: #ffffff38; }
.daylight-line { position: absolute; bottom: 1px; height: 2px; background: var(--sun); left: 0; right: 0; opacity: .85; }
@media(prefers-reduced-motion:no-preference) { .day-card, button { transition: background-color .2s ease; } }

.past .temp, .past .rain { opacity: .42; }
.hour.past { color: #ffffff66; }

@media(prefers-reduced-motion:no-preference) {
  body::before { transition: opacity .85s ease-in-out; }
  .day-card, .settings-panel, .settings-group, .setting-row, .current-name, .current-rain, .weekday, .source-title, .hour, .rain {
    transition: background-color .7s ease-in-out, color .7s ease-in-out, border-color .7s ease-in-out;
  }
}

h1 { font-size: 22px; margin-left: auto; white-space: nowrap; }
a, a:visited, a:hover { text-decoration: none; }
.now-dot { position: absolute; bottom: -1px; transform: translateX(-50%); z-index: 1; width: 12px; height: 12px; background: #ff5148; border-radius: 50%; box-shadow: 0 0 0 2px #ff51481c; }
.clocks { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.clock { display: grid; justify-items: center; gap: 3px; width: 116px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-face { display: grid; place-items: center; width: 100%; height: 32px; background: #bfddf252; color: #f3f8ff; border: 1px solid #dceeff26; border-radius: 9px; font-size: 26px; font-weight: 600; letter-spacing: -1.5px; line-height: 1; }
.clock-face.clock-night { background: #214b794d; color: #e0edfc; border-color: #b6d2ef1c; }
.night .clock-face { background: #8098ba4a; color: #edf3ff; }
.night .clock-face.clock-night { background: #172b4859; color: #d3e0f5; }
.clock-city { display: flex; justify-content: center; align-items: baseline; gap: 7px; font-size: 11px; font-weight: 500; line-height: 12px; color: var(--muted); }
.settings-panel { min-width: 0; height: 100%; color-scheme: light; border: 1px solid #ffffff6b; border-radius: 18px; padding: 18px 14px; color: #202530; background: #f2f4f8eb; backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); font-size: 12px; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.settings-heading h2 { margin: 0; font-size: 21px; font-weight: 650; }
.version { color: #8a909b; font-size: 11px; font-variant-numeric: tabular-nums; }
.settings-group { background: #fff; border-radius: 12px; padding: 0 12px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.setting-row + .setting-row { border-top: 1px solid #e7e8eb; }
#city-select { font: inherit; color: #007aff; background: transparent; border: 0; padding: 8px 0 8px 4px; max-width: 172px; cursor: pointer; text-align: right; }
.ios-switch { flex: 0 0 43px; width: 43px; height: 27px; padding: 2px; border: 0; border-radius: 20px; background: #e4e5e9; }
.ios-switch span { display: block; width: 23px; height: 23px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px #0002; transform: translateX(0); }
.ios-switch[aria-checked=true] { background: #34c759; }
.ios-switch[aria-checked=true] span { transform: translateX(16px); }
.group-label { font-size: 11px; font-weight: 500; letter-spacing: .04em; color: #818894; margin: 20px 10px 7px; }
.clock-settings { padding: 0 12px; }
.clock-picker { padding: 10px 0; }
.clock-picker + .clock-picker { border-top: 1px solid #e7e8eb; }
.clock-picker label { display: block; color: #8a909b; font-size: 10px; margin-bottom: 4px; }
.combo { position: relative; }
.combo input { width: 100%; border: 0; padding: 5px 18px 5px 0; color: #007aff; background: transparent; font: inherit; border-radius: 3px; cursor: text; }
.combo-chevron { position: absolute; right: 0; top: 2px; color: #8a909b; pointer-events: none; }
.combo-options { position: absolute; top: calc(100% + 6px); left: -7px; right: -7px; z-index: 20; background: #fff; border: 1px solid #d9dce2; box-shadow: 0 10px 35px #1321372b; border-radius: 10px; max-height: 180px; overflow-y: auto; padding: 5px; overscroll-behavior: contain; }
.combo-options [role=option], .no-results { padding: 9px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.combo-options [role=option]:hover, .combo-options [role=option].active { color: #fff; background: #007aff; }
.combo-options [aria-selected=true]::after { content: '✓'; float: right; }
.no-results { color: #8a909b; cursor: default; }
.source-status { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 45px; font-size: 11px; }
.source-status + .source-status { border-top: 1px solid #e7e8eb; }
.source-status a { color: inherit; }
.source-status > span { font-variant-numeric: tabular-nums; text-align: right; color: #818894; }
.stale { display: block; color: #b67720; font-size: 9px; padding-top: 2px; }
.settings-note { margin: 9px 8px 0; color: #818894; font-size: 10px; line-height: 1.6; }
.settings-panel :is(button, select, input):focus-visible { outline: 2px solid #007aff; outline-offset: 3px; }
.night .settings-panel { color-scheme: dark; color: #f5f5f7; border-color: #ffffff20; background: #252a35e8; }
.night .settings-group, .night .combo-options { background: #343945; }
.night :is(.setting-row, .clock-picker, .source-status) + :is(.setting-row, .clock-picker, .source-status), .night .combo-options { border-color: #ffffff16; }
.night .ios-switch:not([aria-checked=true]) { background: #595b64; }
.night #city-select, .night .combo input { color: #70b8ff; }
.night :is(.version, .group-label, .settings-note, .clock-picker label, .source-status > span) { color: #afb6c3; }
@media(prefers-reduced-motion:no-preference) {
  .ios-switch span { transition: transform .25s ease; }
  .clock-face, .settings-panel, .settings-group { transition: color .85s ease, background-color .85s ease, border-color .85s ease; }
}

/* Shared time selection stays on the daylight baseline, with a larger drag target. */
.hours-row { position: relative; }
.timeline { position: absolute; left: 54px; right: 0; bottom: -6px; height: 16px; z-index: 2; cursor: ew-resize; touch-action: none; }
.timeline .now-dot { bottom: 2px; cursor: grab; }
.timeline .now-dot::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
.timeline:active .now-dot { cursor: grabbing; }
.timeline:focus, .timeline:focus-visible { outline: none; }
.timeline:focus-visible .now-dot { box-shadow: 0 0 0 3px #ffffff42; }
.clock-face { cursor: text; padding: 0; font-family: inherit; }
.clock-editor { display: block; min-width: 0; text-align: center; outline: 2px solid #c7e8ff; }
.city-heading { display: grid; justify-items: end; gap: 3px; margin-left: auto; white-space: nowrap; }
.city-heading h1 { margin: 0; }
.weekday.holiday-red, .holiday-name { color: #ffbbb5; }
.holiday-name { font-size: 9px; line-height: 12px; max-width: 56px; text-align: center; overflow-wrap: anywhere; }
.settings-panel, .night .settings-panel { color-scheme: dark; color: #fff; background: transparent; border-color: #ffffff24; backdrop-filter: none; -webkit-backdrop-filter: none; }
.settings-group, .night .settings-group { background: transparent; }
.version, .group-label, .clock-picker label, .source-status > span,
.night :is(.version, .group-label, .clock-picker label, .source-status > span) { color: var(--muted); }
.setting-row + .setting-row, .clock-picker + .clock-picker, .source-status + .source-status { border-color: #ffffff18; }
#city-select, .combo input, .night #city-select, .night .combo input { color: #f4f9ff; }
#city-select option { background: #285982; color: #fff; }
.combo-chevron { color: var(--muted); }
.clock-picker { display: flex; align-items: center; gap: 7px; padding: 5px 0; min-height: 34px; }
.clock-picker label { flex: 0 0 34px; margin: 0; font-size: 10px; }
.combo { min-width: 0; flex: 1; }
.combo input { padding-top: 4px; padding-bottom: 4px; font-size: 12px; }
.combo-options { left: -48px; top: calc(100% + 3px); max-height: 144px; padding: 3px; background: #2c608ded; border-color: #ffffff35; backdrop-filter: blur(22px); }
.night .combo-options { background: #293d5bed; }
.combo-options [role=option] { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 5px 6px; font-size: 10px; line-height: 15px; }
.combo-options small { flex: none; font-size: 9px; color: #d1e8f9; font-variant-numeric: tabular-nums; }
.combo-options [aria-selected=true]::after { content: none; }
.combo-options [aria-selected=true] { background: #ffffff16; }
.combo-options [role=option]:hover, .combo-options [role=option].active { background: #ffffff28; }
.no-results { padding: 6px; color: var(--muted); }
.stale { color: #ffe0a5; }
.settings-panel :is(button, select, input):focus-visible { outline-color: #c7e8ff; }

/* Stable numeric columns and identical font metrics for button/input clock faces. */
.current { gap: 12px; flex: none; }
.current-source { grid-template-columns: 92px 60px; }
.current-temp { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.current-name, .current-rain { white-space: nowrap; }
.clock-face, input.clock-face { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; font-size: 26px; font-weight: 600; line-height: 30px; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; text-align: center; padding: 0; appearance: none; -webkit-appearance: none; }
#city-select { font: inherit; text-align: left; max-width: none; width: 100%; padding: 4px 18px 4px 0; }
.night .combo-options { background: #121f35f5; }
.night .clock-face { background: #54668045; }
.night .clock-face.clock-night { background: #050c1e70; }

.settings-group > .clock-picker + .setting-row { border-top: 1px solid #ffffff18; }

.clock-zone { font-size: 10px; font-weight: 400; opacity: .85; }
.data-heading { display: flex; align-items: center; justify-content: space-between; margin: 20px 10px 7px; }
.data-heading .group-label { margin: 0; }
#data-refresh { display: grid; place-items: center; padding: 3px; border: 0; background: transparent; color: var(--muted); border-radius: 50%; }
#data-refresh:hover { color: #fff; background: #ffffff16; }
#data-refresh:disabled { opacity: .6; cursor: wait; }
.refresh-status { font-size: 10px; line-height: 14px; color: var(--muted); margin: 5px 10px 0; }
.refresh-status:empty { display: none; }
@media (prefers-reduced-motion: no-preference) { .refreshing svg { animation: refresh-spin 1s linear infinite; } }
@keyframes refresh-spin { to { transform: rotate(360deg); } }

.clock-city.long-city { font-size: 10px; }

/* Compact clock faces; labels keep their own width for readable city names. */
.clock { width: max-content; min-width: 104px; }
.clock-face, input.clock-face { width: 94px; justify-self: center; }
.clock-face, .clock-face.clock-night, .night .clock-face, .night .clock-face.clock-night { color: var(--clock-ink, #f1f6ff); background: var(--clock-fill); border-color: #e7f0ff36; box-shadow: none; }
.clock-city { font-size: 13px; line-height: 16px; gap: 6px; }
.clock-zone { font-size: 12px; opacity: 1; }
.clock-city.long-city { font-size: 11px; }
.current { gap: 4px; }
.current-source { grid-template-columns: 84px 59px; column-gap: 4px; }
.current-source small { margin-left: 2px; }
.city-heading h1 { font-size: 28px; }
.refresh-status a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

.night .clock-face, .night .clock-face.clock-night { background: var(--clock-dark-fill); color: var(--clock-dark-ink); }

/* Reclaim unused integer-temperature width and keep clocks close to the readings. */
header { justify-content: flex-start; }
.current-source.compact-temp { grid-template-columns: 64px 59px; }
.clocks { margin-left: auto; margin-right: auto; gap: 4px; justify-content: center; }
.city-heading { margin-left: 0; }
.settings-panel { display: flex; flex-direction: column; margin-top: calc(var(--header-height) + var(--content-gap)); height: calc(100% - var(--header-height) - var(--content-gap)); }
.settings-panel > * { flex-shrink: 0; }
.settings-panel > .version { margin-top: auto; padding: 12px 10px 0; align-self: flex-end; color: var(--muted); }
.weather-cell .temp { font-size: 18px; letter-spacing: -.04em; }
.weather-cell .rain { font-size: 17px; }
.probability { font-size: 12px; line-height: 13px; color: var(--muted); font-weight: 400; }
.probability small { font-size: 9px; margin-left: 1px; }
.probability.missing { color: #ffffff66; }
.past .probability { opacity: .42; }

/* Radar and settings share the existing narrow sidebar without page scrolling. */
.right-pane { min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-top: calc(var(--header-height) + var(--content-gap)); }
.right-pane .settings-panel { margin-top: 0; height: auto; flex: 1; min-height: 0; padding: 9px 10px; }
.right-pane .group-label { margin: 10px 10px 5px; }
.right-pane .data-heading { margin: 10px 10px 5px; }
.right-pane .data-heading .group-label { margin: 0; }
.right-pane .setting-row { min-height: 36px; }
.right-pane .source-status { min-height: 33px; }
.right-pane .settings-panel > .version { padding-top: 5px; }
.radar-panel { flex: 0 0 auto; border: 1px solid #ffffff24; border-radius: 13px; overflow: hidden; background: var(--panel); }
.radar-map { height: 304px; position: relative; overflow: hidden; background: #d5e4eb; }
#radar-base, #radar-rain { position: absolute; inset: 0; }
.radar-map img { position: absolute; width: 256px; height: 256px; max-width: none; }
#radar-rain { opacity: .83; }
.radar-pin { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; transform: translate(-50%,-50%); background: #ee464b; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 1px 3px #0005; }
#radar-message { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); white-space: nowrap; padding: 7px 9px; border-radius: 6px; font-size: 11px; color: #21334b; background: #f2f7f9eb; }

#radar-time { position:absolute; top:5px; right:6px; padding:2px 5px; border-radius:4px; font-size:10px; color:#243e57; background:#f4f9ffd9; }
#radar-status { position:absolute; bottom:5px; left:6px; font-size:10px; color:#243e57; background:#f4f9ffd9; border-radius:4px; padding:2px 5px; }
#radar-status:empty { display:none; }
.radar-info { position:absolute; bottom:5px; right:5px; color:#243e57; font-size:10px; }
.radar-info summary { display:grid; place-items:center; width:20px; height:20px; border-radius:50%; background:#f4f9ffdf; cursor:pointer; list-style:none; }
.radar-info summary::-webkit-details-marker { display:none; }
.radar-credits { position:absolute; bottom:25px; right:0; display:flex; flex-direction:column; gap:5px; padding:7px 9px; border-radius:6px; background:#f4f9fff2; white-space:nowrap; }
.radar-credits a { color:inherit; text-decoration:none; }
