:root {
  --bg: #F5F7F6; --surface: #fff; --ink: #1E2B26; --muted: #566660; --line: #D9E1DD;
  --primary: #2F6B4F; --on-primary: #fff; --tint: #E3EEE8;
  --loved: #A3245C; --on-loved: #fff; --so-so: #F2B33D; --on-so-so: #1E2B26; --refused: #3B4A8C; --on-refused: #fff;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111815; --surface: #19231F; --ink: #E8EFEB; --muted: #9FB1A8; --line: #2B3833;
    --primary: #6FC79A; --on-primary: #0F1A15; --tint: #1F332A;
    --loved: #E8709E; --on-loved: #1E0F16; --so-so: #F2B33D; --refused: #98A6EA; --on-refused: #10152E;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 12px; }
body { margin: 0; font: 1.0625rem/1.45 var(--text); background: var(--bg); color: var(--ink); padding-bottom: calc(88px + env(safe-area-inset-bottom)); -webkit-text-size-adjust: 100%; }
main { max-width: 600px; margin: 0 auto; padding: 16px 16px 8px; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.1; letter-spacing: -.02em; }
h1 { font-size: 1.75rem; font-weight: 700; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
svg { display: block; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); min-height: 44px; padding: 0 10px; font-weight: 500; }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn.sm { min-height: 44px; padding: 0 14px; }

input[type=text], input[type=search], textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
textarea { line-height: 1.5; resize: vertical; }
label.f { display: block; margin: 16px 0 6px; font-weight: 600; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }

.top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.top svg { width: 34px; height: 34px; }
.top h1 { font-size: 1.15rem; }
.tools { display: flex; gap: 8px; margin-bottom: 8px; }
.tools .primary { flex: 1.5; }
.tools .btn:not(.primary) { flex: 1; }

.day { padding: 22px 0 8px; border-top: 1.5px solid var(--line); }
.day:first-child { border-top: 0; }
.day > header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.dn { font: 700 2.25rem/1 var(--display); letter-spacing: -.035em; font-variation-settings: "opsz" 96; }
.day time { color: var(--muted); font-size: 1rem; }
.day.past .dn { color: var(--muted); }
.day.today { background: var(--surface); border: 0; border-radius: 26px; padding: 20px 18px 10px; margin: 14px -6px; box-shadow: 0 0 0 2px var(--primary); }
.day.today .dn { color: var(--primary); }
.pill { margin-left: auto; align-self: center; padding: 3px 12px; border-radius: 99px; background: var(--primary); color: var(--on-primary); font-size: .9rem; font-weight: 700; }
.meals { list-style: none; margin: 0; padding: 0; }
.meal { display: grid; grid-template-columns: 38px 1fr; column-gap: 12px; padding: 14px 0; border-top: 1.5px dashed var(--line); }
.meal:first-child { border-top: 0; }
.glyph { width: 38px; height: 38px; border-radius: 50%; background: var(--tint); color: var(--primary); display: grid; place-items: center; }
.glyph svg { width: 22px; height: 22px; }
.name { font: 600 1.25rem/1.2 var(--display); letter-spacing: -.01em; }
.desc { color: var(--muted); margin-top: 3px; font-size: 1rem; }
.lo { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .95rem; font-weight: 600; color: var(--primary); }
.lo svg { width: 16px; height: 16px; }
.empty { color: var(--muted); padding-top: 6px; }
.acts { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.acts .primary { flex: 1; }
.acts .btn:not(.primary):not(.quiet) { flex: 0 0 auto; padding: 0 22px; }
.acts.row .btn.quiet { margin-left: -10px; }

.rate { margin-top: 12px; }
.faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.face { --fc: var(--fi); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 84px; padding: 8px 4px 6px; border: 0; border-radius: 18px; background: transparent; font-size: .9rem; font-weight: 600; }
.face[aria-pressed=true] { --fc: var(--on); background: color-mix(in srgb, var(--c) 12%, transparent); }
[data-r=loved] { --c: var(--loved); --on: var(--on-loved); --fi: var(--loved); }
[data-r=so-so] { --c: var(--so-so); --on: var(--on-so-so); --fi: var(--ink); }
[data-r=refused] { --c: var(--refused); --on: var(--on-refused); --fi: var(--refused); }
.fs { width: 52px; height: 52px; overflow: visible; }
.fs .bg { fill: color-mix(in srgb, var(--c) 16%, transparent); stroke: var(--c); stroke-width: 2.5; }
.fs .f { fill: none; stroke: var(--fc, var(--fi)); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.fs .d { fill: var(--fc, var(--fi)); stroke: none; }
.face[aria-pressed=true] .bg, .fs.on .bg { fill: var(--c); }
.fs.on { --fc: var(--on); }
.face.pop .fs { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.22) rotate(-6deg); } 100% { transform: scale(1) rotate(0); } }
.note { margin-top: 8px; }
.shown { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-weight: 600; }
.shown .fs { width: 34px; height: 34px; }
.quote { margin: 6px 0 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }

.hist .day { padding-top: 18px; }
.hist .dn { font-size: 1.75rem; }
.more { display: flex; margin: 18px auto 0; }
.state { padding: 36px 0; text-align: center; color: var(--muted); }
.state h2 { color: var(--ink); font-size: 1.4rem; margin-bottom: 8px; }
.state .btn { margin-top: 16px; }

.lib { list-style: none; margin: 14px 0 0; padding: 0; }
.lib li { padding: 18px 0; border-top: 1.5px solid var(--line); }
.lib li:first-child { border-top: 0; }
.lib h2 { font-size: 1.4rem; font-weight: 650; }
.counts { display: flex; gap: 14px; margin: 8px 0 4px; }
.counts span { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.counts .fs { width: 28px; height: 28px; }
.meta { color: var(--muted); font-size: .98rem; margin-top: 2px; }
h1 + .lede { color: var(--muted); margin: 8px 0 16px; max-width: 34rem; }
.field-row { margin-top: 14px; }

.tabs { position: fixed; inset: auto 0 0; display: flex; justify-content: center; background: var(--surface); border-top: 1.5px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: .85rem; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; min-height: 64px; }
.tabs svg { width: 26px; height: 26px; }
.tabs a[aria-current] { color: var(--primary); font-weight: 700; }
.tabs a[aria-current]::before { content: ""; position: absolute; top: -1.5px; width: 34px; height: 4px; border-radius: 0 0 4px 4px; background: var(--primary); }

dialog { border: 0; padding: 0; color: var(--ink); background: var(--bg); width: 100%; max-width: 100%; max-height: min(88dvh, 720px); margin: auto 0 0; border-radius: 28px 28px 0 0; overflow: auto; overscroll-behavior: contain; }
dialog[open] { animation: up .28s ease-out; }
dialog::backdrop { background: rgb(10 20 15 / .5); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet { padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); max-width: 600px; margin: 0 auto; }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 8px; }
.sh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sh h2 { font-size: 1.5rem; }
.x { width: 44px; height: 44px; border: 0; background: var(--tint); border-radius: 50%; display: grid; place-items: center; margin-right: -4px; }
.x svg { width: 20px; height: 20px; }
.opts { display: grid; gap: 8px; }
.opt { display: block; width: 100%; text-align: left; padding: 14px 16px; min-height: 56px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.opt strong { display: block; font-weight: 700; }
.opt .muted { font-size: .97rem; }
.opt.go { display: flex; align-items: center; gap: 14px; }
.opt.go svg { width: 28px; height: 28px; color: var(--primary); }
.opt .counts { margin: 6px 0 0; gap: 10px; }
.opt .counts .fs { width: 22px; height: 22px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 10px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.think { display: grid; gap: 8px; }
.sk { height: 76px; border-radius: 14px; background: linear-gradient(100deg, var(--tint) 30%, var(--surface) 50%, var(--tint) 70%) 0 0 / 300% 100%; animation: sk 2.4s ease-in-out infinite; }
@keyframes sk { to { background-position: -150% 0; } }
.says { margin-bottom: 12px; color: var(--muted); }
.problem { padding: 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--refused); }
.problem h3 { font-size: 1.15rem; margin-bottom: 6px; }
.problem .acts { margin-top: 14px; flex-wrap: wrap; }
.problem .acts .btn { flex: 1 1 auto; }
.problem .acts .primary { flex-basis: 100%; }
.list-text { white-space: pre-wrap; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.sheet > .btn.primary { width: 100%; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; padding: 13px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
#toast.show { opacity: 1; transform: none; }
.spin { width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: r .8s linear infinite; }
@keyframes r { to { transform: rotate(360deg); } }
@media (min-width: 640px) {
  dialog { margin: auto; border-radius: 28px; width: 540px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .sk { animation: none; }
}
