/* ================================================================
   МОБИЛЬНАЯ ВЕРСИЯ — подключается последним на всех страницах
   ================================================================ */

/* ==== ОБЩЕЕ ==== */
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
a, button, select, input { -webkit-tap-highlight-color: transparent; }
:target, .booking-panel { scroll-margin-top: 72px; }

/* Стрелка у select (appearance: none убирает родную) */
.booking-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a8a8a' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* Нижние вкладки — только на телефоне/планшете */
.tabbar { display: none; }

/* ==== ПЛАНШЕТ И ТЕЛЕФОН ==== */
@media (max-width: 900px) {

  /* Описание квеста — раньше карточки с характеристиками */
  .quest-main { order: -1; }
  .quest-layout { gap: 24px; }

  /* Липкая панель «Забронировать» не нужна — её заменяет вкладка «Бронь» */
  .fixed-bar { display: none; }
  /* «Записаться» в шапке дублирует вкладку «Бронь» */
  .header-cta { display: none; }

  /* ==== НИЖНИЕ ВКЛАДКИ (создаёт main.js) ==== */
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 58px;
    color: var(--text-mute);
    text-decoration: none;
    font-family: var(--font-head);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    position: relative;
    transition: color 0.15s;
  }
  .tabbar-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
  .tabbar-item.is-active { color: #e8e8e8; }
  .tabbar-item.is-active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 28%;
    right: 28%;
    height: 2px;
    background: var(--accent-hi);
  }
  .tabbar-item:active { color: var(--text); }

  /* Центральная вкладка «Бронь» — акцентная кнопка */
  .tabbar-item.is-cta { color: #f0f0f0; }
  .tabbar-item.is-cta .tabbar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 30px;
    background: var(--accent);
    border: 1px solid var(--accent-hi);
    border-radius: var(--radius);
    box-shadow: 0 0 16px var(--accent-glow);
  }
  .tabbar-item.is-cta svg { width: 20px; height: 20px; }
  .tabbar-item.is-cta.is-active::before { display: none; }

  /* Место под вкладки, чтобы не закрывали низ страницы */
  body.has-tabbar { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  body.has-tabbar :target,
  body.has-tabbar .booking-panel { scroll-margin-bottom: 70px; }

  /* Слоты: без внутренней прокрутки на всю высоту — только расписание */
  .slots { max-height: 70vh; padding: 16px; overscroll-behavior: contain; }

  /* Гильзы — за контентом и приглушённые, чтобы не закрывали текст */
  .shells-layer { z-index: -1; }
  .shell { opacity: 0.35; }
}

/* ==== ТЕЛЕФОН ==== */
@media (max-width: 560px) {
  .container { padding: 0 16px; }

  /* Шапка помещается в 320–390px */
  .header-inner { height: 56px; }
  .logo { font-size: 16px; }

  /* Hero */
  .hero { padding: 56px 0 48px; }
  .hero-title { margin-bottom: 20px; }
  .hero-sub { font-size: 14px; margin-bottom: 28px; }
  .hero-actions { gap: 10px; margin-bottom: 28px; }
  .hero-actions .btn { flex: 1 1 140px; min-height: 48px; }

  /* Параллакс — ниже и спокойнее, чтобы слова не наезжали */
  .parallax, .parallax-inner { min-height: 50vh; height: 50vh; }
  .parallax-word { font-size: clamp(48px, 19vw, 96px); }
  .layer-back, .layer-front { display: none; }   /* на узком экране слои наезжают */
  .layer-mid .parallax-word.outline { -webkit-text-stroke-width: 1px; opacity: 0.6; }
  .parallax-title { font-size: clamp(26px, 8vw, 40px); }

  /* Карточка квеста на главной */
  .quest-card-media, .media-placeholder { min-height: 200px; }
  .media-placeholder { font-size: 28px; }
  .quest-card-body { padding: 20px 16px; }
  .quest-card-foot { flex-direction: column; align-items: stretch; }
  .quest-card-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quest-card-actions .btn { min-height: 48px; }

  .rule { padding: 22px 18px; }

  /* Контакты: подпись над значением, телефон крупно */
  .contact-list li { flex-direction: column; gap: 4px; padding: 12px 0; }
  .contact-list a { color: var(--text); font-size: 16px; }

  /* Страница квеста */
  .quest-hero { padding: 40px 0 32px; }
  .quest-hero-title { margin-bottom: 24px; }
  .quest-hero-meta { grid-template-columns: repeat(3, 1fr); }
  .meta-item { padding: 12px; }
  .meta-item strong { font-size: 16px; }
  .sidebar-card { padding: 18px; }
  .sidebar-actions [data-action="like"],
  .sidebar-actions [data-action="compare"] { display: none; }
  .tab { padding: 14px 14px; }

  /* Слоты — по 2 в ряд, время над ценой */
  .slots-head { padding-bottom: 12px; margin-bottom: 12px; }
  .slots-day { margin-bottom: 18px; padding-bottom: 18px; }
  #slotsGrid { display: block; }   /* контейнер дней — дни друг под другом */
  .slots-day .slots-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .slot {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    min-height: 60px;
  }
  .slot-price { font-size: 12px; }

  /* Форма брони: 16px — iPhone не зумит поле при вводе */
  .booking-panel { padding: 18px; }
  .booking-form input,
  .booking-form select { font-size: 16px; min-height: 48px; padding: 12px 14px; }
  .booking-form select { padding-right: 38px; }
  .booking-form label,
  .booking-summary span,
  .sidebar-stats span,
  .meta-item span { font-size: 12px; }
  .booking-form .btn[type="submit"] { min-height: 52px; font-size: 14px; }

  /* Товары */
  .goods-soon { padding: 40px 18px; }
  .goods-soon-text { font-size: 15px; }
  .goods-soon-text br { display: none; }

  /* Подвал */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ==== ОЧЕНЬ УЗКИЕ ЭКРАНЫ (iPhone SE, старые Android) ==== */
@media (max-width: 360px) {
  .quest-hero-meta { grid-template-columns: 1fr 1fr; }
  .quest-hero-meta .meta-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tabbar-item { font-size: 10px; letter-spacing: 0.03em; }
}
