:root {
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --border: #e3ddd2;
  --text: #24211b;
  --dim: #766f62;
  --accent: #b4492d;
  --on-accent: #fffdf9;
  --offer: #2f6b47;
  --offer-soft: rgba(47, 107, 71, 0.11);
  --radius: 12px;
  --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --surface: #1f1d16;
    --border: #322f25;
    --text: #e6e2d8;
    --dim: #9a9384;
    --accent: #d9775c;
    --on-accent: #1a120e;
    --offer: #86c79f;
    --offer-soft: rgba(134, 199, 159, 0.13);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: 0.82rem; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.5rem; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
section { margin: 0 0 26px; }

.main { max-width: 640px; margin: 0 auto; padding: calc(var(--safe-top) + 14px) 16px 24px; min-height: 70vh; }
.page-head + p { margin-bottom: 22px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.dim { color: var(--dim); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; align-items: baseline; }
.row > .input { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.plain { list-style: none; padding: 0; margin: 0; }

.input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  outline: none;
  resize: vertical;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--dim); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: 0.92rem; }

.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 44px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: 0.5; }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn { background: none; border: 0; width: 44px; height: 44px; margin: -8px -12px -8px 0; font-size: 1.4rem; color: var(--dim); cursor: pointer; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.dish { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; font-size: 0.8rem; padding: 2px 8px; border-radius: 6px; }
.tag.offer { background: var(--offer-soft); color: var(--offer); font-weight: 600; }
.rows .tag { margin-left: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; min-height: 38px; color: var(--dim); cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }

.rows > li { padding: 11px 0; border-bottom: 1px solid var(--border); }
.rows { margin-bottom: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.steps { margin: 0 0 14px; padding-left: 1.4em; }
.steps li { margin-bottom: 12px; padding-left: 4px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

.loading { display: flex; gap: 12px; align-items: center; color: var(--dim); padding: 18px 0; }
.spinner { width: 18px; height: 18px; flex: none; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.error { border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); text-decoration: none; font-size: 0.68rem; }
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
