/* GiftList — мини-апп. Стиль по референсу AuthKit «стеклянный собор в полночь»:
   полночный холст, матовое стекло с волосяной кромкой, сетка-чертёж и прожектор сверху,
   светящийся текст, единственный цветной акцент — фиолетовая кнопка «Сохранить».
   Тёмная тема — основная; светлая — та же система при дневном свете (по теме Telegram). */

:root, [data-theme="dark"] {
  --canvas: #05060f;               /* Midnight Canvas */
  --glass: rgba(186, 214, 247, .03); /* Frosted Glass: карточки */
  --glass-2: rgba(186, 214, 247, .06); /* кнопки-призраки */
  --glass-3: rgba(186, 214, 247, .12); /* нажатие, активный сегмент */
  --field: rgba(199, 211, 234, .06);  /* поля ввода */
  --tint: rgba(199, 211, 234, .12);   /* Luminous Fill: бейджи */
  --edge: rgba(186, 215, 247, .12);   /* Glass Edge: единственный вид рамки */
  --edge-strong: rgba(186, 215, 247, .26);
  --grid: rgba(186, 215, 247, .055);
  --halo: rgba(124, 145, 182, .5);
  --halo-soft: rgba(124, 145, 182, .16);
  --ink: #ffffff;                  /* текст кнопок и полей */
  --frost: #d1e4fa;                /* Frost Glow: основной текст */
  --mist: #c7d3ea;                 /* Moon Mist: вторичный */
  --fog: #9da7ba;                  /* Fog Veil: подписи */
  --head-a: #d8ecf8;               /* Ice Highlight → Skywash */
  --head-b: #98c0ef;
  --violet: #663af3;               /* Void Violet: только «Сохранить» */
  --on-violet: #ffffff;
  --deal: #5fd4bb;                 /* ниже флора — хорошая цена */
  --warn: #f0896b;                 /* ошибки */
  --sheet: rgba(5, 6, 15, .97);    /* Deep Glass: слои поверх */
  --bar: rgba(9, 11, 24, .78);
  --shadow-card: inset 0 1px 1px rgba(199, 211, 234, .12), inset 0 24px 48px rgba(199, 211, 234, .05), 0 24px 32px rgba(6, 6, 14, .7);
  --shadow-float: inset 0 1px 1px rgba(216, 236, 248, .2), inset 0 24px 48px rgba(168, 216, 245, .06), 0 16px 32px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

[data-theme="light"] {
  --canvas: #f2f5fb;
  --glass: rgba(255, 255, 255, .66);
  --glass-2: rgba(36, 60, 116, .05);
  --glass-3: rgba(36, 60, 116, .10);
  --field: rgba(36, 60, 116, .05);
  --tint: rgba(36, 60, 116, .08);
  --edge: rgba(36, 60, 116, .14);
  --edge-strong: rgba(36, 60, 116, .30);
  --grid: rgba(36, 60, 116, .07);
  --halo: rgba(122, 152, 214, .38);
  --halo-soft: rgba(122, 152, 214, .12);
  --ink: #0a0f1f;
  --frost: #121a33;
  --mist: #2d3856;
  --fog: #586480;
  --head-a: #0b1430;
  --head-b: #3a5fa8;
  --violet: #5b2fe6;
  --on-violet: #ffffff;
  --deal: #0e7a65;
  --warn: #c2462a;
  --sheet: rgba(245, 247, 252, .98);
  --bar: rgba(250, 251, 254, .86);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(20, 32, 70, .06), 0 14px 28px -12px rgba(20, 32, 70, .18);
  --shadow-float: inset 0 1px 0 rgba(255, 255, 255, .95), 0 1px 2px rgba(20, 32, 70, .08), 0 18px 36px -10px rgba(20, 32, 70, .24);
  color-scheme: light;
}

:root {
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;     /* округлый, с кириллицей */
  --font-display: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-label: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;     /* подписи капсом и цифры */
  --r-card: 16px;
  --r-badge: 6px;
  --r-pill: 999px;
  --gutter: 16px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--canvas);
  color: var(--frost);
  font: 600 15px/1.5 var(--font-body);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { max-width: 100%; display: block; }
.icon { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--head-b); outline-offset: 2px; }

