/* ═══════════════════════════════════════════════════════════ tokens ═══ */
:root {
  --bg:        #fbfbfa;
  --card:      #ffffff;
  --ink:       #0c0c0e;
  --ink-soft:  #55555c;
  --muted:     #93939b;
  --line:      color-mix(in srgb, var(--ink) 8%, transparent);
  --hair:      color-mix(in srgb, var(--ink) 5%, transparent);
  --fill:      color-mix(in srgb, var(--ink) 4%, transparent);

  --p: #3e7bfa;  /* protein */
  --c: #f2a03d;  /* carbs   */
  --f: #ef6461;  /* fat     */

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;

  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px -12px rgb(0 0 0 / .12);
  --ease:  cubic-bezier(.22, 1, .36, 1);
  --snap:  cubic-bezier(.34, 1.56, .64, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter,
          system-ui, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #000000;
    --card:     #16161a;
    --ink:      #f4f4f5;
    --ink-soft: #b3b3bb;
    --muted:    #7a7a84;
    --line:     color-mix(in srgb, var(--ink) 12%, transparent);
    --hair:     color-mix(in srgb, var(--ink) 8%, transparent);
    --fill:     color-mix(in srgb, var(--ink) 7%, transparent);
    --shadow:   0 1px 2px rgb(0 0 0 / .5), 0 10px 30px -14px rgb(0 0 0 / .7);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Any author `display` beats the UA stylesheet's [hidden] { display: none },
   so elements toggled via the hidden attribute need this to stay hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; cursor: pointer; }
svg { display: block; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--p); outline-offset: 3px; border-radius: 6px; }

/* ══════════════════════════════════════════════════════ the device ═══ */
.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(900px 520px at 50% -10%, color-mix(in srgb, var(--p) 7%, transparent), transparent 70%),
    var(--bg);
}

.device {
  width: 390px;
  height: 844px;
  max-height: calc(100svh - 56px);
  padding: 11px;
  border-radius: 62px;
  background: linear-gradient(160deg, #3a3a3f, #101013 45%, #2c2c31);
  box-shadow:
    0 0 0 1.5px rgb(255 255 255 / .09) inset,
    0 42px 90px -30px rgb(0 0 0 / .55);
}

.phone {
  position: relative;
  height: 100%;
  border-radius: 51px;
  background: var(--bg);
  overflow: hidden;
  isolation: isolate;
}

/* dynamic island */
.phone::before {
  content: "";
  position: absolute;
  top: 11px; left: 50%;
  translate: -50% 0;
  width: 112px; height: 33px;
  border-radius: 20px;
  background: #08080a;
  z-index: 60;
  pointer-events: none;
}

/* real phone / small viewport: drop the frame */
@media (max-width: 460px), (max-height: 720px) {
  .stage  { padding: 0; background: var(--bg); }
  .device {
    width: 100%; height: 100svh; max-height: none;
    padding: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .phone  { border-radius: 0; }
  .phone::before { display: none; }
}

/* ══════════════════════════════════════════════════════════ screens ═══ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  translate: 22px 0;
  transition: opacity .3s var(--ease), translate .42s var(--ease), visibility .42s;
}
.screen.is-active { opacity: 1; visibility: visible; translate: 0 0; }
.screen.is-behind { opacity: 0; visibility: hidden; translate: -22px 0; }

@media (prefers-reduced-motion: reduce) {
  .screen, .screen.is-behind { transition: opacity .18s linear; translate: 0 0; }
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 22px 28px;
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }

/* ═══════════════════════════════════════════════ 1. search screen ═══ */
.top { padding: 18px 22px 10px; }

.greeting {
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  letter-spacing: .02em;
  margin-bottom: 2px;
}

.title {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.03em;
}

.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 22px 10px;
  padding: 0 14px;
  height: 46px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.searchbar:focus-within {
  border-color: color-mix(in srgb, var(--p) 45%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--p) 12%, transparent);
}

.searchbar__icon {
  width: 19px; height: 19px; flex: none;
  fill: none; stroke: var(--muted); stroke-width: 1.9;
  stroke-linecap: round;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.searchbar input::placeholder { color: var(--muted); }
.searchbar input::-webkit-search-cancel-button { display: none; }

.searchbar__clear {
  flex: none;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--fill);
  border: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
}
.searchbar__clear svg {
  width: 13px; height: 13px;
  fill: none; stroke: var(--ink-soft); stroke-width: 2.1; stroke-linecap: round;
}

.searchbar__scan {
  flex: none;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  color: var(--muted);
  transition: color .2s;
  background: transparent;
  border: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
}
.searchbar__scan:hover { color: var(--ink); }
.searchbar__scan svg {
  width: 18px; height: 18px;
}

.scan-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

#scan-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 48px;
  gap: 24px;
  pointer-events: none;
}

