/* TopEscapeRoom - Mobile Player UX V2 (compact reference style) */

@media (max-width: 820px) {
  html, body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body.ter-player-mobile {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding-bottom: 92px !important;
    background: #071224;
  }

  body.ter-page-booking {
    padding-bottom: 28px !important;
  }

  body.ter-player-mobile *,
  body.ter-player-mobile *::before,
  body.ter-player-mobile *::after {
    box-sizing: border-box;
  }

  body.ter-player-mobile img,
  body.ter-player-mobile video,
  body.ter-player-mobile iframe {
    max-width: 100% !important;
    height: auto !important;
  }

  body.ter-player-mobile .container,
  body.ter-player-mobile .wrapper,
  body.ter-player-mobile .page,
  body.ter-player-mobile .content,
  body.ter-player-mobile .main-content,
  body.ter-player-mobile .content-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  body.ter-player-mobile h1 {
    font-size: clamp(26px, 7vw, 34px) !important;
    line-height: 1.35 !important;
    margin-bottom: 10px !important;
  }

  body.ter-player-mobile h2 {
    font-size: clamp(21px, 6vw, 28px) !important;
    line-height: 1.45 !important;
    margin-bottom: 10px !important;
  }

  body.ter-player-mobile h3 {
    font-size: 18px !important;
    line-height: 1.55 !important;
  }

  body.ter-player-mobile p,
  body.ter-player-mobile li {
    line-height: 1.85 !important;
  }

  body.ter-player-mobile button,
  body.ter-player-mobile .btn,
  body.ter-player-mobile .button,
  body.ter-player-mobile input[type="submit"],
  body.ter-player-mobile a[class*="btn"],
  body.ter-player-mobile a.cta {
    min-height: 48px !important;
    border-radius: 14px !important;
  }

  body.ter-player-mobile input,
  body.ter-player-mobile select,
  body.ter-player-mobile textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 52px !important;
    font-size: 16px !important;
    border-radius: 14px !important;
  }

  body.ter-player-mobile textarea {
    min-height: 110px !important;
  }

  /* Compact hero + cards */
  body.ter-player-mobile .hero,
  body.ter-player-mobile .hero-section,
  body.ter-player-mobile .hero-wrap {
    min-height: 0 !important;
    height: auto !important;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
  }

  body.ter-player-mobile .hero-content,
  body.ter-player-mobile .hero-grid,
  body.ter-player-mobile .hero-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  body.ter-player-mobile .hero img,
  body.ter-player-mobile .hero-image img {
    width: 100% !important;
    max-height: 240px !important;
    object-fit: cover !important;
    border-radius: 20px !important;
  }

  body.ter-player-mobile .room-card,
  body.ter-player-mobile .card,
  body.ter-player-mobile .box,
  body.ter-player-mobile .panel,
  body.ter-player-mobile section.box {
    border-radius: 20px !important;
    overflow: hidden;
  }

  body.ter-player-mobile .rooms-grid,
  body.ter-player-mobile .room-grid,
  body.ter-player-mobile .featured-grid,
  body.ter-player-mobile .cards-grid,
  body.ter-player-mobile .cards,
  body.ter-player-mobile .grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  body.ter-player-mobile .room-card img,
  body.ter-player-mobile .card img {
    width: 100% !important;
    aspect-ratio: 16/10;
    object-fit: cover !important;
  }

  /* Reference-style compact room detail */
  body.ter-page-room-detail section,
  body.ter-page-room-detail .section,
  body.ter-page-room-detail .card,
  body.ter-page-room-detail .box {
    margin-bottom: 14px !important;
  }

  body.ter-page-room-detail .ter-room-mobile-tabs {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0 14px 8px 14px;
    margin: 4px 0 14px 0;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 51;
    background: linear-gradient(180deg, rgba(7,18,36,.98), rgba(7,18,36,.92));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }

  body.ter-page-room-detail .ter-room-mobile-tabs::-webkit-scrollbar {
    display: none;
  }

  body.ter-page-room-detail .ter-room-mobile-tabs a {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #eef4ff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 2px 10px;
    opacity: .88;
  }

  body.ter-page-room-detail .ter-room-mobile-tabs a.ter-active::after,
  body.ter-page-room-detail .ter-room-mobile-tabs a:hover::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    height: 4px;
    border-radius: 999px;
    background: #ef3b54;
  }

  body.ter-page-room-detail .ter-room-mobile-tabs a.ter-active {
    opacity: 1;
  }

  body.ter-page-room-detail .summary-grid,
  body.ter-page-room-detail .room-stats,
  body.ter-page-room-detail .quick-stats,
  body.ter-page-room-detail .info-grid,
  body.ter-page-room-detail .meta-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.ter-page-room-detail .summary-card,
  body.ter-page-room-detail .stat-card,
  body.ter-page-room-detail .info-card {
    min-width: 0 !important;
    padding: 13px !important;
    border-radius: 16px !important;
  }

  body.ter-page-room-detail .main-image img,
  body.ter-page-room-detail .room-image img,
  body.ter-page-room-detail .detail-hero img {
    width: 100% !important;
    max-height: 330px !important;
    object-fit: cover !important;
    border-radius: 22px !important;
  }

  body.ter-page-room-detail .ter-mobile-collapsible {
    position: relative;
  }

  body.ter-page-room-detail .ter-mobile-collapsible .ter-collapse-body {
    overflow: hidden;
    max-height: 170px;
    transition: max-height .28s ease;
  }

  body.ter-page-room-detail .ter-mobile-collapsible.ter-expanded .ter-collapse-body {
    max-height: 1200px;
  }

  body.ter-page-room-detail .ter-collapse-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: #e8cf8a;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
  }

  body.ter-page-room-detail .slots-grid,
  body.ter-page-room-detail .slot-grid,
  body.ter-page-room-detail .available-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.ter-page-room-detail a[href*="/booking/slot/"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 50px !important;
    text-align: center !important;
    border-radius: 14px !important;
  }

  body.ter-page-room-detail iframe,
  body.ter-page-room-detail .map iframe,
  body.ter-page-room-detail #map,
  body.ter-page-room-detail .map-box {
    min-height: 220px !important;
    max-height: 260px !important;
    border-radius: 22px !important;
  }

  /* Compact booking pages */
  body.ter-page-booking .booking-layout,
  body.ter-page-booking .booking-grid,
  body.ter-page-booking .booking-wrapper,
  body.ter-page-booking .booking-container {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.ter-page-booking .form-side,
  body.ter-page-booking .summary-side,
  body.ter-page-booking .summary-panel,
  body.ter-page-booking .booking-summary {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.ter-page-booking .form-side {
    order: 1;
    padding: 16px 14px !important;
  }

  body.ter-page-booking .summary-side,
  body.ter-page-booking .summary-panel,
  body.ter-page-booking .booking-summary {
    order: 2;
  }

  body.ter-page-booking .summary-grid,
  body.ter-page-booking .summary-cards {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  body.ter-page-booking .summary-card {
    min-width: 0 !important;
    padding: 12px !important;
    border-radius: 13px !important;
  }

  body.ter-page-booking .info-box,
  body.ter-page-booking .minimum-notice {
    font-size: 13px !important;
    line-height: 1.9 !important;
    padding: 13px !important;
    border-radius: 14px !important;
  }

  body.ter-page-booking .submit {
    position: sticky !important;
    bottom: 10px !important;
    z-index: 60 !important;
    width: 100% !important;
    min-height: 56px !important;
    box-shadow: 0 12px 32px rgba(0,0,0,.38) !important;
  }

  /* Sticky bottom booking bar, closer to reference */
  .ter-sticky-book-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(23, 29, 49, .98);
    border-top: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 -10px 28px rgba(0,0,0,.28);
  }

  .ter-page-room-detail .ter-sticky-book-bar {
    display: flex;
  }

  .ter-sticky-book-bar .ter-book-price {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #fff;
  }

  .ter-sticky-book-bar .ter-book-price small {
    color: rgba(255,255,255,.72);
    font-size: 12px;
    line-height: 1.4;
  }

  .ter-sticky-book-bar .ter-book-price strong {
    font-size: 14px;
    line-height: 1.5;
    font-weight: 800;
  }

  .ter-sticky-book-bar .ter-book-button {
    flex: 0 0 auto;
    min-width: 180px;
    min-height: 48px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ef4659, #df334a);
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    font-weight: 800;
    font-size: 15px;
  }

  /* Home/list mobile nav */
  .ter-mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(12px, env(safe-area-inset-bottom));
    height: 64px;
    z-index: 9999;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(5,19,35,.96);
    border: 1px solid #1a456c;
    border-radius: 18px;
    box-shadow: 0 15px 42px rgba(0,0,0,.42);
    backdrop-filter: blur(13px);
    overflow: hidden;
  }

  .ter-mobile-bottom-nav a {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #9eb4ca;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
  }

  .ter-mobile-bottom-nav a span {
    font-size: 20px;
    line-height: 1;
  }

  .ter-mobile-bottom-nav a.ter-active {
    color: #17d9f4;
    background: rgba(23,217,244,.07);
  }

  @media (max-width: 380px) {
    body.ter-page-room-detail .summary-grid,
    body.ter-page-room-detail .room-stats,
    body.ter-page-room-detail .quick-stats,
    body.ter-page-room-detail .slots-grid,
    body.ter-page-room-detail .slot-grid,
    body.ter-page-room-detail .available-slots,
    body.ter-page-booking .summary-grid,
    body.ter-page-booking .summary-cards {
      grid-template-columns: 1fr !important;
    }

    .ter-sticky-book-bar .ter-book-button {
      min-width: 150px;
    }
  }
}

@media (min-width: 821px) {
  .ter-mobile-bottom-nav,
  .ter-sticky-book-bar {
    display: none !important;
  }
}
