/* ============ Токены ============ */
:root {
  --accent: #ff7a00;
  --green: #7ed90b;
  --font: 'Inter';
  --radius: 18px;
  --maxw: 1280px;
  --header-h: 68px;
}
[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-a: rgba(10, 10, 12, .82);
  --surface: #141418;
  --surface-2: #1d1d23;
  --text: #f3f3f5;
  --muted: #8e8e99;
  --border: #26262d;
  --shadow: 0 20px 60px rgba(0, 0, 0, .55);
  --logo-blend: lighten;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f4f6;
  --bg-a: rgba(244, 244, 246, .85);
  --surface: #ffffff;
  --surface-2: #ececf0;
  --text: #3a3d45;    /* тёмно-серый вместо почти чёрного — мягче на белом */
  --muted: #868994;
  --border: #e0e0e6;
  --shadow: 0 20px 60px rgba(20, 20, 40, .14);
  --logo-blend: multiply;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font), system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
  padding-bottom: env(safe-area-inset-bottom);
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 24px 120px;
}

/* ============ Шапка ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-a);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.header__in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
}

/* Логотип: прозрачный PNG, только цветные буквы — одинаково на тёмной и светлой теме */
.logo {
  flex: none;
  display: block;
  height: 40px;
}
.logo img.logo__def {
  height: 40px;
  width: auto;
  max-width: none;
}
.logo img.logo__custom {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}
.logo.is-custom { width: auto; max-width: 160px; }
.logo.is-custom img { width: auto; height: 40px; }

.tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
  transition: color .15s, background .15s;
  cursor: pointer;
  user-select: none;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: '';
  position: absolute;
  left: 16px; right: 16px; bottom: 2px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.tab__t { outline: none; white-space: nowrap; }
.tab__x {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-2);
}
.tab__x:hover { background: #e5484d; color: #fff; }
.tab--add {
  color: var(--accent);
  border: 1.5px dashed var(--border);
}

.header__right {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--green));
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--border);
  transition: box-shadow .15s;
}
.avatar:hover { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.burger {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.burger span {
  display: block;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: var(--text);
}
.burger:hover { border-color: var(--accent); }

/* ============ Баннер ============ */
.banner {
  position: relative;
  margin-bottom: 36px;
}
.slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--radius);
  aspect-ratio: 2000 / 410;
  background: var(--surface);
}
.slides::-webkit-scrollbar { display: none; }
.slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  height: 100%;
}
.slide a, .slide picture { display: block; height: 100%; }
.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slide--add {
  display: grid; place-items: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 700;
  font-size: 17px;
}
.slide__tools {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; gap: 8px;
}
.banner__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 20px;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .2s;
}
.banner:hover .banner__nav { opacity: 1; }
.banner__nav--prev { left: 14px; }
.banner__nav--next { right: 14px; }
.dots {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 12px;
}
.dots button {
  width: 8px; height: 8px;
  border-radius: 8px;
  background: var(--border);
  transition: width .25s, background .25s;
}
.dots button.is-active { width: 24px; background: var(--accent); }

/* ============ Лента дропов ============ */
.feed {
  --drop-w: 156px;
  --drop-gap: 12px;
  margin-bottom: 36px;
}
.feed__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 800;
  font-size: 18px;
  flex-wrap: wrap;
}
.feed__title { outline: none; }
.live-dot {
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.feed__track {
  display: flex;
  gap: var(--drop-gap);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 6px;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.feed__track::-webkit-scrollbar { display: none; }
body.is-editing .feed__track { -webkit-mask-image: none; mask-image: none; }

.drop {
  --c: var(--accent);
  position: relative;
  flex: 0 0 var(--drop-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    radial-gradient(110% 70% at 50% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 65%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  text-align: center;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.drop--green { --c: var(--green); }
.drop:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--border)); transform: translateY(-2px); }
.drop__img {
  width: 96px; height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .45));
}
.drop__title {
  margin-top: 2px;
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.2;
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.drop__price {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  font-size: 19px;
  color: var(--c);
  line-height: 1;
}
/* Иконка RB: белая в тёмной теме, чёрная в светлой (цвет = цвет текста) */
.coin {
  width: 18px; height: 18px;
  display: inline-grid; place-items: center;
  color: var(--text);
}
.coin svg { width: 100%; height: 100%; display: block; }
.drop__cur { font-size: 13px; font-weight: 600; color: var(--muted); }
.drop__user {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  font-size: 12px;
  color: var(--muted);
}
.drop__user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop__user::after {
  content: '';
  flex: none;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
}
.drop__bar {
  margin-top: 8px;
  width: 60%;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--c);
  box-shadow: 0 0 12px var(--c);
}
.drop.is-new { animation: dropIn .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes dropIn {
  from { margin-left: calc(-1 * (var(--drop-w) + var(--drop-gap))); opacity: 0; transform: scale(.85); }
  to { margin-left: 0; opacity: 1; transform: none; }
}
body.is-editing .drop:not(.drop--add) { cursor: pointer; }
.drop--add {
  justify-content: center;
  min-height: 200px;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}
.drop--add b { font-size: 36px; font-weight: 400; line-height: 1; }
.chip--soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); backdrop-filter: none; }
.chip--soft:hover { background: var(--surface); border-color: var(--accent); }

