/* Халявка — домашняя праздничная тема: крем, ягода, мята, солнце, конфетти.
   Дизайн-система: все цвета, отступы, скругления, шрифты и тени — только через токены ниже (см. DESIGN.md). */
:root {
  /* Цвет: поверхности */
  --page: #FFF6EA;          /* фон под картой */
  --bg: #FFFDF8;            /* карточки, шапка, шторка */
  --soft: #FFF1E0;          /* вложенные плашки */
  --line: rgba(59, 42, 42, 0.09);
  /* Цвет: текст */
  --fg: #3B2A2A;
  --muted: #8A7266;
  /* Цвет: смысл */
  --free: #2FA36B;          /* бесплатно */
  --discount: #E6467A;      /* скидка */
  --accent: #E6467A;        /* главное действие */
  --accent-fg: #ffffff;
  --sun: #FFD25A;           /* выбранное, праздник */
  --sun-fg: #3B2A2A;
  --bday: #B4235A;          /* день рождения: текст бейджа */
  --bday-bg: #FFE3EC;       /* день рождения: фон бейджа */
  /* Отступы: шкала 4px */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  /* Скругления */
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 24px; --r-pill: 999px;
  --r: var(--r-lg);
  /* Типографика */
  --font: Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --t-xs: 12px; --t-sm: 13px; --t-md: 14px; --t-lg: 15px; --t-xl: 16px; --t-2xl: 21px; --t-3xl: 22px;
  /* Тени */
  --shadow: 0 10px 32px rgba(120, 70, 40, 0.14);
  --shadow-sm: 0 1px 3px rgba(120, 70, 40, .12);
  --press: inset 0 -2px 0 rgba(0, 0, 0, .12);
  /* Движение */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fast: .15s;
  font-family: var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #241A1A; --bg: #2E2222; --fg: #FFF3E3; --muted: #CDB7A8; --line: rgba(255, 243, 227, 0.1);
    --soft: #3A2B2A; --shadow: 0 10px 32px rgba(0, 0, 0, 0.5); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --bday: #FF9DBE; --bday-bg: rgba(230, 70, 122, .18);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--page); color: var(--fg); -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }

.map { position: fixed; inset: 0; background: var(--page); }
.map-fallback { display: grid; place-items: center; height: 100%; padding: 32px; text-align: center; color: var(--muted); }

/* Floating header with a bunting garland */
.top {
  position: fixed; z-index: 10; top: calc(env(safe-area-inset-top) + 12px); left: 12px; right: 12px;
  max-width: 420px; padding: 22px 14px 14px; border-radius: var(--r); overflow: hidden;
  background: var(--bg); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.garland {
  position: absolute; top: 0; left: 0; right: 0; height: 16px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='16' viewBox='0 0 72 16'%3E%3Cpath d='M0 2 Q18 6 36 2 T72 2' fill='none' stroke='%23C98A5C' stroke-width='1.2'/%3E%3Cpath d='M6 3.4 L18 3.8 L12 14z' fill='%23E6467A'/%3E%3Cpath d='M30 2.6 L42 2.6 L36 13z' fill='%23FFD25A'/%3E%3Cpath d='M54 3.8 L66 3.4 L60 14z' fill='%232FA36B'/%3E%3C/svg%3E") repeat-x 0 0 / 72px 16px;
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 36px; height: 36px; flex: none; }
.brand h1 { margin: 0; font-size: var(--t-3xl); font-weight: 900; letter-spacing: -0.01em; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--soft); flex: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.cities { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; scroll-padding: 14px; }
.cities::-webkit-scrollbar { display: none; }
.city {
  flex: none; height: 36px; padding: 0 15px; border-radius: var(--r-pill); font-size: var(--t-md); font-weight: 700; white-space: nowrap;
  background: var(--soft); transition: background var(--fast), color var(--fast);
}
.city[aria-pressed="true"] { background: var(--sun); color: var(--sun-fg); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--soft); }
.tab { height: 40px; border-radius: var(--r-sm); font-size: var(--t-lg); font-weight: 800; color: var(--muted); white-space: nowrap; transition: background var(--fast), color var(--fast), box-shadow var(--fast); }
.tab .n { font-weight: 600; opacity: .75; }
.tab[aria-selected="true"] { background: var(--bg); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.tab[data-tab="free"][aria-selected="true"] { color: var(--free); }
.tab[data-tab="discount"][aria-selected="true"] { color: var(--discount); }
@media (max-width: 359px) { .tab { font-size: var(--t-md); } }

/* Bottom sheet (mobile) / side panel (desktop) */
.sheet {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  max-height: 46vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow), inset 0 1px 0 var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { max-height: 64vh; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 2px; flex: none; }
.sheet-body { overflow-y: auto; padding: 0 var(--s-4) var(--s-5); overscroll-behavior: contain; }
.search[hidden] + .sheet-body { padding-top: var(--s-2); }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-1) var(--s-3); color: var(--muted); font-size: var(--t-sm); font-weight: 700; }
.item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 0;
  border-radius: var(--r-md); margin-bottom: 8px; background: var(--soft);
}
.item:hover { box-shadow: inset 0 0 0 1px var(--line); }
.item-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px 4px 8px 14px; }
.item .mark { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px var(--bg); }
.item .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .name { font-weight: 800; font-size: var(--t-lg); display: flex; align-items: center; gap: 6px; min-width: 0; }
.item .nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .count, .item .bday { flex: none; }
.item .count { font-weight: 600; color: var(--muted); }
.item .sub, .item .where { color: var(--muted); font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .where { font-size: var(--t-xs); opacity: .85; }
.item-cta {
  flex: none; height: 40px; padding: 0 14px; border-radius: var(--r-sm); display: inline-flex; align-items: center;
  background: var(--accent); color: var(--accent-fg); font-size: var(--t-md); font-weight: 800; text-decoration: none;
  box-shadow: var(--press);
}
@media (max-width: 359px) { .item-cta { padding: 0 10px; font-size: var(--t-sm); } }

.venue { display: flex; flex-direction: column; gap: 14px; }
.venue-head { display: flex; gap: 12px; align-items: flex-start; }
.venue-head .t { flex: 1; min-width: 0; }
.venue h2 { margin: 2px 0 4px; font-size: var(--t-2xl); font-weight: 900; letter-spacing: -0.01em; }
.venue .addr { color: var(--muted); font-size: var(--t-md); line-height: 1.35; }
.offer { padding: 14px 16px; border-radius: var(--r-md); background: var(--soft); box-shadow: inset 4px 0 0 var(--c); }
.offer h3 { margin: 0 0 6px; font-size: var(--t-xl); font-weight: 800; display: flex; gap: 8px; align-items: center; }
.offer h3::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.offer p { margin: 0; font-size: var(--t-md); line-height: 1.45; }
.offer .meta { margin-top: 10px; font-size: var(--t-xs); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.offer .meta a { color: var(--muted); }
.other { font-size: var(--t-sm); color: var(--muted); padding: 0 4px; }
.other button { text-decoration: underline; padding: 0; color: var(--fg); font-weight: 700; }

.actions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; position: sticky; bottom: -20px; padding: 12px 0 4px; background: var(--bg); }
.btn {
  height: 48px; padding: 0 16px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: var(--t-lg); text-decoration: none; background: var(--soft); white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--accent-fg); box-shadow: var(--press); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.square { width: 48px; padding: 0; }
@media (max-width: 359px) {
  .btn { height: 46px; font-size: var(--t-md); padding: 0 12px; }
  .btn.square { width: 46px; }
  .actions { gap: 6px; }
}

.empty { padding: 24px 8px; color: var(--muted); text-align: center; font-size: var(--t-md); }
.foot { padding: 8px 4px 0; font-size: var(--t-xs); color: var(--muted); line-height: 1.5; }

.toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: var(--r-sm); background: var(--fg); color: var(--bg); font-size: var(--t-md); font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .top { left: 20px; top: 20px; width: 400px; }
  .sheet {
    left: 20px; right: auto; bottom: 20px; top: 244px; width: 400px; max-height: none;
    border-radius: var(--r); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  }
  .sheet.open { max-height: none; }
  .grip { display: none; }
  .sheet-body { padding: 0 var(--s-4) var(--s-4); }
  .search[hidden] + .sheet-body { padding-top: var(--s-4); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Chain card: address list */
.addr-title { margin: 6px 4px -4px; font-size: var(--t-md); font-weight: 800; color: var(--muted); }
.addr-list { display: flex; flex-direction: column; gap: 6px; }
.addr-item { text-align: left; padding: 12px 14px; border-radius: var(--r-sm); background: var(--soft); font-size: var(--t-md); font-weight: 600; }
.addr-item:hover { box-shadow: inset 0 0 0 1px var(--line); }

/* Поиск по ДР-акциям */
.search {
  position: relative; display: flex; align-items: center; flex: none;
  margin: var(--s-4) var(--s-4) var(--s-1); height: 48px; border-radius: var(--r-md);
  background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--fast);
}
.search[hidden] { display: none; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--bday-bg); }
.search-icon { position: absolute; left: var(--s-4); width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--fg);
  font: 700 var(--t-lg) var(--font); padding: 0 var(--s-2) 0 calc(var(--s-4) + 28px);
}
.search input::placeholder { color: var(--muted); font-weight: 600; opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { width: 40px; height: 40px; margin-right: var(--s-1); border-radius: var(--r-sm); display: grid; place-items: center; flex: none; color: var(--muted); }
.search-clear[hidden] { display: none; }
.search-clear svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.list-head svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 6px; }

/* Бейдж «ДР» и шапка ДР-акции */
.bday {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; padding: 2px 7px 2px 5px; vertical-align: 1px;
  border-radius: var(--r-pill); background: var(--bday-bg); color: var(--bday); font-size: 11px; font-weight: 900; letter-spacing: .02em; line-height: 16px;
}
.bday svg, .offer-kicker svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.offer.is-bday { background: linear-gradient(180deg, var(--bday-bg), var(--soft) 72%); }
.offer-kicker { display: inline-flex; align-items: center; gap: 5px; margin-bottom: var(--s-2); color: var(--bday); font-size: var(--t-xs); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }

/* Состояния нажатия и фокуса */
.item-main:active, .addr-item:active, .city:active, .tab:active { transform: scale(.98); }
.item-main, .addr-item, .city, .tab, .btn, .item-cta, .icon-btn { transition: transform var(--fast) var(--ease), background var(--fast), color var(--fast), box-shadow var(--fast); }
.btn:active, .item-cta:active, .icon-btn:active { transform: translateY(1px); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.search input:focus-visible { outline: none; }
