/* PööpöTracker — warm, calm and tactile. Users can restyle it on the Teema page:
   a saved theme sets the custom properties below inline on <html>. */

/* Theme fonts (SIL Open Font License). Browsers only download the ones in use. */
@font-face { font-family: "Nunito"; src: url(/static/fonts/nunito.woff2) format("woff2"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url(/static/fonts/quicksand.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url(/static/fonts/fredoka.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Caveat"; src: url(/static/fonts/caveat.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url(/static/fonts/playfair.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Pacifico"; src: url(/static/fonts/pacifico.woff2) format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #f6f1ea;
  --surface: #fffdfa;
  --surface-2: #f2ece4;
  --ink: #2d2622;
  --muted: #7f736a;
  --line: #e6dcd0;
  --accent: #e07a5f;
  --accent-strong: #c4603f;
  --accent-soft: #fbe4da;
  --on-accent: #ffffff;
  --good: #4a9a64;
  --good-soft: #e0f0e4;
  --warn: #cf8d22;
  --warn-soft: #faedd1;
  --bad: #c4553f;
  --bad-soft: #f8e0d9;
  --info: #5674a6;
  --info-soft: #e2e9f5;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(70 45 25 / 0.05), 0 6px 20px rgb(70 45 25 / 0.06);
  --shadow-lift: 0 2px 4px rgb(70 45 25 / 0.08), 0 12px 28px rgb(70 45 25 / 0.12);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --surface: #26211d;
    --surface-2: #302924;
    --ink: #f2eae2;
    --muted: #a99b8f;
    --line: #3b332d;
    --accent: #ee8a6e;
    --accent-strong: #f4a189;
    --accent-soft: #4a2d23;
    --on-accent: #1c1815;
    --good: #72c08a;
    --good-soft: #22382a;
    --warn: #e8b354;
    --warn-soft: #403321;
    --bad: #e67d66;
    --bad-soft: #47261f;
    --info: #8ea9da;
    --info-soft: #262f43;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.35), 0 12px 28px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* With overflow set on html, the body's own "overflow-x: clip" (below) really clips instead of
   being handed to the browser window. */
html { overflow-x: clip; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }


/* Installed as an app: no browser bars, so the content may go a little closer to the top. */
@media (display-mode: standalone) {
  .container { padding-top: 1rem; }
  .mainnav a, .btn, button { user-select: none; -webkit-user-select: none; }
}
body {
  /* Content sliding sideways (tab swipes) must never make the page wider than the screen: a wider
     page lets phone browsers shift or zoom the whole view, top bar included. "clip" (unlike
     "hidden") keeps the sticky top bar and calendar day row working. */
  overflow-x: clip;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
small { font-size: .8em; }
.muted { color: var(--muted); }
.lead { max-width: 60ch; margin-top: .25rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* --- layout --- */

.container { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin: .5rem 0 1.5rem;
}
.page-head h1 { margin: 0; }
.eyebrow { margin: 0 0 .2rem; color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.section-title { margin: 1.5rem 0 .75rem; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.section-title:first-child { margin-top: 0; }

.layout-main-side { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 900px) {
  .layout-main-side { grid-template-columns: minmax(0, 1fr) 340px; }
  .side-card, .side-stack { position: sticky; top: 1rem; }
}
.side-stack { display: grid; gap: 1.25rem; }
.side-stack .side-card { position: static; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.layout-main-side > .card, .side-stack > .card { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }
.empty { color: var(--muted); padding: 1.5rem 0; text-align: center; }
.empty.small { padding: .5rem 0; text-align: left; font-size: .92rem; margin: 0; }
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.error-code { font: 800 4rem/1 var(--font-display); color: var(--accent); margin-bottom: .5rem; }
.traceback { text-align: left; overflow-x: auto; font-size: .8rem; background: var(--surface-2); padding: 1rem; border-radius: var(--radius-sm); }

/* --- top bar --- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .65rem max(1rem, calc((100% - 1180px) / 2 + 1rem));
  /* Solid rather than translucent or blurred: content (e.g. the calendar) scrolls under it, and
     blurring over the fixed pattern layer repainted on every scroll. */
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 750 1.15rem var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
}
.brand-dot {
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent-strong), var(--accent));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mainnav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; order: 3; width: 100%; }
.mainnav a {
  padding: .4rem .85rem; border-radius: 999px; color: var(--muted); text-decoration: none;
  font-weight: 600; font-size: .95rem; white-space: nowrap; transition: background .15s, color .15s;
}
.mainnav a:hover { color: var(--ink); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--on-accent); background: var(--accent); }
.logout { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.whoami { color: var(--muted); }
@media (min-width: 820px) {
  .mainnav { order: 0; width: auto; }
}

/* --- buttons & forms --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 .95rem var(--font);
  text-decoration: none; cursor: pointer;
  transition: transform .12s var(--ease), background .15s, box-shadow .15s, border-color .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-small { padding: .35rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; padding: 0; color: var(--accent-strong); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.btn-icon {
  width: 2.2rem; height: 2.2rem; flex: none; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 1.2rem; cursor: pointer;
}
.btn-icon:hover { color: var(--bad); border-color: var(--bad); }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .75rem;
  min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
textarea { width: 100%; resize: vertical; }

.stack { display: grid; gap: .9rem; }
.stack label, .field { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.field input, .field select, .field textarea, .stack input { font-weight: 400; }
.field.inline { display: flex; align-items: center; gap: .6rem; font-weight: 500; }
.field.inline input { width: 5rem; }
.field-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; margin: .25rem 0 0; }

.form { display: grid; gap: 1.25rem; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .8rem; }
.form legend { font: 650 1rem var(--font-display); margin-bottom: .6rem; padding: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.more summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: .25rem 0; }
.more[open] summary { margin-bottom: .8rem; }
.more > .field + .field, .more > form + form { margin-top: .8rem; }
.danger-zone { display: flex; justify-content: flex-end; margin-top: -.25rem; }

.segmented {
  display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem;
  background: var(--surface-2); border-radius: 999px; justify-self: start;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: block; padding: .45rem .95rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
  color: var(--muted); transition: background .2s var(--ease), color .2s, box-shadow .2s;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

.weekday-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.daybox { position: relative; }
.daybox input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.daybox span {
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 50%;
  border: 1.5px solid var(--line); font-weight: 650; text-transform: capitalize; color: var(--muted);
  transition: background-color .18s, border-color .18s, color .18s, transform .18s var(--ease);
}
.daybox input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: scale(1.05); }
.daybox input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.quick-picks { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .88rem; }

.time-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.time-row .field { min-width: 9rem; }

.option-rows { display: grid; gap: .5rem; }
.option-rows:empty { display: none; }
.option-row { display: flex; align-items: center; gap: .5rem; }
.option-row input[name="option_label"] { flex: 1; }

.check-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-check { position: relative; display: inline-flex; }
.pill-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pill-check span {
  padding: .4rem .9rem; border-radius: 999px; border: 1.5px solid var(--line);
  font-weight: 600; font-size: .9rem; color: var(--muted); transition: background-color .15s, border-color .15s, color .15s;
}
.pill-check span::before { content: "＋ "; }
.pill-check input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.pill-check input:checked + span::before { content: "✓ "; color: var(--accent-strong); }
.pill-check input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; }
.filters-inline { margin: -.5rem 0 1rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.inline-form input { flex: 1 1 8rem; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 500; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-ok { background: var(--good-soft); color: var(--good); }
.inline-error { color: var(--bad); font-size: .88rem; margin: .4rem 0 0; animation: shake .35s; }

/* --- tags & chips --- */

.tag {
  display: inline-block; padding: .05rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 650; background: var(--surface-2); color: var(--muted);
}
.tag-late, .tag-overdue { background: var(--warn-soft); color: var(--warn); }
.tag-missed, .tag-undone { background: var(--bad-soft); color: var(--bad); }
.tag-ok { background: var(--good-soft); color: var(--good); }

.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .7rem; border-radius: 999px;
  font-size: .82rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.chip-sm { padding: .05rem .45rem; font-size: .75rem; }
.chip-done, .chip-on_track { background: var(--good-soft); color: var(--good); }
.chip-late, .chip-at_risk { background: var(--warn-soft); color: var(--warn); }
.chip-missed, .chip-behind, .chip-failed { background: var(--bad-soft); color: var(--bad); }
.chip-start { background: var(--info-soft); color: var(--info); }

/* --- tasks --- */

.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.task {
  position: relative; display: flex; align-items: flex-start; gap: .9rem;
  padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: background .3s, border-color .3s, opacity .3s;
}
.task.is-done { background: color-mix(in srgb, var(--good-soft) 45%, var(--surface)); }
.task.status-late { background: color-mix(in srgb, var(--warn-soft) 40%, var(--surface)); }
.task.status-missed { border-left: 4px solid var(--bad); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 650; }
.task.is-done:not(.per-week) .task-title { color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.task-notes { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; white-space: pre-line; }
.task .btn { margin-top: .6rem; }

.check {
  flex: none; display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem; margin-top: -.1rem; padding: 0;
  border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent);
  background: transparent; color: var(--on-accent); cursor: pointer;
  transition: background .25s var(--ease), border-color .25s, transform .15s var(--ease);
}
button.check:hover:not(:disabled) { border-color: var(--good); transform: scale(1.06); }
button.check:disabled { cursor: default; opacity: .6; }
span.check { cursor: default; }
.check-icon { width: 1.25rem; height: 1.25rem; }
.check-icon path {
  fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 22; stroke-dashoffset: 22;
}
.is-done > .check { background: var(--good); border-color: var(--good); }
.status-late > .check { background: var(--warn); border-color: var(--warn); }
.is-done > .check .check-icon path { stroke-dashoffset: 0; }
.just-changed.is-done > .check { animation: pop .4s var(--ease); }
.just-changed.is-done > .check .check-icon path { animation: draw .45s .05s var(--ease) both; }

.options { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; }
.option {
  padding: .4rem .85rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 600 .88rem var(--font); cursor: pointer; transition: background-color .18s, border-color .18s, color .18s, transform .18s var(--ease);
}
.option:hover:not(:disabled) { border-color: var(--good); }
.option:disabled { cursor: default; opacity: .65; }
.option.chosen { background: var(--good); border-color: var(--good); color: var(--on-accent); }
.option.chosen::before { content: "✓ "; }
.just-changed .option.chosen { animation: pop .35s var(--ease); }
.or { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }

.dots { display: inline-flex; gap: .25rem; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--line); transition: background .3s; }
.dot.on { background: var(--good); }
.just-changed .dot.on:last-of-type { animation: pop .4s var(--ease); }

/* compact task rows (week calendar) */
.task.compact { padding: .55rem .6rem; gap: .55rem; border-radius: var(--radius-sm); box-shadow: none; }
.task.compact .check { width: 1.6rem; height: 1.6rem; border-width: 1.5px; }
.task.compact .check-icon { width: .95rem; height: .95rem; }
.task.compact .task-title { font-size: .9rem; line-height: 1.3; }
.task.compact .task-meta { font-size: .8rem; }
.task.compact .options { margin-top: .4rem; gap: .25rem; }
.task.compact .option { padding: .2rem .55rem; font-size: .78rem; }
.task.compact .btn { margin-top: .4rem; }

/* --- day progress ring --- */

.ring { position: relative; width: 4.5rem; height: 4.5rem; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring-track { stroke: var(--line); }
.ring-fill {
  stroke: var(--good); stroke-linecap: round; stroke-dasharray: var(--pct) 100;
  animation: ring-in .9s var(--ease) both; transition: stroke-dasharray .6s var(--ease);
}
.ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--muted); }
.ring strong { font-size: 1.25rem; color: var(--ink); }

/* --- weekly pace --- */

.pace { display: grid; gap: .7rem; }
.pace-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pace-points strong { font: 750 2rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.pace-points span { color: var(--muted); font-weight: 600; }
.pace-compact .pace-points strong { font-size: 1.5rem; }
.bar { position: relative; height: .85rem; border-radius: 999px; background: var(--surface-2); overflow: visible; }
.bar-fill {
  height: 100%; width: var(--pct); border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  animation: grow .9s var(--ease) both; transition: width .6s var(--ease);
}
.pace-done .bar-fill, .pace-on_track .bar-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--good) 75%, white), var(--good)); }
.pace-at_risk .bar-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--warn) 70%, white), var(--warn)); }
.pace-behind .bar-fill, .pace-failed .bar-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 70%, white), var(--bad)); }
.bar-marker {
  position: absolute; top: -.3rem; bottom: -.3rem; left: var(--pct); width: 3px; margin-left: -1.5px;
  border-radius: 2px; background: var(--ink); opacity: .55;
}
.pace-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1rem; margin: .25rem 0 0; }
.pace-stats div { display: grid; }
.pace-stats dt { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pace-stats dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.side-card h2 { margin-bottom: .9rem; }
.side-card .btn-block { margin-top: 1rem; }

/* --- week calendar --- */

.week-nav { display: flex; gap: .4rem; }
.week-top { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.week-top .card { margin: 0; }
@media (min-width: 900px) { .week-top { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .week-top > :only-child { grid-column: 1 / -1; } }
.week-grid { display: grid; gap: .75rem; }
@media (min-width: 1000px) { .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; } }
.day-col {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem; min-height: 6rem;
}
.day-col header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; }
.day-name { font-weight: 700; text-transform: capitalize; font-size: .92rem; }
.day-num { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.day-col.is-today { border: 2px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.day-col.is-today .day-name { color: var(--accent-strong); }
.day-col.is-past { background: color-mix(in srgb, var(--surface) 60%, var(--bg)); }
.day-col .task-list { gap: .4rem; }

/* --- calendar (timeline) --- */

.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.segmented-links a {
  display: block; padding: .45rem .95rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
  color: var(--muted); text-decoration: none;
}
.segmented-links a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.cal-perweek h2 { margin-bottom: .75rem; }
.cal-perweek-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.cal {
  --hour: 64px; --gutter: 3.75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cal-week { --col-min: 0px; --hour: 80px; }
.cal-day { --col-min: 0px; --hour: 96px; }
/* The calendar scrolls with the page (no scroll box of its own): native page scrolling is the
   smoothest there is, and the wheel always moves what you are looking at. The day-name row stays
   pinned under the top bar (--topbar-h is measured by app.js). */
.cal-scroll { background: var(--surface); border-radius: inherit; }
.cal-head, .cal-allday, .cal-body {
  display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(var(--col-min), 1fr));
  min-width: min-content;
}
.cal-head {
  position: sticky; top: var(--topbar-h, 0px); z-index: 6; background: var(--surface);
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.cal-corner, .cal-gutter, .cal-gutter-label { position: sticky; left: 0; background: var(--surface); }
.cal-corner { z-index: 7; }
.cal-dayhead {
  display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem 0 .55rem;
  border-left: 1px solid var(--line); color: var(--muted); text-decoration: none;
}
.cal-dayname { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.cal-daynum {
  display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  font: 700 1.25rem var(--font-display); color: var(--ink); transition: background-color .15s;
}
.cal-dayhead:hover .cal-daynum { background: var(--surface-2); }
.cal-dayhead.is-today .cal-dayname { color: var(--accent-strong); }
.cal-dayhead.is-today .cal-daynum { background: var(--accent); color: var(--on-accent); }

.cal-allday { border-bottom: 2px solid var(--line); }
.cal-gutter-label { z-index: 3; padding: .45rem .5rem; font-size: .68rem; line-height: 1.2; text-align: right; color: var(--muted); }
.cal-allday-cell { display: grid; gap: .3rem; align-content: start; padding: .35rem .3rem; border-left: 1px solid var(--line); min-height: 2.6rem; }

.cal-gutter { z-index: 3; }
.cal-hour { position: relative; height: var(--hour); }
.cal-hour span {
  position: absolute; top: -.55rem; right: .45rem; padding: 0 .15rem; background: var(--surface);
  font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.cal-hour:first-child span { top: .2rem; }
/* Hour and half-hour lines are painted once across the whole body, not per day column. */
.cal-body {
  background-image:
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--hour) / 2),
      color-mix(in srgb, var(--line) 45%, transparent) calc(var(--hour) / 2) calc(var(--hour) / 2 + 1px),
      transparent calc(var(--hour) / 2 + 1px) var(--hour));
  background-position: var(--gutter) 0;
  background-repeat: repeat-y;
}
.cal-col { position: relative; height: calc(var(--hours) * var(--hour)); border-left: 1px solid var(--line); }
.cal-col.is-today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }

.cal-slot {
  position: absolute; z-index: 2;
  top: calc(var(--top) * var(--hour) / 60); height: calc(var(--dur) * var(--hour) / 60);
  left: calc(var(--col) * 100% / var(--cols)); width: calc(100% / var(--cols));
  padding: 1px 4px 2px 3px;
}
.cal-slot:focus-within { z-index: 5; }
/* Flat blocks (no shadows): shadows are expensive to repaint and there can be dozens of blocks. */
.cal-event {
  display: flex; align-items: flex-start; gap: .4rem; height: 100%; min-height: 1.9rem; overflow: hidden;
  padding: .3rem .45rem; border-radius: var(--radius-sm); border-left: 4px solid var(--accent);
  background: var(--accent-soft); font-size: .82rem; line-height: 1.25;
  transition: background-color .25s, border-color .25s;
}
.cal-event .check { width: 1.4rem; height: 1.4rem; margin: 0; border-width: 1.5px; }
.cal-event .check-icon { width: .85rem; height: .85rem; }
body:not([data-done-icon="check"]) .cal-event.is-done > .check::after { font-size: .85rem; }
.cal-event-body { flex: 1; min-width: 0; }
/* Titles wrap in full (at word boundaries); app.js sizes each block so its whole content fits. */
.cal-event-title { font-weight: 650; overflow-wrap: break-word; hyphens: auto; }

/* Wide blocks (day view): title, time and choice on one line so short tasks stay compact. */
@container (min-width: 360px) {
  .cal-event { align-items: center; }
  .cal-event-body { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .7rem; }
  .cal-option { width: auto; max-width: 16rem; margin-top: 0; }
}

/* Narrow blocks (side-by-side lanes in the week view): check circle beside the time, title full width. */
.cal-slot { container-type: inline-size; }
@container (max-width: 125px) {
  .cal-event { display: grid; grid-template-columns: auto 1fr; gap: .15rem .3rem; padding: .25rem .35rem; font-size: .76rem; }
  .cal-event > .check { grid-row: 1; grid-column: 1; width: 1.15rem; height: 1.15rem; }
  .cal-event .check-icon { width: .7rem; height: .7rem; }
  .cal-event-body { display: contents; }
  .cal-event-time { grid-row: 1; grid-column: 2; align-self: center; }
  .cal-event-title, .cal-option, .cal-event .inline-error { grid-column: 1 / -1; }
}
.cal-event-time { color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.cal-option { width: 100%; margin-top: .25rem; padding: .1rem .3rem; border-radius: 6px; font-size: .75rem; }
.cal-event.is-done { background: var(--good-soft); border-left-color: var(--good); }
.cal-event.is-done .cal-event-title { color: var(--muted); }
.cal-event.status-late { background: var(--warn-soft); border-left-color: var(--warn); }
.cal-event.status-missed { background: var(--bad-soft); border-left-color: var(--bad); }
.cal-allday .cal-event { height: auto; }
.cal-event .inline-error { font-size: .72rem; }

.cal-gap {
  position: absolute; z-index: 1; left: 0; right: 0; pointer-events: none;
  top: calc(var(--top) * var(--hour) / 60); height: calc(var(--dur) * var(--hour) / 60);
  display: grid; place-items: center;
}
.cal-gap::before {
  content: ""; position: absolute; top: 6px; bottom: 6px; left: 50%;
  border-left: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
}
.cal-gap > span {
  position: relative; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .7rem; font-weight: 600;
}
.cal-week .gap-word { display: none; }

.cal-now {
  position: absolute; z-index: 4; left: 0; right: 0; height: 2px; background: var(--bad);
  top: calc(var(--top) * var(--hour) / 60); pointer-events: none;
}
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }

/* Phones: a week is too wide for the screen, so it scrolls sideways (the day row then scrolls
   along with the page instead of staying pinned). */
@media (max-width: 700px) {
  .cal { --gutter: 3rem; }
  .cal-week { --col-min: 6.5rem; --hour: 72px; }
  .cal-day { --hour: 80px; }
  .cal-week .cal-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
  /* Inside that sideways scroller a top offset would push the day row down, not pin it. */
  .cal-week .cal-head { top: 0; }
}

/* --- personal notes --- */

.notes-card { margin-top: 1.5rem; }
.notes-card .card-head { align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.notes-card .card-head h2 { margin-bottom: .1rem; }
.small { font-size: .82rem; }
.note-form { display: grid; gap: .8rem; padding: 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.note-form textarea { min-height: 6rem; }
.note-form-row { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; }
.note-form .hint { margin-top: -.4rem; }
.note-form-row .field { flex: 1 1 9rem; }
.note-form .form-actions { border-top: 0; padding-top: 0; }

.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.note {
  padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--info);
}
.note.just-added { animation: rise .4s var(--ease) both; }
.note-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .6rem; }
.note-time { font-weight: 700; color: var(--info); font-variant-numeric: tabular-nums; }
.note-title { flex: 1; margin: 0; font-size: 1rem; }
.note-actions { display: flex; gap: .8rem; font-size: .85rem; }
.btn-link-danger { color: var(--bad); }
.note-body { margin: .4rem 0 0; white-space: pre-line; overflow-wrap: break-word; }

/* Notes in the calendar: same footprint as task blocks, own colour and a 📝 marker. */
.cal-note {
  display: flex; align-items: flex-start; gap: .35rem; width: 100%; height: 100%; min-height: 1.9rem;
  overflow: hidden; padding: .3rem .45rem; text-align: left; cursor: pointer;
  font: inherit; font-size: .82rem; line-height: 1.25; color: var(--ink);
  background: var(--info-soft); border: 0; border-left: 4px solid var(--info); border-radius: var(--radius-sm);
}
.cal-note:hover { background: color-mix(in srgb, var(--info) 22%, var(--surface)); }
.cal-note .cal-event-body { display: grid; }
.cal-note-icon { flex: none; font-size: .9rem; line-height: 1.25; }
.cal-allday .cal-note { height: auto; }

.note-dialog {
  width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem); padding: 1.5rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lift);
}
.note-dialog::backdrop { background: rgb(0 0 0 / .35); }
.note-dialog[open] { animation: rise .25s var(--ease) both; }
.note-dialog-close { position: absolute; top: .75rem; right: .75rem; }
.note-dialog-title { margin: 0 2.5rem .75rem 0; }
.note-dialog .note-body { margin-bottom: 1.25rem; }
.note-dialog .note-form { padding: 0; background: none; margin: 0; }

