:root {
  color-scheme: light dark;
  --bg: #f7f1e7;
  --surface: #fffdf8;
  --surface-alt: #ede4d5;
  --ink: #1c1917;
  --muted: #564d43;
  --line: #d9cfc0;
  --line-soft: #e9e1d5;
  --line-strong: #a99b88;
  --tomato: #c93b2b;
  --tomato-ink: #a32d1f;
  --basil: #2e7d32;
  --basil-ink: #1e5a21;
  --basil-soft: #e3efe1;
  --amber: #b45309;
  --amber-bg: #fdf0dc;
  --amber-ink: #7c2d12;
  --amber-border: #c47b22;
  --ferment: #6d4aae;
  --stage-mix: #2e7d32;
  --stage-ferment: #6d4aae;
  --stage-shape: #b45309;
  --stage-cook: #c93b2b;
  --focus: #1e6b24;
  --crust: #e8d8b8;
  --water: #5b9bc9;
  --sheet: #fffdf8;
  --shadow: 0 1px 0 rgb(28 25 23 / 0.04);
  --tap: 40px;
  accent-color: var(--tomato);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412;
    --surface: #221e1a;
    --surface-alt: #2c2621;
    --ink: #f4eee6;
    --muted: #c2b6a7;
    --line: #3d352d;
    --line-soft: #332c25;
    --line-strong: #877968;
    --tomato: #e0523f;
    --tomato-ink: #ff9b8c;
    --basil: #49a44e;
    --basil-ink: #a7f3b0;
    --basil-soft: #1b2e1c;
    --amber: #f0a13a;
    --amber-bg: #2d2114;
    --amber-ink: #fde68a;
    --amber-border: #a96918;
    --ferment: #a88bea;
    --crust: #5b4a32;
    --water: #3f7eaa;
    --sheet: #221e1a;
    --focus: #76d27b;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 12px/1.25 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.sr-only {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
.num { font-family: ui-monospace, Menlo, Consolas, "SF Mono", monospace; font-variant-numeric: tabular-nums; }
.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  /* Rounded displays: keep every control inside the corner curve, and let
     the page background run all the way to the edge so nothing looks cut. */
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    calc(63px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
}
.view { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; }
.vhead { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.vtitle {
  display: flex; align-items: center; gap: 6px; margin: 0;
  font: 800 10px/1 ui-monospace, monospace; letter-spacing: 0.16em; text-transform: uppercase;
}
.tag {
  max-width: 132px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-alt); color: var(--ink);
  font: 8.5px/1 ui-monospace, monospace; letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mode-pill {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto;
  padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: 999px;
  font: 8.5px/1 ui-monospace, monospace; letter-spacing: 0.05em; text-transform: uppercase;
  white-space: nowrap;
}
.m-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ferment); }
.mode-pill[data-mode="warm"] .m-dot { background: var(--amber); }
.ghost {
  width: 26px; height: 26px; min-width: 26px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--muted); font-size: 15px; line-height: 1;
}
.ghost:hover:not(:disabled) { background: var(--surface-alt); color: var(--ink); }
.ghost:disabled { opacity: 0.3; }
button { font-family: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* The dough disc: diameter is the scale, hydration is the fill, pips are pizzas. */
.hero {
  display: grid; grid-template-columns: 146px minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 4px 0 3px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.disc-stage { position: relative; width: 146px; height: 140px; display: flex; align-items: center; justify-content: center; }
.disc {
  position: relative; width: 136px; height: 136px; border-radius: 50%; overflow: hidden;
  border: 5px solid var(--crust);
  background: radial-gradient(circle at 34% 28%, #f2e4c5, #e6d3ad 58%, #d9c295);
  box-shadow: inset 0 0 18px rgb(90 60 20 / 0.18), 0 3px 10px rgb(60 40 10 / 0.12);
  transform: scale(var(--scale, 1));
}
.disc-water {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 40%);
  background: linear-gradient(180deg, rgb(91 155 201 / 0.36), rgb(64 120 160 / 0.6));
}
.disc-water::before {
  content: ""; position: absolute; left: -20%; right: -20%; top: -6px; height: 12px;
  border-radius: 50%; background: rgb(255 255 255 / 0.28);
}
.disc-dough {
  position: absolute; inset: 0; opacity: 0.55;
  background-image:
    radial-gradient(circle at 20% 36%, rgb(120 85 35 / 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 68% 22%, rgb(120 85 35 / 0.28) 0 1px, transparent 1.5px),
    radial-gradient(circle at 42% 72%, rgb(120 85 35 / 0.3) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 64%, rgb(120 85 35 / 0.26) 0 1px, transparent 1.5px);
  background-size: 21px 21px, 27px 27px, 19px 19px, 23px 23px;
}
.disc-label { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.disc-label strong { font: 700 30px/1 ui-monospace, monospace; letter-spacing: -0.06em; }
.disc-label span { margin-top: 2px; font: 8px/1 ui-monospace, monospace; letter-spacing: 0.22em; color: var(--muted); }
.disc-pip {
  position: absolute; left: calc(50% - 2px); top: calc(50% - 2px); z-index: 3;
  width: 4px; height: 4px; border-radius: 50%; background: var(--tomato);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.35);
}
.disc-legend { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 8px; color: var(--muted); }
.hero-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 7px; min-width: 0; }
.fact { min-width: 0; padding-left: 5px; border-left: 2px solid var(--line-strong); display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; }
.fact b { width: 100%; font: 700 7.5px/1 ui-monospace, monospace; letter-spacing: 0.12em; color: var(--muted); }
.fact strong { font-size: 20px; line-height: 1; }
.fact i { font-style: normal; font-size: 8px; color: var(--muted); }
.stage-rail { display: flex; height: 22px; gap: 1px; overflow: hidden; border-radius: 2px; }
.sr-stage { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; }
.sr-stage i { font: 700 7px/1 ui-monospace, monospace; letter-spacing: 0.04em; padding: 0 2px; white-space: nowrap; color: #fff; }
.sr-stage.mix { background: var(--stage-mix); }
.sr-stage.ferm { background: var(--stage-ferment); }
.sr-stage.temper { background: var(--stage-shape); }
.sr-stage.bake { background: var(--stage-cook); }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; min-height: 0; }
.fld { min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld-top { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; min-height: 14px; }
.fld-top label, .fld-label { font: 800 8.5px/1 ui-monospace, monospace; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.unit { font: 8.5px/1 ui-monospace, monospace; color: var(--muted); white-space: nowrap; }
.fld-body { display: flex; align-items: center; gap: 5px; min-width: 0; }
.num-in {
  width: 56px; height: 34px; padding: 0 4px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink); text-align: right;
  font: 600 12px ui-monospace, monospace; font-variant-numeric: tabular-nums;
  appearance: textfield;
}
.num-in::-webkit-outer-spin-button, .num-in::-webkit-inner-spin-button { appearance: none; margin: 0; }
.is-invalid .num-in { border-color: var(--tomato); box-shadow: 0 0 0 1px var(--tomato); }
input[type="range"] { flex: 1; min-width: 0; height: 34px; margin: 0; padding: 0; background: transparent; appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 20px; height: 20px; margin-top: -8px; border: 2px solid var(--bg);
  border-radius: 50%; background: var(--tomato); box-shadow: 0 0 0 1px var(--line-strong);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: 2px solid var(--bg); border-radius: 50%; background: var(--tomato);
  box-shadow: 0 0 0 1px var(--line-strong);
}
#inHTRange::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--basil) 0 12%, var(--amber) 12% 17%, var(--ferment) 17% 100%); }
#inHTRange::-moz-range-track { background: linear-gradient(90deg, var(--basil) 0 12%, var(--amber) 12% 17%, var(--ferment) 17% 100%); }
#inTFridgeRange::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--tomato) 0 18%, var(--basil) 18% 55%, var(--amber) 55% 100%); }
#inTFridgeRange::-moz-range-track { background: linear-gradient(90deg, var(--tomato) 0 18%, var(--basil) 18% 55%, var(--amber) 55% 100%); }
.stepper-row { display: flex; align-items: center; gap: 4px; }
.sq {
  width: 30px; height: 34px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); font-size: 17px; line-height: 1;
}
.n-in { width: 44px; height: 34px; text-align: center; font-size: 17px; font-weight: 700; }
.n-bars { display: flex; flex: 1; gap: 2px; height: 16px; margin-left: 3px; }
.n-bars .n-bar { flex: 1; height: 100%; border-radius: 1px; background: var(--line); }
.n-bars .n-bar.filled { background: var(--tomato); }
.texture-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.presets { display: flex; flex: 1 1 auto; min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.seg-btn {
  flex: 1; min-width: 0; height: 34px; padding: 0 2px; border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--muted); font: 700 8.5px/1 ui-monospace, monospace;
  letter-spacing: 0.03em; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.glyph { display: inline-block; width: 11px; border-bottom: 1px solid currentColor; }
.glyph.thin { height: 2px; }
.glyph.med { height: 4px; border-bottom-width: 2px; }
.glyph.thick { height: 7px; border-bottom-width: 4px; }
.tex-note { order: 3; flex: 1 1 100%; margin: 0; font-size: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stuffed {
  order: 2; flex: 0 0 auto; height: 34px; padding: 0 9px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--muted);
  font: 700 8.5px/1 ui-monospace, monospace; letter-spacing: 0.03em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
}
.stuffed[aria-pressed="true"] { background: var(--basil-soft); border-color: var(--basil); color: var(--basil-ink); }
.stuffed b { font-size: 8px; }
.flour-row select {
  width: 100%; height: 34px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink); font-size: 10.5px;
}
.adv-btn { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; min-height: 28px; margin-top: 1px; padding: 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font: 800 8px/1 ui-monospace, monospace; letter-spacing: 0.12em; text-align: left; }
.adv-plus { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 9px; }
.adv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tomato); }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; padding: 2px 0 4px; }
.hint { margin: 1px 0 3px; font-size: 9px; line-height: 1.3; color: var(--muted); }
.field-err { margin: 1px 0; font-size: 9px; color: var(--tomato-ink); }
.status { display: flex; align-items: center; gap: 4px; min-height: 32px; padding-top: 3px; margin-top: 1px; border-top: 1px solid var(--line); }
.s-chip {
  display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 6px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  color: var(--muted); font: 800 8px/1 ui-monospace, monospace; letter-spacing: 0.04em; white-space: nowrap;
}
.s-chip.s-danger { border-color: var(--tomato); background: var(--amber-bg); color: var(--tomato-ink); }
.s-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }
.status-ok { flex: 1; min-width: 0; font: 9px/1.2 ui-monospace, monospace; color: var(--basil-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-more {
  width: 24px; height: 24px; flex: 0 0 auto; padding: 0; border: 1px solid var(--line-strong);
  border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1;
}
.load { display: grid; gap: 3px; padding: 4px 0 3px; border-top: 1px solid var(--line); }
.load-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 52px; align-items: center; gap: 5px; font: 7.5px/1 ui-monospace, monospace; color: var(--muted); }
.load-track { height: 6px; overflow: hidden; border-radius: 2px; background: var(--surface-alt); }
.load-track i { display: block; height: 100%; border-radius: 2px; }
.load-row em { font-style: normal; text-align: right; color: var(--ink); }
.rack { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--line); }
.rack-balls { display: flex; flex: 1; flex-wrap: wrap; gap: 3px; }
.rack-balls i { width: 18px; height: 18px; border: 1px solid var(--line-strong); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f2e4c5, #d9c295); box-shadow: inset 0 -3px 4px rgb(90 60 20 / 0.12); }
.rack-meta { font: 8.5px/1 ui-monospace, monospace; color: var(--muted); white-space: nowrap; }
.plan { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.plan-donut { position: relative; width: 104px; height: 104px; flex: 0 0 auto; padding: 15px; border-radius: 50%; }
.plan-hole { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%; border-radius: 50%; background: var(--bg); }
.plan-hole strong { font-size: 13px; letter-spacing: -0.04em; }
.plan-hole span { font: 7px/1 ui-monospace, monospace; letter-spacing: 0.14em; color: var(--muted); }
.plan-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; flex: 1; min-width: 0; }
.plan-legend span { display: flex; align-items: center; gap: 4px; min-width: 0; font: 8px/1.1 ui-monospace, monospace; color: var(--muted); white-space: nowrap; }
.plan-legend b { margin-left: auto; color: var(--ink); font-weight: 700; }
.plan-legend i { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; }
.pl-mix { background: var(--stage-mix); }
.pl-ferm { background: var(--stage-ferment); }
.pl-temper { background: var(--stage-shape); }
.pl-bake { background: var(--stage-cook); }

/* Native popover as a bottom sheet; no JS, no fallback. */
.sheet {
  position: fixed; inset: auto 0 0 0; z-index: 200;
  width: min(100%, 560px); max-height: 86dvh; margin: 0 auto; overflow: auto;
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  border: 0; border-top: 1px solid var(--line-strong); border-radius: 14px 14px 0 0;
  background: var(--sheet); color: var(--ink); box-shadow: 0 -20px 50px rgb(0 0 0 / 0.25);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.38); backdrop-filter: blur(2px); }
