/* =========================================================
   Mobile adaptation — phones & small tablets
   ========================================================= */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body.sidebar-open,
html.nav-lock,
html.nav-lock body {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

/* ---- Header ---- */
@media (max-width: 1100px) {
  .duel-app .site-header {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .duel-app .header-inner {
    width: 100%;
    max-width: none;
    padding-inline: 0.75rem;
    gap: 0.5rem;
  }

  .duel-sidebar {
    padding-top: calc(0.85rem + env(safe-area-inset-top));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .sidebar-chat {
    max-height: 180px;
  }
}

@media (max-width: 900px) {
  .duel-app .hero {
    margin: 0.5rem;
    margin-top: 0.4rem;
    border-radius: 0 0 18px 18px;
    min-height: clamp(340px, 92vw, 480px);
  }

  .duel-app .hero::after {
    background:
      linear-gradient(180deg, rgba(8, 10, 18, 0.25) 0%, rgba(8, 10, 18, 0.55) 38%, rgba(8, 10, 18, 0.96) 100%),
      linear-gradient(90deg, rgba(8, 10, 18, 0.55) 0%, transparent 55%);
  }

  .duel-app .hero-bg {
    object-position: 68% center;
  }

  .duel-app .hero-content {
    max-width: none;
    padding: 2.1rem 0 1.6rem;
  }

  .duel-app .hero-title {
    font-size: clamp(1.55rem, 7.2vw, 2.15rem);
    line-height: 1.12;
    word-break: break-word;
  }

  .duel-app .hero-text {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .duel-app .hero-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .duel-app .hero-actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .duel-app .cta-row {
    flex-wrap: wrap;
  }

  .duel-app .cta-row .btn {
    min-height: 46px;
  }

  .hero-stats {
    gap: 0.45rem;
  }

  .hero-chip {
    font-size: 0.74rem;
    padding: 0.45rem 0.7rem;
  }

  /* Live rail — contain marquee, no page overflow */
  .live-rail {
    margin: 0.75rem 0.5rem 0;
    border-radius: 14px;
    overflow: hidden;
    max-width: calc(100% - 1rem);
  }

  .live-rail-head {
    font-size: 0.68rem;
    padding: 0 0.7rem;
    max-width: 5.6rem;
  }

  .live-track {
    padding-left: 6.2rem;
    gap: 0.55rem;
    will-change: transform;
  }

  .live-pill {
    font-size: 0.74rem;
    padding: 0.38rem 0.65rem;
  }

  /* Rails */
  .rail-section {
    padding: 1.1rem 0 0.25rem !important;
  }

  .rail-head {
    align-items: flex-start;
    gap: 0.65rem;
  }

  .originals-title {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
  }

  .originals-sub {
    font-size: 0.8rem;
  }

  .rail-controls {
    flex-shrink: 0;
  }

  .rail-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .quick-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.45rem;
    margin: 0.15rem 0 0.95rem;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .quick-filters::-webkit-scrollbar {
    display: none;
  }

  .qf {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    min-height: 40px;
  }

  .orig-rail {
    margin-inline: -0.15rem;
    padding-inline: 0.15rem;
    gap: 0.7rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .orig-card {
    flex: 0 0 clamp(132px, 42vw, 158px);
    border-radius: 16px;
  }

  .orig-meta strong {
    font-size: 0.92rem;
  }

  .orig-meta span {
    font-size: 0.7rem;
  }

  .play-pulse {
    opacity: 1;
    transform: none;
    font-size: 0.68rem;
    padding: 0.32rem 0.55rem;
  }

  /* Bento */
  .bento {
    gap: 0.7rem;
  }

  .bento-card {
    min-height: 0;
    padding: 1.05rem 1.05rem 1.15rem;
    border-radius: 18px;
  }

  .bento-card h3 {
    font-size: 1.1rem;
  }

  .bento-card p {
    font-size: 0.9rem;
  }

  .bento-media {
    display: none;
  }

  .rail-head .btn {
    width: 100%;
  }

  .rail-head {
    flex-direction: column;
  }

  /* Content cards / grids */
  .duel-app .container {
    width: min(100% - 1.1rem, var(--max));
  }

  .duel-app section {
    padding: 1.75rem 0;
  }

  .duel-app .viz-card,
  .duel-app .promo-card,
  .duel-app .promo-hero,
  .duel-app .wallet-demo,
  .duel-app .cta-banner {
    border-radius: 16px !important;
  }

  .viz-split,
  .viz-split--flip,
  .grid-2,
  .crypto-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .info-tiles {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.55rem;
  }

  .coin-cloud {
    gap: 0.4rem;
  }

  .coin-chip {
    min-height: 36px;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
  }

  .wallet-demo {
    width: 100%;
    max-width: none;
  }

  .table-wrap,
  .media-frame {
    max-width: 100%;
  }

  .media-frame img,
  .viz-media img {
    max-width: 100%;
    height: auto;
  }

  /* Sticky bar + back-top */
  .sticky-cta {
    display: flex;
    z-index: 1150;
    padding-left: calc(0.75rem + env(safe-area-inset-left));
    padding-right: calc(0.75rem + env(safe-area-inset-right));
  }

  .app-main,
  main {
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
  }

  .back-top {
    right: 0.75rem;
    bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }

  .site-footer {
    padding-bottom: 1.25rem;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.55rem;
    align-items: flex-start;
    text-align: left;
  }

  /* Forms / promo */
  .copy-row,
  .promo-code-row {
    flex-wrap: wrap;
  }

  .copy-row .copy-btn,
  .copy-row .btn,
  .promo-code-row .btn {
    min-height: 44px;
  }

  .faq summary {
    padding: 0.95rem 0.2rem;
    min-height: 48px;
  }

  /* Disable tilt transforms feel on touch */
  .orig-card {
    --tilt-x: 0deg !important;
    --tilt-y: 0deg !important;
  }

  .organic-bg::before,
  .organic-bg::after {
    filter: blur(36px);
    opacity: 0.7;
  }
}

@media (max-width: 640px) {
  .duel-app .header-actions .btn-login {
    display: none;
  }

  .duel-app .header-actions .btn-register {
    padding: 0.55rem 0.85rem;
    font-size: 0.82rem;
    min-height: 40px;
  }

  .logo-mobile img {
    height: 22px;
  }

  .sidebar-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .info-tiles {
    grid-template-columns: 1fr !important;
  }

  .hero-stats {
    flex-direction: column;
    align-items: flex-start;
  }

  .steps,
  .step-grid {
    grid-template-columns: 1fr !important;
  }

  .knowhow-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 400px) {
  .duel-app .hero-title {
    font-size: 1.45rem;
  }

  .orig-card {
    flex-basis: 128px;
  }

  .live-rail-head {
    max-width: 4.8rem;
    font-size: 0.62rem;
  }

  .live-track {
    padding-left: 5.4rem;
  }
}

/* Landscape phones */
@media (max-height: 430px) and (orientation: landscape) {
  .duel-app .hero {
    min-height: 280px;
  }

  .sidebar-chat {
    display: none;
  }

  .sticky-cta {
    padding-top: 0.45rem;
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom));
  }
}
