/* ============ мини-апп: вид клона amahasla (мобильный слой) ============ */
@media (max-width: 860px) {
  :root { --pad: 16px; }

  body {
    padding-top: 56px;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
    background: #0b0b0b !important;
    color: #fff;
  }
  .wrap { max-width: none; width: auto; padding-left: var(--pad); padding-right: var(--pad); }

  /* ---------- шапка ---------- */
  .hdr {
    position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    background: rgba(11, 11, 11, .82);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid #1b1b1b;
  }
  .hdr { padding: 0 !important; height: 56px; }
  .hdr-in { height: 56px !important; padding: 0 12px !important; display: flex; align-items: center; justify-content: space-between; overflow: hidden; }
  .hdr .logo svg { max-height: 20px; }
  .hdr-right { display: flex; align-items: center; gap: 8px; }
  .nav, .burger, .acct, .logo-sub, #favBtn { display: none !important; }
  .logo { display: flex; align-items: center; justify-content: center; margin: 0 auto; }
  .logo svg { height: 20px; width: auto; display: block; }
  .hdr-right { gap: 10px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 50%; background: #1a1a1a; color: #fff; border: 0; }
  #adminLink { display: none !important; }
  .hdr-spacer { height: 56px; }

  /* ---------- hero ---------- */
  .hero { margin-top: 8px; padding-top: 0; }
  .hero-row {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .hero-row::-webkit-scrollbar { display: none; }
  .hero-card {
    position: relative; flex: 0 0 100%; scroll-snap-align: center;
    display: flex !important; flex-direction: column !important;
    background: #141414; border-radius: 22px; overflow: hidden;
    padding: 0 !important; height: auto !important; min-height: 0 !important;
  }
  .hero-art {
    -webkit-mask-image: none !important; mask-image: none !important;
    filter: none !important;
    position: relative !important; inset: auto !important;
    width: 100% !important; height: 320px !important;
    order: 1; border-radius: 0 !important;
    background-size: cover !important; background-position: center top !important;
  }
  .hero-card::after { display: none !important; }
  .hero-card > div:not(.hero-art) {
    position: relative !important; inset: auto !important;
    order: 2; height: auto !important; width: auto !important;
    padding: 16px 18px 18px !important;
    background: #141414;
  }
  .hero-tag {
    position: absolute !important; left: 12px !important; top: 12px !important;
    right: auto !important; width: auto !important; display: inline-flex !important;
    z-index: 3; background: #fff; color: #0b0b0b; border-radius: 999px;
    padding: 6px 14px; font-size: 10.5px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
  }
  .hero-card h3 { color: #fff; font-size: 23px; line-height: 1.16; margin: 0 0 6px; letter-spacing: -.02em; }
  .hero-card p { color: #a9a9a9; font-size: 13px; line-height: 1.45; margin: 0 0 14px; max-width: 100%; }
  .hero-cta {
    display: inline-flex; align-items: center; height: 40px; padding: 0 22px;
    background: #fff; color: #0b0b0b; border-radius: 999px; font-size: 14px; font-weight: 600;
  }
  .hero-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
  .hero-dots i { width: 6px; height: 6px; border-radius: 50%; background: #3a3a3a; }
  .hero-dots i.on { background: #fff; width: 18px; border-radius: 999px; }

  /* ---------- плитки ---------- */
  .tiles { margin-top: 20px; }
  .tiles-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile {
    position: relative; border-radius: 22px; border: 0; text-align: left;
    padding: 18px; overflow: hidden; isolation: isolate;
    background: #1a1a1a; color: #fff;
    display: flex; flex-direction: column; justify-content: flex-end;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  }
  .tile:nth-child(1) { grid-column: 1 / -1; min-height: 210px; justify-content: flex-end; padding: 20px; }
  .tile:nth-child(2), .tile:nth-child(3) { min-height: 176px; padding: 16px; justify-content: flex-end; }
  .tile > div { position: relative; z-index: 3; max-width: 100%; }
  .tile:nth-child(1) > div { max-width: 74%; }
  .tile h3 { font-size: 18px; line-height: 1.18; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 650; }
  .tile:nth-child(1) h3 { font-size: 23px; }
  .tile p { font-size: 12.5px; line-height: 1.4; margin: 0; opacity: .82; }
  .tile.light p, .tile.orange p { opacity: 1; }
  .tile > .arrow {
    position: absolute !important; left: auto !important; bottom: auto !important;
    right: 14px !important; top: 14px !important;
    width: 32px !important; height: 32px !important; border-radius: 50%;
    background: rgba(255,255,255,.14) !important; color: inherit !important;
    display: grid !important; place-items: center; z-index: 4;
    backdrop-filter: blur(6px); opacity: 1;
  }
  .tile > .arrow svg { width: 15px !important; height: 15px !important; }

  /* тёмная плитка каталога */
  .tile.dark { background: linear-gradient(150deg, #262626 0%, #161616 55%, #0b0b0b 100%); }
  .tile.dark::after {
    content: ''; position: absolute; right: -50px; top: -70px; width: 190px; height: 190px;
    border-radius: 50%; z-index: 1;
    background: radial-gradient(circle, rgba(255,92,0,.34) 0%, rgba(255,92,0,0) 68%);
  }

  /* синяя плитка контакта */
  .tile.blue { background: linear-gradient(150deg, #3b7bff 0%, #1d4ed8 52%, #102b86 100%); color: #fff; }
  .tile.blue::after {
    content: ''; position: absolute; right: -46px; bottom: -56px; width: 150px; height: 150px;
    border-radius: 50%; background: rgba(255,255,255,.14); z-index: 1;
  }
  .tile.blue h3 { color: #fff !important; }
  .tile.blue p { color: rgba(255,255,255,.86) !important; opacity: 1 !important; }
  .tile.blue > .arrow { background: rgba(255,255,255,.26) !important; color: #fff !important; }
  .tile.dark > .arrow { background: rgba(255,255,255,.18) !important; color: #fff !important; box-shadow: 0 0 0 1px rgba(255,255,255,.16); }
  .tile.dark p { color: rgba(255,255,255,.86) !important; opacity: 1 !important; }
  .tile.blue p { color: rgba(255,255,255,.9) !important; }

  /* крупные иконки в углу */
  .tile-icon {
    position: absolute; right: -8px; bottom: -16px; width: 134px; height: 134px;
    z-index: 2; opacity: .12; color: #fff; pointer-events: none;
  }
  .tile.blue .tile-icon { opacity: .2; }
  .tile-icon svg { width: 100%; height: 100%; }

  /* оранжевая — скидки */
  .tile.orange { background: linear-gradient(155deg, #ff7a2f 0%, #ff5c00 58%, #ef4f00 100%); color: #14100a; }
  .tile.orange::after {
    content: ''; position: absolute; right: -34px; bottom: -46px; width: 124px; height: 124px;
    border-radius: 50%; background: rgba(255,255,255,.13); z-index: 1;
  }
  .tile.orange h3 { color: #17100a !important; font-weight: 750; }
  .tile.orange p { color: rgba(23,16,10,.88) !important; opacity: 1 !important; font-weight: 500; }
  .tile.orange > .tile-pct { display: none !important; }
  .tile.orange > .arrow { background: rgba(0,0,0,.18) !important; color: #17100a !important; }

  /* светлая — написать */
  .tile.light { background: #f4f2ee; color: #0b0b0b; }
  .tile.light::after {
    content: ''; position: absolute; right: -34px; bottom: -40px; width: 110px; height: 110px;
    border-radius: 50%; background: rgba(0,0,0,.045); z-index: 1;
  }
  .tile.light h3 { color: #101012 !important; }
  .tile.light p { color: rgba(16,16,18,.72) !important; opacity: 1 !important; }
  .tile.light > .arrow { background: rgba(0,0,0,.1) !important; color: #101012 !important; }
  .tile-pct { font-size: 40px; font-weight: 800; line-height: 1; opacity: .9; }

  /* ---------- поиск ---------- */
  .searchbar {
    position: sticky; top: 56px; z-index: 40; margin: 16px 0 4px;
    background: #0b0b0b; padding-top: 6px; padding-bottom: 10px;
  }
  .searchbar input {
    width: 100%; height: 46px; border-radius: 14px; border: 1px solid #232323;
    background: #151515; color: #fff; font-size: 15px; padding: 0 44px 0 16px;
  }
  .searchbar svg { right: 28px; color: #7d7d7d; }

  /* ---------- чипы ---------- */
  .chips { gap: 8px; padding-bottom: 12px; }
  .chip { height: 34px; padding: 0 16px; border-radius: 999px; background: #171717; color: #e6e6e6; border: 1px solid #232323; font-size: 13px; }
  .chip.on { background: #fff; color: #0b0b0b; border-color: #fff; }

  /* ---------- секции и сетка ---------- */
  .sec { margin-top: 22px; }
  .sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
  .sec-head h2 { font-size: 21px; letter-spacing: -.02em; color: #fff; margin: 0; }
  .sec-head a, .sec-head .more { font-size: 12px; color: #8a8a8a; }
  .grid-products { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .pcard { background: #131313; border-radius: 16px; overflow: hidden; border: 0; padding: 0 0 10px; }
  .pcard-media { aspect-ratio: 4 / 5; border-radius: 16px 16px 0 0; background: #1b1b1b; }
  .pcard-cat { display: none; }
  .pcard-title { font-size: 12.5px; line-height: 1.3; color: #efefef; padding: 9px 10px 0; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .pcard-bottom { padding: 6px 10px 0; }
  .pcard-price { font-size: 14px; font-weight: 700; color: #fff; }
  .pcard-old { font-size: 11px; color: #6f6f6f; }
  .pcard-sizes { display: flex; flex-wrap: wrap; gap: 5px; }
  .pcard-size {
    min-width: 26px; height: 23px; padding: 0 7px; border-radius: 7px;
    background: #232326; color: #d6d6d6; font-size: 11px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #2c2c31;
  }
  .pcard-sale { font-size: 10px; padding: 3px 8px; border-radius: 999px; }
  .pcard-actions { padding: 8px 8px 0; margin: 0; }
  .mini-circ { width: 30px; height: 30px; background: #1e1e1e; color: #ddd; }
  .mini-circ.white { background: #fff; color: #0b0b0b; }

  .brands, #reviews, .faq { display: none !important; }

  /* ---------- нижнее меню ---------- */
  .mnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: rgba(11,11,11,.92); backdrop-filter: blur(14px);
    border-top: 1px solid #1b1b1b;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mnav-in { height: 58px; display: flex; }
  .mnav-in button { flex: 1; background: none; border: 0; color: #7c7c7c; font-size: 10px; }
  .mnav-in button.on { color: #fff; }
  .mnav-in svg { width: 22px; height: 22px; }

  /* ---------- тосты/куки ---------- */
  .cookie { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); border-radius: 16px; }
  .sec:last-of-type { margin-bottom: 8px; }
}

/* лёгкая тень под карточкой товара, если открыт sheet */
body.locked .mnav { display: none; }

  /* ---------- сортировка и фильтры каталога ---------- */
  .cat-tools { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
  .sort-row { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
  .sort-row::-webkit-scrollbar { display: none; }
  .sort-btn {
    flex: 0 0 auto; height: 34px; padding: 0 14px; border-radius: 999px;
    background: #141416; color: #9d9d9d; border: 1px solid #202020;
    font-size: 12.5px; font-weight: 500; white-space: nowrap;
  }
  .sort-btn.on { background: #fff; color: #0b0b0c; border-color: #fff; font-weight: 600; }
  .filter-toggle {
    flex: 0 0 auto; height: 34px; padding: 0 14px; border-radius: 999px;
    background: #141416; color: #e6e6e6; border: 1px solid #262626;
    font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  }
  .filter-toggle svg { width: 15px; height: 15px; }
  .filter-toggle.on { background: #fff; color: #0b0b0c; border-color: #fff; }
  .filter-count {
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    background: #ff5c00; color: #fff; font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .filter-panel {
    background: #131315; border: 1px solid #202022; border-radius: 18px;
    padding: 14px; margin: 0 0 16px;
  }
  .filter-block { margin-bottom: 14px; }
  .filter-block:last-of-type { margin-bottom: 12px; }
  .filter-label {
    display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: #7d7d85; margin-bottom: 8px;
  }
  .size-chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .size-chip {
    height: 34px; min-width: 44px; padding: 0 12px; border-radius: 10px;
    background: #1b1b1e; color: #cfcfd6; border: 1px solid #242427; font-size: 13px;
  }
  .size-chip.on { background: #fff; color: #0b0b0c; border-color: #fff; font-weight: 600; }
  .price-row { display: flex; align-items: center; gap: 10px; }
  .price-inp {
    flex: 1; height: 40px; border-radius: 12px; background: #1b1b1e;
    border: 1px solid #242427; color: #f0f0f0; font-size: 14px; padding: 0 12px;
  }
  .price-dash { color: #55555c; }
  .filter-actions { display: flex; gap: 10px; margin-top: 4px; }
  .filter-reset {
    flex: 1; height: 42px; border-radius: 12px; background: #1b1b1e;
    border: 1px solid #242427; color: #cfcfd6; font-size: 14px;
  }
  .filter-apply {
    flex: 1.4; height: 42px; border-radius: 12px; background: #fff;
    color: #0b0b0c; font-size: 14px; font-weight: 600;
  }

/* только каталог: главная, плитки, подборки и текстовые блоки скрыты */
.hero, .tiles, .brands, #new, #sale, #popular, #reviews, #about, .faq { display: none !important; }
#catalog { padding-top: 6px; }
#catalog .sec-head { margin-bottom: 12px; }

/* ============ светлая тема (настройка «Тема магазина») ============ */
[data-theme="light"] {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --card: #ffffff;
  --card-hover: #f4f4f1;
  --line: #e4e4df;
  --line-soft: #ececea;
  --text: #101012;
  --muted: #5d5d66;
  --dim: #8a8a93;
}
[data-theme="light"] body { background: #f7f7f5 !important; color: #101012; }
[data-theme="light"] .hdr, [data-theme="light"] .topbar {
  background: rgba(247,247,245,.92) !important;
  border-bottom: 1px solid #e6e6e0 !important;
}
[data-theme="light"] .hdr .nav a, [data-theme="light"] .hdr a { color: #3b3b42 !important; }
[data-theme="light"] .hdr .nav a.active { color: #101012 !important; }
[data-theme="light"] .hdr .btn-line { border-color: #dcdcd6 !important; color: #101012 !important; }
[data-theme="light"] .topbar .icon-btn,
[data-theme="light"] .icon-btn { background: #ecece8 !important; color: #101012 !important; }
[data-theme="light"] #catalog { background: #f7f7f5 !important; }
[data-theme="light"] .searchbar input { background: #ffffff !important; color: #101012 !important; border: 1px solid #e4e4df; }
[data-theme="light"] .searchbar svg { color: #8a8a93 !important; }
[data-theme="light"] .chip { background: #ffffff !important; color: #3b3b42 !important; border-color: #e4e4df !important; }
[data-theme="light"] .chip.on { background: #101012 !important; color: #ffffff !important; border-color: #101012 !important; }
[data-theme="light"] .sec-head h2 { color: #101012 !important; }
[data-theme="light"] .sec-head a, [data-theme="light"] .sec-head .more { color: #6d6d75 !important; }
[data-theme="light"] .pcard { background: #ffffff !important; box-shadow: 0 1px 0 #ecece8, 0 6px 18px rgba(16,16,18,.05); }
[data-theme="light"] .pcard-media { background: #f0f0ec !important; }
[data-theme="light"] .pcard-title { color: #1b1b1f !important; }
[data-theme="light"] .pcard-price { color: #101012 !important; }
[data-theme="light"] .pcard-old { color: #9a9aa2 !important; }
[data-theme="light"] .pcard-size { background: #eeeeea !important; color: #34343a !important; }
[data-theme="light"] .mini-circ { background: #eaeae6 !important; color: #2c2c31 !important; }
[data-theme="light"] .mini-circ.white { background: #101012 !important; color: #ffffff !important; }
[data-theme="light"] .sort-btn, [data-theme="light"] .filter-toggle { background: #ffffff !important; color: #3b3b42 !important; border-color: #e4e4df !important; }
[data-theme="light"] .sort-btn.on, [data-theme="light"] .filter-toggle.on { background: #101012 !important; color: #ffffff !important; border-color: #101012 !important; }
[data-theme="light"] .filter-panel { background: #ffffff !important; border-color: #e4e4df !important; }
[data-theme="light"] .filter-label { color: #7a7a83 !important; }
[data-theme="light"] .size-chip { background: #f4f4f1 !important; color: #3b3b42 !important; border-color: #e4e4df !important; }
[data-theme="light"] .size-chip.on { background: #101012 !important; color: #ffffff !important; border-color: #101012 !important; }
[data-theme="light"] .price-inp { background: #f7f7f5 !important; color: #101012 !important; border-color: #e4e4df !important; }
[data-theme="light"] .price-dash { color: #9a9aa2 !important; }
[data-theme="light"] .filter-reset { background: #f4f4f1 !important; color: #3b3b42 !important; }
[data-theme="light"] .filter-apply { background: #101012 !important; color: #ffffff !important; }
[data-theme="light"] .mnav-in { background: rgba(255,255,255,.94) !important; border-top: 1px solid #e6e6e0; }
[data-theme="light"] .mnav-in button { color: #8a8a93 !important; }
[data-theme="light"] .mnav-in button.on { color: #101012 !important; }
[data-theme="light"] .sheet-panel { background: #ffffff !important; border-color: #e4e4df !important; }
[data-theme="light"] .sheet-title, [data-theme="light"] .sheet-price .now { color: #101012 !important; }
[data-theme="light"] .sheet-desc, [data-theme="light"] .sheet-cat, [data-theme="light"] .sheet-block-t { color: #5d5d66 !important; }
[data-theme="light"] .sheet-close { background: #f0f0ec !important; color: #101012 !important; }
[data-theme="light"] .cart-row, [data-theme="light"] .cart-item { background: #f7f7f5 !important; }
[data-theme="light"] .toast { background: #101012 !important; color: #ffffff !important; }

/* видео вместо обложки в карточке */
.pcard-media video.pcard-vid { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-media img, .pcard-media video { width: 100%; height: 100%; object-fit: cover; }
