/* Окошко-магазин Xorazm Go‘sht. Матовый стиль: фон плавно меняет цвет по разделам (мясо — тёмно-красный,
   бахча — зелёный, хлеб — кремовый…). Цвета ниже — стартовые, при прокрутке их меняет app.js (applyTheme). */
:root {
  --bg: #5a0f14;
  --text: #fbefd8;
  --hint: rgba(251, 239, 216, .68);
  --card: rgba(255, 255, 255, .09);
  --solid: #3d0a0e;            /* шторка, нижнее меню — непрозрачный слой поверх фона */
  --field: rgba(255, 255, 255, .1);
  --ph-bg: rgba(255, 255, 255, .08);
  --accent: #d9b25f;
  --on-accent: #2a0a0c;
  --line: rgba(255, 255, 255, .14);
  --gold: #d9b25f;
  --bordo: #8e1b22;
  --ok: #1f9d55;
  --radius: 18px;
  --tabs-h: 64px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--hint); }
[hidden] { display: none !important; }
main { padding: 0 12px calc(var(--tabs-h) + 84px + env(safe-area-inset-bottom)); }

/* ---- Шапка с хорезмским узором ---- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 0 12px 6px; }
.ornament { height: 9px; margin: 0 -12px 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='9'%3E%3Cpath d='M7 0.5 13.5 4.5 7 8.5 0.5 4.5Z' fill='%23d9b25f'/%3E%3Ccircle cx='21' cy='4.5' r='1.6' fill='%23d9b25f'/%3E%3C/svg%3E") repeat-x 0 0;
  border-bottom: 1px solid rgba(217, 178, 95, .45); }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 44px; height: 44px; border-radius: 50%; background: var(--bordo); color: var(--gold); border: 2px solid var(--gold);
  font: 500 17px/1 var(--serif); display: grid; place-items: center; letter-spacing: .5px; flex: none; }
.logo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.brand-text { flex: 1; min-width: 0; }
.brand-name { font: 600 20px/1.15 var(--serif); letter-spacing: .2px; }
.branch-chip { color: var(--hint); font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-chip::after { content: " ▾"; }
.lang-chip { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-weight: 600; }
.icon-chip { padding: 7px 10px; display: grid; place-items: center; color: var(--text); }
.icon-chip svg { display: block; }
.top-search { padding-top: 2px; }
/* Режим поиска: в шапке только строка поиска, ниже — только товары */
body.searching .top .brand, body.searching #hero, body.searching #infoStrip, body.searching #promoStrip,
body.searching #closedNotice, body.searching #stick { display: none !important; }

