/* ==============================================================================
   SwapnoFlix — Ultra-Responsive Mobile Optimization & Dynamic APK Widget
   Strict Mobile-First Viewport Constraints: Zero Overflow, Perfect Wrapping
   ============================================================================== */

/* --- 1. Global Viewport & Mobile Scroll Reset --- */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}

*, *::before, *::after {
  box-sizing: border-box !important;
}

/* Constrain background glows to prevent viewport enlargement */
.ambient-glow {
  max-width: 80vw !important;
  max-height: 80vw !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .ambient-glow {
    display: none !important;
  }
}

/* --- 2. APK Target Selector & Dynamic Download Widget --- */
.apk-download-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 18px 0 22px;
  box-sizing: border-box;
}

.hero-left .apk-download-widget {
  align-items: flex-start;
}

@media (max-width: 1080px) {
  .hero-left .apk-download-widget {
    align-items: center;
    margin: 18px auto 24px;
    max-width: 440px;
  }
}

/* Radio Platform Selector Bar */
.apk-selector-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 100%;
  background: rgba(15, 15, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 8px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.apk-toggle-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  box-sizing: border-box;
}

.apk-toggle-label:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.apk-toggle-label.active {
  background: linear-gradient(135deg, rgba(255, 51, 85, 0.2), rgba(138, 43, 226, 0.15));
  border-color: #ff3355;
  box-shadow: 0 0 20px rgba(255, 51, 85, 0.28), inset 0 0 12px rgba(255, 51, 85, 0.12);
}

.apk-radio-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom Checkbox/Radio Indicator */
.apk-toggle-custom-check {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apk-toggle-label.active .apk-toggle-custom-check {
  border-color: #ff3355;
  background: #ff3355;
  box-shadow: 0 0 8px #ff3355;
}

.apk-toggle-label.active .apk-toggle-custom-check::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
}

.apk-toggle-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.apk-toggle-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.apk-plat-icon {
  width: 15px;
  height: 15px;
  color: #ff3355;
  flex-shrink: 0;
}

.apk-toggle-label[data-platform="tv"] .apk-plat-icon {
  color: #a855f7;
}

