:root{
  --bg:#0b0c10;
  --card:#11131a;
  --text:#e7e9ee;
  --muted:#9aa3b2;
  --line:rgba(255,255,255,.08);
  --accent:#ff6a00;
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --tabH: 74px;
  --topH: 56px;
  --r: 18px;
  --pad: 16px;
  --padSafeL: max(var(--pad), env(safe-area-inset-left));
  --padSafeR: max(var(--pad), env(safe-area-inset-right));
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body::before{
  content:"";
  position: fixed;
  inset: 0;
  background-image: url("/static/img/bg_pattern.png");
  background-repeat: repeat;
  background-size: 320px 320px; /* подберём */
  opacity: 0.08;               /* КЛЮЧЕВО */
  pointer-events: none;
  z-index: 0;
}

/* затемняющий слой поверх паттерна */
body::after{
  content:"";
  position: fixed;
  inset: 0;
  background: radial-gradient(
      80% 60% at 50% 30%,
      rgba(0,0,0,0.25),
      rgba(0,0,0,0.65)
  );
  pointer-events: none;
  z-index: 1;
}

/* весь UI поверх */
.appHeader,
.appMain,
.tabBar,
#splash{
  position: relative;
  z-index: 2;
}

.appHeader{
  position:fixed;
  top:0; left:0; right:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(11,12,16,.55);
  backdrop-filter: blur(14px);
  border-bottom:1px solid var(--line);
  z-index:20;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--topH) + env(safe-area-inset-top));
}

.appHeaderInner{
  width: 100%;
  padding-left: var(--padSafeL);
  padding-right: var(--padSafeR);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}



.appLogo{
  height: 28px;
  width: auto;
  max-width: 180px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}


.appTitle{
  font-weight:700;
  letter-spacing:.3px;
  font-size:15px;
  opacity:.95;
}

.appMain{
  padding-top: calc(var(--topH) + env(safe-area-inset-top) + 12px);
  padding-bottom: calc(var(--tabH) + env(safe-area-inset-bottom) + 16px);
}

.screen{
  max-width:720px;
  margin:0 auto;
  padding-left: var(--padSafeL);
  padding-right: var(--padSafeR)
}

.screenTop{display:flex; align-items:center; justify-content:space-between}
h1{margin:10px 0 12px; font-size:22px}
h2{margin:0; font-size:18px}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding:14px;
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.itemCard{
  background:var(--card);
  border:1px solid var(--line);
  border-radius: var(--r);
  overflow:hidden;
  box-shadow: var(--shadow);
  text-decoration:none;
  color:inherit;
  transform: translateZ(0);
  transition: transform .15s ease;
}
.itemCard:active{ transform: scale(.99); }
.itemImg{
  aspect-ratio: 16/10;
  background:#0f1117;
  border-bottom:1px solid var(--line);
  display:block;
  width:100%;
  object-fit:cover;
}
.itemBody{ padding:12px; }
.itemTitle{ font-weight:700; font-size:15px; margin:0 0 6px; }
.itemMeta{ display:flex; gap:10px; flex-wrap:wrap; color:var(--muted); font-size:13px; }
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  border:1px solid var(--line);
  font-size:12px;
  color:var(--text);
}
.price{ font-weight:800; color: #fff; opacity:.95; }
.priceFrom{ margin-top:10px; color:var(--muted); }

.row{display:flex; align-items:center; justify-content:space-between; gap:12px}
.h2{font-size:20px; font-weight:800; margin:0 0 6px}
.meta{color:var(--muted); font-size:13px; margin:6px 0 10px}
.desc{color:#cfd6e3; line-height:1.45; white-space:pre-wrap}

.btn{
  display:inline-flex;
  align-items:center; justify-content:center;
  height:44px;
  border-radius: 14px;
  background: var(--accent);
  color: #111;
  font-weight:800;
  text-decoration:none;
  border:0;
  padding:0 14px;
  width:100%;
  margin-top:12px;
}
.btnGhost{
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  color: var(--text);
}
.backBtn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  height:40px;
  padding:0 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
  color: var(--text);
  font-weight:700;
}

.chips{ display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 10px; }

.tabBar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  height: var(--tabH);
  padding:
    12px
    max(12px, env(safe-area-inset-left))
    calc(12px + env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-right));
  gap: 10px;
  padding-left: var(--padSafeL);
  padding-right: var(--padSafeR);

  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;   /* 🔥 КЛЮЧ */
  align-items: center;
  gap: 8px;

  background: rgba(11,12,16,.78);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 30;
}