/* ---------------------------------------------------------------- атмосфера: прожектор + сетка-чертёж */
.atmosphere { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.atmosphere::before {    /* луч прожектора: мягкий конус без filter: blur (дорого для слабых телефонов) */
  content: ""; position: absolute; left: 50%; top: 0; width: 200vw; height: 85vh; transform: translateX(-50%);
  background: conic-gradient(from 180deg at 50% -6%, transparent 146deg, var(--halo-soft) 165deg, var(--halo) 180deg,
    var(--halo-soft) 195deg, transparent 214deg);
  -webkit-mask-image: radial-gradient(ellipse 50% 100% at 50% 0%, #000 0%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 100% at 50% 0%, #000 0%, transparent 100%);
  opacity: .6;
}
.atmosphere::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 50% 0 / 72px 72px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 50% 0 / 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 110% 70% at 50% 0%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 110% 70% at 50% 0%, #000 30%, transparent 80%);
}

.shell {
  position: relative; z-index: 1; max-width: 560px; margin: 0 auto;
  padding: 8px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(104px + var(--safe-bottom)) max(var(--gutter), env(safe-area-inset-left, 0px));
}

/* ---------------------------------------------------------------- заголовок экрана */
.hero { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 20px 0 22px; }
.eyebrow {
  display: flex; align-items: center; gap: 12px; width: 100%; justify-content: center;
  font: 800 12px/1.2 var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--mist);
  font-feature-settings: "tnum" 1;
}
.eyebrow::before, .eyebrow::after { content: ""; flex: 1; max-width: 72px; height: 1px; }
.eyebrow::before { background: linear-gradient(90deg, transparent, var(--edge)); }
.eyebrow::after { background: linear-gradient(90deg, var(--edge), transparent); }
.display {
  margin: 0; font: 800 28px/1.14 var(--font-display); letter-spacing: -0.01em; text-wrap: balance;
  background: linear-gradient(180deg, var(--head-a) 0%, var(--head-b) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.lede { margin: 0; max-width: 34ch; color: var(--fog); font-size: 14px; line-height: 1.43; }

.section-label {
  margin: 22px 2px 10px; font: 800 11px/1.2 var(--font-label); letter-spacing: .1em; text-transform: uppercase;
  color: var(--fog); display: flex; justify-content: space-between; gap: 8px;
}

/* ---------------------------------------------------------------- стекло */
.card {
  position: relative; border-radius: var(--r-card); background: var(--glass); box-shadow: var(--shadow-card);
  padding: 16px;          /* без backdrop-filter: на слабых Android он тормозит прокрутку длинной ленты */
}
.card::after {          /* волосяная кромка — вместо рамки */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--edge);
}
.stack { display: grid; gap: 12px; }

/* ---------------------------------------------------------------- кнопки */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 8px 16px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px; line-height: 1.2; white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.pill svg { width: 16px; height: 16px; flex: none; }
.pill-ghost { background: var(--glass-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); }
.pill-ghost:active, .pill-outline:active { background: var(--glass-3); }
.pill-outline { color: var(--frost); box-shadow: inset 0 0 0 1px var(--edge); }
.pill-sm { min-height: 30px; padding: 6px 12px; font-size: 13px; }
.pill-wide { width: 100%; min-height: 44px; }
.pill[disabled] { opacity: .45; cursor: default; }
.pill-danger { color: var(--warn); }

.cta {                  /* единственная цветная кнопка: сохранение фильтра */
  width: 100%; min-height: 48px; border-radius: 6px; padding: 12px 24px;
  background: var(--violet); color: var(--on-violet); font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 10px 30px -10px rgba(102, 58, 243, .7);
}
.cta[disabled] { opacity: .5; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9999px; display: inline-grid; place-items: center;
  color: var(--frost); box-shadow: inset 0 0 0 1px var(--edge); background: var(--glass-2);
}
.icon-btn svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- бейджи, чипы */
.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-badge);
  padding: 2px 7px; background: var(--tint); color: var(--frost);
  font: 800 12px/1.33 var(--font-body); letter-spacing: 0; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.badge-quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--edge); color: var(--mist); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
  padding: 4px 9px; border-radius: var(--r-badge); background: var(--field); color: var(--mist);
  font-size: 12px; line-height: 1.33; box-shadow: inset 0 0 0 1px var(--edge);
}
.chip b { font-weight: 700; color: var(--frost); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- поля */
.field {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 6px; border: 0;
  background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge);
  transition: box-shadow .15s ease;
}
.field::placeholder { color: var(--mist); opacity: .6; }
.field:focus { outline: none; box-shadow: inset 0 0 0 1px var(--edge-strong); }
.search { position: relative; }
.search .field { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--fog); }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill);
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge);
}
.seg button {
  min-height: 30px; padding: 5px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; color: var(--fog);
}
.seg button.on { background: var(--glass-3); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; }

