/* Цены рядом — mobile first. One accent, hairline borders, big tap targets. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #15181d;
  --muted: #5d6673;
  --faint: #8a929d;
  --line: #e2e5e9;
  --accent: #0b7f72;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f0;
  --warn: #9a5b00;
  --warn-soft: #fff4dc;
  --promo: #b4410f;
  --promo-soft: #fdece3;
  --err: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 14px;
  --hdr: 140px;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e9ecf0;
    --muted: #a3acb7;
    --faint: #7c8590;
    --line: #262c34;
    --accent: #36b9a6;
    --accent-ink: #06201c;
    --accent-soft: #12302b;
    --warn: #f0b44c;
    --warn-soft: #2d2410;
    --promo: #ff9a6b;
    --promo-soft: #33201a;
    --err: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  border-bottom: 1px solid var(--line);
}
#search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 4px 4px 14px; box-shadow: var(--shadow);
}
#search:focus-within { border-color: var(--accent); }
#search .lens { color: var(--faint); }
#q {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 1.0625rem; padding: 8px 0; /* >=16px: no zoom on iOS focus */
}
#q::-webkit-search-cancel-button { -webkit-appearance: none; }
.go {
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; padding: 9px 16px; min-height: 40px;
}
.trip {
  display: flex; align-items: center; gap: 6px; width: 100%;
  margin-top: 8px; padding: 6px 2px; min-height: 36px;
  border: 0; background: transparent; color: var(--muted); text-align: left; font-size: .9rem;
}
.trip-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip b { color: var(--text); font-weight: 600; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.seg { display: inline-flex; background: var(--line); border-radius: 10px; padding: 3px; }
.seg button {
  border: 0; background: transparent; border-radius: 8px; padding: 6px 16px; min-height: 34px;
  color: var(--muted); font-weight: 600; font-size: .9rem;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.sort select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 6px 10px; min-height: 36px; font-size: .9rem; color: var(--text);
}

/* ------------------------------------------------------------ status */
main { padding: 0 16px 24px; }
#status:empty { display: none; }
#status { margin-top: 14px; }
.msg {
  border-radius: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  font-size: .95rem; color: var(--muted);
}
.msg.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.msg.err { color: var(--err); }
.progress { display: flex; flex-direction: column; gap: 10px; }
.progress .line { display: flex; gap: 10px; align-items: baseline; }
.progress .es { color: var(--accent); font-weight: 600; }
.pbar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pbar i {
  display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 4px;
  animation: slide 1.3s ease-in-out infinite;
}
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .pbar i { animation: none; width: 100%; opacity: .5; } }

/* ------------------------------------------------------------ results */
.rhead { margin: 18px 2px 10px; }
.rhead h1 { font-size: 1.35rem; line-height: 1.2; margin: 0; }
.rhead h1 .es { color: var(--muted); font-weight: 400; font-size: 1rem; }
.rhead p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.hint { background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 10px 12px; margin: 10px 0 0; font-size: .92rem; }
.section-title {
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
  margin: 22px 2px 8px; font-weight: 600;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 6px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card .name { font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.card .meta { color: var(--muted); font-size: .88rem; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tier {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: 2px;
}
.offers { list-style: none; margin: 8px 0 0; padding: 0; }
.offer {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--line); min-height: 48px;
  width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left;
}
.offer .price { font-weight: 700; font-size: 1.12rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.offer .where { min-width: 0; }
.offer .chain { font-weight: 600; }
.offer .addr { color: var(--muted); }
.offer .sub { grid-column: 2; color: var(--muted); font-size: .86rem; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.offer .detour { color: var(--accent); font-weight: 600; }
.offer .shut { color: var(--faint); }
.promo {
  grid-column: 1 / -1; justify-self: start; margin-top: 2px;
  font-size: .82rem; color: var(--promo); background: var(--promo-soft); border-radius: 8px; padding: 2px 8px;
}
.more {
  display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: none;
  color: var(--accent); font-weight: 600; padding: 12px 0 10px; text-align: left; min-height: 44px;
}
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ------------------------------------------------------------ idle */
.idle h2 { font-size: 1.05rem; margin: 22px 2px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; min-height: 40px;
  font-size: .95rem;
}
.chip:active { background: var(--accent-soft); }
.stores { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stores li { padding: 11px 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.stores li:first-child { border-top: 0; }
.stores .r { color: var(--muted); font-size: .88rem; white-space: nowrap; text-align: right; }

/* ------------------------------------------------------------ map */
#mapwrap { margin: 12px -16px 0; }
#map { height: calc(100dvh - var(--hdr) - 12px); min-height: 320px; background: var(--line); }
.pin {
  background: var(--surface); color: var(--text); border: 1.5px solid var(--accent); border-radius: 999px;
  padding: 3px 8px; font: 700 13px/1.2 system-ui, sans-serif; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.pin.close { border-style: dashed; border-color: var(--warn); }
.pin.idle { border-color: var(--faint); font-weight: 600; color: var(--muted); }
.pin.sel { background: var(--accent); color: var(--accent-ink); }
.place {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--text); color: var(--bg); box-shadow: 0 1px 5px rgba(0,0,0,.35); font-size: 17px;
}
.maplibregl-ctrl-attrib { font-size: 11px; }

/* ------------------------------------------------------------ sheet */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.2);
  padding: 6px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; width: 560px; transform: translateX(-50%); animation: none; } }
.grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { font-size: 1.15rem; margin: 6px 0; }
.x { border: 0; background: var(--bg); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; }
.field { margin: 14px 0; }
.field > label, .field > .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.field .cur { color: var(--muted); font-size: .92rem; margin: -2px 0 8px; }
.picker input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg);
  font-size: 1.0625rem; outline: 0;
}
.picker input:focus { border-color: var(--accent); }
.sugg { list-style: none; margin: 6px 0 0; padding: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.sugg:empty { display: none; }
.sugg button { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px; min-height: 48px; }
.sugg li:first-child button { border-top: 0; }
.sugg small { display: block; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 14px; min-height: 42px; font-weight: 600;
}
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 14px; min-height: 44px; font-weight: 600;
  text-decoration: none; color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.link { border: 0; background: none; color: var(--accent); padding-left: 0; }
.note { color: var(--muted); font-size: .88rem; }
.sheet .offer { border-top: 1px solid var(--line); }
.store-meta { color: var(--muted); margin: 0 0 10px; }

/* ------------------------------------------------------------ footer */
.foot { color: var(--faint); font-size: .8rem; padding: 10px 16px 28px; text-align: center; }
.foot a { color: inherit; }
.stale { color: var(--warn); }

@media (min-width: 700px) {
  main, .top > * { max-width: 760px; margin-left: auto; margin-right: auto; }
  #mapwrap { max-width: none; margin: 12px 0 0; }
}
