/* Веб-магазин. Цвета — theme.css. Главный элемент — плитки подарочных карт с крупным номиналом. */

/* Шрифты лежат в проекте (OFL): сайт не зависит от Google Fonts и быстро открывается из РФ */
@font-face { font-family: "Onest"; src: url("/static/fonts/onest.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("/static/fonts/unbounded.woff") format("woff"); font-weight: 600 700; font-display: swap; }

:root {
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.01em; }
h2 { font-family: var(--display); font-weight: 600; font-size: 20px; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 28px 0 72px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- шапка ---------- */
.site-head { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.head-row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.logo { font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--text); letter-spacing: -0.02em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.mainnav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.mainnav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.mainnav a.on { color: var(--text); background: var(--surface-2); }
.head-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.balance-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 14px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.balance-pill:hover { border-color: var(--primary); text-decoration: none; }
.balance-pill .plus {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: var(--primary-text); font-weight: 700; line-height: 1;
}
@media (max-width: 760px) {
  .head-row { flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  .mainnav { order: 3; flex-basis: 100%; overflow-x: auto; padding: 6px 0 8px; margin: 0 -4px; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
}

/* ---------- кнопки и поля ---------- */
.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: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--text); white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.tg { background: #2aabee; color: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%; min-height: 46px; padding: 0 14px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }

/* ---------- витрина ---------- */
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.intro p { color: var(--muted); max-width: 52ch; margin-top: 10px; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 34px; }
.cats a {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-weight: 500;
}
.cats a:hover { border-color: var(--accent); text-decoration: none; }
.shelf { margin-bottom: 44px; scroll-margin-top: 90px; }
.shelf h2 { margin-bottom: 16px; }
.grid { display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); }

.tile { display: block; color: var(--text); }
.tile:hover { text-decoration: none; }
.tile:hover .gcard { transform: translateY(-3px); }
.tile .name { margin-top: 10px; font-weight: 500; line-height: 1.35; }
.tile .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 4px; }
.tile .price { font-weight: 700; font-variant-numeric: tabular-nums; }
.stock { font-size: 13px; color: var(--ok); }
.stock.low { color: var(--warn); }
.stock.out { color: var(--muted); }
.tile.soldout .gcard { filter: grayscale(.85); opacity: .55; }

/* Карта: пропорции банковской карты, номинал — главный текст */
.gcard {
  position: relative; aspect-ratio: 1.586; border-radius: 16px; padding: 14px 16px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background-color: var(--face);
  background-image:
    linear-gradient(120deg, rgb(255 255 255 / 14%) 0 30%, transparent 30.2%),
    radial-gradient(120% 90% at 100% 100%, rgb(0 0 0 / 28%), transparent 60%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 10%);
  transition: transform .18s ease;
}
.gcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 500; }
.gcard .brand { opacity: .85; }
.gcard .region { background: rgb(0 0 0 / 28%); padding: 2px 8px; border-radius: 6px; font-weight: 600; font-size: 12px; letter-spacing: .02em; }
.gcard .denom { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 3.2vw, 34px); line-height: 1; letter-spacing: -0.02em; }
.gcard .title { font-family: var(--display); font-weight: 600; font-size: 17px; line-height: 1.2; }
.gcard.big { border-radius: 22px; padding: 22px 24px; }
.gcard.big .denom { font-size: clamp(40px, 7vw, 60px); }
.gcard.big .top { font-size: 15px; }
.face-0 { --face: #3a46c4; }
.face-1 { --face: #0f7a84; }
.face-2 { --face: #b3324b; }
.face-3 { --face: #6b3bbd; }
.face-4 { --face: #2b7546; }
.face-5 { --face: #8c5a10; }

/* ---------- товар ---------- */
.product { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 820px) { .product { grid-template-columns: 1fr; gap: 24px; } .product .gcard { max-width: 440px; } }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.p-name { font-family: var(--font); font-weight: 600; font-size: clamp(24px, 3vw, 30px); }
.p-price { font-family: var(--display); font-weight: 700; font-size: 34px; margin: 14px 0 4px; font-variant-numeric: tabular-nums; }
.p-desc { white-space: pre-line; color: var(--text); max-width: 60ch; margin: 18px 0 24px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.buy { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--surface-2); color: var(--text); font-size: 20px; cursor: pointer; }
.stepper input { width: 56px; min-height: 44px; border: 0; border-radius: 0; text-align: center; background: var(--surface); padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.buy .btn.primary { flex: 1; min-width: 220px; font-size: 17px; }
.balance-note { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* ---------- вход ---------- */
.auth { max-width: 460px; margin: 4vh auto 0; }
.auth h1 { margin-bottom: 8px; }
.auth .lead { color: var(--muted); margin-bottom: 22px; }
.tg-box { padding: 18px; border-radius: 16px; background: var(--surface-2); }
.tg-wait { display: none; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.tg-wait.on { display: flex; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 22px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--surface-2); margin-bottom: 16px; }
.seg a { text-align: center; padding: 8px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }

/* ---------- кабинет ---------- */
.acc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 820px) { .acc { grid-template-columns: 1fr; } }
.wallet { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wallet .sum { font-family: var(--display); font-weight: 700; font-size: clamp(32px, 5vw, 44px); font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.facts { display: flex; gap: 28px; margin-top: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.facts b { display: block; color: var(--text); font-size: 18px; margin-top: 2px; }
.list { display: flex; flex-direction: column; }
.list .item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.list .item:first-child { border-top: 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-mute { background: var(--surface-2); color: var(--muted); }

/* ---------- пополнение ---------- */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; cursor: pointer; text-align: center;
  font-variant-numeric: tabular-nums;
}
.choice input:checked + span { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--surface); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.choices.wide { grid-template-columns: 1fr; }
.choices.wide span { justify-content: flex-start; min-height: 56px; padding: 0 18px; }

/* ---------- коды ---------- */
.code-row { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.code {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border);
  font-family: var(--mono); font-size: 16px; word-break: break-all; user-select: all;
}
.code.big { font-size: clamp(17px, 2.6vw, 22px); padding: 18px; }
.order { padding: 18px 20px; }
.order + .order { margin-top: 14px; }
.order-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.done-mark { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-size: 26px; margin-bottom: 16px; }
.note { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); white-space: pre-line; }

.site-foot { border-top: 1px solid var(--border); padding: 22px 0 28px; color: var(--muted); font-size: 14px; }
.foot-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.foot-row nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-row a { color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .btn { margin-top: 16px; }

/* Телефоны: две карты в ряд, компактнее */
@media (max-width: 560px) {
  main { padding-top: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .gcard { padding: 10px 12px; border-radius: 12px; }
  .gcard .top { font-size: 11px; }
  .gcard .region { font-size: 10px; padding: 1px 6px; }
  .gcard .denom { font-size: 24px; }
  .gcard .title { font-size: 14px; }
  .tile .name { font-size: 14px; margin-top: 8px; }
  .tile .row { flex-direction: column; gap: 0; }
  .cats { margin-bottom: 26px; }
  .shelf { margin-bottom: 34px; }
}

/* ---------- поддержка ---------- */
.mainnav .dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: var(--primary); color: var(--primary-text); font-size: 12px; font-weight: 700; }
.support { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 24px; align-items: start; }
@media (max-width: 860px) { .support { grid-template-columns: 1fr; } }
.tlist .item { align-items: center; }
.tlist .item > span:first-child { min-width: 0; }
.tlist a.subj { color: var(--text); font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tlist .badge { flex: none; white-space: nowrap; }
.tlist .new { color: var(--primary); font-size: 13px; font-weight: 600; margin-left: 6px; }
textarea {
  width: 100%; min-height: 140px; padding: 12px 14px; font: inherit; color: var(--text); resize: vertical;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; padding: 12px 16px; border-radius: 16px 16px 16px 6px; background: var(--surface); border: 1px solid var(--border); }
.msg.me { align-self: flex-end; border-radius: 16px 16px 6px 16px; background: var(--accent-soft); border-color: transparent; }
.msg .meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; }
.msg img { display: block; max-width: 100%; max-height: 380px; border-radius: 10px; margin-top: 8px; }
@media (max-width: 560px) { .msg { max-width: 94%; } }
.composer { margin-top: 18px; }
.composer .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.attach { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; margin: 0;
  border-radius: 12px; border: 1px dashed var(--border); color: var(--muted); font-weight: 500; font-size: 15px; cursor: pointer; }
.attach:hover, .attach.has { border-color: var(--accent); color: var(--text); }
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.attach:focus-within { box-shadow: var(--focus); }

/* ---------- заказы у поставщиков ---------- */
.done-mark.wait { background: var(--warn-soft); color: var(--warn); font-size: 22px; }
.done-mark.fail { background: var(--err-soft); color: var(--err); }
.order-facts { display: grid; gap: 8px; padding: 16px 18px; margin-bottom: 12px; }
.order-facts > div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order-facts b { font-weight: 600; word-break: break-all; text-align: right; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.sup-form { display: block; max-width: 460px; }
.sup-form .field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.sup-form input[type=text], .sup-form input[type=password], .sup-form select { width: 100%; }
.sup-form .hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.sup-presets { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.sup-form .btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- продавцы ---------- */
.tile .seller-tag { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seller-box { margin: 14px 0 0; max-width: 60ch; }
.seller-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.seller-name { font-weight: 600; }
.seller-desc { color: var(--muted); white-space: pre-line; margin: 8px 0 0; max-width: 70ch; }
.seller-contacts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip-link { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
a.chip-link:hover { border-color: var(--primary); text-decoration: none; }
.seller-page { margin-bottom: 28px; }
.order-facts a { color: inherit; }

/* ---------- проблема с оплатой ---------- */
.pay-problem { margin-top: 24px; }
.pay-problem > details > summary { list-style: none; display: inline-flex; cursor: pointer; }
.pay-problem > details > summary::-webkit-details-marker { display: none; }
.pay-problem textarea { width: 100%; }

/* ---------- логотип, страницы ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; }
.logo-img { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; flex: none; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 4px 0 12px; }
.agree input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.page-body { max-width: 72ch; }
.page-body img { max-width: 100%; height: auto; border-radius: 10px; }
.page-body figure { margin: 14px 0; }
.page-body figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.notice.warn { background: var(--warn-soft, rgba(255,180,0,.12)); color: var(--warn, #c80); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.page-body h1 { margin-bottom: 18px; }
.page-body h2 { font-size: 20px; margin: 26px 0 10px; }
.page-body h3 { font-size: 17px; margin: 20px 0 8px; }
.page-body p { margin: 0 0 12px; line-height: 1.6; }
.page-body ul, .page-body ol { margin: 0 0 14px; padding-left: 22px; line-height: 1.6; }
.page-body hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.site-foot nav { flex-wrap: wrap; }
