:root {
  --bg: #0e0e10;
  --panel: #18181b;
  --panel-2: #212126;
  --line: rgba(255, 255, 255, .09);
  --text: #f3efe8;
  --mute: #a5a19a;
  --red: #ef3b24;
  --red-2: #ff7a3d;
  --cream: #f6e3c4;
  --vk: #2787f5;
  --grad: linear-gradient(135deg, #ff5a36 0%, #e8301c 100%);
  --radius: 14px;
  --bar-h: 64px;
  --gutter: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 64px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: var(--red-2); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red-2); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(14, 14, 16, .84);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  max-width: 1100px; margin: 0 auto; height: var(--bar-h);
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.brand__logo { border-radius: 50%; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__text b { font-size: 16px; letter-spacing: .01em; }
.brand__text small { color: var(--mute); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.search {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; height: 42px;
}
.search:focus-within { border-color: var(--red-2); }
.search svg { width: 18px; height: 18px; margin-left: 12px; fill: var(--mute); flex: none; }
.search input {
  flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0;
  color: var(--text); padding: 0 12px; font-size: 15px;
}
.search input::placeholder { color: var(--mute); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear { background: none; border: 0; color: var(--mute); font-size: 22px; line-height: 1; padding: 0 12px; cursor: pointer; height: 100%; }

.cartbtn {
  position: relative; flex: none; display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 16px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--grad); color: #fff; font-weight: 700;
  box-shadow: 0 6px 20px rgba(239, 59, 36, .35);
}
.cartbtn svg { width: 20px; height: 20px; fill: currentColor; }
.cartbtn__count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #fff; color: var(--red); font-size: 13px; font-weight: 800;
  display: grid; place-items: center;
}
.cartbtn.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(900px 360px at 85% -10%, rgba(239, 59, 36, .38), transparent 70%),
    radial-gradient(600px 300px at 0% 110%, rgba(255, 122, 61, .18), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero__in { max-width: 1100px; margin: 0 auto; padding: 40px var(--gutter) 32px; }
.hero__kicker { margin: 0 0 10px; color: var(--cream); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; }
.hero h1 { margin: 0 0 14px; font-size: clamp(30px, 6vw, 52px); line-height: 1.04; letter-spacing: -.02em; font-weight: 800; }
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 760px; }
.steps li { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; color: #e4dfd6; }
.steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 12px; }
.hero__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { background: rgba(246, 227, 196, .1); border: 1px solid rgba(246, 227, 196, .3); color: var(--cream); border-radius: 999px; padding: 8px 14px; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; text-align: center;
}
.btn--vk { background: var(--vk); color: #fff; }
.btn--vk:hover { filter: brightness(1.08); }
.btn--ghost { background: rgba(255, 255, 255, .06); color: var(--text); border-color: rgba(255, 255, 255, .22); }
.btn--ghost:hover { background: rgba(255, 255, 255, .12); }
.btn--big { width: 100%; min-height: 54px; font-size: 17px; background: var(--grad); color: #fff; box-shadow: 0 10px 28px rgba(239, 59, 36, .4); }
.btn--big:hover { filter: brightness(1.07); }
.btn--big.done { background: #2ea043; box-shadow: 0 10px 28px rgba(46, 160, 67, .35); }

/* ---------- publisher chips ---------- */
.chips {
  position: sticky; top: var(--bar-h); z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 10px var(--gutter);
  background: rgba(14, 14, 16, .9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip em { font-style: normal; color: var(--mute); font-weight: 500; }
.chip:hover { border-color: rgba(255, 122, 61, .6); }
.chip[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; }
.chip[aria-pressed="true"] em { color: rgba(255, 255, 255, .8); }
@media (min-width: 1100px) { .chips { padding-left: calc((100vw - 1100px) / 2 + var(--gutter)); padding-right: var(--gutter); } }

/* ---------- catalog ---------- */
.catalog { max-width: 1100px; margin: 0 auto; padding: 8px var(--gutter) 60px; }
.pub { padding-top: 26px; }
.pub__title { margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: .01em; }
.pub__title i { font-style: normal; font-size: 13px; color: var(--mute); font-weight: 500; }
.series { content-visibility: auto; contain-intrinsic-size: auto 240px; }
.series__title { margin: 18px 0 6px; padding-left: 10px; border-left: 3px solid var(--red); font-size: 14px; font-weight: 700; color: var(--cream); }

.row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 76px 148px; align-items: center; gap: 14px;
  padding: 8px 10px; border-radius: 12px; border: 1px solid transparent;
}
.row:hover { background: var(--panel); }
.row.in-cart { background: rgba(239, 59, 36, .08); border-color: rgba(239, 59, 36, .35); }
.row__thumb {
  position: relative; width: 52px; height: 78px; padding: 0; border: 0; border-radius: 7px; overflow: hidden; cursor: zoom-in;
  background: var(--panel-2); box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.row__name { font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.row__price { text-align: right; font-weight: 800; font-size: 16px; white-space: nowrap; }
.row__price small { font-weight: 600; color: var(--mute); }
.row__buy { display: flex; justify-content: flex-end; }

.addbtn {
  height: 38px; min-width: 128px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 14px;
}
.addbtn:hover { filter: brightness(1.08); }
.addbtn:active { transform: scale(.97); }

.stepper { display: inline-flex; align-items: center; height: 38px; border-radius: 10px; border: 1px solid rgba(239, 59, 36, .6); overflow: hidden; background: rgba(0, 0, 0, .25); }
.stepper button { width: 38px; height: 100%; border: 0; background: none; font-size: 20px; font-weight: 700; cursor: pointer; color: #fff; }
.stepper button:hover { background: rgba(255, 255, 255, .1); }
.stepper output { min-width: 34px; text-align: center; font-weight: 800; }

.empty { max-width: 1100px; margin: 40px auto; padding: 0 var(--gutter); color: var(--mute); text-align: center; }

@media (max-width: 720px) {
  :root { --bar-h: 58px; }
  .brand__text, .cartbtn__label { display: none; }
  .cartbtn { padding: 0 12px; }
  .hero__in { padding: 22px var(--gutter) 18px; }
  .hero h1 { font-size: 28px; margin-bottom: 14px; }
  .hero h1 br { display: none; }
  /* the three steps are the only how-to on a phone, so they stay — just tighter */
  .steps { grid-template-columns: 1fr; gap: 6px; margin-bottom: 16px; }
  .steps li { padding: 8px 12px; font-size: 13px; }
  .hero__cta .btn { flex: 1 1 140px; }
  .row { grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: "thumb name" "thumb buy"; row-gap: 6px; align-items: start; }
  .row__thumb { grid-area: thumb; }
  .row__name { grid-area: name; }
  .row__price { display: none; }
  .row__buy { grid-area: buy; justify-content: space-between; align-items: center; gap: 10px; }
  .row__buy .mprice { display: block; font-weight: 800; font-size: 16px; }
}
@media (min-width: 721px) { .row__buy .mprice { display: none; } }

/* ---------- hover preview ---------- */
.peek {
  position: fixed; z-index: 60; pointer-events: none; left: 0; top: 0;
  padding: 6px; border-radius: 14px; background: #fff; box-shadow: var(--shadow);
}
.peek img { width: 250px; max-width: 40vw; height: auto; border-radius: 9px; background: var(--panel-2); }
@media (hover: none) { .peek { display: none !important; } }

/* ---------- viewer (cover lightbox) ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 20px 12px;
  background: rgba(6, 6, 8, .66);
  -webkit-backdrop-filter: blur(16px) saturate(.9); backdrop-filter: blur(16px) saturate(.9);
  opacity: 0; transition: opacity .18s ease;
}
.viewer.open { opacity: 1; }
.viewer__body { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: min(92vw, 520px); }
.viewer__body img {
  /* the box is reserved up front (2:3), so the caption does not jump while the cover loads */
  height: min(70vh, 560px, 132vw); width: auto; aspect-ratio: 2 / 3; object-fit: contain;
  border-radius: 12px; background: var(--panel-2);
  box-shadow: var(--shadow);
}
.viewer figcaption { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.viewer__name { font-size: 15px; font-weight: 600; }
.viewer__row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.viewer__row b { font-size: 20px; }
.viewer__close {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .4); font-size: 28px; line-height: 1; cursor: pointer;
}
.viewer__nav {
  flex: none; width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .4); font-size: 30px; line-height: 1; padding-bottom: 4px;
}
.viewer__nav:hover, .viewer__close:hover { background: rgba(255, 255, 255, .14); }
@media (max-width: 720px) {
  .viewer { gap: 4px; padding: 16px 4px; }
  .viewer__nav { width: 38px; height: 38px; font-size: 24px; }
}

/* ---------- cart drawer ---------- */
.shade { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s; }
.shade.open { opacity: 1; }
.cart {
  position: fixed; z-index: 75; top: 0; right: 0; bottom: 0; width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform .24s ease;
}
.cart.open { transform: none; }
.cart__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cart__head h2 { margin: 0; font-size: 20px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); font-size: 24px; line-height: 1; cursor: pointer; }
.cart__empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 30px; text-align: center; color: var(--mute); }
.cart__empty img { border-radius: 10px; }
.cart__list { flex: 1; list-style: none; margin: 0; padding: 6px 12px; overflow-y: auto; overscroll-behavior: contain; }
.citem { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.citem img { width: 44px; height: 66px; object-fit: cover; border-radius: 6px; background: var(--panel-2); }
.citem__name { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.citem__row { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.citem__sum { font-weight: 800; }
.citem__sum small { color: var(--mute); font-weight: 500; }
.citem .stepper { height: 34px; }
.citem .stepper button { width: 34px; }
.citem__del { background: none; border: 0; color: var(--mute); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 6px 4px; }
.cart__foot {
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; gap: 12px;
}
.cart__total { display: flex; align-items: baseline; justify-content: space-between; color: var(--mute); }
.cart__total b { color: var(--text); font-size: 24px; }
.sendbox { background: rgba(46, 160, 67, .12); border: 1px solid rgba(46, 160, 67, .45); border-radius: 12px; padding: 12px; }
.sendbox p { margin: 0 0 10px; font-size: 14px; }
.sendbox__row { display: grid; gap: 8px; }
.preview summary { cursor: pointer; color: var(--mute); font-size: 13px; }
.preview textarea { width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 13px/1.45 ui-monospace, Consolas, monospace; resize: vertical; }
.linkbtn { align-self: center; background: none; border: 0; color: var(--mute); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }

/* ---------- toast & footer ---------- */
.toast {
  position: fixed; z-index: 100; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: #fff; color: #111; font-weight: 600; box-shadow: var(--shadow);
}
.footer { max-width: 1100px; margin: 0 auto; padding: 24px var(--gutter) 48px; border-top: 1px solid var(--line); color: var(--mute); font-size: 13px; }
.footer p { margin: 0 0 8px; max-width: 720px; }

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