/*
 * Витрина заведения — вид по образцу нового мобильного сайта ThaiNuki (v9.561, спека §2):
 * шапка с логотипом и названием Oswald, разделы лентой, «Популярное», блюдо строкой с «+»,
 * внизу «Разделы» и корзина. Цвета — только переменными темы; заливка акцента и текст на ней —
 * разные переменные (`--acc` / `--acc-ink`), иначе в светлой теме текст пропадал (урок Кефира).
 */
:root {
  --bg: #120d0b; --bg2: #1a1310; --card: #211712; --card2: #2a1d16;
  --line: #3a2a22; --ink: #efe7dc; --muted: #9c9082;
  --acc: #e2b14a; --acc-ink: #2a1c0c; --acc-text: #e2b14a;
  --ok: #5ec47e; --warn: #e89a4a; --bad: #e0584f;
  --img-bg: #160f0c;
  --rad: 14px;
  --font: 'Manrope', 'Noto Sans Thai', 'Noto Sans Devanagari', system-ui, sans-serif;
  --title: 'Oswald', 'Arial Narrow', 'Noto Sans Thai', 'Noto Sans Devanagari', sans-serif;
  color-scheme: dark;
}
:root.light {
  --bg: #faf6ef; --bg2: #f2ebdf; --card: #ffffff; --card2: #f6efe4;
  --line: #e4d9c8; --ink: #23180f; --muted: #75685a;
  --img-bg: #efe6d8;
  --ok: #2f7a56; --warn: #a65d12; --bad: #b3261e;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 15px/1.45 var(--font);
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
/* Слой открыт — страница под ним не прокручивается (правило образца) */
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }

/* ---------- шапка ---------- */
.head { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; gap: 6px; min-height: 58px; padding: 0 8px 0 14px; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; flex: 0 0 34px; background: var(--card); }
.brand-text { min-width: 0; }
.brand b { display: block; font: 600 20px/1.05 var(--title); letter-spacing: .02em; text-transform: uppercase; color: var(--acc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small:empty { display: none; }
.icon { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon.lang { font-size: 13px; font-weight: 800; }
.find { flex: 1 1 auto; }
.find input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--ink); font: 600 16px var(--font); outline: none;
}
.find input:focus { border-color: var(--acc); }
.head.finding .brand { display: none; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 10px; scrollbar-width: none; max-width: 1100px; margin: 0 auto; }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 700; white-space: nowrap;
}
.chips a.on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }

/* ---------- статус приёма ---------- */
.status { max-width: 1100px; margin: 10px auto 0; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  background: var(--card2); border: 1px solid var(--line); width: calc(100% - 24px); }
.status.closed, .status.stop { border-color: var(--warn); color: var(--warn); }
.status.busy { border-color: var(--warn); }

main { max-width: 1100px; margin: 0 auto; }
.hero { padding: 16px 16px 4px; }
.hero h1 { font: 600 26px/1.1 var(--title); letter-spacing: .01em; text-transform: uppercase; margin: 0 0 4px; }
.hero p { margin: 0; color: var(--muted); font-size: 14.5px; }
.hero p:empty { display: none; }

