:root {
  color-scheme: light dark;
  --paper: #f5f2ea; --ink: #23241f; --muted: #6e7066; --line: #e1ded3; --well: #e9e6dc;
  --trace: #4d6b58; --accent: #b0612b; --accent-soft: #f0dfcd;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none; -webkit-font-smoothing: antialiased; background: var(--paper); color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--trace); outline-offset: 4px; }
button { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
button:active, .home-preview a:active { transform: scale(.98); }

h1 { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.9px; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 650; letter-spacing: -.35px; }
.room-value, .overall-word, .overall-number, .part-value { font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -.5px; line-height: 1.1; }
.nudges p, .room-name, .part-name { font-size: 16px; line-height: 1.4; font-weight: 400; letter-spacing: -.15px; }
.day, .unit, .overall-label, .meter-ends, .missing, footer, .collected { font-size: 13px; line-height: 1.4; color: var(--muted); font-weight: 400; letter-spacing: 0; }

.app-shell { max-width: 440px; margin: auto; padding: calc(22px + env(safe-area-inset-top,0px)) 24px calc(28px + env(safe-area-inset-bottom,0px)); }
.day { margin-top: 4px; }

.nudges { display: grid; gap: 8px; margin-top: 18px; }
.nudges li { display: grid; grid-template-columns: 8px 1fr; gap: 12px; align-items: start; }
.dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); margin-top: 7.5px; }

.columns { display: grid; gap: 26px; margin-top: 24px; }
.rooms ul, .parts { margin-top: 2px; }
.rooms li { display: grid; grid-template-columns: 1fr 96px 64px; align-items: center; gap: 14px; min-height: 56px; border-bottom: 1px solid var(--line); }
.rooms li:last-child { border-bottom: 0; }
.room-value { font-size: 30px; text-align: right; }
.curve { display: block; overflow: visible; }
.curve path { fill: none; stroke: var(--trace); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .85; }
.curve circle { fill: var(--trace); }

.overall { margin-top: 10px; padding: 14px 16px 12px; border-radius: 16px; background: var(--well); }
.overall-read { display: flex; align-items: baseline; justify-content: space-between; margin-top: 2px; }
.overall-word { font-size: 30px; letter-spacing: -.8px; }
.overall-number { font-size: 30px; color: var(--muted); font-weight: 400; }
.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 10px; }
.meter span { height: 6px; border-radius: 3px; background: var(--line); }
.meter span.on { background: var(--trace); }
.meter-ends { display: flex; justify-content: space-between; margin-top: 6px; }
.parts li { display: flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 11px 2px 0; border-bottom: 1px solid var(--line); }
.parts li:last-child { border-bottom: 0; }
.part-name { flex: 1; }
.part-note { font-size: 15px; line-height: 1.4; color: var(--accent); }
.part-value.off { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.part-value { font-size: 18px; letter-spacing: -.2px; min-width: 64px; text-align: right; }
.unit { margin-left: 3px; letter-spacing: 0; }
footer { padding-top: 22px; }
.loading, .error { padding: 30px; font-size: 16px; line-height: 1.5; }
.error { max-width: 390px; margin: auto; }
.error h1 { margin-bottom: 16px; }
.error button { margin-top: 18px; }

@media (min-width: 820px) {
  .app-shell { max-width: 880px; padding: 48px 40px; }
  .app-header { display: flex; align-items: baseline; gap: 16px; }
  .day { margin-top: 0; }
  .nudges { margin-top: 16px; max-width: 640px; }
  .columns { gap: 32px; margin-top: 28px; }
  .rooms ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
  .rooms li { grid-template-columns: 1fr auto; grid-template-areas: "name name" "curve value"; align-items: end; row-gap: 10px; min-height: 0; padding: 16px 18px 14px; border: 0; border-radius: 16px; background: var(--well); }
  .room-name { grid-area: name; }
  .rooms .curve { grid-area: curve; width: 120px; height: 37.5px; }
  .room-value { grid-area: value; font-size: 40px; }
  .air { display: grid; grid-template-columns: 5fr 7fr; column-gap: 32px; align-items: start; }
  .air h2 { grid-column: 1 / -1; }
  .overall { margin-top: 12px; padding: 20px 22px 18px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
  .overall-word, .overall-number { font-size: 40px; }
  .parts { margin-top: 4px; }
}

.rooms-widget { display: flex; flex-direction: column; justify-content: space-between; width: 100%; height: 100%; padding: 14px 15px 12px; border-radius: 23px; background: var(--paper); color: var(--ink); text-decoration: none; overflow: hidden; }
.widget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.widget-name { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-room strong { display: block; font-size: 24px; line-height: 1.1; font-weight: 600; letter-spacing: -.7px; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.widget-room .curve { margin-top: 4px; width: 100%; }
.widget-room .curve path { stroke-width: 1.3; }
.widget-note { display: flex; align-items: center; gap: 6px; font-size: 10.5px; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; }
.widget-note .dot { width: 6px; height: 6px; margin: 0; box-shadow: 0 0 0 2px var(--accent-soft); flex: none; }
.rooms-widget .collected { font-size: 10.5px; white-space: nowrap; }
.widget-page, .widget-page #app { height: 100dvh; min-height: 160px; background: transparent; }
.widget-page .error { font-size: 12px; padding: 15px; }
.widget-page .error h1 { font-size: 20px; margin-bottom: 8px; }
.widget-page .error button { font-size: 12px; min-height: 30px; margin-top: 8px; padding: 4px 8px; }

.home-preview { min-height: 100dvh; background: #d6d8ca; }
.preview-home { max-width: 390px; margin: auto; min-height: 100dvh; padding: 70px 30px 30px; position: relative; }
.home-title { margin-bottom: 34px; }
.home-title > span { font-size: 30px; letter-spacing: -.8px; font-weight: 600; }
.home-title p { font-size: 13px; margin-top: 7px; color: #50574c; }
.home-preview .rooms-widget { width: 172px; height: 172px; box-shadow: 0 3px 16px #3840310d; }
.home-icon { display: inline-flex; flex-direction: column; align-items: center; gap: 7px; text-decoration: none; margin-top: 30px; margin-left: 10px; font-size: 12px; }
.home-icon img { border-radius: 14px; box-shadow: 0 2px 6px #38403112; }
.home-caption { position: absolute; bottom: 40px; font-size: 12px; color: #50574c; }

@media (prefers-color-scheme: dark) {
  :root { --paper: #1f201c; --ink: #ecebe2; --muted: #a4a698; --line: #383a32; --well: #292a25; --trace: #a9c4af; --accent: #e3a56c; --accent-soft: #4a3424; }
  .home-preview { background: #242d27; }
  .home-title p, .home-caption { color: #b9c6b9; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 350px) { .app-shell { padding-left: 20px; padding-right: 20px; } .rooms li { grid-template-columns: 1fr 72px 56px; } }
