/* ===== Токени ===== */
:root {
  --font: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f6f0e8;
  --ink: #241b16;
  --ink-2: #4b4039;
  --muted: #84776d;
  --line: #ece3d9;
  --line-2: #dccfc2;
  --accent: #d2492a;
  --accent-2: #b63c20;
  --accent-ink: #ffffff;
  --accent-soft: #fde6dd;
  --logo-inner: #fde6dd;
  --good: #2f7d4f;
  --good-soft: #e2f3e8;
  --warn: #93600f;
  --warn-soft: #fbf0db;
  --bad: #b3261e;
  --star: #e3a008;
  --plate: #ffffff;
  --plate-rim: #f1e9e0;
  --check: rgba(255, 255, 255, .26);
  --toast-action: #ffab8e;
  --shadow-1: 0 1px 2px rgba(56, 36, 20, .06), 0 2px 8px rgba(56, 36, 20, .05);
  --shadow-2: 0 2px 6px rgba(56, 36, 20, .06), 0 14px 34px rgba(56, 36, 20, .12);
  --shadow-3: 0 24px 64px rgba(40, 24, 12, .24);
  --radius-s: 12px;
  --radius: 20px;
  --radius-l: 28px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100d;
    --surface: #201a16;
    --surface-2: #29221d;
    --ink: #f5eee8;
    --ink-2: #d6cabf;
    --muted: #a3958a;
    --line: #362d27;
    --line-2: #4a3f37;
    --accent: #ff7b57;
    --accent-2: #ff9374;
    --accent-ink: #1c0f09;
    --accent-soft: #3d2118;
    --logo-inner: #fde6dd;
    --good: #66c993;
    --good-soft: #1b3426;
    --warn: #e8b157;
    --warn-soft: #37291a;
    --bad: #ff8a80;
    --star: #ffc93c;
    --plate: #302824;
    --plate-rim: #28211d;
    --check: rgba(255, 255, 255, .035);
    --toast-action: #c2410c;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .3), 0 14px 34px rgba(0, 0, 0, .35);
    --shadow-3: 0 24px 64px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

/* Цвят на "покривката" според вида ястие */
.tint-paprika { --tint-a: #fde2d6; --tint-b: #f4ab90; }
.tint-saffron { --tint-a: #fdefd0; --tint-b: #f3c472; }
.tint-sea     { --tint-a: #dcefee; --tint-b: #94cccb; }
.tint-olive   { --tint-a: #e7f0d7; --tint-b: #b0d08a; }
.tint-wheat   { --tint-a: #fbefd8; --tint-b: #e9c587; }
.tint-berry   { --tint-a: #fbe2ea; --tint-b: #eaa8bf; }
.tint-cream   { --tint-a: #fff5d6; --tint-b: #f2d685; }
.tint-neutral { --tint-a: #f4ede5; --tint-b: #e0d3c6; }
@media (prefers-color-scheme: dark) {
  .tint-paprika { --tint-a: #3b2018; --tint-b: #5c2e20; }
  .tint-saffron { --tint-a: #3a2d16; --tint-b: #5b4420; }
  .tint-sea     { --tint-a: #16302f; --tint-b: #1f4a47; }
  .tint-olive   { --tint-a: #222f1d; --tint-b: #344a28; }
  .tint-wheat   { --tint-a: #342a1a; --tint-b: #554429; }
  .tint-berry   { --tint-a: #35202a; --tint-b: #53303f; }
  .tint-cream   { --tint-a: #362f19; --tint-b: #574a24; }
  .tint-neutral { --tint-a: #29221d; --tint-b: #3a312a; }
}

/* ===== Основа ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.grow small, .grow > small { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; }

.i { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.i-fill { fill: currentColor; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent); outline-offset: 2px; }

.label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.eyebrow { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 800; vertical-align: middle; }

/* ===== Бутони ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: .98rem; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn .i { width: 20px; height: 20px; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: .86rem; }
.btn.small .i { width: 16px; height: 16px; }
.btn-lg { min-height: 56px; border-radius: 18px; font-size: 1.06rem; }
.btn.wide { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn .i { width: 20px; height: 20px; }
.icon-btn.glass { border: 0; background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-1); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 2px; border: 0; background: none; color: var(--accent); font-weight: 800; font-size: .88rem; cursor: pointer; }
.link-btn .i { width: 16px; height: 16px; }

/* ===== Чипове, сегменти, превключватели ===== */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; flex: 0 0 auto;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1);
  font-weight: 700; font-size: .9rem; white-space: nowrap; cursor: pointer;
}
.chip .i { width: 16px; height: 16px; color: var(--muted); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg-opt {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 4px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2);
  font-weight: 700; font-size: .88rem; cursor: pointer; transition: background-color .15s, color .15s;
}
.seg-opt:hover { color: var(--ink); }
.seg-opt.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 auto; margin: 0;
  width: 48px; height: 28px; border-radius: 999px; background: var(--line-2); cursor: pointer; transition: background-color .2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* ===== Панели ===== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-1); }
.panel-title { font-size: 1.08rem; font-weight: 800; letter-spacing: -.01em; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ===== Чиния и миниатюра ===== */
.plate {
  --size: 168px;
  display: grid; place-items: center; width: var(--size); height: var(--size); border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(circle, var(--plate) 0 55%, var(--plate-rim) 56% 61%, var(--plate) 62% 100%);
  box-shadow: 0 16px 30px -12px rgba(60, 28, 8, .4), 0 3px 8px rgba(60, 28, 8, .12), inset 0 -4px 10px rgba(0, 0, 0, .06);
}
.plate-food { font-size: calc(var(--size) * .5); line-height: 1; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .18)); }
.plate.sm { --size: 92px; }
.plate.lg { --size: clamp(150px, 40vw, 200px); }

.thumb {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px;
  background: linear-gradient(145deg, var(--tint-a), var(--tint-b));
}
.thumb > span { font-size: 25px; line-height: 1; }
.thumb.sm { width: 38px; height: 38px; border-radius: 12px; }
.thumb.sm > span { font-size: 20px; }

/* Покривка на квадрати зад чинията */
.cloth {
  background-color: var(--tint-b);
  background-image:
    repeating-linear-gradient(0deg, var(--check) 0 14px, transparent 14px 28px),
    repeating-linear-gradient(90deg, var(--check) 0 14px, transparent 14px 28px),
    radial-gradient(130% 100% at 50% 0%, var(--tint-a), var(--tint-b));
}

/* ===== Лист отдолу (на компютър – прозорец в средата) ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 6, .45); animation: fade .2s ease-out; }
.sheet {
  position: relative; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0;
  background: var(--surface); box-shadow: var(--shadow-3); animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ''; align-self: center; width: 40px; height: 5px; margin-bottom: 2px; border-radius: 3px; background: var(--line-2); }
.sheet-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.sheet-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; cursor: pointer;
}
.sheet-opt:hover { border-color: var(--line-2); }
.sheet-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.sheet-ico .i { width: 18px; height: 18px; }
@media (min-width: 720px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { max-width: 460px; border-radius: 26px; padding: 22px; }
  .sheet::before { display: none; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .3; } }
@keyframes fade { from { opacity: 0; } }

/* ===== Известие ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 16px; background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: .92rem; box-shadow: var(--shadow-3); animation: toast-in .25s ease-out;
}
.toast button { padding: 4px; border: 0; background: none; color: var(--toast-action); font-weight: 800; cursor: pointer; }
@keyframes toast-in { from { transform: translate(-50%, 14px); opacity: 0; } }

/* ===== Само на телефон / само на компютър ===== */
@media (max-width: 959.98px) { .only-desktop { display: none !important; } }
@media (min-width: 960px) { .only-mobile { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
