/* Weather remains decorative; opaque surfaces keep device controls readable. */
body { isolation: isolate; }
#weather-sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
html[data-sky]:not([data-sky=""]) body::before { display: none; }
.sky-scene { overflow: hidden; background: linear-gradient(155deg,#10233b,#111521 75%); }
.sky-scene[hidden] { display: none; }
.sky-scene[data-sky="sunny"] { background: linear-gradient(165deg,#2476ad 0%,#75b9d9 52%,#e8ecde 100%); }
.sky-scene[data-sky="cloudy"],.sky-scene[data-sky="foggy"] { background: linear-gradient(160deg,#63798e,#b7c8cf 65%,#e2e4df); }
.sky-scene[data-sky="rainy"],.sky-scene[data-sky="stormy"] { background: linear-gradient(155deg,#344a62,#647b8b 65%,#a2b1b8); }
.sky-scene[data-sky="snowy"] { background: linear-gradient(160deg,#57718b,#bdcedc); }
.sky-scene[data-sky="night"] { background: linear-gradient(155deg,#07122d,#172444 55%,#313b55); }
.sky-scene i { position: absolute; display: block; pointer-events: none; }
.sky-orb { top: 9%; right: 12%; width: clamp(70px,15vw,180px); aspect-ratio: 1; border-radius: 50%; opacity: 0; }
[data-sky="sunny"] > .sky-orb { opacity: 1; background: #fff6cd; box-shadow: 0 0 60px 35px #ffecb155,0 0 150px 75px #ffecb133; }
[data-sky="night"] > .sky-orb { opacity: 1; width: clamp(45px,9vw,100px); background: #dde7f1; box-shadow: 0 0 50px 10px #b7d6ff33; }
[data-sky="night"] > .sky-orb::after { content: ''; position: absolute; inset: -8% -10% 20% 28%; border-radius: 50%; background: #111e3b; }
.sky-cloud { width: 60%; height: 24%; left: -12%; top: 12%; border-radius: 50%; background: radial-gradient(ellipse,#f5fafbeb 0%,#edf5f8aa 40%,transparent 70%); filter: blur(13px); opacity: 0; animation: sky-drift 40s ease-in-out infinite alternate; }
.sky-cloud-two { top: 36%; left: 55%; width: 70%; animation-duration: 55s; animation-direction: alternate-reverse; }
[data-sky="cloudy"] > .sky-cloud,[data-sky="foggy"] > .sky-cloud,[data-sky="rainy"] > .sky-cloud,[data-sky="stormy"] > .sky-cloud,[data-sky="snowy"] > .sky-cloud { opacity: .85; }
[data-sky="sunny"] > .sky-cloud-two { opacity: .3; }
[data-sky="night"][data-condition="cloudy"] > .sky-cloud,[data-sky="night"][data-condition="rainy"] > .sky-cloud,[data-sky="night"][data-condition="stormy"] > .sky-cloud,[data-sky="night"][data-condition="foggy"] > .sky-cloud { opacity: .18; }
.sky-stars { inset: 0; opacity: 0; background-image: radial-gradient(1px 1px at 12% 20%,#fff 95%,transparent),radial-gradient(2px 2px at 34% 8%,#fff 95%,transparent),radial-gradient(1px 1px at 69% 35%,#fff 95%,transparent),radial-gradient(1px 1px at 90% 65%,#fff 95%,transparent),radial-gradient(1px 1px at 26% 54%,#fff 95%,transparent); background-size: 350px 300px; }
[data-sky="night"] > .sky-stars { opacity: .65; }
[data-sky="night"][data-condition="rainy"] > .sky-stars,[data-sky="night"][data-condition="stormy"] > .sky-stars { opacity: 0; }
.sky-rain { inset: 0; opacity: 0; background: linear-gradient(180deg,transparent,#b0ccdc12); }
[data-sky="rainy"] > .sky-rain,[data-sky="stormy"] > .sky-rain,[data-condition="rainy"] > .sky-rain { opacity: 1; }
.sky-atmosphere { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mask-image: linear-gradient(#000b,#000 28%,#0009); }
.sky-scene::before { content: ''; position: absolute; inset: -10%; pointer-events: none; background: radial-gradient(ellipse at 80% 12%,#d6edf725,transparent 48%),radial-gradient(ellipse at 15% 80%,#0b1e3840,transparent 65%); }
.sky-scene[data-sky="rainy"],.sky-scene[data-sky="stormy"] { background: radial-gradient(ellipse at 78% 0%,#a8bac8 0%,transparent 48%),linear-gradient(175deg,#33475e,#566d82 48%,#8a9fae); }
.sky-cloud { width: 110%; height: 38%; top: -8%; left: -35%; filter: blur(28px); background: radial-gradient(ellipse at 28% 48%,#d4e2ea80,transparent 42%),radial-gradient(ellipse at 60% 30%,#e1ebf06b,transparent 45%),radial-gradient(ellipse at 80% 80%,#14283f40,transparent 50%); animation-duration: 65s; }
.sky-cloud-two { top: 28%; left: 20%; height: 48%; opacity: .45; animation-duration: 90s; }
.sky-paused i { animation-play-state: paused; }
html[data-sky]:not([data-sky=""]) { --surface-canvas: #0a0c10; }
html.light-ui[data-sky]:not([data-sky=""]) { --surface-canvas: #f5f3ee; }
html[data-sky]:not([data-sky=""]) header,html[data-sky]:not([data-sky=""]) #nav { background: var(--bg); }
/* The day sky is bright. Put loose headings and status rows on a quiet canvas. */
html[data-sky]:not([data-sky=""]) main { background: var(--bg); border-radius: 0; }
.theme-choices { border: 0; padding: 0; margin: 22px 0 18px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.theme-choices legend { font-size: 14px; font-weight: 650; margin-bottom: 12px; }
.theme-choice { position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 9px; border: 2px solid var(--line); border-radius: 16px; cursor: pointer; background: var(--panel); }
.theme-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.theme-choice:focus-within { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.theme-choice input { position: absolute; top: 14px; right: 14px; accent-color: var(--accent); width: 18px; height: 18px; z-index: 1; }
.theme-choice strong { font-size: 14px; }
.theme-choice small { font-size: 11px; color: var(--dim); line-height: 1.4; }
.theme-swatch { height: 76px; border-radius: 9px; background: #f5f3ee; padding: 14px 9px; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; }
.theme-swatch i { height: 7px; width: 60%; background: #bbb5a8; border-radius: 3px; }
.theme-swatch i:last-child { width: 40%; }
.theme-swatch-dark { background: #14171d; }
.theme-swatch-dark i { background: #555e6c; }
.theme-swatch-auto { background: linear-gradient(115deg,#f5f3ee 50%,#14171d 51%); }
.theme-swatch-weather { background: radial-gradient(circle at 25% 25%,#fff5cc 0 9%,transparent 10%),linear-gradient(160deg,#277daf,#a0d0e4); }
.theme-swatch-weather i { background: #edf5f8bd; }
.weather-preview { position: relative; min-height: 210px; border-radius: 18px; margin: 0 0 18px; }
.weather-preview.preview-light[data-sky=""] { background: linear-gradient(125deg,#e0e7e9,#faf7ec); }
.weather-preview-copy { position: relative; z-index: 1; min-height: 210px; display: flex; flex-direction: column; justify-content: flex-end; padding: 24px; color: #fff; background: linear-gradient(transparent,#071221df); }
.weather-preview-copy > span { font-size: 10px; letter-spacing: .18em; margin-bottom: 8px; }
.weather-preview-title { font-size: clamp(20px,4vw,30px); font-weight: 500; letter-spacing: -.03em; }
.weather-preview-detail { font-size: 13px; line-height: 1.5; margin: 8px 0 0; max-width: 42ch; }
.weather-preview.preview-light[data-sky=""] .weather-preview-copy { color: #171a1f; background: transparent; }
.theme-city { padding: 16px; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; }
.theme-city[hidden] { display: none; }
.theme-city > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 9px; }
.weather-search { display: flex; gap: 8px; }
.weather-search input { min-width: 0; flex: 1; }
.weather-search button { flex-shrink: 0; }
.theme-city p { margin: 10px 0; line-height: 1.55; }
.theme-city a { color: var(--accent); text-decoration: underline; }
.weather-results { display: grid; gap: 6px; }
.weather-city-result { min-height: 48px; text-align: left; padding: 10px 12px; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; font: inherit; cursor: pointer; }
.appearance-field { display: block; margin: 16px 0; }
.appearance-field > span { display: block; color: var(--dim); font-size: 13px; margin-bottom: 7px; }
#appearance-settings > .switchrow { width: 100%; margin: 10px 0 18px; }
@keyframes sky-drift { to { transform: translate3d(14%,5%,0); } }
@keyframes sky-rain { to { transform: translate3d(-20px,100px,0); } }
.calm-ui .sky-scene i,.friendly-ui .sky-scene i { animation: none; }
@media(prefers-reduced-motion:reduce) { .sky-scene i { animation: none; } }
@media(max-width:380px) { .theme-choices { grid-template-columns: repeat(2,minmax(0,1fr)); } .weather-search { flex-direction: column; } }
@media(forced-colors:active) { #weather-sky,.theme-swatch { display: none; } .theme-choice:has(input:checked) { border-color: Highlight; } .weather-preview-copy { color: CanvasText; background: Canvas; } }
#appearance-settings .weather-preview,#appearance-settings .theme-city,#appearance-settings .theme-choices { width: 100%; }
#appearance-settings .appearance-field { width: 100%; }
#appearance-settings .appearance-field .fsel { width: 100%; }
#weather-heading { position: relative; max-width: 760px; margin: 0 auto; padding: 24px 24px 28px; color: #fff; text-shadow: 0 1px 8px #06152ac0; background: linear-gradient(90deg,#071a3270,transparent); }
#weather-heading[hidden] { display: none; }
.weather-heading-city { display: block; font-size: 16px; font-weight: 550; }
.weather-heading-temperature { display: block; font-size: 64px; line-height: 1.15; font-weight: 300; letter-spacing: -.05em; margin: 6px 0; }
.weather-heading-detail { font-size: 13px; line-height: 1.5; margin: 0; }
#weather-heading.weather-heading-fallback { color: var(--text); text-shadow: none; background: var(--panel); border-radius: 18px; margin-block: 12px; }
html[data-sky]:not([data-sky=""]) main { background: var(--bg); }
html.light-ui[data-sky]:not([data-sky=""]) main { background: var(--bg); }
@media(min-width:1000px) { #weather-heading { max-width: 1140px; } }
@media(min-width:1400px) { #weather-heading { max-width: 1320px; } }

/* Daylight uses the same rooms, with a pale reading surface instead of the
   night vignette. CSS follows sunrise changes without rebuilding controls. */
html.light-ui { --room-day-saturation: .88; --room-day-brightness: 1; --room-day-wash: 249,247,242; }
html.light-ui[data-sky="sunny"] { --room-day-saturation: 1; --room-day-brightness: 1.04; --room-day-wash: 255,249,234; }
html.light-ui[data-sky="cloudy"],html.light-ui[data-sky="foggy"] { --room-day-saturation: .65; --room-day-wash: 238,243,245; }
html.light-ui[data-sky="rainy"],html.light-ui[data-sky="stormy"] { --room-day-saturation: .5; --room-day-brightness: .92; --room-day-wash: 226,236,244; }
html.light-ui[data-sky="snowy"] { --room-day-saturation: .45; --room-day-brightness: 1.08; --room-day-wash: 244,249,252; }
@media(min-width:700px) {
  html.light-ui .roomvisual::before,html.light-ui .spatialroom::before {
    background-image:var(--room-image-day,var(--room-image));
    filter:saturate(var(--room-day-saturation)) brightness(var(--room-day-brightness));
  }
  html.light-ui .roomvisual::after {
    opacity:1;
    background:linear-gradient(90deg,rgba(var(--room-day-wash),.96),rgba(var(--room-day-wash),.78) 42%,rgba(var(--room-day-wash),.1) 100%),
      linear-gradient(0deg,rgba(var(--room-day-wash),.5),transparent 65%);
  }
  html.light-ui .roomvisual:hover::before { filter:saturate(var(--room-day-saturation)) brightness(calc(var(--room-day-brightness) + .04)); }
  html.light-ui .roomvisual .roomstate { color:var(--dim); }
  html.light-ui .roombadge,html.light-ui .roomquick { background:rgba(var(--room-day-wash),.94); color:var(--text); border-color:var(--line); }
  html.light-ui .roombadge.alert { color:var(--danger,#943f28); border-color:currentColor; }
  html.light-ui .curtainmeter { border-color:var(--dim); }
  html.light-ui .curtainmeter i { background:var(--dim); }
}
html.light-ui .spatialroom { background:var(--panel); }
html.light-ui .spatialroom::before { background-image:var(--room-image-day,var(--room-image)); filter:saturate(var(--room-day-saturation)) brightness(var(--room-day-brightness)); }
html.light-ui .spatialroom::after { background:linear-gradient(180deg,rgba(var(--room-day-wash),.88),rgba(var(--room-day-wash),.15) 50%,rgba(var(--room-day-wash),.45)); }
html.light-ui .spatialhead span,html.light-ui .spatialdevice small { color:var(--dim); }
html.light-ui .spatialbadge,html.light-ui .spatialdevice { background:rgba(var(--room-day-wash),.95); border-color:var(--line); }
html.light-ui .spatialdevice.on { border-color:var(--accent); background:var(--accent-soft); }
/* Scene artwork depicts the scene itself, so its labels retain contrast even
   when the surrounding app switches to daylight. */
html.light-ui:not(.friendly-ui) .scenecard { color:#f3f5f8; }
html.light-ui .roomvisual { box-shadow:var(--hi),0 12px 28px -22px #3a332a66; }

#app-updates-button.update-ready { color:var(--accent); box-shadow:inset 0 0 0 2px var(--accent); border-radius:50%; }
#app-update-notice { position:fixed; z-index:1100; right:max(16px,env(safe-area-inset-right)); bottom:calc(86px + env(safe-area-inset-bottom)); width:min(390px,calc(100vw - 32px)); padding:20px; border:1px solid var(--line); border-radius:18px; background:var(--panel); color:var(--text); box-shadow:0 12px 48px #0003; }
#app-update-notice[hidden] { display:none; }
#app-update-notice strong { display:block; font-size:16px; }
#app-update-notice p { color:var(--dim); font-size:13px; line-height:1.6; margin:10px 0 16px; }
#app-update-notice > div { display:flex; gap:8px; flex-wrap:wrap; }
#app-update-notice button { min-height:44px; }

/* Recovery is a small, happy acknowledgement, kept away from device controls. */
.recovery-celebration { position: fixed; z-index: 1200; left: 50%; top: max(18px,env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px); padding: 14px 16px 14px 12px; border: 1px solid #9ee6c54d; border-radius: 24px; color: #effff8; background: linear-gradient(125deg,#173e38f5,#12272bf5); box-shadow: 0 16px 60px #071a2940,inset 0 1px #ffffff12; backdrop-filter: blur(20px); animation: recovery-arrive .65s cubic-bezier(.16,1,.3,1) both; }
.recovery-celebration strong { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.recovery-celebration p { margin: 3px 0 0; font-size: 12px; color: #c3ded4; line-height: 1.4; overflow-wrap: anywhere; }
.recovery-celebration button { align-self: center; border: 0; background: transparent; color: #c3ded4; width: 36px; height: 36px; font-size: 24px; cursor: pointer; }
.recovery-mark { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; background: #7ce6b512; box-shadow: 0 0 26px #7ce6b520; }
.recovery-mark svg { width: 100%; height: 100%; fill: none; stroke: #96f1c7; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.recovery-mark circle { stroke-opacity: .3; }
.recovery-mark path { stroke-dasharray: 32; animation: recovery-check .6s .18s ease both; }
.healing-badge::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; animation: healing-breathe 2s ease-in-out infinite; }
@keyframes recovery-arrive { from { opacity: 0; transform: translate(-50%,-14px) scale(.94); } to { opacity: 1; transform: translate(-50%,0) scale(1); } }
@keyframes recovery-check { from { stroke-dashoffset: 32; } to { stroke-dashoffset: 0; } }
@keyframes healing-breathe { 50% { opacity: .35; } }
.calm-ui .recovery-celebration,.calm-ui .recovery-mark path,.calm-ui .healing-badge::before,.friendly-ui .recovery-celebration,.friendly-ui .recovery-mark path,.friendly-ui .healing-badge::before { animation: none; }
@media(prefers-reduced-motion:reduce) { .recovery-celebration,.recovery-mark path,.healing-badge::before { animation: none; } }
@media(forced-colors:active) { .recovery-celebration { background: Canvas; color: CanvasText; border-color: CanvasText; } .recovery-celebration p,.recovery-celebration button { color: CanvasText; } .recovery-mark svg { stroke: CanvasText; } }
/* Night is a quiet, irregular sky; the moon uses the current lit fraction. */
.sky-scene[data-sky="night"] { background: radial-gradient(ellipse at 75% 8%,#23334c 0%,transparent 46%),radial-gradient(ellipse at 20% 85%,#20304566,transparent 60%),linear-gradient(175deg,#050b18,#101b30 65%,#25374d); }
#weather-sky .sky-stars { background: none; }
.sky-atmosphere { z-index: 1; }
.sky-orb { z-index: 2; }
.sky-cloud { z-index: 3; }
[data-sky="night"] > .sky-orb.sky-moon { top: 8%; right: 10%; width: clamp(80px,13vw,150px); background: transparent; box-shadow: none; filter: drop-shadow(0 0 28px #b7d6ff28); }
[data-sky="night"] > .sky-orb.sky-moon::after { display: none; }
.moon-disc { display: block; width: 100%; height: 100%; }
.moon-shadow { fill: #253348; stroke: #d7e6ef12; stroke-width: .5; }
.moon-light { fill: #e0e7ec; }
.moon-craters { fill: #17273c; opacity: .11; }
#weather-heading { padding-right: clamp(110px,21vw,210px); min-height: 170px; }
.weather-heading-temperature:empty { display: none; }
.sky-almanac { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 30px; margin-top: 24px; color: #eff5ff; text-shadow: 0 1px 6px #02081766; }
.sky-moon-info { display: flex; align-items: center; gap: 10px; }
.sky-moon-icon { width: 44px; height: 44px; flex: 0 0 44px; }
.sky-moon-info strong { display: block; font-size: 14px; font-weight: 550; letter-spacing: -.01em; }
.sky-moon-info [data-moon-detail] { display: block; font-size: 11px; margin-top: 4px; opacity: .8; }
.sky-sun-times { display: flex; gap: 28px; }
.sky-sun-times span { display: block; font-size: 11px; opacity: .8; }
.sky-sun-times strong { display: block; margin-top: 5px; font-size: 16px; font-weight: 450; font-variant-numeric: tabular-nums; }
.sky-almanac [data-sky-clock] { flex-basis: 100%; font-size: 10px; opacity: .72; }
.weather-heading-fallback .sky-almanac { color: var(--text); text-shadow: none; }
@media(max-width:600px) { #weather-heading { padding: 22px 24px 26px; } .weather-heading-city,.weather-heading-detail { max-width: calc(100% - 82px); } .sky-almanac { gap: 16px; margin-top: 20px; } .sky-sun-times { gap: 24px; } .sky-moon-info { width: 100%; } }
@media(forced-colors:active) { .sky-almanac { color: CanvasText; text-shadow: none; } .moon-light { fill: CanvasText; } .moon-shadow { fill: Canvas; stroke: CanvasText; } }

/* Calendar dates share the quiet material of the home, with today's date lit. */
.calendar-card{margin:16px 0;padding:20px;border:1px solid var(--line);border-radius:24px;background:var(--surface,rgba(128,128,128,.07));overflow:hidden}
.calendar-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.calendar-heading h2{margin:4px 0;font-size:20px;letter-spacing:-.5px}
.calendar-heading a{font-size:12px;color:var(--text);text-underline-offset:4px}
.calendar-heading .eyebrow{font-size:10px;letter-spacing:1.8px;opacity:.75}
.calendar-events{font-size:13px;line-height:1.6}
.calendar-event{display:flex;gap:14px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.calendar-event time{flex:0 0 55px;font-size:12px;font-weight:650}
.calendar-event b{font-weight:550}.calendar-event small{display:block;opacity:.65;font-size:11px}
.calendar-event.is-today time{color:var(--accent);font-weight:750}.calendar-event.is-today{background:linear-gradient(110deg,rgba(110,185,150,.10),transparent);border-radius:12px;padding-left:10px}
.calendar-editor{display:grid;gap:10px}.calendar-check{display:flex;align-items:center;gap:9px;font-size:13px;padding:7px 0;line-height:1.4}
.calendar-check input{accent-color:var(--accent);width:18px;height:18px;flex-shrink:0}
.calendar-observances summary{cursor:pointer;padding:10px 0;font-size:14px}.calendar-observances>div{max-height:280px;overflow:auto}
.calendar-personal-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(130px,.6fr);gap:8px;padding:12px 0;border-bottom:1px solid var(--line)}
.calendar-personal-row .tin{width:100%;min-width:0}.calendar-personal-row button{justify-self:end}
@media(max-width:420px){.calendar-card{padding:16px}.calendar-heading h2{font-size:18px}.calendar-personal-row{grid-template-columns:minmax(0,1fr)}.calendar-personal-row button{justify-self:start}}