.switch {
  position: relative; flex: none; width: 46px; height: 28px; border-radius: var(--r-pill);
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge); transition: background-color .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--fog); transition: transform .2s ease, background-color .2s ease;
}
.switch[aria-checked="true"] { background: var(--glass-3); box-shadow: inset 0 0 0 1px var(--edge-strong); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--frost); }

/* ---------------------------------------------------------------- нижнее меню: стеклянная пилюля */
.tabbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + var(--safe-bottom));
  display: flex; gap: 4px; padding: 5px; border-radius: var(--r-pill);
  background: var(--bar); box-shadow: var(--shadow-float), inset 0 0 0 1px var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}
.tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 16px;
  border-radius: var(--r-pill); color: var(--fog); font-size: 13px; font-weight: 700;
}
.tab svg { width: 18px; height: 18px; }
.tab.on { background: var(--glass-3); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.tab .count {
  min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--tint); color: var(--frost);
  font: 800 11px/18px var(--font-label); text-align: center;
}

/* ---------------------------------------------------------------- лента */
.listing { padding: 12px; display: grid; gap: 12px; }
.listing-top { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: start; }
.thumb-btn { display: block; border-radius: 12px; }
.listing-body { min-width: 0; }
.thumb {
  width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: var(--glass-2);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.listing-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px;
  font: 800 11px/1.2 var(--font-label); letter-spacing: .06em; text-transform: uppercase; color: var(--fog);
}
.kind { color: var(--mist); }
.kind-drop { color: var(--deal); }
.meta-dot { opacity: .5; }
.listing-title {
  margin: 0 0 6px; font: 800 16px/1.25 var(--font-display); color: var(--ink); letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listing-title .num { color: var(--fog); font-family: var(--font-label); font-size: 13px; letter-spacing: 0; }
.attrs { display: grid; gap: 4px; }
.attr { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; line-height: 1.35; }
.attr-k { flex: none; width: 52px; color: var(--fog); }
.attr-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--frost); }
.listing-bottom {
  display: flex; align-items: center; gap: 12px; padding-top: 12px;
  border-top: 1px solid var(--edge);
}
.price-block { flex: 1; min-width: 0; }
.price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price-v { font: 800 22px/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.price-u { font: 800 12px/1 var(--font-label); color: var(--mist); letter-spacing: .06em; }
.price-old { color: var(--fog); font-size: 13px; text-decoration: line-through; font-variant-numeric: tabular-nums; }
.floor { margin-top: 3px; font-size: 12px; line-height: 1.33; color: var(--fog); font-variant-numeric: tabular-nums; }
.deal { color: var(--deal); font-weight: 700; }
.above { color: var(--mist); }
.buy { flex: none; }
.new-flash { animation: arrive .6s ease both; }
@keyframes arrive { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.more { display: flex; justify-content: center; padding: 8px 0 0; }

/* ---------------------------------------------------------------- фильтры */
.filter { display: grid; gap: 12px; transition: opacity .2s ease; }
.filter.paused > :not(.filter-head) { opacity: .55; }
.filter-head { display: flex; align-items: center; gap: 12px; }
.tile {
  flex: none; width: 48px; height: 48px; border-radius: 9999px; object-fit: cover;
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge);
}
.filter-name { min-width: 0; flex: 1; }
.filter-name h3 {
  margin: 0; font: 800 16px/1.25 var(--font-display); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sub { margin: 2px 0 0; font-size: 12px; line-height: 1.33; color: var(--fog); font-variant-numeric: tabular-nums; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--mist); }

/* ---------------------------------------------------------------- слои: редактор, выбор из списка */
.layer {               /* поверх прозрачен: под ним — та же сетка и прожектор (основной экран скрыт) */
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.layer .shell { padding-bottom: calc(112px + var(--safe-bottom)); }
.layer .hero { padding: 4px 0 18px; }
.layer-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding-top: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--mist); font-size: 14px; font-weight: 700; min-height: 36px; }
.back svg { width: 18px; height: 18px; }