.scan-capture-btn {
  pointer-events: auto;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 3px solid rgba(255,255,255,.8);
  color: #fff;
  display: grid; place-items: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
}
.scan-capture-btn:active { transform: scale(.92); background: rgba(255,255,255,.32); }
.scan-capture-btn svg { width: 32px; height: 32px; }


.scan-hint {
  color: rgba(255,255,255,.8);
  font-size: 13px;
  letter-spacing: .2px;
  text-align: center;
  background: rgba(0,0,0,.35);
  padding: 6px 16px;
  border-radius: 20px;
}

/* results list */
.results { list-style: none; }

.results li {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 4px;
  border-bottom: 1px solid var(--hair);
  cursor: pointer;
  animation: rise .34s var(--ease) both;
}
.results li:last-child { border-bottom: 0; }
.results li:active { background: var(--fill); border-radius: var(--r-sm); }

@keyframes rise {
  from { opacity: 0; translate: 0 8px; }
  to   { opacity: 1; translate: 0 0; }
}

.res__body { flex: 1; min-width: 0; }

.res__name {
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res__meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res__cal {
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  text-align: right;
}
.res__cal em { display: block; font-style: normal; font-size: 9.5px; font-weight: 500; color: var(--muted); }

.res__hist {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--p) 12%, transparent);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .03em;
  color: var(--p);
  vertical-align: 1px;
}

