:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #1d1f24;
  --muted: #6b6f78;
  --line: #e4e2dc;
  --accent: #d9480f;
  --accent-soft: #fff0e8;
  --ok: #2b8a3e;
  --warn: #c92a2a;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --card: #20232a;
    --text: #eceef2;
    --muted: #9aa0ab;
    --line: #2f333c;
    --accent: #ff8a4c;
    --accent-soft: #3a2a22;
    --ok: #69db7c;
    --warn: #ff8787;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
button {
  font: inherit; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
button.primary { background: var(--accent); color: #fff; }
button.ghost { background: transparent; color: var(--muted); padding: 8px 10px; }
button:disabled { opacity: .5; cursor: default; }
select, input {
  font: inherit; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); width: 100%;
}

.view { max-width: 680px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; margin: 4px 0 12px; }
h2 { font-size: 18px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
a.card { display: block; color: inherit; text-decoration: none; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.badge.ok { background: transparent; color: var(--ok); border: 1px solid currentColor; }
.meal-label { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.meal-title { font-size: 18px; font-weight: 650; margin-top: 2px; }
.cooked .meal-title { text-decoration: line-through; color: var(--muted); }

.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.daynav h1 { margin: 0; text-align: center; flex: 1; font-size: 20px; }
.daynav button { font-size: 22px; line-height: 1; width: 44px; height: 44px; padding: 0; flex: none; }

.ingredients { list-style: none; margin: 0; }
.ingredients.card { padding: 2px 14px; }
.ingredients li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .amount { white-space: nowrap; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; background: transparent; }
.dot.ok { background: var(--ok); }
.dot.missing { background: var(--warn); }

.step { display: flex; gap: 12px; }
.step .num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.step.done .num { background: var(--ok); color: #fff; }
.step.done .text { color: var(--muted); }
.step .heat { font-size: 13px; color: var(--muted); margin-top: 4px; }
.step .actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

.timers {
  position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px;
}
.timer { display: flex; align-items: center; gap: 10px; max-width: 680px; margin: 0 auto; width: 100%; min-width: 0; }
.timer .clock { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; min-width: 72px; }
.timer .label { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer button { padding: 6px 10px; }
.timer.ringing { animation: ring 1s infinite; border-radius: 10px; }
.timer.ringing .clock { color: var(--warn); }
@keyframes ring { 50% { background: var(--accent-soft); } }

.store-total { font-size: 18px; font-weight: 700; }
.line { padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .item { font-size: 14px; color: var(--muted); }
.price { white-space: nowrap; font-weight: 700; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20;
}
.tabs a {
  flex: 1; max-width: 170px; text-align: center; padding: 14px 4px; color: var(--muted); text-decoration: none; font-weight: 600;
  border-top: 2px solid transparent; margin-top: -1px;
}
.tabs a.active { color: var(--accent); border-top-color: var(--accent); }

.error { background: var(--accent-soft); color: var(--warn); border-radius: var(--radius); padding: 12px 14px; }
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text);
  width: min(92vw, 420px); padding: 16px;
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