.tab{
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;

  border-radius: 16px;
  background: transparent;
  border: 1px solid transparent;
  min-height: 48px;
  padding: 0 10px;

  transition: background .15s ease, color .15s ease, transform .1s ease;
  user-select: none;
}

.tab.active{
  color: var(--text);
  background: rgba(255,255,255,.08);
  border-color: var(--line);
}

.tab:active{
  transform: scale(.97);
}

/* Gallery */
.gallery{
  background: #0f1117;
  border:1px solid var(--line);
  border-radius: var(--r);
  overflow:hidden;
  box-shadow: var(--shadow);
  margin-bottom:12px;
}
.galleryTrack{
  display:flex;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling: touch;
}
.galleryTrack::-webkit-scrollbar{display:none}
.gallerySlide{
  min-width:100%;
  scroll-snap-align: start;
}
.gallerySlide img{
  width:100%;
  display:block;
  aspect-ratio: 16/10;
  object-fit: contain;
  background:#0f1117;
}

.galleryDots{
  display:flex;
  justify-content:center;
  gap:6px;
  padding:10px;
  background: rgba(255,255,255,.03);
  border-top:1px solid var(--line);
}
.dot{
  width:7px; height:7px; border-radius:999px;
  background: rgba(255,255,255,.18);
}
.dot.on{ background: rgba(255,255,255,.75); }

/* Splash */
#splash{
  position:fixed; inset:0;
  background: radial-gradient(80% 60% at 50% 40%, rgba(255,106,0,.10), transparent 70%),
              var(--bg);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:999;
  transition: opacity .25s ease, transform .25s ease;
}
#splash.hidden{
  opacity:0;
  transform: scale(1.02);
  pointer-events:none;
}
.splashCard{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  padding:22px 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.04);
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  width:min(320px, 92vw);
}
.splashLogoFill{
  width: 180px;
  height: 72px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 100%);
  /* маска логотипом */
  -webkit-mask-image: url("/static/img/logo.svg");
  mask-image: url("/static/img/logo.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;

  /* “заполнение” слева направо: анимируем clip-path */
  clip-path: inset(0 100% 0 0);
  animation: fillLogo .9s ease forwards;
}
@keyframes fillLogo{
  0%   { clip-path: inset(0 100% 0 0); opacity:.9; }
  70%  { clip-path: inset(0 12% 0 0); }
  100% { clip-path: inset(0 0 0 0); opacity:1; }
}
.splashHint{
  font-size:13px;
  color: var(--muted);
}
.priceRub{
  color: var(--accent);
  text-shadow: 0 0 18px rgba(255,106,0,.25);
}
.galleryWrap{
  position:relative;
}
.gNav{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  width:40px;
  height:40px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.35);
  color: var(--text);
  font-weight:900;
  z-index:2;
  display:none; /* покажем только на ПК */
}
.gPrev{ left:10px; }
.gNext{ right:10px; }

@media (hover:hover) and (pointer:fine){
  .gNav{ display:flex; align-items:center; justify-content:center; }
  .galleryTrack{ cursor: grab; user-select:none; }
  .galleryTrack.dragging{ cursor: grabbing; }
}

/* запрет прокрутки при открытом fullscreen */
.noScroll{ overflow: hidden; }

.lightbox{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}
.lightbox.hidden{ display:none; }

.lbImg{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 16px;
  background: #0f1117;
}

.lbClose{
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 900;
}

.lbNav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 900;
}
.lbPrev{ left: max(14px, env(safe-area-inset-left)); }
.lbNext{ right: max(14px, env(safe-area-inset-right)); }

@media (hover:none) and (pointer:coarse){
  /* на телефоне можно скрыть стрелки, если хочешь */
  .lbNav{ display:none; }
}

.lightbox{
  touch-action: pan-y; /* разрешаем вертикальные жесты ОС, но мы ловим горизонт */
}
.lbImg{
  -webkit-user-select: none;
  user-select: none;
}