/* today summary — compact card */
.summary {
  margin: 0 0 16px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.summary__cal { display: flex; align-items: baseline; gap: 4px; }
.summary__num {
  font-size: 34px; font-weight: 700; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.summary__unit { font-size: 12px; font-weight: 550; color: var(--muted); }

.summary__caption {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary__macros {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pill em {
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  opacity: .6;
}
.pill--p { border-left: 3px solid var(--p); }
.pill--c { border-left: 3px solid var(--c); }
.pill--f { border-left: 3px solid var(--f); }

.summary__note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.dot { width: 7px; height: 7px; border-radius: 50%; display: block; margin-bottom: 4px; }
.dot--p { background: var(--p); }
.dot--c { background: var(--c); }
.dot--f { background: var(--f); }

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 4px;
}

/* logged list */
.log { list-style: none; }

.log li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--hair);
  animation: rise .3s var(--ease) both;
}
.log li:last-child { border-bottom: 0; }

.log__body { flex: 1; min-width: 0; }
.log__name { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log__meta { margin-top: 1px; font-size: 11px; color: var(--muted); }
.log__cal  { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.log__actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.log__edit, .log__del {
  flex: none;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  opacity: .45;
  transition: opacity .2s, background .2s;
}
.log__edit:hover, .log__del:hover { opacity: 1; background: var(--fill); }
.log__edit svg, .log__del svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; }

.empty, .state {
  padding: 24px 8px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-soft);
  line-height: 1.6;
}
.empty span, .state { color: var(--muted); font-weight: 450; }

/* ════════════════════════════════════════════ 2. nutrition screen ═══ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 4px;
}
.nav__title { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  transition: background .2s, scale .18s var(--snap);
}
.icon-btn:active { scale: .9; }
.icon-btn:hover { background: var(--fill); }
.icon-btn.is-ghost { pointer-events: none; }
.icon-btn svg {
  width: 21px; height: 21px;
  fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.food-head { padding: 8px 0 2px; }
.food-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.024em;
  text-wrap: balance;
}
.food-brand { margin-top: 3px; font-size: 12px; color: var(--muted); }

.ring-wrap {
  position: relative;
  width: 130px; height: 130px;
  margin: 10px auto 0;
}

.ring { width: 100%; height: 100%; rotate: -90deg; }
.ring circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transform-origin: center;
}
.ring__track { stroke: var(--fill); stroke-width: 8.5; }
.ring__p { stroke: var(--p); }
.ring__c { stroke: var(--c); }
.ring__f { stroke: var(--f); }
.ring__p, .ring__c, .ring__f {
  stroke-dasharray: 0 999;
  transition: stroke-dasharray .75s var(--ease), rotate .75s var(--ease);
}

.ring__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0;
}
.ring__num {
  font-size: 26px; font-weight: 700; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.ring__unit { font-size: 10px; font-weight: 550; color: var(--muted); letter-spacing: .04em; }

.serving-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.macro__bar {
  height: 3px;
  border-radius: 3px;
  background: var(--fill);
  overflow: hidden;
}
.macro__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width .7s var(--ease);
}
.macro__fill--p { background: var(--p); }
.macro__fill--c { background: var(--c); }
.macro__fill--f { background: var(--f); }

.macro__val {
  margin-top: 6px;
  font-size: 15px; font-weight: 650;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.macro__key { margin-top: 1px; font-size: 10.5px; color: var(--muted); }

/* hand-edited macros */
.editor {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise .3s var(--ease) both;
}

.editor__hint {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 10px;
}

.editor__grid { display: grid; grid-template-columns: 1fr; gap: 8px; }

.field {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--fill);
  border: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.field:focus-within { border-color: color-mix(in srgb, var(--p) 45%, transparent); background: var(--card); }

.field > span {
  flex: none;
  width: 60px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  text-align: right;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.field em { flex: none; font-style: normal; font-size: 11px; color: var(--muted); }

.editor__reset {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--fill);
  transition: background .2s;
}
.editor__reset:active { background: var(--line); }

.icon-btn[aria-pressed="true"] { background: var(--ink); }
.icon-btn[aria-pressed="true"] svg { stroke: var(--bg); }

/* ══════════════════════════════════ period + date navigation ═══ */
.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 2px;
  border-radius: 999px;
  background: var(--fill);
  width: 80px;
  flex: none;
}

.segmented button {
  position: relative;
  z-index: 1;
  padding: 5px 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  transition: color .24s var(--ease);
}
.segmented button[aria-selected="true"] { color: var(--ink); }

.segmented__thumb {
  position: absolute;
  z-index: 0;
  top: 2px; bottom: 2px; left: 2px;
  width: calc((100% - 4px) / 3);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 1px 2px rgb(0 0 0 / .08);
  transition: translate .32s var(--ease);
}

.daynav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.daynav__label { flex: 1; text-align: center; min-width: 0; }
.daynav__label > p {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -.015em;
}

.daynav__cal-btn svg {
  stroke-width: 1.8;
}

.daynav__picker {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
  overflow: hidden;
}

.icon-btn--sm { width: 30px; height: 30px; }
.icon-btn--sm svg { width: 17px; height: 17px; }

.icon-btn:disabled { opacity: .25; pointer-events: none; }

/* ═════════════════════════════════════════════════ daily bars ═══ */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 68px;
  padding: 0 2px;
}

.chart__bar {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: 3px 3px 2px 2px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  transform-origin: bottom;
  animation: grow .5s var(--ease) both;
}
.chart__bar.is-empty { background: var(--fill); }
.chart__bar.is-today { background: var(--p); }

