/* Витрина в духе референса: много белого, крупный жирный гротеск с курсивными акцентами,
   мягкое градиентное свечение и тонкие кнопки-обводки. Фон и текст берутся из темы Telegram,
   поэтому в тёмной теме всё остаётся читаемым. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --soft: var(--tg-theme-secondary-bg-color, #f5f4f7);
  --text: var(--tg-theme-text-color, #0e0d12);
  --hint: var(--tg-theme-hint-color, #8a8794);
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --danger: #e5484d;
  --ok: #16a34a;
  --tile: #ffffff;
  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "New York", Georgia, serif;
  /* то самое свечение из референса: оранжевый → малиновый → фиолетовый */
  --glow: radial-gradient(55% 60% at 22% 45%, rgba(255, 166, 48, .8), transparent 70%),
          radial-gradient(55% 55% at 55% 58%, rgba(236, 55, 132, .72), transparent 70%),
          radial-gradient(45% 50% at 85% 40%, rgba(147, 77, 255, .5), transparent 70%);
  --band: linear-gradient(100deg, #5b1aa8 0%, #c2187f 38%, #f5583a 70%, #ffc93c 100%);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img, svg { display: block; }
em, .serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }

.screen { padding: 10px 18px calc(104px + env(safe-area-inset-bottom)); animation: in .3s ease; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- верхняя строка: название и кнопки-обводки ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0 6px; }
.brand { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  position: relative; height: 36px; min-width: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.round { padding: 0; width: 36px; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--text); color: var(--bg);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; letter-spacing: 0;
}
.icon-btn.round .badge { position: absolute; top: -5px; right: -5px; }

/* ---------- первый экран ---------- */
.intro { position: relative; text-align: center; padding: 26px 0 8px; }
.intro .kicker { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--text); opacity: .8; }
.intro h1 { font-size: 40px; line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; margin: 8px 0 12px; }
.intro p { font-size: 14px; color: var(--hint); max-width: 300px; margin: 0 auto 18px; }
.glow-stage { position: relative; height: 350px; margin: 10px -18px 0; display: grid; place-items: center; overflow: hidden; }
.glow-stage::before {                      /* свечение; низ плавно тает, телефон не трогаем */
  content: ""; position: absolute; inset: 10% -8% 0; background: var(--glow); filter: blur(34px);
  -webkit-mask: linear-gradient(to bottom, transparent 0, #000 22%, #000 55%, transparent 92%); mask: linear-gradient(to bottom, transparent 0, #000 22%, #000 55%, transparent 92%);
}
.glow-stage::after {                       /* световое пятно позади телефона */
  content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%; top: 40px;
  background: radial-gradient(circle, rgba(255, 236, 214, .95), rgba(255, 190, 150, 0) 70%); filter: blur(10px);
}
.hero-phone {
  position: relative; z-index: 1; height: 290px; cursor: pointer;
  transform: rotate(-11deg); animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 34px 30px rgba(90, 18, 45, .42)) drop-shadow(0 6px 10px rgba(40, 10, 25, .35));
}
.hero-phone img { height: 100%; width: auto; }
.hero-phone::after {                       /* блик по корпусу: маска повторяет форму телефона */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .38) 46%, rgba(255, 255, 255, 0) 60%);
  -webkit-mask: url(/static/hero-iphone.webp) center / contain no-repeat; mask: url(/static/hero-iphone.webp) center / contain no-repeat;
  mix-blend-mode: soft-light; animation: sheen 6s ease-in-out infinite;
}
.hero-phone::before {                      /* мягкая тень-«отражение» на полу */
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -26px; height: 26px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60, 10, 30, .35), transparent); transform: rotate(11deg);
}
@keyframes sheen { 0%, 100% { background-position: 0 0; opacity: .7; } 50% { opacity: 1; } }
@keyframes float { 0%, 100% { transform: rotate(-11deg) translateY(0); } 50% { transform: rotate(-9deg) translateY(-10px); } }