.cap { margin: 18px 16px 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.popular .strip { display: flex; gap: 10px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.popular .strip::-webkit-scrollbar { display: none; }
.sh .strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.sh .cap { margin: 18px 0 8px; }
.pop { flex: 0 0 140px; text-align: left; border: 1px solid var(--line); border-radius: var(--rad); background: var(--card); padding: 0; overflow: hidden; cursor: pointer; }
.pop img, .pop .ph { width: 140px; height: 104px; object-fit: cover; background: var(--img-bg); }
.pop span { display: block; padding: 7px 9px 1px; font-size: 13px; font-weight: 700; line-height: 1.25; height: 40px; overflow: hidden; }
.pop b { display: block; padding: 0 9px 9px; font-size: 13.5px; color: var(--acc-text); }

/* ---------- меню ---------- */
.sec h2 { margin: 22px 16px 8px; font: 600 21px/1.15 var(--title); letter-spacing: .02em; text-transform: uppercase; scroll-margin-top: 112px; }
.rows { display: grid; gap: 0; padding: 0 16px; }
@media (min-width: 820px) { .rows { grid-template-columns: 1fr 1fr; column-gap: 22px; } }
.dish { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; }
.dish .info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.dish h3 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.25; }
.dish .desc { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish .bottom { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dish .price { font-weight: 800; font-size: 15px; }
.dish .note { font-size: 12px; color: var(--muted); font-weight: 600; }
.dish .pic { position: relative; flex: 0 0 116px; height: 116px; border-radius: 12px; overflow: hidden; background: var(--img-bg); }
@media (min-width: 400px) { .dish .pic { flex-basis: 132px; height: 132px; } }
.dish .pic img { width: 100%; height: 100%; object-fit: cover; }
.plus {
  position: absolute; right: 6px; bottom: 6px; width: 36px; height: 36px; border-radius: 11px; border: 0;
  background: var(--acc); color: var(--acc-ink); font-size: 24px; line-height: 1; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.plus.inline { position: static; margin-left: auto; box-shadow: none; }
.qtybadge.inline { position: static; margin-left: auto; }
.qtybadge.inline + .plus.inline { margin-left: 0; }
.qtybadge { position: absolute; left: 6px; top: 6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 8px; background: var(--acc); color: var(--acc-ink); font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.badge.acc { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.dish.off { cursor: default; }
.dish.off .pic img { opacity: .55; }
.state { text-align: center; color: var(--muted); padding: 30px 16px; margin: 0; }
.state:empty { display: none; }

/* ---------- подвал: контакты, часы, карта ---------- */
.foot { padding: 26px 16px 20px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.foot h2 { font: 600 19px var(--title); text-transform: uppercase; color: var(--ink); margin: 0 0 10px; letter-spacing: .02em; }
.foot .grid { display: grid; gap: 18px; }
@media (min-width: 820px) { .foot .grid { grid-template-columns: 1fr 1fr; } }
.foot table { border-collapse: collapse; }
.foot td { padding: 2px 14px 2px 0; }
.foot td.today { color: var(--ink); font-weight: 800; }
.foot .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.foot iframe { width: 100%; height: 220px; border: 0; border-radius: 12px; margin-top: 10px; background: var(--card); }
.foot .made { margin-top: 22px; font-size: 12px; text-align: center; }
.foot .made a { color: inherit; }
.foot p { margin: 4px 0; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 13px; border: 1px solid var(--line); background: var(--card2); color: var(--ink);
  font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn.small { min-height: 38px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }
.btn.main { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); width: 100%; }
.btn.main[disabled] { opacity: .5; cursor: default; }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; }

/* ---------- нижняя панель ---------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--bg) 30%);
  max-width: 1100px; margin: 0 auto;
}
.bar button { min-height: 50px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; font-weight: 800; }
.bar-cats { display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--card); }
.bar-cats svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bar-cart { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--acc); color: var(--acc-ink); border-color: var(--acc) !important; }
.bar-cart b { margin-left: auto; font-size: 16px; }
.bar-count { min-width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(0,0,0,.18); font-size: 13.5px; }
.bar-cart.pulse { animation: pulse .45s ease; }
@keyframes pulse { 30% { transform: scale(1.04); } }

/* ---------- слой ---------- */
.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh;
  background: var(--bg); color: var(--ink); border-radius: 20px 20px 0 0; overflow: hidden;
}
@media (min-width: 760px) { .sheet { margin: auto; max-width: 560px; border-radius: 20px; } }
.sheet::backdrop { background: rgba(0,0,0,.55); }
.sheet-in { position: relative; max-height: inherit; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom, 0px); }
.close { position: sticky; top: 8px; float: right; margin: 8px 8px -52px 0; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.sh-photo { width: 100%; aspect-ratio: 4 / 3; max-height: 46vh; object-fit: cover; background: var(--img-bg); }
.sh { padding: 16px 16px 18px; }
.sh h2 { margin: 0 44px 6px 0; font: 600 23px/1.15 var(--title); text-transform: uppercase; letter-spacing: .01em; }
.sh .lead { color: var(--muted); margin: 0 0 10px; white-space: pre-line; }
.sh .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.grp { margin: 16px 0 0; }
.grp-h { display: flex; align-items: baseline; gap: 8px; font-weight: 800; margin-bottom: 6px; }
.grp-h small { color: var(--muted); font-weight: 700; font-size: 12px; }
.grp-h small.need { color: var(--warn); }
.opt { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; cursor: pointer; background: var(--card); }
.opt input { width: 20px; height: 20px; accent-color: var(--acc); margin: 0; flex: 0 0 20px; }
.opt span { flex: 1 1 auto; }
.opt b { font-weight: 800; color: var(--muted); }
.opt.on { border-color: var(--acc); }
.grp.missing .opt { border-color: var(--warn); }
textarea, .field input, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px;
  padding: 12px; font: 500 16px var(--font); outline: none;
}
textarea { min-height: 64px; resize: vertical; }
textarea:focus, .field input:focus, .field select:focus { border-color: var(--acc); }
.field { display: block; margin: 12px 0 0; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field.bad input { border-color: var(--bad); }
.sh-foot { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.stepper button { width: 44px; height: 46px; border: 0; background: none; font-size: 22px; cursor: pointer; }
.stepper span { min-width: 26px; text-align: center; font-weight: 800; }
.stepper.small button { width: 34px; height: 34px; font-size: 18px; }
.why { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--card2); color: var(--warn); font-weight: 700; font-size: 13.5px; }

/* выбор «Где будете есть?» и раздела */
.choice { display: grid; gap: 10px; margin-top: 14px; }
.choice button { text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.choice button b { display: block; font-size: 17px; }
.choice button small { color: var(--muted); font-weight: 600; }
.choice button.on { border-color: var(--acc); }
.catlist a { display: flex; justify-content: space-between; padding: 13px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; font-weight: 700; }
.catlist a small { color: var(--muted); }

/* корзина */
.line { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line img, .line .ph { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: var(--img-bg); flex: 0 0 58px; }
.line .li { flex: 1 1 auto; min-width: 0; }
.line .li b { display: block; font-size: 14.5px; line-height: 1.25; }
.line .li small { display: block; color: var(--muted); font-size: 12.5px; }
.line .lr { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line .lr b { font-size: 14.5px; }
.line.bad { opacity: .6; }
.sum { display: flex; justify-content: space-between; padding: 6px 0; font-weight: 700; }
.sum.total { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.sum.disc { color: var(--ok); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 13px; background: var(--card2); margin-top: 12px; }
.seg button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; font-weight: 800; cursor: pointer; }
.seg button.on { background: var(--acc); color: var(--acc-ink); }
.steps { display: flex; gap: 6px; margin: 0 44px 14px 0; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--acc); }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }

/* статус заказа */
.track { padding: 18px 16px; }
.track h1 { font: 600 26px var(--title); text-transform: uppercase; margin: 0 0 4px; }
.track .big { font-size: 18px; font-weight: 800; margin: 14px 0 4px; }
.track .when { color: var(--muted); margin: 0 0 14px; }
.flow { display: flex; gap: 6px; margin: 12px 0; }
.flow div { flex: 1; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.flow div i { display: block; height: 5px; border-radius: 3px; background: var(--line); margin-bottom: 6px; }
.flow div.on { color: var(--ink); }
.flow div.on i { background: var(--ok); }
.card { border: 1px solid var(--line); border-radius: var(--rad); background: var(--card); padding: 12px 14px; margin: 12px 0; }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; max-width: calc(100% - 32px); text-align: center; }
dialog[open] ~ .toast { bottom: 24px; }