/* --- chores --- */

.chore-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.chore-card {
  position: relative; display: grid; gap: .6rem; align-content: start;
  padding: 1.1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.chore-card:hover:not(.capped) { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.chore-card.overdue { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.chore-card.capped { opacity: .6; box-shadow: none; }
.chore-card.just-logged { animation: pop .45s var(--ease); }
.chore-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.chore-top h3 { margin: 0; }
.chore-points { white-space: nowrap; color: var(--muted); font-weight: 600; }
.chore-points strong { font: 750 1.6rem/1 var(--font-display); color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.chore-card.overdue .chore-points strong { color: var(--warn); }
.chore-meta { margin: 0; color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.freshness { height: .35rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.freshness div {
  height: 100%; width: var(--pct); border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--accent));
  animation: grow .8s var(--ease) both;
}
.chore-card.overdue .freshness div { background: linear-gradient(90deg, var(--accent), var(--warn)); }
.float-points {
  position: absolute; right: 1rem; top: .6rem; pointer-events: none;
  font: 800 1.6rem var(--font-display); color: var(--good);
  animation: float-up 1.4s var(--ease) both;
}

.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.log-list li { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; padding-bottom: .5rem; border-bottom: 1px dashed var(--line); }
.log-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.log-title { font-weight: 600; flex: 1; }
.log-points { font-weight: 700; color: var(--good); font-variant-numeric: tabular-nums; }
.log-list .btn-link { font-size: .85rem; }

/* --- manage lists & tables --- */

.manage-list { list-style: none; margin: 0; padding: 0; }
.manage-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.manage-list li:last-child { border-bottom: 0; }
.row-actions { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; white-space: nowrap; }
.lock { font-size: .85em; }

.table-wrap { overflow-x: auto; margin: 0 -.25rem; padding: 0 .25rem; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .6rem .6rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
tbody tr:last-child > * { border-bottom: 0; }
tr.archived { opacity: .55; }
.list-table td .task-meta { font-size: .82rem; }

.grid-table th[scope="row"] { font-weight: 600; min-width: 11rem; }
.grid-table th small { display: block; color: var(--muted); font-weight: 500; margin-top: .1rem; }
.grid-table thead th { text-align: center; }
.grid-table thead th:first-child { text-align: left; }
.grid-table thead th small { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; }
.grid-table thead th.is-today { color: var(--accent-strong); }
.grid-table td { text-align: center; width: 3.2rem; }
.cell {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  font-weight: 800; font-size: .95rem;
}
.cell-done { background: var(--good-soft); color: var(--good); }
.cell-late { background: var(--warn-soft); color: var(--warn); }
.cell-missed { background: var(--bad-soft); color: var(--bad); }
.cell-upcoming { color: var(--muted); }

.overview-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.overview-head h2 { margin: 0; font-size: 1.35rem; }
.counts { display: flex; flex-wrap: wrap; gap: .35rem; }
.overview-body { display: grid; gap: 1.5rem; }
@media (min-width: 1000px) { .overview-body { grid-template-columns: minmax(0, 1fr) 300px; } }
.overview-points { border-top: 1px solid var(--line); padding-top: 1rem; }
@media (min-width: 1000px) { .overview-points { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 1.5rem; } }
.overview-points h3 { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; }

.activity tr.undone td { color: var(--muted); }
.activity tr.undone .activity-title, .activity tr.undone .log-points { text-decoration: line-through; }
.activity-detail { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; }
.activity td { vertical-align: top; }
.kind { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .05rem .45rem; border-radius: 6px; margin-right: .35rem; }
.kind-task { background: var(--info-soft); color: var(--info); }
.kind-chore { background: var(--accent-soft); color: var(--accent-strong); }
.activity-title { font-weight: 600; }

.preview-table td, .preview-table th { padding: .45rem .4rem; }
.preview-table tr.is-ideal td { font-weight: 700; color: var(--accent-strong); }

.user-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.user-grid .card { margin: 0; }
.user-card.archived { opacity: .6; }
.user-card .card-head { margin-bottom: .5rem; }
.user-card .card-head p { margin: 0; font-size: .88rem; }
.target-box { display: flex; gap: 1.5rem; flex-wrap: wrap; padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.target-box div { display: grid; }
.target-box span { font-size: .78rem; }
.target-box strong { font-size: 1.2rem; }
.new-user { border-style: dashed; box-shadow: none; }

/* --- login --- */

.login-page .container { min-height: 100vh; display: grid; place-items: center; padding-top: 2rem; }
.login-card { width: min(100%, 400px); text-align: center; padding: 2.25rem 2rem; animation: rise .6s var(--ease) both; }
.login-card form { text-align: left; margin-top: 1.25rem; }
.login-card h1 { font-size: 1.8rem; margin-bottom: .25rem; }
.login-card h1 span { color: var(--accent); }
.login-logo { width: 4rem; height: 4rem; margin: 0 auto 1rem; }
.login-logo circle { fill: var(--accent); }
.login-logo path {
  fill: none; stroke: var(--on-accent); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; animation: draw-long .8s .3s var(--ease) both;
}

/* --- toast --- */

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 50; transform: translateX(-50%);
  padding: .75rem 1.25rem; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-weight: 600; box-shadow: var(--shadow-lift); animation: rise .3s var(--ease) both;
  transition: opacity .4s, transform .4s;
}
.toast.leaving { opacity: 0; transform: translate(-50%, .5rem); }

/* --- htmx feedback --- */

.htmx-request.task, .htmx-request .check, .htmx-request.chore-card { opacity: .7; }
#chore-panel.htmx-request .chore-card { pointer-events: none; }

/* --- theme: background, decorations, done icon --- */

/* Fixed backgrounds live on their own compositor layers (translateZ), so scrolling never
   repaints the full-screen gradient or pattern. */
body.bg-gradient::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; transform: translateZ(0);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 42%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--good) 14%, transparent), transparent 40%);
}

.deco-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; contain: strict; }
[data-deco="none"] .deco-layer { display: none; }
.deco-pattern {
  position: absolute; inset: 0; background-color: var(--accent); opacity: var(--pattern-opacity, .16);
  -webkit-mask-repeat: repeat; mask-repeat: repeat; transform: translateZ(0); will-change: transform;
}
[data-deco="flowers"] .deco-pattern { -webkit-mask-image: url(/static/deco/flowers.svg); mask-image: url(/static/deco/flowers.svg); }
[data-deco="bunnies"] .deco-pattern { -webkit-mask-image: url(/static/deco/bunnies.svg); mask-image: url(/static/deco/bunnies.svg); }
[data-deco="garden"] .deco-pattern { -webkit-mask-image: url(/static/deco/garden.svg); mask-image: url(/static/deco/garden.svg); }
[data-deco="hearts"] .deco-pattern { -webkit-mask-image: url(/static/deco/hearts.svg); mask-image: url(/static/deco/hearts.svg); }
[data-deco="stars"] .deco-pattern { -webkit-mask-image: url(/static/deco/stars.svg); mask-image: url(/static/deco/stars.svg); }