.apk-plat-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.apk-badge-rec, .apk-badge-tv {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.apk-badge-rec {
  background: rgba(255, 51, 85, 0.2);
  color: #ff4d6d;
  border: 1px solid rgba(255, 51, 85, 0.3);
}

.apk-badge-tv {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.apk-plat-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Primary CTA Button Polish */
.btn-dynamic-download {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  min-height: 52px !important;
  padding: 0 24px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #ff3355 0%, #e60039 100%) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  box-shadow: 0 8px 26px rgba(255, 51, 85, 0.42) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.btn-dynamic-download:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 34px rgba(255, 51, 85, 0.55) !important;
}

.btn-dynamic-download:active {
  transform: scale(0.98) !important;
}

/* Direct 1-Tap Pills Row */
.apk-direct-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

.direct-hint {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.direct-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.direct-pill i, .direct-pill svg {
  width: 13px;
  height: 13px;
  color: #ff3355;
  flex-shrink: 0;
}

.direct-pill:hover {
  background: rgba(255, 51, 85, 0.15);
  border-color: rgba(255, 51, 85, 0.4);
  color: #ffffff;
  transform: translateY(-1px);
}

.direct-pill small {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

/* --- 3. Responsive Breakpoints: < 640px (Mobile Phones) --- */
@media (max-width: 640px) {
  /* Stack APK selector vertically on phones so neither option is squeezed */
  .apk-selector-group {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 8px !important;
    width: 100% !important;
  }

  .apk-toggle-label {
    width: 100% !important;
    padding: 12px 14px !important;
  }

  .apk-toggle-content {
    width: 100% !important;
  }

  .apk-plat-name {
    font-size: 14px !important;
  }

  .apk-plat-meta {
    font-size: 11px !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* Direct pills wrap neatly */
  .apk-direct-pills {
    justify-content: center !important;
  }

  .direct-pill {
    flex: 1 1 140px !important;
    justify-content: center !important;
  }
}

/* --- 4. Responsive Breakpoints: < 768px (Mobile & Tablets) --- */
@media (max-width: 768px) {
  /* Hero Spacing & Typography */
  .hero-section {
    padding: 75px 16px 32px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hero-inner {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .hero-left {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  .hero-heading {
    font-size: clamp(26px, 7vw, 36px) !important;
    line-height: 1.18 !important;
    margin-bottom: 12px !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
    padding: 0 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hero-subtitle {
    font-size: clamp(13px, 3.6vw, 15px) !important;
    line-height: 1.5 !important;
    margin-bottom: 20px !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
    padding: 0 6px !important;
    color: rgba(255, 255, 255, 0.72) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hide-sm {
    display: none !important;
  }

  /* Compact Vertical Triad (Clean, Centered, No Horizontal Expansion) */
  .hero-feature-triad {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto 20px !important;
    box-sizing: border-box !important;
  }

  .triad-item {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 14px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }

  .triad-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .triad-icon svg, .triad-icon i {
    width: 16px !important;
    height: 16px !important;
  }

  .triad-text strong {
    font-size: 13px !important;
    display: block !important;
    color: #ffffff !important;
  }

  .triad-text span {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    display: block !important;
  }

  /* Hero CTA Buttons */
  .hero-cta-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
  }

  .btn-dynamic-download, .btn-primary, .btn-glass {
    width: 100% !important;
    justify-content: center !important;
  }

  .hero-devices-stage {
    margin-top: 24px !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .hero-showcase-img {
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }

  /* Section 2: Category Rail */
  .category-capsule {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .cpi-separator {
    display: none !important;
  }

  .cat-pill-item {
    padding: 10px 8px !important;
    text-align: center !important;
  }

  /* Section 3: Intro 60s */
  .intro-60s-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    text-align: center !important;
  }

  /* Section 4: 3D Experience */
  .stage-3d-card-frame {
    padding: 24px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .stage-phones-holder {
    max-width: 100% !important;
  }

  .stage-card-asset {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Section 6: Ready Banner Card */
  .ready-banner-card {
    padding: 24px 14px !important;
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .rb-title {
    font-size: 24px !important;
  }

  .qr-neon-box {
    width: 120px !important;
    height: 120px !important;
  }

  .qr-code-img {
    width: 95px !important;
    height: 95px !important;
  }

  .store-pill-btn {
    width: 100% !important;
    min-height: 48px !important;
  }

  /* Section 7: Features Header & Grid */
  .pf-header-row {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 16px !important;
    width: 100% !important;
    margin-bottom: 24px !important;
    box-sizing: border-box !important;
  }

  .btn-outline-action {
    width: 100% !important;
    max-width: 320px !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .features-5-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
  }

  .fc-preview-img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Section 8: Cross Platform */
  .cp-devices-asset {
    max-width: 100% !important;
    height: auto !important;
  }

  .cp-platforms-row {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
  }

  /* Section 9: Stats 5 Cards Row */
  .stats-5-cards-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .stat-neon-box {
    padding: 14px 10px !important;
  }

  .snb-val {
    font-size: 22px !important;
  }

  .snb-label {
    font-size: 11px !important;
  }

  /* Section 10: Get App Card */
  .get-app-card {
    padding: 24px 14px !important;
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .spiderman-phone-img {
    max-width: 240px !important;
    height: auto !important;
  }

  .gra-btn {
    width: 100% !important;
  }

  /* Section 11: Support */
  .support-integrated-card {
    padding: 24px 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mascot-asset {
    max-width: 180px !important;
    height: auto !important;
    margin: 16px auto 0 !important;
  }

  /* Intro Video Modal Mobile Styling */
  .intro-dialog {
    width: 92vw !important;
    max-width: 440px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 0 !important;
    border-radius: 20px !important;
  }

  .intro-modal-stage {
    grid-template-columns: 1fr !important;
  }

  .ims-preview {
    min-height: 220px !important;
    aspect-ratio: 16/9 !important;
  }

  .ims-copy {
    padding: 20px 16px !important;
  }

  .ims-copy h2 {
    font-size: 20px !important;
    margin-bottom: 8px !important;
  }

  .ims-copy p {
    font-size: 13px !important;
    margin-bottom: 16px !important;
  }

  .ims-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .ims-actions .btn-primary, .ims-actions .btn-glass {
    width: 100% !important;
    justify-content: center !important;
  }
}
