/* Layout: one calm phone-width column under a meadow, four tabs and a center Log button. */
:root {
  --sky: #7CC4EE; --bg-top: #E6F4FA; --bg: #F5F8E4; --surface: #FFFEF8; --fg: #16382A; --muted: #4C6A52; --line: #DCE6C6;
  --lawn: #2A6B3C; --on-lawn: #FFFEF8; --lawn-soft: #E4F1C9; --sky-soft: #D3ECF8; --ball: #E4E34C; --on-ball: #16382A;
  --rose: #A82B4E; --rose-soft: #FFE3EA; --on-rose: #FFFFFF; --dim: rgba(22, 56, 42, .5);
  --display: "Fraunces", Georgia, serif; --body: "Figtree", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --sky: #17354A; --bg-top: #10283A; --bg: #0F201B; --surface: #1A2F29; --fg: #EDF7F2; --muted: #A9C4BA; --line: #2D4A41;
  --lawn: #7ED9A6; --on-lawn: #0B1F18; --lawn-soft: #1F4034; --sky-soft: #17354A; --rose: #FF8FA8; --rose-soft: #4A2530; --on-rose: #2A0F17; --dim: rgba(0, 0, 0, .6);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --sky: #17354A; --bg-top: #10283A; --bg: #0F201B; --surface: #1A2F29; --fg: #EDF7F2; --muted: #A9C4BA; --line: #2D4A41;
  --lawn: #7ED9A6; --on-lawn: #0B1F18; --lawn-soft: #1F4034; --sky-soft: #17354A; --rose: #FF8FA8; --rose-soft: #4A2530; --on-rose: #2A0F17; --dim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 400 16px/1.45 var(--body); overflow: hidden; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; line-height: 1.14; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.95rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lawn); }
:focus-visible { outline: 3px solid var(--lawn); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.tnum { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { font-weight: 700; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.err { color: var(--rose); font-weight: 700; font-size: .9rem; }

/* Shell */
[hidden] { display: none !important; }
img { max-width: 100%; }
#shell { height: 100%; max-width: 480px; margin: 0 auto; padding-top: env(safe-area-inset-top, 0px); display: flex; flex-direction: column; position: relative; background: var(--bg); overflow: hidden; }
#screen { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: linear-gradient(180deg, var(--bg-top), var(--bg) 340px) no-repeat; background-color: var(--bg); }
.page { padding: 14px max(18px, env(safe-area-inset-right, 0px)) 28px max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
.page > * { flex: none; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px)); }
.dogs { display: flex; gap: 8px; overflow-x: auto; flex: 1; min-width: 0; padding: 3px; scrollbar-width: none; }
.dogs::-webkit-scrollbar { display: none; }
.dogchip { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); flex: none; width: 50px; min-height: 44px; }
.dogchip .av { outline: 2px solid transparent; outline-offset: 1px; }
.dogchip[aria-current="true"] { color: var(--fg); }
.dogchip[aria-current="true"] .av { outline-color: var(--lawn); }
.dogchip span.nm { max-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 38px; height: 38px; border-radius: 50%; background: var(--lawn-soft); color: var(--fg); display: grid; place-items: center; font: 500 1.05rem var(--display); overflow: hidden; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.big { width: 96px; height: 96px; font-size: 2.4rem; border: 3px solid var(--surface); }
.urgent-btn { border: 0; border-radius: 999px; background: var(--rose); color: var(--on-rose); font-weight: 700; font-size: .84rem; padding: 10px 14px; flex: none; min-height: 44px; }
.tabs { flex: none; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.tabs button { border: 0; background: transparent; padding: 5px 2px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: .74rem; font-weight: 600; color: var(--muted); min-height: 50px; justify-content: center; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--on-lawn); background: var(--lawn); }
.tabs .log span.plus { width: 36px; height: 36px; border-radius: 50%; background: var(--ball); color: var(--on-ball); display: grid; place-items: center; font: 500 1.6rem/1 var(--display); }
.tabs .log { color: var(--fg); }

/* Controls */
.btn { border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 700; background: var(--lawn); color: var(--on-lawn); width: 100%; font-size: 1rem; text-align: center; text-decoration: none; display: block; min-height: 48px; }
.btn.line { background: transparent; color: var(--fg); border: 1.5px solid var(--line); }
.btn.mini { width: auto; display: inline-block; padding: 8px 14px; font-size: .875rem; min-height: 38px; }
.btn.danger { background: transparent; color: var(--rose); border: 1.5px solid var(--rose); }
.filebtn { position: relative; overflow: hidden; cursor: pointer; align-self: flex-start; }
.filebtn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filebtn:focus-within { outline: 3px solid var(--lawn); outline-offset: 2px; }
.link { border: 0; background: transparent; padding: 11px 0; color: var(--lawn); font-weight: 700; font-size: .9rem; text-align: left; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=time], input[type=tel], select, textarea { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; min-width: 0; }
.field small { font-weight: 400; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 999px; font-weight: 600; font-size: .875rem; min-height: 40px; }
.chip[aria-pressed="true"] { background: var(--lawn); color: var(--on-lawn); border-color: var(--lawn); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; line-height: 1.25; min-height: 48px; }
.choice small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }
.choice[aria-pressed="true"] { border-color: var(--lawn); background: var(--lawn-soft); }
.progress { height: 7px; background: var(--line); border-radius: 7px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--lawn); border-radius: 7px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.lawn { background: var(--lawn); color: var(--on-lawn); border: 0; }
.card.lawn .eyebrow { color: inherit; opacity: .85; }
.card.lawn .sub { opacity: .85; font-size: .8rem; display: block; }
.card.lawn .btn { background: var(--surface); color: var(--fg); }
.note { background: var(--sky-soft); border-radius: 20px; padding: 15px 17px; display: flex; flex-direction: column; gap: 5px; }
.app-icon { width: 48px; height: 48px; border-radius: 12px; flex: none; display: block; }
.note .btn { margin-top: 6px; }
.warn { background: var(--rose-soft); border-radius: 14px; padding: 11px 13px; font-size: .875rem; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.facts > div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts b { font: 500 1.06rem/1.25 var(--display); display: block; overflow-wrap: anywhere; }
.band { position: relative; height: 150px; overflow: hidden; }
.band .meadow, .hero-art .meadow { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.band-dog, .hero-dog { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); }
.hero { background: var(--surface); border-radius: 26px; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; box-shadow: 0 10px 30px rgba(30, 70, 40, .12); }
.hero-art { position: relative; height: 150px; }
.hero-copy { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; margin: 0 18px; }
.next { border-top: 1px solid var(--line); padding-top: 13px; margin: 0 18px; display: flex; flex-direction: column; gap: 4px; }
.next b { font: 500 1.15rem/1.2 var(--display); }
.next .btn { margin-top: 8px; }
.pawrow { display: flex; gap: 6px; }
.hero-copy .pawrow { justify-content: center; }
.paw { fill: var(--line); }
.paw.on { fill: var(--lawn); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 14px; font-size: .72rem; color: var(--muted); }
.day b { font: 500 .98rem/1.1 var(--display); color: var(--fg); }
.day.today { background: var(--lawn); color: var(--on-lawn); }
.day.today b { color: var(--on-lawn); }
.day.later b { color: var(--muted); }
.day::after { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.day.earned::after { background: #C9C72F; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.plan-row { display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 12px 14px; text-align: left; min-height: 56px; }
.plan-row:first-child { border-top: 0; }
.plan-row b { display: block; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.plan-row small { display: block; color: var(--muted); font-size: .84rem; margin-top: 1px; overflow-wrap: anywhere; }
.ring { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.5px solid var(--muted); position: relative; }
.plan-row.done .ring { background: var(--lawn); border-color: var(--lawn); }
.plan-row.done .ring::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid var(--on-lawn); border-width: 0 2px 2px 0; transform: rotate(42deg); }
.plan-row.done b { color: var(--muted); }
.chev { color: var(--muted); font-weight: 700; }
.done-toggle { display: flex; justify-content: space-between; width: 100%; background: transparent; border: 0; padding: 4px 2px; font-weight: 600; color: var(--muted); min-height: 40px; align-items: center; }
.bar { height: 10px; background: var(--line); border-radius: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--lawn); border-radius: 10px; }
.trail-wrap { border-radius: 22px; overflow: hidden; border: 1px solid var(--line); }
.trail { display: block; width: 100%; height: auto; }
.trail text { font-family: var(--body); }
.stamps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stamps > * { min-width: 0; }
.stamp { border: 1.5px dashed var(--line); background: transparent; border-radius: 14px; padding: 10px 12px; text-align: left; font-weight: 600; font-size: .875rem; line-height: 1.25; overflow-wrap: anywhere; }
.stamp.on { border: 1.5px solid var(--lawn); background: var(--lawn-soft); }
.stamp small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; font-size: .78rem; }
.urgent { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.urgent > * { border: 0; border-radius: 18px; padding: 13px; background: var(--rose-soft); color: var(--fg); font-weight: 700; text-align: left; text-decoration: none; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; min-width: 0; }
.urgent small { font-weight: 500; color: var(--muted); }
.urgent .wide { grid-column: 1 / -1; }
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.places a { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 13px; font-weight: 700; color: var(--fg); text-decoration: none; line-height: 1.2; min-width: 0; }
.places small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
details.a { border-top: 1px solid var(--line); }
details.a:first-child { border-top: 0; }
details.a summary { cursor: pointer; font-weight: 700; padding: 11px 0; }
details.a p { margin-bottom: 11px; }
details.a p a { display: inline-block; padding: 6px 0; }
.timeline > div { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.timeline > div:first-child { border-top: 0; padding-top: 0; }
.timeline .yr { font: 500 .9rem var(--display); color: var(--lawn); }
.timeline img { display: block; max-width: 100%; max-height: 160px; border-radius: 10px; margin-top: 6px; }
pre.report { white-space: pre-wrap; font: 500 .9rem/1.5 var(--body); margin: 0; background: var(--surface); border: 1px solid var(--line); padding: 14px; border-radius: 14px; overflow-wrap: anywhere; }
canvas.poster { width: 100%; height: auto; border-radius: 16px; display: block; }
.spark { width: 100%; height: auto; display: block; }

/* Sheet, toast, celebration */
.sheetwrap { position: absolute; inset: 0; background: var(--dim); display: flex; align-items: flex-end; z-index: 10; }
.sheet { background: var(--bg); width: 100%; max-height: 92%; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; animation: rise .2s ease-out; }
.sheet > * { flex: none; }
.sheet.still { animation: none; }
@keyframes rise { from { transform: translateY(22px); } }
.x { border: 0; background: var(--line); color: var(--fg); width: 40px; height: 40px; flex: none; border-radius: 50%; font-weight: 700; }
.toast { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: .875rem; font-weight: 700; width: max-content; max-width: calc(100% - 32px); text-align: center; z-index: 20; }
.party { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 25; }
.party i { position: absolute; top: -60px; border-radius: 50%; background: #DCE94A; box-shadow: inset -3px -3px 6px rgba(120, 130, 20, .35); overflow: hidden; animation: ballfall linear both; }
.party i::before, .party i::after { content: ""; position: absolute; width: 90%; height: 90%; border: 2px solid #FFFFFF; border-radius: 50%; top: 5%; }
.party i::before { left: -55%; }
.party i::after { right: -55%; }
@keyframes ballfall { to { transform: translateY(1000px) rotate(var(--spin)); } }
.woof { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); background: var(--lawn); color: var(--on-lawn); padding: 18px 26px; border-radius: 24px; text-align: center; font: 500 2rem/1.1 var(--display); width: max-content; max-width: 86%; }
.woof small { display: block; font: 600 .84rem/1.3 var(--body); margin-top: 6px; }
.welcome-art { height: 220px; position: relative; overflow: hidden; }
.welcome-art .meadow { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.welcome-art img { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); width: 170px; height: 170px; filter: drop-shadow(0 1px 3px rgba(10, 40, 20, .5)); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