.form { padding: 4px 0; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; text-align: left;
}
.row + .row { border-top: 1px solid var(--edge); }
.row-k { flex: none; color: var(--fog); font-size: 14px; width: 92px; }
.row-v { flex: 1; min-width: 0; color: var(--frost); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-v-empty { color: var(--fog); font-weight: 600; }
.row .icon, .item-side .icon { width: 16px; height: 16px; color: var(--fog); }
.row[disabled] { opacity: .5; }
.row-img { flex: none; width: 28px; height: 28px; border-radius: 9999px; object-fit: cover; background: var(--glass-2); }

.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preset {
  display: grid; gap: 2px; justify-items: center; padding: 9px 4px; border-radius: 12px;
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge); color: var(--mist);
}
.preset b { font: 800 14px/1.2 var(--font-display); color: var(--frost); font-variant-numeric: tabular-nums; }
.preset span { font: 800 11px/1.2 var(--font-label); letter-spacing: .04em; }
.preset.on { background: var(--glass-3); box-shadow: inset 0 0 0 1px var(--edge-strong); }
.preset.on b, .preset.on span { color: var(--ink); }
.price-custom { display: flex; gap: 8px; margin-top: 10px; }
.price-custom .field { flex: 1; font-variant-numeric: tabular-nums; }
.hint { margin: 10px 2px 0; font-size: 12px; line-height: 1.4; color: var(--fog); }

.market-row { display: flex; gap: 8px; flex-wrap: wrap; }
.market-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px 8px 10px;
  border-radius: var(--r-pill); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--fog); font-weight: 700; font-size: 14px;
}
.market-toggle .box {
  width: 20px; height: 20px; border-radius: 9999px; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px var(--edge-strong);
}
.market-toggle .box svg { width: 12px; height: 12px; opacity: 0; }
.market-toggle.on { color: var(--ink); background: var(--glass-3); box-shadow: inset 0 0 0 1px var(--edge-strong); }
.market-toggle.on .box { background: var(--frost); color: var(--canvas); box-shadow: none; }
.market-toggle.on .box svg { opacity: 1; }
.market-toggle[disabled] { opacity: .5; }
.market-toggle[disabled] .box svg { opacity: 1; color: var(--fog); }

.savebar {
  position: fixed; z-index: 35; left: 0; right: 0; bottom: 0;
  padding: 12px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(12px + var(--safe-bottom)) max(var(--gutter), env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, transparent, var(--canvas) 38%);
}
.savebar > div { max-width: 528px; margin: 0 auto; display: grid; gap: 8px; }
.form-error { color: var(--warn); font-size: 13px; text-align: center; }

/* список выбора */
.picker-tools { display: grid; gap: 10px; position: sticky; top: 0; z-index: 2; padding: 8px 0 12px; background: var(--sheet); }
.list { padding: 4px 0; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 14px; text-align: left; }
.item + .item { border-top: 1px solid var(--edge); }
.item-img { flex: none; width: 36px; height: 36px; border-radius: 9999px; object-fit: cover; background: var(--glass-2); }
.item-name { flex: 1; min-width: 0; color: var(--frost); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-side { flex: none; display: flex; align-items: center; gap: 6px; color: var(--mist); font-size: 13px; font-variant-numeric: tabular-nums; }
.item.current { background: var(--glass-2); }
.savebar > .pickerbar { display: flex; gap: 8px; }
.pickerbar .pill { flex: 1; min-height: 44px; }

/* ---------------------------------------------------------------- админка */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat-v { font: 800 28px/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-k { margin-top: 4px; font: 800 11px/1.25 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--fog); }
.stat-sub { margin-top: 6px; font-size: 12px; color: var(--mist); font-variant-numeric: tabular-nums; }
.mkts { padding: 4px 0; }
.mkt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.mkt + .mkt { border-top: 1px solid var(--edge); }
.mkt-name { font-weight: 700; color: var(--ink); }
.mkt-state { font-size: 12px; color: var(--fog); line-height: 1.4; word-break: break-word; }
.dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--fog); }
.dot-ok { background: var(--deal); box-shadow: 0 0 10px var(--deal); }
.dot-fail { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 132px; padding-top: 8px; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; height: 100%; justify-items: center; }
.bar-v { font: 800 11px/1 var(--font-label); color: var(--mist); }
.bar-track { width: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; min-height: 2px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--head-a), var(--head-b)); opacity: .85; }
.bar-d { font: 800 10px/1 var(--font-label); color: var(--fog); letter-spacing: .04em; }
.bars-legend { margin-top: 10px; font-size: 12px; color: var(--fog); display: flex; justify-content: space-between; gap: 8px; }