.brand-text { color: var(--ink); }
.brand-dot { flex: none; }

/* Emoji instead of the tick once a task is done */
body:not([data-done-icon="check"]) .is-done > .check .check-icon { display: none; }
body:not([data-done-icon="check"]) .is-done > .check { background: var(--accent-soft); border-color: var(--accent); }
body:not([data-done-icon="check"]) .is-done > .check::after { content: var(--done-emoji); font-size: 1.2rem; line-height: 1; }
body:not([data-done-icon="check"]) .task.compact.is-done > .check::after { font-size: .85rem; }
body:not([data-done-icon="check"]) .status-late > .check { background: var(--warn-soft); border-color: var(--warn); }

.motto { margin: .4rem 0 0; font: 600 1.05rem var(--font-display); color: var(--accent-strong); }
.quote { margin: .3rem 0 0; color: var(--muted); font-style: italic; }
.quote::before { content: "“"; } .quote::after { content: "”"; }

/* --- theme page --- */

.theme-sections > .card:last-child { margin-bottom: 0; }
.theme-sections h3.sub { margin: 1rem 0 .5rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.theme-sections h3.sub:first-of-type { margin-top: .25rem; }
.theme-sections .card > .field, .theme-sections .card > .switch, .theme-sections .card > .segmented { margin-top: 1rem; }
.theme-sections .card > .field + .field { margin-top: .9rem; }

.preset-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); margin-top: .75rem; }
.preset-card {
  display: grid; gap: .45rem; padding: .5rem; text-align: left; cursor: pointer;
  font: 600 .9rem var(--font); color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, transform .15s var(--ease), box-shadow .15s;
}
.preset-card:hover { transform: translateY(-2px); }
.preset-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.preset-swatch { position: relative; display: block; height: 64px; border-radius: 8px; background: var(--p-bg); overflow: hidden; }
.preset-swatch > span:nth-child(1) { position: absolute; inset: 10px 10px 18px 10px; background: var(--p-surface); border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.preset-swatch > span:nth-child(2) { position: absolute; left: 18px; top: 18px; width: 42%; height: 5px; border-radius: 3px; background: var(--p-text); opacity: .75; }
.preset-swatch > span:nth-child(3) { position: absolute; right: 16px; bottom: 9px; width: 34px; height: 13px; border-radius: 999px; background: var(--p-accent); }
.preset-emoji { position: absolute; left: 14px; bottom: 4px; font-size: 1rem; }
.preset-name { padding: 0 .15rem .1rem; }

.color-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-top: .5rem; }
.color-field { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; text-align: center; }
.color-field input { width: 100%; height: 3.2rem; padding: .25rem; cursor: pointer; }