.sheet-grip { width: 36px; height: 4px; margin: 0 auto 8px; border-radius: 999px; background: var(--line-strong); opacity: 0.6; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sheet-head h3 { margin: 0; font: 800 9px/1 ui-monospace, monospace; letter-spacing: 0.16em; color: var(--muted); }
.diag-errs { margin-bottom: 8px; padding: 5px 8px; border-left: 3px solid var(--tomato); border-radius: 4px; background: var(--amber-bg); }
.diag-title { font: 800 8.5px/1 ui-monospace, monospace; letter-spacing: 0.1em; }
.diag-errs p { margin: 3px 0; font-size: 10.5px; line-height: 1.3; }
.jump-row { display: flex; flex-wrap: wrap; gap: 3px 8px; margin-top: 4px; font-size: 9px; }
.jump-row a { color: inherit; font-weight: 700; }
.diag-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 6px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.diag-kind { width: 16px; height: 16px; border-radius: 50%; background: var(--amber-bg); color: var(--amber-ink); display: flex; align-items: center; justify-content: center; font: 800 10px/1 ui-monospace, monospace; }
.diag-row p { margin: 0; font-size: 10.5px; line-height: 1.35; }
.diag-row .diag-fix { margin-top: 2px; color: var(--muted); }
.diag-row.quiet .diag-kind { background: var(--surface-alt); color: var(--muted); }
.diag-foot { margin: 8px 0 0; font-size: 9px; color: var(--muted); }

/* Recipe */
.rhero { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.r-stat { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; min-width: 0; }
.micro { width: 100%; font: 800 7.5px/1 ui-monospace, monospace; letter-spacing: 0.12em; color: var(--muted); }
.big { font-size: 34px; line-height: 1; }
.r-stat i { font-style: normal; font-size: 9px; color: var(--muted); }
.hyd-ring { position: relative; width: 58px; height: 58px; flex: 0 0 auto; }
.hyd-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hyd-bg { fill: none; stroke: var(--line); stroke-width: 5; }
.hyd-fg { fill: none; stroke: var(--basil); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 138.23; }
.hyd-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.r-side { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; margin-left: auto; font-size: 9px; }
.r-side div { display: flex; flex-direction: column; }
.r-side span { font: 800 7px/1 ui-monospace, monospace; letter-spacing: 0.1em; color: var(--muted); }
.r-side b { font-size: 10px; white-space: nowrap; }
.stack { display: flex; gap: 1px; height: 8px; overflow: hidden; border-radius: 2px; background: var(--surface-alt); }
.sb { display: block; height: 100%; min-width: 1px; }
.sb-flour { background: #c99a5b; }
.sb-water { background: #5b9bc9; }
.sb-oil { background: #d9b44a; }
.sb-salt { background: #9a8f84; }
.sb-yeast { background: var(--tomato); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 6px; }
.kpi { min-width: 0; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font: 10.5px/1.2 ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b { display: block; font: 700 7px/1.2 ui-monospace, monospace; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 2px; }
.sec-head h3 { margin: 0; font: 800 8.5px/1 ui-monospace, monospace; letter-spacing: 0.16em; color: var(--muted); }
.sec-note { font: 8px/1 ui-monospace, monospace; color: var(--muted); }
.ings { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; margin: 0; padding: 0; list-style: none; }
.ings li { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 4px; min-height: 28px; border-bottom: 1px solid var(--line-soft); font-size: 9.5px; }
.ing-dot { width: 5px; height: 5px; border-radius: 50%; }
.i-flour { background: #c99a5b; }
.i-water { background: #5b9bc9; }
.i-salt { background: #9a8f84; }
.i-sugar { background: #d9b44a; }
.i-yeast { background: var(--tomato); }
.i-oil { background: #8aae4a; }
.i-rice { background: var(--surface-alt); border: 1px solid var(--line-strong); }
.i-cheese { background: #f2c14e; }
.i-total { background: var(--ink); }
.ing-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-name b { font-size: 7.5px; font-weight: 600; color: var(--muted); }
.ings .val { font-size: 8.5px; white-space: nowrap; }
.ing-total { grid-column: 1 / -1; border-bottom: 0 !important; }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding-left: 8px; border-left: 2px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: -4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong); }
.st-mix { border-left-color: var(--stage-mix) !important; }
.st-mix::before { border-color: var(--stage-mix) !important; }
.st-ferment { border-left-color: var(--stage-ferment) !important; }
.st-ferment::before { border-color: var(--stage-ferment) !important; }
.st-shape { border-left-color: var(--stage-shape) !important; }
.st-shape::before { border-color: var(--stage-shape) !important; }
.st-cook { border-left-color: var(--stage-cook) !important; }
.st-cook::before { border-color: var(--stage-cook) !important; }
.view-recipe .timeline { flex: 1; grid-auto-rows: 1fr; }
.sched-head { align-items: center; }
.sched-head .sec-note { margin-left: auto; }
.ck-sched { height: 4px; margin: 0 0 2px; }
.sched-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 5px; min-height: 50px; padding: 2px 0 2px 6px; }
.sched-item::before { display: none; }
.sched-item.done .sched-info, .sched-item.done .val { opacity: 0.55; }
.sched-item.done .t-label { text-decoration: line-through; color: var(--muted); }
.sched-info { display: flex; min-width: 0; cursor: pointer; line-height: 1.1; }
.row-timer { display: flex; align-items: center; gap: 2px; }
.ck-progress { display: flex; gap: 2px; height: 5px; margin: 1px 0 3px; }
.ck-progress i { flex: 1; border-radius: 1px; background: var(--line); }
.ck-progress i.on { background: var(--basil); }
.step-check {
  appearance: none; width: 28px; height: 28px; margin: 0; padding: 0;
  border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface);
  display: grid; place-content: center; cursor: pointer;
}
.step-check:checked { background: var(--basil); border-color: var(--basil); }
.step-check:checked::after { content: "✓"; color: #fff; font-size: 15px; font-weight: 800; line-height: 1; }
.no-timer { display: flex; align-items: center; justify-content: center; width: 44px; font-size: 16px; color: var(--muted); }
.timer { display: flex; align-items: center; gap: 2px; }
.timer-ring { position: relative; width: 44px; height: 44px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--tomato); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 125.66; }
.timer-clock { position: relative; z-index: 1; font: 700 8.5px/1 ui-monospace, monospace; letter-spacing: -0.04em; }
.timer.is-running .ring-fg { stroke: var(--basil); }
.timer.is-running .timer-clock { color: var(--basil-ink); }
.timer.is-done .ring-fg { stroke: var(--amber); }
.timer.is-done .timer-clock { color: var(--amber-ink); }
.timer-reset { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 13px; line-height: 1; }
.timer-reset:disabled { opacity: 0.3; }
.t-label { display: flex; flex-direction: column; min-width: 0; font-size: 10.5px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-label small { font-size: 8.5px; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { padding: 1px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-alt); font: 8.5px/1.2 ui-monospace, monospace; white-space: nowrap; }
.more { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 2px; }
.more summary { display: flex; align-items: center; min-height: 28px; list-style: none; cursor: pointer; color: var(--muted); font: 800 8px/1 ui-monospace, monospace; letter-spacing: 0.12em; }
.more summary::-webkit-details-marker { display: none; }
.more .hint, .more .warn { margin: 2px 0 6px; font-size: 9.5px; line-height: 1.35; color: var(--muted); }
.more .warn { color: var(--amber-ink); }
.warn { padding: 4px 6px; border: 1px solid var(--amber-border); border-radius: 4px; background: var(--amber-bg); color: var(--amber-ink); font-size: 9px; line-height: 1.3; }
.warn-compact { margin: 0; padding: 2px 5px; font: 800 8px/1.3 ui-monospace, monospace; letter-spacing: 0.05em; }
.cook-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 3px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cook-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.cook-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font: 8px/1.2 ui-monospace, monospace; white-space: nowrap; }
.cook-chip.fire { border-color: var(--tomato); color: var(--tomato-ink); }
.cook-chip.pan { border-color: var(--basil); color: var(--basil-ink); }
.safety-strip { display: flex; gap: 2px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.safety-strip li { display: flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--surface-alt); font-size: 10px; }
.ferment-chart { position: relative; padding: 2px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fc-svg { display: block; width: 100%; height: 62px; }
.fc-area { fill: var(--ferment); opacity: 0.16; }
.fc-line { fill: none; stroke: var(--ferment); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.fc-mark { stroke: var(--line-strong); stroke-dasharray: 2 2; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.55; }
.fc-legend { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 0 4px; font: 7.5px/1 ui-monospace, monospace; color: var(--muted); }
.fc-legend b { font-weight: 700; color: var(--ink); }
.copy-btn { height: 24px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--muted); font: 800 7.5px/1 ui-monospace, monospace; letter-spacing: 0.06em; }
.copy-btn + .copy-btn { margin-left: 1px; }
.copy-btn:disabled { opacity: 0.35; }

/* Fixed thumb-rail navigation. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center;
  padding:
    4px
    max(20px, env(safe-area-inset-right, 0px))
    calc(6px + env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.wizard-steps { position: relative; display: flex; width: min(100%, 540px); padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.wizard-steps button { position: relative; z-index: 1; flex: 1; height: 40px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 800 10px/1 ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.wizard-steps button::before { content: attr(data-step); display: block; margin-bottom: 2px; font: 7px/1 ui-monospace, monospace; opacity: 0.55; }
.wizard-steps button[aria-pressed="true"] { color: var(--ink); }
.dock-ind { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / 2); border-radius: 7px; background: var(--surface-alt); transform: translateX(calc(var(--step, 0) * 100%)); }
.update-bar { display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 6px; margin-bottom: 3px; border: 1px solid var(--amber-border); border-radius: 6px; background: var(--amber-bg); color: var(--amber-ink); font-size: 9px; }
.update-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.update-bar span:nth-child(2) { flex: 1; }
.mini-btn { height: 24px; padding: 0 6px; border: 1px solid currentColor; border-radius: 999px; background: none; font-size: 8.5px; font-weight: 700; }
#toast {
  position: fixed; left: 50%; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 100;
  display: flex; align-items: center; gap: 6px; max-width: min(92vw, 420px);
  padding: 6px 10px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 10px; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: no-preference) {
  button, .disc, .disc-water, .n-bars i, .ck-progress i, .step-check, .dock-ind, .hyd-fg, .ring-fg {
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 160ms ease, stroke-dashoffset 250ms linear, height 250ms ease;
  }
  button:active:not(:disabled) { transform: scale(0.97); }
  .view:not([hidden]) { animation: view-in 180ms ease-out; }
  @keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  .sheet:popover-open { animation: sheet-up 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .timer.is-running .ring-fg { animation: ring-pulse 1.6s ease-in-out infinite; }
  @keyframes ring-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
  .timer.is-done .ring-fg { animation: ring-done 0.7s ease-out 3; }
  @keyframes ring-done { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .disc, .step-check, .s-chip, .copy-btn, .wizard-steps, .sheet, .cook-chip { border-color: ButtonText; }
  .dock-ind { background: Highlight; }
  .seg-btn[aria-pressed="true"], .wizard-steps button[aria-pressed="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
  :focus-visible { outline-color: Highlight; }
}
@media print {
  .dock, .status, #toast, .update-bar, .copy-btn { display: none !important; }
  .app { max-width: 100%; padding: 0; }
  .view { display: flex !important; }
  body { background: #fff; color: #000; }
}