/* ---- Поиск, акции, разделы ---- */
.stick { position: sticky; top: 71px; z-index: 15; margin: 0 -12px; padding: 6px 12px 0; background: var(--bg); }
.search { position: relative; margin: 0; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; color: var(--hint); font-size: 16px; }
.search input { width: 100%; border: 1px solid var(--line); outline: 0; border-radius: 14px; padding: 11px 42px 11px 38px; background: var(--card)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23a89a86' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E") 12px 50% no-repeat; }
.hero { margin: 4px 0 14px; border-radius: 24px; overflow: hidden; border: 2px solid var(--gold); aspect-ratio: 1669 / 765; background: #3d0a0e; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.info-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; width: 100%; margin: -4px 0 12px; font-size: 13px; color: var(--hint); text-align: center; }
.info-strip b { color: var(--accent); font-weight: 700; }
.notice { background: #fff4d6; color: #7a5600; border-radius: 14px; padding: 10px 14px; margin: 6px 0 10px; font-size: 14px; }
.promos { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 12px -12px 4px; padding: 0 12px; scrollbar-width: none; }
.promos::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.promo { flex: 0 0 84%; scroll-snap-align: start; border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.promo img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; }
.promo .cap { padding: 8px 12px 10px; font-weight: 600; font-size: 14px; }
.promo.wide { flex-basis: 100%; margin-bottom: 12px; }
.promo.text { background: var(--bordo); color: #fbefd8; border-color: var(--gold); display: flex; align-items: center; min-height: 92px; }
.promo.text .cap { font: 600 18px/1.25 var(--serif); padding: 16px 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -12px; padding: 10px 12px;
  background: var(--bg); scrollbar-width: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px;
  white-space: nowrap; transition: background .25s, color .25s; }
.chip .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; border: 1px solid rgba(127, 127, 127, .45); }
.chip.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cat-title { font: 600 26px/1.15 var(--serif); margin: 22px 2px 12px; scroll-margin-top: 185px; display: flex; align-items: center; gap: 10px; }
.cat-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- Карточки товаров (матовые) ---- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 10px; display: flex; flex-direction: column; }
.ph { aspect-ratio: 1; border-radius: 14px; overflow: hidden; display: grid; place-items: center; font-size: 54px; background: var(--ph-bg); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.name { font-weight: 600; font-size: 14px; margin: 8px 2px 2px; min-height: 2.7em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Товар по дням: «📅 Только по средам · от 5 кг · лахм, жигар…» */
.rule { font-size: 11.5px; line-height: 1.35; color: var(--accent); margin: 0 2px 4px; }
.price { font-weight: 800; font-size: 15px; margin: 0 2px 8px; color: var(--accent); }
.price small { font-weight: 500; color: var(--hint); font-size: 12px; }
.price.ask { color: var(--hint); font-weight: 600; font-size: 13px; }
.add { margin-top: auto; width: 100%; border-radius: 12px; padding: 9px 0; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 14px; }
.add:active { transform: scale(.97); }
.stepper { margin-top: auto; display: flex; align-items: center; justify-content: space-between; background: var(--accent); color: var(--on-accent); border-radius: 12px; }
.stepper button { width: 40px; height: 38px; font-size: 22px; font-weight: 600; color: var(--on-accent); }
.stepper span { font-weight: 700; font-size: 14px; }
.empty { text-align: center; color: var(--hint); padding: 40px 16px; }

/* ---- Плашка корзины и нижнее меню ---- */
.cartbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + 10px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--bordo); color: #fbefd8; border: 1px solid var(--gold); border-radius: 16px; padding: 14px 18px; display: flex; justify-content: space-between;
  font-weight: 700; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.tabs { position: fixed; left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 40; height: var(--tabs-h);
  display: flex; background: var(--solid); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); padding: 0 4px; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--hint); position: relative; border-radius: 18px; margin: 6px 0; }
.tabs svg { width: 23px; height: 23px; fill: currentColor; }
.tabs button.active { color: var(--accent); background: var(--card); }
.badge { position: absolute; top: 3px; left: 54%; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bordo); color: #fff; border: 1px solid var(--gold);
  font: 700 11px/16px sans-serif; font-style: normal; text-align: center; padding: 0 5px; }