.choice-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }
.choice-card { position: relative; display: flex; }
.choice-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice-card > span {
  flex: 1; display: grid; justify-items: center; gap: .2rem; padding: .65rem .4rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-weight: 600; font-size: .85rem; text-align: center;
  transition: border-color .15s, background-color .15s, transform .15s var(--ease);
}
.choice-icon { font-size: 1.5rem; line-height: 1.2; }
.choice-card input:checked + span { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.03); }
.choice-card input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

input[type="range"] { accent-color: var(--accent); padding: 0; border: 0; background: none; box-shadow: none; }

.switch { display: flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 600; font-size: .92rem; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 2.6rem; height: 1.5rem; margin: 0; padding: 0; border-radius: 999px; background: var(--line); border: 0; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(1.1rem); }

.theme-preview { display: grid; gap: 1rem; }
.theme-preview h2 { margin-bottom: 0; }
.theme-preview .btn-block { margin-top: 0; }
.preview-title { font: 700 1.5rem/1.2 var(--font-display); margin: 0; }
.theme-preview .motto { margin-top: -.6rem; }
.reset-link { justify-self: center; font-size: .88rem; color: var(--muted); }

/* --- celebration particles --- */

.particle { position: fixed; z-index: 100; pointer-events: none; font-size: 1.5rem; line-height: 1; transform: translate(-50%, -50%); will-change: transform, opacity; }
.particle.confetti { width: .55rem; height: .85rem; border-radius: 2px; }
.particle.hopper { font-size: 2.6rem; }

/* While a theme control is being dragged, colours change many times a second: skip every
   transition so each update is a single cheap repaint. */
.theme-editing *, .theme-editing *::before, .theme-editing *::after { transition: none !important; }

[data-anim="reduced"] *, [data-anim="reduced"] *::before, [data-anim="reduced"] *::after {
  animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

/* --- animations --- */

@keyframes draw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }
@keyframes draw-long { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes grow { from { width: 0; } }
@keyframes ring-in { from { stroke-dasharray: 0 100; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes float-up {
  0% { opacity: 0; transform: translateY(10px) scale(.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-48px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