/* ============ Товары ============ */
.section-title {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0 0 20px;
  outline: none;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: var(--shadow);
}
.card__img {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.card__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.card:hover .card__img img { transform: scale(1.04); }
.card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.15;
}
.card__desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__price {
  margin-top: auto;
  padding-top: 8px;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
}
.card__tools {
  position: absolute;
  top: 10px; right: 10px;
  display: flex; gap: 6px;
}
.card--add {
  min-height: 260px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}
.card--add span { font-size: 44px; line-height: 1; font-weight: 400; }
body.is-editing .card:not(.card--add) { cursor: pointer; }

/* ============ Кнопки/поля ============ */
.btn {
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--danger { color: #e5484d; }
.btn--sm { height: 34px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  backdrop-filter: blur(6px);
}
.chip:hover { background: rgba(0, 0, 0, .8); }
.chip--danger:hover { background: #e5484d; }

body.is-editing [contenteditable] {
  outline: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 4px;
  border-radius: 4px;
  cursor: text;
}
body.is-editing [contenteditable]:focus { outline-style: solid; }

/* ============ Меню ============ */
.overlay {
  position: fixed; inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 100;
  width: min(340px, 88vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: calc(16px + env(safe-area-inset-top)) 16px 16px;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; gap: 4px;
}
.drawer.is-open { transform: none; box-shadow: var(--shadow); }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 20px;
  padding: 4px 8px 14px;
}
.drawer__item {
  display: flex; align-items: center; gap: 14px;
  height: 52px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  text-align: left;
}
.drawer__item:hover { background: var(--surface-2); }
.drawer__item svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--muted);
}
.x {
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  display: grid; place-items: center;
}
.x:hover { background: var(--surface-2); color: var(--text); }

/* ============ Модалки ============ */
.modal {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.m { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.m__head { display: flex; align-items: center; justify-content: space-between; }
.m__head h3 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.m__foot { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.m__foot .sp { flex: 1; }
.m label, .field {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.m input:not([type=color]), .m textarea, .m select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  resize: vertical;
}
.m input:focus, .m textarea:focus, .m select:focus { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); font-weight: 500; }

.pick {
  position: relative;
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg);
  display: grid; place-items: center;
  color: var(--muted);
  font-weight: 600;
}
.pick:hover { border-color: var(--accent); color: var(--accent); }
.pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick span {
  position: relative;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--bg-a);
  font-size: 13px;
}
.pick--sq { aspect-ratio: 1; max-width: 240px; margin: 0 auto; }
.pick--wide { aspect-ratio: 2000 / 410; }
.pick--mob { aspect-ratio: 3 / 1; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.seg button {
  height: 40px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--muted);
}
.seg button.is-active { background: var(--surface-2); color: var(--text); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.swatch.is-active { box-shadow: 0 0 0 2px var(--text); }
.m input[type=color] {
  width: 34px; height: 34px;
  padding: 0; border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.m input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.m input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.m input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
.switch {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  color: var(--text) !important;
  font-size: 15px !important;
  cursor: pointer;
}
.switch input { display: none; }
.switch i {
  position: relative;
  width: 46px; height: 28px;
  border-radius: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .2s;
}
.switch i::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.divider { height: 1px; background: var(--border); margin: 2px 0; }

/* ============ Плашки ============ */
.editbar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 150%);
  z-index: 80;
  display: flex; align-items: center; gap: 12px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  transition: transform .3s;
}
body.is-editing .editbar { transform: translate(-50%, 0); }
.editbar__dot {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent);
}
.toast {
  position: fixed;
  left: 50%; top: 84px;
  transform: translate(-50%, -20px);
  z-index: 200;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: calc(100vw - 24px);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ============ Телефон ============ */
@media (max-width: 760px) {
  :root { --header-h: auto; --radius: 14px; }
  .header__in {
    flex-wrap: wrap;
    gap: 0;
    padding: 10px 16px 0;
  }
  .logo { order: 1; }
  .header__right { order: 2; }
  .tabs {
    order: 3;
    flex: 0 0 100%;
    margin: 8px -16px 0;
    padding: 0 12px 6px;
  }
  .tab { height: 38px; padding: 0 12px; font-size: 14px; }
  .tab.is-active::after { left: 12px; right: 12px; }
  .container { padding: 14px 16px 120px; }
  .banner { margin-bottom: 26px; }
  .feed { --drop-w: 128px; --drop-gap: 10px; margin-bottom: 28px; }
  .feed__head { font-size: 16px; }
  .drop__img { width: 76px; height: 76px; }
  .drop__title { font-size: 12.5px; }
  .drop__price { font-size: 16px; }
  .slides { aspect-ratio: 5 / 2; }
  .banner__nav { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card__body { padding: 10px 12px 12px; gap: 4px; }
  .card__title { font-size: 15px; }
  .card__desc { font-size: 12.5px; }
  .card__price { font-size: 15px; padding-top: 4px; }
  .card--add { min-height: 180px; font-size: 14px; }
  .editbar { font-size: 12.5px; }
  .toast { top: 16px; }
}
@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
  .card:hover .card__img img { transform: none; }
}

/* Текст для экранных читалок и поисковиков (визуально скрыт, но доступен) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Подвал сайта */
.site-footer { border-top: 1px solid var(--border); margin-top: 20px; }
.site-footer__in { max-width: var(--maxw); margin: 0 auto; padding: 22px 24px 90px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.site-footer__in p { margin: 0 0 8px; }
.site-footer__in b { color: var(--text); }
.site-footer__small { font-size: 12px; opacity: .8; }
@media (max-width: 760px) { .site-footer__in { padding: 18px 16px 90px; } }