@keyframes grow { from { scale: 1 0; } to { scale: 1 1; } }

.chart__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 550;
  color: var(--muted);
}

.summary__caption {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary__note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.log__custom {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  color: var(--ink-soft);
  vertical-align: 1px;
}

/* serving chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-soft);
  transition: background .2s, color .2s, border-color .2s, scale .18s var(--snap);
}
.chip:active { scale: .95; }
.chip[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* ═════════════════════════════════════════════ quantity ═══ */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 14px;
}

.stepper__btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: scale .18s var(--snap), background .2s;
}
.stepper__btn:active { scale: .88; background: var(--fill); }
.stepper__btn svg {
  width: 18px; height: 18px;
  fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round;
}

.stepper__input {
  width: 80px;
  border: 0;
  background: none;
  outline: none;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}

.qty-unit {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 44px;
}

.presets { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.presets button {
  min-width: 38px;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  transition: background .2s, color .2s, border-color .2s, scale .18s var(--snap);
}
.presets button:active { scale: .93; }
.presets button.is-on {
  background: var(--ink); border-color: var(--ink); color: var(--bg);
}

.preset--custom {
  min-width: 38px;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  font-size: 12px;
  font-weight: 600;
  color: var(--bg);
  font-variant-numeric: tabular-nums;
}

/* ═════════════════════════════════════════════════ 3. done screen ═══ */
.screen--done { justify-content: center; }

.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 30px; }

.tick { width: 76px; height: 76px; margin-bottom: 22px; }
.tick circle, .tick path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tick__ring { stroke: color-mix(in srgb, var(--ink) 14%, transparent); stroke-width: 2; }
.tick__path { stroke: var(--ink); stroke-width: 3.4; stroke-dasharray: 40; stroke-dashoffset: 40; }

.screen--done.is-active .tick__ring {
  animation: draw-ring .6s var(--ease) both;
}
.screen--done.is-active .tick__path {
  animation: draw-tick .45s var(--ease) .22s forwards;
}
@keyframes draw-ring { from { scale: .7; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes draw-tick { to { stroke-dashoffset: 0; } }

.done__title {
  font-size: 30px; font-weight: 700; letter-spacing: -.03em;
}
.done__sub { font-size: 14.5px; color: var(--muted); text-align: center; line-height: 1.55; }

.done__progress {
  width: 120px;
  height: 3px;
  margin-top: 20px;
  border-radius: 3px;
  background: var(--fill);
  overflow: hidden;
}

.done__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--ink);
}

.screen--done.is-active .done__bar {
  animation: progress-fill 2s linear forwards;
}

@keyframes progress-fill {
  from { width: 0; }
  to   { width: 100%; }
}

/* ════════════════════════════════════════════════════════ footers ═══ */
.foot {
  flex: none;
  padding: 8px 22px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}

.btn {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: scale .18s var(--snap), opacity .2s;
}
.btn:active { scale: .977; }
.btn:disabled { opacity: .35; pointer-events: none; }

.btn--quiet {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ══════════════════════════════════════════════ toast & spinner ═══ */
.toast {
  position: absolute;
  left: 18px; right: 18px;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.45;
  box-shadow: 0 14px 34px -12px rgb(0 0 0 / .45);
  animation: toast-in .34s var(--ease) both;
}
@keyframes toast-in { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

.veil {
  position: absolute; inset: 0;
  z-index: 65;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(3px);
}

.spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2.2px solid var(--line);
  border-top-color: var(--ink);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }

/* inline loading shimmer for the results list */
.skeleton { list-style: none; padding-top: 6px; }
.skeleton li {
  height: 14px;
  margin: 16px 4px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--fill) 25%, var(--hair) 37%, var(--fill) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton li:nth-child(2) { width: 78%; }
.skeleton li:nth-child(3) { width: 62%; }
.skeleton li:nth-child(4) { width: 84%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