.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 42px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--text); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; transition: background .2s, color .2s;
}
.pill-btn svg { width: 16px; height: 16px; }
.pill-btn:active, .pill-btn.dark { background: var(--text); color: var(--bg); }

/* ---------- поиск и категории ---------- */
.search {
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line);
  height: 48px; margin: 18px 0 12px;
}
.search svg { width: 18px; height: 18px; color: var(--hint); flex: none; }
.search input { border: 0; outline: 0; background: none; width: 100%; height: 100%; font-size: 16px; }
.search input::placeholder { color: var(--hint); }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 6px; padding: 4px 18px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text);
  transition: background .2s, color .2s, border-color .2s;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- заголовки разделов: жирный гротеск + курсивная подпись ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 30px 0 14px; }
.section-head:first-child { margin-top: 12px; }
.section-head h2 { font-size: 30px; line-height: 1; letter-spacing: -0.04em; font-weight: 700; margin: 0; }
.section-head .serif { font-size: 17px; color: var(--hint); white-space: nowrap; }
.sub-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--hint); margin: 18px 0 10px; }

/* ---------- сетка товаров ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { position: relative; text-align: left; display: flex; flex-direction: column; gap: 10px; transition: transform .2s; }
.card:active { transform: scale(.97); }
.card .pic { position: relative; background: var(--tile); aspect-ratio: 1; border-radius: 22px; overflow: hidden; }
.card .pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card .info { display: flex; flex-direction: column; gap: 3px; padding: 0 2px; }
.card .name { font-weight: 600; font-size: 15px; line-height: 1.2; letter-spacing: -.015em; }
.card .price { font-size: 14px; color: var(--hint); }
.card .price b { color: var(--text); font-weight: 700; }
.card.out { opacity: .5; }
.tag {
  position: absolute; top: 10px; left: 10px; z-index: 1; font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: #0e0d12;
  border: 1px solid rgba(14, 13, 18, .14);
}
.mini-dots { display: flex; gap: 4px; margin: 1px 0; }
.mini-dots i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); }

.stock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--hint); }
.stock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.stock.none::before { background: var(--hint); }

/* ---------- градиентная полоса, как внизу референса ---------- */
.band {
  position: relative; overflow: hidden; margin: 34px -18px 0; padding: 34px 22px 30px; color: #fff; background: var(--band);
}
.band h3 { font-size: 30px; line-height: 1.02; letter-spacing: -0.04em; font-weight: 700; margin: 0 0 10px; }
.band p { font-size: 14px; opacity: .9; margin: 0 0 18px; max-width: 280px; }
.band .pill-btn { border-color: #fff; color: #fff; }
.band .pill-btn:active { background: #fff; color: #0e0d12; }
.band .contacts-list { display: grid; gap: 4px; font-size: 14px; margin-bottom: 18px; }
.band .contacts-list a { color: #fff; }

/* ---------- карточка товара ---------- */
.product-stage { position: relative; margin: 0 -18px 4px; padding: 6px 18px 10px; overflow: hidden; }
.product-stage::before {
  content: ""; position: absolute; inset: 18% 4% 6%; background: var(--glow); filter: blur(34px); opacity: .85; z-index: 0;
}
.hero { position: relative; display: grid; place-items: center; }   /* без z-index: иначе фото не смешается со свечением */
.hero img { width: 86%; aspect-ratio: 1; object-fit: contain; mix-blend-mode: multiply; }
.hero-cart { position: absolute; top: 6px; right: 0; z-index: 2; background: var(--bg); }
.p-note { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; margin: 6px 0 10px; }
.p-name { font-size: 34px; font-weight: 700; letter-spacing: -0.045em; margin: 0 0 6px; line-height: 1.02; }
.p-price { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.p-price small { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; font-size: 18px; color: var(--hint); margin-top: 2px; }
.p-stock { margin: 10px 0 0; }
.p-stock .stock { font-size: 13px; }

.block { border-top: 1px solid var(--line); padding: 18px 0 2px; margin-top: 18px; }
.block h3 { margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .08em; }
.block h3 span { text-transform: none; letter-spacing: 0; color: var(--text); font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 18px; margin-left: 6px; }

.colors { display: flex; flex-wrap: wrap; gap: 14px; }
.dot { width: 34px; height: 34px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 1px var(--line); }
.dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid transparent; transition: border-color .15s; }
.dot.on::after { border-color: var(--text); }

.mem { display: flex; flex-wrap: wrap; gap: 8px; }
.mem.wide { display: grid; grid-template-columns: 1fr; }
.opt {
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; text-align: left; min-width: 96px;
  transition: background .2s, color .2s, border-color .2s;
}
.opt .m { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.opt .p { font-size: 12px; color: var(--hint); margin-top: 1px; }
.opt.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.opt.on .p { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.opt.soldout .p { color: var(--danger); }

.perks { display: grid; gap: 16px; }
.perk { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; font-size: 14px; }
.perk .ic { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; }
.perk .ic svg { width: 17px; height: 17px; }
.perk b { display: block; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.perk span.t { color: var(--hint); font-size: 13px; }

/* ---------- корзина ---------- */
.in-cart {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
  padding: 8px 8px 8px 16px; border-radius: 999px; border: 1px solid var(--text);
}
.in-cart > span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--text); font-size: 18px; line-height: 1;
}
.stepper button:active { background: var(--text); color: var(--bg); }
.stepper button:disabled { border-color: var(--line); color: var(--hint); }
.stepper span { min-width: 24px; text-align: center; font-weight: 700; }

.title-row { display: flex; justify-content: space-between; align-items: baseline; }
.link-btn { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; text-decoration: underline; text-underline-offset: 3px; margin-top: 10px; }
.danger-link { color: var(--danger); }

.cart-line { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cl-pic img { width: 84px; height: 84px; border-radius: 18px; background: var(--tile); object-fit: cover; box-shadow: inset 0 0 0 1px var(--line); }
.cl-body { flex: 1; min-width: 0; }
.cl-name { font-weight: 600; letter-spacing: -.01em; }
.cl-meta { color: var(--hint); font-size: 13px; margin-top: 2px; }
.cl-stock { margin-top: 4px; }
.cl-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.cl-bottom b { font-weight: 700; white-space: nowrap; }
.cl-out { color: var(--danger); font-size: 13px; margin-top: 8px; }
.cl-remove { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--hint); }
.cl-remove:active { color: var(--danger); border-color: var(--danger); }
.cl-remove svg { width: 17px; height: 17px; }
.cart-line.unavailable .cl-pic, .cart-line.unavailable .cl-name, .cart-line.unavailable .cl-meta { opacity: .5; }

/* ---------- оформление и данные заказа ---------- */
.summary { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; }
.summary-list { display: grid; gap: 14px; }
.summary img, .summary .noimg { width: 64px; height: 64px; border-radius: 16px; background: var(--tile); object-fit: cover; flex: none; box-shadow: inset 0 0 0 1px var(--line); }
.summary .t { font-weight: 600; }
.summary .s { color: var(--hint); font-size: 13px; }
.summary .pr { font-weight: 700; margin-top: 2px; }
.field { display: block; margin-top: 14px; }
.field span { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--hint); margin-bottom: 4px; }
.field input { width: 100%; height: 46px; border: 0; border-bottom: 1px solid var(--line); outline: 0; padding: 0; background: none; font-size: 18px; }
.field input:focus { border-bottom-color: var(--text); }
.error { color: var(--danger); font-size: 14px; margin: 10px 0 0; min-height: 1em; }
.fine { color: var(--hint); font-size: 12px; margin: 18px 4px 0; text-align: center; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button { height: 42px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.segmented button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.specs { display: grid; }
.spec { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 15px; }
.spec + .spec { border-top: 1px solid var(--line); }
.spec span { color: var(--hint); }
.spec b { font-weight: 600; text-align: right; }
.spec.total span { color: var(--text); font-weight: 600; }
.spec.total b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.summary-list .spec.total { border-top: 1px solid var(--line); padding-bottom: 0; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; padding: 0 24px;
  border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: none; color: var(--text); border: 1px solid var(--text); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .5; }
.btn.wide, .actions .btn { width: 100%; }
.actions { display: grid; gap: 10px; margin-top: 20px; }
.fallback-main {
  position: fixed; left: 18px; right: 18px; bottom: calc(16px + env(safe-area-inset-bottom)); height: 54px;
  border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}
.fallback-main:disabled { opacity: .6; }

/* ---------- результат, заказы, пусто ---------- */
.center { position: relative; isolation: isolate; text-align: center; padding-top: 12vh; }
.center::before { content: ""; position: absolute; left: -18px; right: -18px; top: 4vh; height: 240px; background: var(--glow); filter: blur(30px); opacity: .7; z-index: -1; }
.big-icon { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 22px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--text); }
.big-icon svg { width: 36px; height: 36px; }
.center h2 { font-size: 34px; line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; margin: 0 0 10px; }
.center p { color: var(--hint); font-size: 15px; margin: 0 auto 24px; max-width: 290px; }
.stack { display: grid; gap: 10px; justify-items: center; }

.order { width: 100%; display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px 0; border-bottom: 1px solid var(--line); }
.o-pics { position: relative; width: 72px; height: 72px; flex: none; }
.o-pics img, .o-pics .noimg { width: 72px; height: 72px; border-radius: 18px; background: var(--tile); object-fit: cover; box-shadow: inset 0 0 0 1px var(--line); }
.o-pics .more { position: absolute; right: -6px; bottom: -6px; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.o-body { flex: 1; min-width: 0; }
.order .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.order .num { font-size: 11px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .08em; }
.order .what { font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order .meta { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-price { font-weight: 700; margin-top: 2px; }

.st { font-size: 10px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--line); }
.st-new { border-color: #c2187f; color: #c2187f; }
.st-confirmed { border-color: var(--ok); color: var(--ok); }
.st-done { color: var(--hint); }
.st-canceled { border-color: var(--danger); color: var(--danger); }

.row-between { display: flex; justify-content: space-between; align-items: center; }
.status-help { display: flex; gap: 12px; font-size: 14px; color: var(--hint); }
.status-help .ic { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--band); }
.empty { color: var(--hint); text-align: center; padding: 40px 0; font-family: var(--serif); font-style: italic; font-size: 20px; }

.loader { display: grid; place-items: center; height: 80vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--text); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- таблица заказов (для продавца) ---------- */
.table-sum { font-size: 14px; color: var(--hint); margin: 0 0 12px; }
.table-sum b { color: var(--text); }
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; -webkit-overflow-scrolling: touch; }
.orders-table { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.orders-table th, .orders-table td { padding: 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); background: var(--bg); }
.orders-table th { position: sticky; top: 0; color: var(--hint); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.orders-table td small { color: var(--hint); }
.orders-table .num { text-align: right; }
.nowrap { white-space: nowrap; }
.orders-table td:first-child, .orders-table th:first-child { position: sticky; left: 0; }
.orders-table td:nth-child(2) { min-width: 140px; }

/* заголовки служебных экранов (корзина, оформление, заказы) */
.section-title { font-size: 34px; line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; margin: 8px 0 14px; }
.section-title.small { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--hint); margin: 22px 0 4px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; }

/* Тёмная тема Telegram: «растворение» белого фона фото не работает на тёмном,
   поэтому фото кладём на белую подложку, как в карточках */
html.dark .glow-stage::after { background: radial-gradient(circle, rgba(255, 170, 140, .45), rgba(255, 120, 120, 0) 70%); }
html.dark .hero-phone { filter: drop-shadow(0 34px 34px rgba(0, 0, 0, .6)) drop-shadow(0 0 22px rgba(236, 55, 132, .35)); }
html.dark .hero img { mix-blend-mode: normal; width: 78%; border-radius: 30px; background: #fff; }
html.dark .tag { background: rgba(255, 255, 255, .92); }
