/* THE SHOPPY — витрина в стиле мобильного магазина.
   Чистый белый фон, крупные фото, минимум декора. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f4f3f1;
  --ink: #141414;
  --ink-soft: #8a8a8a;
  --line: #ececec;
  --sale: #d64533;
  --radius: 16px;
  --radius-sm: 12px;
  --pad: 16px;
  --tabbar: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: #f0efed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { padding-bottom: calc(var(--tabbar) + var(--safe-bottom)); }

.hidden { display: none !important; }
.center { text-align: center; }
.tiny { font-size: 12px; }
.muted { color: var(--ink-soft); }

/* ───────── загрузка ───────── */

.boot {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: var(--bg);
}
.boot-logo {
  width: 58px; height: 58px; border-radius: 18px;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; letter-spacing: .05em; font-size: 18px;
  animation: pulse 1.6s ease-in-out infinite;
}
.boot-text { color: var(--ink-soft); font-size: 14px; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ───────── каркас ───────── */

.app {
  max-width: 520px; margin: 0 auto;
  background: var(--bg); min-height: 100vh;
}
.screen { display: none; animation: fade .18s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ───────── верхняя панель ───────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px var(--pad);
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
}
.top-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.top-btn {
  width: 38px; height: 38px; padding: 0;
  border: 0; background: none; color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
  border-radius: 50%;
}
.top-btn svg { width: 23px; height: 23px; }
.top-btn.ghost { pointer-events: none; }
.top-btn.text { width: auto; font-size: 14px; color: var(--ink-soft); padding: 0 4px; }

/* ───────── поиск ───────── */

.search-wrap {
  display: flex; gap: 10px; padding: 0 var(--pad) 12px;
  position: sticky; top: 58px; z-index: 19; background: var(--bg);
}
.search-wrap input {
  flex: 1; font-family: inherit; font-size: 16px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--soft); outline: none;
}
.search-wrap input:focus { border-color: #ccc; background: #fff; }
.search-cancel {
  border: 0; background: none; color: var(--ink-soft);
  font-family: inherit; font-size: 15px; cursor: pointer;
}

/* ───────── чипсы категорий ───────── */

.chips {
  display: flex; gap: 8px; padding: 4px var(--pad) 14px;
  overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid transparent; background: var(--soft);
  color: var(--ink); font-size: 15px; font-family: inherit; cursor: pointer;
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.chip.active { background: var(--ink); color: #fff; }
.chip svg { width: 15px; height: 15px; }

/* ───────── баннеры ───────── */

.hero { padding: 2px 0 18px; }
.hero:empty { display: none; }
.hero-track {
  display: flex; gap: 10px; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 0 var(--pad);
}
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide {
  position: relative; flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius); overflow: hidden;
  background: var(--soft); cursor: pointer;
}
.hero-slide img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: center;
}
.hero-slide.has-caption::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,.5));
}
.hero-caption {
  position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2;
  color: #fff;
}
.hero-caption b { display: block; font-size: 21px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.hero-caption span { font-size: 13px; opacity: .9; }
.hero-dots { display: flex; gap: 5px; justify-content: center; padding-top: 10px; }
.hero-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #d8d6d2;
  transition: background .2s, width .2s;
}
.hero-dot.active { background: var(--ink); width: 16px; border-radius: 3px; }

/* ───────── сетка товаров ───────── */

.grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; padding: 0 var(--pad) 110px;
}
.card { display: flex; flex-direction: column; cursor: pointer; }
.card-media {
  position: relative; aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--soft);
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .3s ease;
}
.card:active .card-media img { transform: scale(1.02); }
.card-media .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-family: Georgia, serif; font-size: 22px;
  letter-spacing: .2em; color: #cfcdc8; text-indent: .2em;
}
.card-fav {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(6px);
  color: #b9b7b2; display: grid; place-items: center; cursor: pointer;
  transition: color .16s, transform .12s;
}
.card-fav:active { transform: scale(.9); }
.card-fav svg { width: 19px; height: 19px; }
.card-fav.on { color: var(--sale); }
.card-fav.on svg { fill: var(--sale); }
.card-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--sale); color: #fff;
  font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px;
}
.card-out {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  background: rgba(255,255,255,.7);
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: #6b6b6b;
}
.card-dots {
  position: absolute; bottom: 8px; left: 0; right: 0; z-index: 2;
  display: flex; gap: 4px; justify-content: center;
}
.card-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,.65);
  box-shadow: 0 0 2px rgba(0,0,0,.25);
}
.card-dot.active { background: #fff; }
.card-body { padding: 9px 2px 0; display: flex; flex-direction: column; gap: 2px; }
.card-price { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card-price .old {
  font-size: 12px; font-weight: 400; color: var(--ink-soft);
  text-decoration: line-through; margin-left: 5px;
}
.card-title { font-size: 14px; color: #3a3a3a; margin: 0; line-height: 1.3; }

/* ───────── пустые состояния ───────── */

.empty { padding: 56px var(--pad); text-align: center; color: var(--ink-soft); }
.empty.small { padding: 20px 0; }
.empty-icon { font-size: 34px; margin-bottom: 12px; opacity: .7; }
.empty p { margin: 0 0 4px; color: var(--ink); font-size: 16px; font-weight: 600; }
.empty span { font-size: 14px; display: block; margin-bottom: 20px; }
.empty.small span { margin-bottom: 0; }

/* ───────── нижнее меню ───────── */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; margin: 0 auto;
  width: 100%; max-width: 520px;
  height: calc(var(--tabbar) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border: 0; background: none; padding: 0;
  color: #9a9a9a; font-family: inherit; font-size: 10px;
  cursor: pointer;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: #2f6bff; }
.badge {
  position: absolute; top: 2px; left: 50%; margin-left: 4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--sale); color: #fff;
  font-size: 10px; font-weight: 600; display: grid; place-items: center;
}

/* ───────── панель корзины ───────── */

.cartbar {
  position: fixed; left: 0; right: 0; margin: 0 auto;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 8px);
  width: calc(100% - 24px); max-width: 496px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 12px 18px;
  background: var(--ink); color: #fff;
  border-radius: 14px; z-index: 35;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: appear .2s ease;
}
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.cartbar-label { display: block; font-size: 11px; opacity: .6; text-transform: uppercase; letter-spacing: .04em; }
.cartbar strong { font-size: 18px; font-weight: 700; }

/* ───────── кнопки ───────── */

.btn {
  font-family: inherit; font-size: 15px; font-weight: 600;
  border-radius: var(--radius-sm); padding: 13px 20px;
  border: 1px solid transparent; cursor: pointer;
  transition: opacity .16s, transform .12s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-invert { background: #fff; color: var(--ink); padding: 11px 20px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-block { display: block; width: 100%; margin-top: 10px; }

/* ───────── корзина ───────── */

.cart-list { padding: 4px var(--pad) 110px; display: flex; flex-direction: column; gap: 14px; }
.cart-item { display: grid; grid-template-columns: 86px 1fr; gap: 12px; }
.cart-thumb {
  width: 86px; height: 106px; border-radius: var(--radius-sm);
  background: var(--soft); overflow: hidden;
  display: grid; place-items: center; color: #cfcdc8; font-family: Georgia, serif; font-size: 18px;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-main { display: flex; flex-direction: column; min-width: 0; }
.cart-top { display: flex; justify-content: space-between; gap: 8px; }
.cart-name { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.cart-meta { font-size: 13px; color: var(--ink-soft); margin: 0; }
.cart-remove {
  border: 0; background: none; color: #c2c2c2;
  padding: 0; width: 28px; height: 28px; cursor: pointer;
  display: grid; place-items: center; flex: 0 0 auto;
}
.cart-remove svg { width: 16px; height: 16px; }
.cart-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.cart-price { font-size: 16px; font-weight: 700; }
.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.qty button {
  width: 32px; height: 30px; border: 0; background: none;
  font-size: 17px; color: var(--ink); cursor: pointer; font-family: inherit;
}
.qty span { min-width: 20px; text-align: center; font-size: 14px; font-weight: 600; }

/* ───────── профиль ───────── */

.profile-card {
  display: flex; align-items: center; gap: 14px;
  padding: 8px var(--pad) 22px;
}
.avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--soft); color: var(--ink);
  display: grid; place-items: center; font-size: 21px; font-weight: 600;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-handle { font-size: 14px; color: var(--ink-soft); }

.block { padding: 0 var(--pad) 26px; }
.block-title {
  margin: 0 0 12px; font-size: 12px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft);
}

.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.order-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.order-num { font-size: 15px; font-weight: 600; }
.order-status { font-size: 12px; color: var(--ink-soft); }
.order-line { font-size: 13px; color: #4a4a4a; display: flex; justify-content: space-between; gap: 10px; }
.order-total {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; font-size: 14px; font-weight: 700;
}
.order-date { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--soft); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 13px 14px;
  resize: none; outline: none; transition: border-color .16s, background .16s;
  -webkit-appearance: none; appearance: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: #ccc; background: #fff; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
  padding-right: 38px;
}

.info-block p { margin: 0 0 8px; font-size: 14px; white-space: pre-line; color: #3a3a3a; }

/* ───────── шторка ───────── */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.35);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein .16s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: relative; width: 100%; max-width: 520px;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  max-height: 92vh; overflow-y: auto;
  padding-bottom: calc(var(--safe-bottom) + 20px);
  animation: slideup .24s cubic-bezier(.22,.9,.3,1);
}
@keyframes slideup { from { transform: translateY(28px); opacity: .7; } to { transform: none; opacity: 1; } }
.sheet-center { padding: 36px 24px calc(var(--safe-bottom) + 24px); text-align: center; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.9);
  color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
}
.sheet-close svg { width: 16px; height: 16px; }

/* галерея товара */
.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; aspect-ratio: 1 / 1; background: var(--soft);
}
.gallery::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: grid; place-items: center;
  background: var(--soft);
}
.gallery-slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery-slide .placeholder {
  font-family: Georgia, serif; font-size: 34px;
  letter-spacing: .22em; color: #cfcdc8; text-indent: .22em;
}
.gallery-dots { display: flex; gap: 5px; justify-content: center; padding: 10px 0 0; }
.gallery-dot { width: 5px; height: 5px; border-radius: 50%; background: #ddd; }
.gallery-dot.active { background: var(--ink); }

.sheet-body { padding: 16px var(--pad) 0; }
.sheet-price { font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.sheet-price .old {
  font-size: 14px; font-weight: 400; color: var(--ink-soft);
  text-decoration: line-through; margin-left: 8px;
}
.sheet-title { margin: 6px 0 10px; font-size: 19px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.sheet-desc { margin: 0 0 16px; color: #5a5a5a; font-size: 14px; white-space: pre-line; }

.sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.size {
  min-width: 48px; padding: 11px 14px; text-align: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-family: inherit; font-size: 14px; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.size.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.totals {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 20px 0 6px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 15px;
}
.totals strong { font-size: 22px; font-weight: 700; }

.done-check {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 28px;
}
.brand-mark {
  width: 58px; height: 58px; margin: 0 auto 16px;
  border-radius: 18px; background: var(--soft);
  display: grid; place-items: center;
  font-family: Georgia, serif; font-size: 18px; letter-spacing: .16em; color: #8a8a8a;
}
.about-lines { text-align: left; margin: 18px 0 6px; border-top: 1px solid var(--line); }
.about-lines p {
  display: flex; justify-content: space-between; gap: 16px;
  margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.about-lines b { font-weight: 600; flex: 0 0 auto; }
.about-lines span { color: var(--ink-soft); text-align: right; white-space: pre-line; }

/* ───────── тост ───────── */

.toast {
  position: fixed; left: 0; right: 0; margin: 0 auto;
  width: fit-content; max-width: 88vw;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 84px);
  background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 999px;
  font-size: 14px; z-index: 90; text-align: center;
  animation: appear .2s ease;
}