/* ---- Экраны ---- */
.view-title { font: 600 28px/1.15 var(--serif); margin: 10px 2px 14px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.box h3 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.cart-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item .ph { width: 62px; height: 62px; flex: none; font-size: 30px; border-radius: 12px; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .t { font-weight: 600; font-size: 14px; }
.cart-item .s { color: var(--hint); font-size: 12px; margin-top: 2px; }
.cart-item .stepper { margin-top: 8px; width: 132px; }
.cart-item .stepper button { width: 36px; height: 32px; font-size: 20px; }
.cart-item .sum { font-weight: 700; white-space: nowrap; }
.link { color: var(--accent); font-size: 12px; font-weight: 600; margin-top: 6px; display: block; }
.amount-input { margin-top: 8px; width: 150px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: var(--field); }
.totals .line { display: flex; justify-content: space-between; margin: 4px 0; }
.totals .big { font-size: 18px; font-weight: 800; }
.note { color: var(--hint); font-size: 12px; margin-top: 6px; }
.seg { display: flex; background: var(--field); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; padding: 9px 0; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--hint); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 12px; color: var(--hint); margin: 0 2px 4px; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--field); outline: 0; resize: none; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.btn { display: block; width: 100%; border-radius: 14px; padding: 14px; font-weight: 700; text-align: center; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:disabled { opacity: .5; }
.btn.light { background: var(--field); margin-bottom: 10px; }
.btn.light.ok { color: var(--ok); }
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.order .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order .no { font-weight: 800; font-size: 16px; }
.order .meta { color: var(--hint); font-size: 12px; margin-bottom: 8px; }
.order .ln { font-size: 14px; margin: 2px 0; }
.order .tot { font-weight: 800; margin-top: 8px; }
.status { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--field); white-space: nowrap; }
.status.new { background: #e8f0ff; color: #2459d6; }
.status.accepted, .status.weighed { background: #fff3d6; color: #9a6700; }
.status.sent, .status.ready { background: #e7f7ee; color: #1f7a45; }
.status.done { background: var(--field); color: var(--hint); }
.status.cancelled { background: #ffe7ea; color: #c8102e; }
.opt { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 13px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.opt:last-child { border-bottom: 0; }
.opt .tick { color: var(--accent); font-weight: 800; }
/* Корзина: точка доставки на Яндекс Карте (булавка стоит в центре, клиент двигает карту под ней) */
.pick-title { margin-top: 6px !important; }
.map-box { margin-bottom: 10px; }
.map-wrap { position: relative; height: 260px; border-radius: 14px; overflow: hidden; background: var(--field); }
.map { position: absolute; inset: 0; z-index: 0; }
.map-pin { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -34px 0 0 -14px; z-index: 1;
  background: var(--bordo); border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35); pointer-events: none; }
.map-pin::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; }
.map-status { font-size: 13px; color: var(--hint); margin-top: 8px; }
.map-status.ok { color: var(--ok); font-weight: 600; }
/* Корзина: выбор магазина для самовывоза */
.shop-opt { padding: 12px; margin-bottom: 8px; border: 1.5px solid var(--line); border-radius: 14px; }
.shop-opt:last-of-type { border-bottom: 1.5px solid var(--line); }
.shop-opt.on { border-color: var(--accent); background: var(--field); }
.shop-info { display: flex; flex-direction: column; gap: 3px; }
.shop-info small { color: var(--hint); font-size: 12px; }
.shop-info .link { margin-top: 4px; }
.shop-opt .tick { font-size: 20px; }
.lost { background: #ffe7ea; color: #8e1b22; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.lost .link { color: #8e1b22; text-decoration: underline; }
.done { text-align: center; padding: 60px 20px; }
.done-icon { width: 84px; height: 84px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 44px; display: grid; place-items: center; margin: 0 auto 18px; }
.done-title { font: 600 24px/1.2 var(--serif); margin-bottom: 8px; }
.done-text { color: var(--hint); margin-bottom: 24px; }

/* ---- Просмотр фото на весь экран (приближение пальцами) ---- */
.zoomable { position: relative; cursor: zoom-in; }
.ph.zoomable::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0, 0, 0, .45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23fff' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='m9.5 9.5 3.5 3.5M6 4v4M4 6h4'/%3E%3C/svg%3E") 50% 50% no-repeat; }
.cart-item .ph.zoomable::after { display: none; }
.viewer { position: fixed; inset: 0; z-index: 70; background: #0c0505; color: #fbefd8; display: flex; flex-direction: column;
  --accent: #d9b25f; --on-accent: #2a0a0c; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.vstage { flex: 1; min-height: 0; overflow: hidden; touch-action: none; display: grid; place-items: center; }
.vstage img { max-width: 100%; max-height: 100%; transform-origin: 0 0; user-select: none; -webkit-user-select: none; will-change: transform; }
.vstage img.anim { transition: transform .2s ease-out; }
.vclose { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 2; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 28px; line-height: 40px; }
.vhint { text-align: center; font-size: 13px; color: rgba(251, 239, 216, .7); padding: 6px 16px; transition: opacity .4s; }
.vbar { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(217, 178, 95, .3); }
.vbar:empty { display: none; }
.vname { font: 600 21px/1.2 var(--serif); }
.vprice { color: #d9b25f; font-weight: 800; font-size: 16px; margin: 4px 0 10px; }
.vprice small { color: rgba(251, 239, 216, .7); font-weight: 500; font-size: 12px; }

/* ---- Шторка выбора, всплывашка, загрузка ---- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--solid); border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; animation: up .2s ease-out; }
.sheet h3 { margin: 0 0 8px; font: 600 20px/1.2 var(--serif); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 90px); transform: translateX(-50%); z-index: 60; background: rgba(20, 20, 20, .9);
  color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 86%; text-align: center; }
.loading { position: fixed; inset: 0; background: #5a0f14; display: grid; place-items: center; z-index: 100; }
.loading-logo { display: block; width: min(70vw, 280px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 2px solid #d9b25f; }
.spinner { width: 36px; height: 36px; border: 4px solid rgba(217, 178, 95, .25); border-top-color: #d9b25f; border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
