/* mobile.css v2 — hard mobile overrides for index.html (and v2.html).
   Belt-and-suspenders: !important everywhere so old index.html rules
   that fight the mobile layout lose.
   Breakpoints: 820, 640, 420.
*/

/* === Base: kill any horizontal overflow globally === */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}
body {
  -webkit-text-size-adjust: 100% !important;
}
img, video, iframe, canvas, svg {
  max-width: 100% !important;
}

/* === Phone + small tablet === */
@media (max-width: 820px) {
  /* Hide the desktop sidebar, show it as off-canvas drawer */
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 82vw !important;
    max-width: 320px !important;
    height: 100dvh !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform .25s ease !important;
    box-shadow: 0 0 40px rgba(0,0,0,.5) !important;
    overflow-y: auto !important;
  }
  body.sb-open #sidebar { transform: translateX(0) !important; }

  /* Scrim overlay */
  #sbScrim {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.6) !important;
    z-index: 999 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    display: block !important;
  }
  body.sb-open #sbScrim { opacity: 1; pointer-events: auto; }

  /* Topbar: compact, sticky, show burger */
  .topbar, header.topbar, header {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    position: sticky !important;
    top: 0 !important;
    background: rgba(10,6,8,.94) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    z-index: 50 !important;
    width: 100% !important;
  }
  #mBurger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px !important;
    height: 42px !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: inherit !important;
    cursor: pointer;
    font-size: 20px !important;
    line-height: 1 !important;
    padding: 0 !important;
  }
  #mBurger::before { content: "\2630"; }

  /* Main content no longer indented by sidebar */
  main, .main, .content {
    padding-left: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Hero */
  .hero, #home {
    padding: 36px 18px 50px !important;
    min-height: auto !important;
    width: 100% !important;
  }
  .hero h1, #home h1, h1 {
    font-size: clamp(36px, 10vw, 56px) !important;
    line-height: 1.05 !important;
    letter-spacing: -.5px !important;
    word-break: break-word !important;
    hyphens: auto !important;
  }
  .hero p, .hero .lead {
    font-size: 15px !important;
    line-height: 1.5 !important;
  }
  .hero .cta, .hero .buttons, .hero > div {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  .hero .btn, .hero button, .cta .btn {
    flex: 1 1 100% !important;
    min-height: 48px !important;
    font-size: 15px !important;
  }

  /* Any section padding */
  section {
    padding: 48px 0 !important;
  }
  section > *, section .wrap, section .container {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }
  h2 {
    font-size: clamp(24px, 6.5vw, 36px) !important;
    line-height: 1.1 !important;
    word-break: break-word !important;
  }
  h3 { font-size: 18px !important; }

  /* Preview grid, pack grid, tiles grid, tools grid, testimonials, affiliate stats */
  #tilesWrap,
  .tiles-grid,
  .tiles,
  .presets-grid,
  .pack-grid,
  .packs,
  .tools-grid,
  .tst-grid,
  .steps,
  .grid-3,
  .grid-cards,
  .aff-stats,
  #affiliate .stats {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .prev, .tile, .pack, .tool-card, .tst, .stat, .step {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .prev video, .prev img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  /* Steps timeline: stack single column */
  .steps {
    grid-template-columns: 1fr !important;
  }

  /* Forms, inputs, buttons */
  input, select, textarea {
    font-size: 16px !important; /* prevent iOS zoom-on-focus */
    min-height: 44px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  button, .btn {
    min-height: 44px !important;
    font-size: 15px !important;
  }

  /* Modals / overlays */
  .overlay, #overlay, #payOverlay, #genOverlay {
    padding: 16px !important;
    align-items: flex-start !important;
    padding-top: 24px !important;
  }
  .overlay .modal, .modal, #payOverlay .modal, #genOverlay .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 48px) !important;
    overflow-y: auto !important;
    padding: 22px !important;
    border-radius: 18px !important;
    margin: 0 !important;
  }
  .modal h2 { font-size: 22px !important; }

  /* Payment modal: QR fits in viewport */
  #payInvoice .qr-wrap img, .qr img, img.qr, #payQR {
    width: 220px !important;
    height: 220px !important;
    max-width: 70vw !important;
    max-height: 70vw !important;
  }
  #payCoins {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)) !important;
    gap: 8px !important;
  }
  #payCoins button {
    padding: 12px 8px !important;
    font-size: 13px !important;
  }
  .pay-row .input-copy {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 6px !important;
  }
  .pay-row .input-copy input {
    font-size: 12px !important;
    min-height: 42px !important;
    padding: 10px !important;
  }
  .pay-row .input-copy button {
    padding: 0 12px !important;
    font-size: 12px !important;
  }

  /* Credits badge: floating bottom-right so sticky topbar stays slim */
  #tbCredits {
    position: fixed !important;
    bottom: 14px !important;
    right: 14px !important;
    z-index: 60 !important;
    padding: 8px 14px !important;
    border-radius: 999px !important;
    background: rgba(28,18,22,.95) !important;
    border: 1px solid rgba(228,194,122,.4) !important;
    box-shadow: 0 6px 24px rgba(0,0,0,.4) !important;
    font-size: 13px !important;
  }

  /* Debug button out of the way */
  #debugBtn {
    bottom: 70px !important;
    right: 10px !important;
    font-size: 11px !important;
    padding: 6px 10px !important;
    z-index: 50 !important;
  }

  /* Footer */
  footer {
    padding: 24px 18px 60px !important;
    font-size: 13px !important;
  }
  footer .foot, footer > div {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }
  footer .foot-links {
    flex-wrap: wrap !important;
    gap: 14px !important;
  }

  /* Generator tabs scrollable */
  #genTabs {
    overflow-x: auto !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
  }
  #genTabs::-webkit-scrollbar { display: none; }
  #genTabs button {
    white-space: nowrap !important;
    flex: 0 0 auto !important;
  }
}

/* === Phone < 640px: single column grids === */
@media (max-width: 640px) {
  #tilesWrap,
  .tiles-grid,
  .tiles,
  .presets-grid,
  .pack-grid,
  .packs,
  .tools-grid,
  .tst-grid,
  .aff-stats,
  #affiliate .stats {
    grid-template-columns: 1fr !important;
  }
}

/* === Very small phones === */
@media (max-width: 420px) {
  .hero h1, h1 {
    font-size: clamp(32px, 11vw, 48px) !important;
  }
  .hero {
    padding: 28px 14px 40px !important;
  }
  section > *, section .wrap, section .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  .modal {
    padding: 18px !important;
  }
  #payInvoice .qr-wrap img {
    width: 180px !important;
    height: 180px !important;
  }
}

/* === Burger only on mobile === */
#mBurger { display: none; }

/* iOS safe-area */
@supports (padding: max(0px)) {
  @media (max-width: 820px) {
    .topbar { padding-top: max(10px, env(safe-area-inset-top)) !important; }
    #tbCredits { bottom: max(14px, env(safe-area-inset-bottom)) !important; }
    #sidebar { padding-bottom: env(safe-area-inset-bottom) !important; }
    footer { padding-bottom: max(60px, calc(env(safe-area-inset-bottom) + 60px)) !important; }
  }
}

/* === Landscape phone orientation: shorter hero === */
@media (max-width: 900px) and (orientation: landscape) {
  .hero, #home {
    padding: 24px 18px 32px !important;
  }
  .hero h1, h1 {
    font-size: clamp(28px, 6vw, 44px) !important;
  }
}
