:root {
  color-scheme: light dark;
  --paper: #f6f1e9;
  --surface: #eee5d7;
  --ink: #3a2e24;
  --muted: #6f6152;
  --line: #d8cab5;
  --accent: #6b4f35;
  --on-accent: #ffffff;
  --olive: #6c7336;
  --outline: #b9a68d;
  --placeholder: #e7dccb;
  --warn: #9c4a2a;
  --focus: #8a5a2b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1e1914;
    --surface: #2a231c;
    --ink: #ece3d6;
    --muted: #b8aa97;
    --line: #463a2d;
    --accent: #d6b68e;
    --on-accent: #2a1f14;
    --olive: #aab26f;
    --outline: #7c6b57;
    --placeholder: #322a22;
    --warn: #e3916b;
    --focus: #e8c49a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.page { max-width: 480px; margin: 0 auto; padding: 28px 16px 24px; }
.masthead { margin-bottom: 20px; }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
.date { margin-top: 4px; color: var(--muted); font-size: .9375rem; }
.card { padding: 18px 16px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.angle-title { font-size: 1.25rem; line-height: 1.3; font-weight: 600; }
.example { margin: 8px 0 16px; font-size: 1.0625rem; font-style: italic; }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 10px 18px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.text-button { min-height: 44px; padding: 8px 4px; border: 0; background: none; color: var(--accent); text-decoration: underline; text-underline-offset: .2em; font-size: .9375rem; }
#backfill-button { display: block; margin: 6px auto 0; }
.entry { scroll-margin-top: 12px; }
.form-day { margin-bottom: 10px; font-weight: 600; color: var(--accent); }
.outcomes { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.outcomes legend, .entry label { display: block; padding: 0; margin-bottom: 8px; font-weight: 600; font-size: .9375rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: 1 1 auto; min-height: 44px; padding: 8px; border: 1px solid var(--outline); border-radius: 999px; background: var(--paper); font-size: .9375rem; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.outcomes.missing legend, .entry label:has(+ input.missing) { color: var(--warn); }
.outcomes.missing .chip { border-color: var(--warn); border-width: 2px; }
.entry input { display: block; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--outline); border-radius: 8px; background: var(--paper); font-size: 1rem; }
.entry input.missing { border: 2px solid var(--warn); }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.form-actions .primary { width: auto; flex: 1; }
.history, .recent { margin-top: 26px; }
.history h2 { margin-bottom: 12px; font-size: 1rem; font-weight: 600; }
.recent summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-weight: 600; cursor: pointer; list-style: none; }
.recent summary::-webkit-details-marker { display: none; }
.recent summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.recent[open] summary::after { content: "\2212"; }
.recent[open] summary { margin-bottom: 4px; }
.weekdays, .dots { display: grid; grid-template-columns: repeat(7, 1fr); justify-items: center; max-width: 340px; }
.weekdays { margin-bottom: 6px; color: var(--muted); font-size: .75rem; }
.dots { gap: 10px 0; }
.dot { width: 22px; height: 22px; border-radius: 50%; }
.dot.is-placeholder { background: var(--placeholder); transform: scale(.45); }
.dot.is-empty { border: 2px solid var(--outline); }
.dot.is-filled { background: var(--olive); }
.dot.is-today { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.dot.is-today:not(.is-filled) { border: 2px solid var(--outline); }
.count { margin-top: 16px; font-size: 1.0625rem; font-weight: 600; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
#lighter { margin-top: 2px; }
.recent-list { margin: 0; padding: 0; list-style: none; }
.recent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.recent-row:last-child { border-bottom: 1px solid var(--line); }
.recent-meta { display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--muted); font-size: .8125rem; }
.recent-text { overflow-wrap: anywhere; }
.delete { font-size: .875rem; white-space: nowrap; }
.delete.armed { color: var(--warn); font-weight: 600; }
.unlinked { margin-top: 24px; color: var(--muted); }
footer { display: flex; justify-content: flex-end; margin-top: 12px; font-size: .8125rem; color: var(--muted); }
footer button { min-height: 44px; }
@media (hover: hover) {
  .primary:hover { filter: brightness(.94); }
  .chip:hover { border-color: var(--accent); }
}
@media (prefers-reduced-motion: no-preference) {
  .chip { transition: background-color .12s ease; }
}
