/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --white:   #ffffff;
  --black:   #111111;
  --accent:  #ff3c3c;
  --radius:  18px;
  --shadow:  0 8px 40px rgba(0,0,0,0.18);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Georgia', serif;
  background: var(--white);
  color: var(--black);
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   UTILITIES
============================================================ */
.hidden { display: none !important; }

.fade-in  { animation: fadeIn  0.5s ease forwards; }
.fade-out { animation: fadeOut 0.6s ease forwards; }
.slide-up { animation: slideUp 0.5s cubic-bezier(0.22,1,0.36,1) forwards; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   PRELOADER
============================================================ */

body {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
}

#app {
  position: relative;  /* ← обязательно, чтобы absolute дети крепились к нему */
  width: 390px;
  height: 844px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  border-radius: 44px;
}

@media (max-width: 430px) {
  body {
    background: #fff;
  }
  #app {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}




#preloader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--white);
  z-index: 9999;
}
.preloader-gif {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

/* ============================================================
   СЦЕНА
============================================================ */
#scene {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}

/* Фон сцены — меняй src в CSS или через JS */
.scene-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.scene-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%;
}

/* Кнопка-картинка */
.enter-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: min(260px, 70vw);
  transition: transform 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.enter-btn:active {
  transform: scale(0.93);
  filter: brightness(0.9);
}
.enter-btn-img {
  width: 100%;
  height: auto;
  display: block;
  /* Если картинка с прозрачным фоном — drop-shadow красиво */
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.35));
}

/* ============================================================
   ПЕРЕХОД (gif)
============================================================ */
.transition-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--white);
  z-index: 100;
}
.transition-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* ============================================================
   КАТАЛОГ
============================================================ */
#catalog {
  position: absolute; inset: 0;
  background: var(--white);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.catalog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.back-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--black);
  line-height: 1;
  padding: 4px 8px 4px 0;
}

.catalog-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.catalog-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 14px 24px;
}

/* ============================================================
   КАРТОЧКА ТОВАРА
============================================================ */
.product-card {
  background: #f8f8f8;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  animation: cardIn 0.4s ease both;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.product-card:active {
  transform: scale(0.96);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.product-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #efefef;
}
.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-info {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.product-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.product-price {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
}

/* ============================================================
   МОДАЛКА ТОВАРА
============================================================ */
.modal {
  position: absolute; inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal-card {
  position: relative;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  will-change: transform, opacity;
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: #eee;
  border: none;
  border-radius: 50%;
  width: 34px; height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  color: #555;
}

.modal-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 24px 24px 0 0;
}

.modal-body {
  padding: 20px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.modal-desc {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.modal-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.buy-btn {
  display: block;
  text-align: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 16px;
  border-radius: 14px;
  text-decoration: none;
  margin-top: 6px;
  letter-spacing: 0.02em;
  background: linear-gradient(
    90deg,
    #ff0000, #ff7700, #ffff00,
    #00ff00, #00aaff, #7700ff, #ff0000
  );
  background-size: 200% 100%;
  animation: rainbow 2.5s linear infinite;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.buy-btn:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

@keyframes rainbow {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