.person { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; text-align: left; }
.person + .person { border-top: 1px solid var(--edge); }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 9999px; display: grid; place-items: center;
  background: var(--glass-3); color: var(--frost); font: 800 14px/1 var(--font-display);
}
.person-main { flex: 1; min-width: 0; }
.person-name { color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-sub { font-size: 12px; color: var(--fog); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-side { flex: none; display: grid; justify-items: end; gap: 4px; }

.day { margin: 18px 2px 8px; font: 800 11px/1.2 var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--fog); }
.event { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 10px 16px; }
.event + .event { border-top: 1px solid var(--edge); }
.event-t { font: 800 12px/1.5 var(--font-label); color: var(--fog); font-variant-numeric: tabular-nums; }
.event-body { font-size: 13px; line-height: 1.45; color: var(--mist); word-break: break-word; }
.event-body b { color: var(--frost); font-weight: 700; }
.event-who { color: var(--frost); font-weight: 700; }
.user-head { display: flex; align-items: center; gap: 12px; }

/* ---------------------------------------------------------------- пусто, загрузка, ошибки */
.empty { display: grid; justify-items: center; gap: 10px; padding: 32px 20px; text-align: center; }
.empty-icon { width: 56px; height: 56px; border-radius: 9999px; display: grid; place-items: center; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge); color: var(--frost); }
.empty-icon svg { width: 24px; height: 24px; }
.empty-title { margin: 6px 0 0; font: 800 18px/1.33 var(--font-display); color: var(--ink); }
.empty-text { margin: 0; max-width: 32ch; color: var(--fog); font-size: 14px; line-height: 1.45; }
.error-box { padding: 14px 16px; color: var(--warn); font-size: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.skeleton { height: 148px; overflow: hidden; }
.skeleton::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--glass-2) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.toast {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(76px + var(--safe-bottom));
  max-width: min(92vw, 420px); padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--bar); box-shadow: var(--shadow-float), inset 0 0 0 1px var(--edge);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  color: var(--ink); font-size: 13px; font-weight: 700; text-align: center; animation: arrive .25s ease both;
}
.layer ~ .toast { bottom: calc(96px + var(--safe-bottom)); }

.gate { min-height: 80vh; display: grid; place-items: center; }

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

/* ---------------------------------------------------------------- выбор моделей (плитки по редкости) и фонов (кружки)
   мелко, по 6 в ряд: на экран влезает примерно вдвое больше */
.group { margin-top: 16px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.group-title { margin: 0; font: 800 15px/1.25 var(--font-display); color: var(--ink); }
.link { min-height: 32px; padding: 0 2px; color: var(--head-b); font-size: 13px; font-weight: 800; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 12px 8px; }
.tile-btn, .swatch { display: grid; justify-items: center; align-content: start; gap: 4px; min-width: 0; text-align: center; }
.tile-img {
  position: relative; width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px;
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge); transition: background-color .15s ease, box-shadow .15s ease;
}
.tile-img img { width: 86%; height: 86%; object-fit: contain; }
.tile-btn.on .tile-img { background: var(--glass-3); box-shadow: inset 0 0 0 2px var(--frost); }
.tile-check {
  position: absolute; top: -3px; right: -3px; width: 17px; height: 17px; border-radius: 9999px;
  display: grid; place-items: center; background: var(--frost); color: var(--canvas);
  box-shadow: 0 0 0 2px var(--canvas); opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease;
}
.tile-check .icon { width: 10px; height: 10px; stroke-width: 3; }
.tile-btn.on .tile-check, .swatch.on .tile-check { opacity: 1; transform: none; }
.tile-name {      /* может заходить в промежуток между колонками: так слова в 9–10 букв не рвутся */
  width: calc(100% + 6px); margin: 0 -3px; color: var(--frost); font-size: 10px; line-height: 1.2; font-weight: 700;
  letter-spacing: -0.01em; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-btn.on .tile-name, .swatch.on .tile-name { color: var(--ink); }
.tile-meta { margin-top: -2px; color: var(--fog); font-size: 9.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 6px; margin-top: 6px; }
.bd {
  position: relative; width: 44px; max-width: 100%; aspect-ratio: 1; border-radius: 9999px;
  background: var(--glass-3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 6px 12px -6px rgba(0, 0, 0, .55);
  transition: box-shadow .15s ease;
}
.swatch.on .bd { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--frost); }
