/* =====================================================================
   VideoLab — mobile & tablet layer
   Loaded LAST (after style, responsive, vl-theme, vl-header, tools).
   Everything is scoped to small screens; desktop (>= 992px) is unchanged.
   Breakpoints: 991 (tablet / hamburger), 900 (footer 2x2), 575 (phone), 360 (small phone)
   ===================================================================== */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body { -webkit-tap-highlight-color: rgba(79, 70, 229, .12); overflow-wrap: break-word; }
img, video { max-width: 100%; }
html.drawer-open, html.drawer-open body { overscroll-behavior: none; }

/* =====================================================================
   HEADER + DRAWER  (<= 991px)
   ===================================================================== */
@media (min-width: 992px) {
  .mobile-drawer, .drawer-backdrop { display: none !important; }
}

@media (max-width: 991px) {
  .site-header .header-inner {
    gap: 12px;
    min-height: 60px;
    padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  }
  .site-header .logo { gap: 8px; min-width: 0; }
  .site-header .logo-img { width: 36px; height: 36px; }
  .site-header .logo-text { font-size: 1.25rem; }

  /* hamburger: pushed to the far right, 44px touch target */
  .site-header .hamburger {
    margin-left: auto; flex: none;
    width: 44px; height: 44px;
    border: 1px solid #E6E8F0; border-radius: 12px; background: #fff;
    -webkit-tap-highlight-color: transparent;
  }
  .site-header .hamburger:active { background: #F3F1FF; }

  /* ---- drawer ---- */
  .drawer-backdrop { background: rgba(11, 12, 20, .5); }
  .mobile-drawer {
    right: 0; left: auto;
    width: min(88vw, 380px);
    height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; overflow: hidden;
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .28s;
    box-shadow: -24px 0 60px -30px rgba(31, 27, 90, .45);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-drawer.open {
    transform: none; visibility: visible;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1), visibility 0s;
  }
  .mobile-drawer-head {
    flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 60px; padding: 8px 12px 8px 20px;
    border-bottom: 1px solid #E6E8F0; background: #fff;
  }
  .mobile-drawer-head .logo { color: #0B0C14; gap: 8px; }
  .mobile-drawer-head .logo-text { font-size: 1.25rem; }
  .drawer-close {
    flex: none; width: 44px; height: 44px; display: grid; place-items: center;
    border: 1px solid #E6E8F0; border-radius: 12px; background: #fff; color: #0B0C14; cursor: pointer;
  }
  .drawer-close svg { width: 20px; height: 20px; }
  .drawer-close:active { background: #F3F1FF; }

  .mobile-drawer-inner {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 6px 20px 28px; gap: 0;
  }
  .mobile-drawer-inner > a,
  .mobile-tools-toggle {
    display: flex; align-items: center; min-height: 52px; padding: 0 4px;
    font-size: 1.02rem; color: #0B0C14; border-bottom: 1px solid #EEF0F6;
  }
  .mobile-tools-toggle { justify-content: space-between; cursor: pointer; }
  .mobile-tools-toggle .chev { font-size: 14px; transition: transform .2s; }
  .mobile-tools-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .mobile-tools-list { margin: 8px 0 10px; padding: 6px; border-radius: 14px; background: #F7F7FC; }
  .mobile-tools-list a {
    display: flex; align-items: center; gap: 10px; min-height: 44px;
    padding: 6px 10px; border-radius: 10px; font-size: .95rem; color: #0B0C14;
  }
  .mobile-tools-list a:active { background: #E9E6FF; }
  .mobile-drawer-actions { margin-top: 24px; }
  .mobile-drawer-actions .btn { min-height: 48px; width: 100%; }
}

/* =====================================================================
   FOOTER — compact 2 x 2 grid  (<= 900px)
   Row 1: Brand | Tools      Row 2: Company | Legal
   ===================================================================== */
@media (max-width: 900px) {
  .site-footer { padding-top: 40px; }
  .site-footer .footer-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
    padding: 0 max(20px, env(safe-area-inset-right)) 28px max(20px, env(safe-area-inset-left));
  }
  .site-footer .footer-brand .logo { gap: 8px; }
  .site-footer .footer-brand .logo-img { width: 36px; height: 36px; }
  .site-footer .footer-brand .logo-text { font-size: 1.2rem; color: #fff; }
  .site-footer .footer-brand p { max-width: none; margin: 10px 0 0; font-size: .88rem; line-height: 1.5; }
  .site-footer .footer-col h4 { margin-bottom: 8px; font-size: .9rem; }
  .site-footer .footer-col a { padding: 6px 0; font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
  .site-footer .footer-bottom {
    padding: 16px max(20px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    text-align: center; font-size: .8rem;
  }
}
@media (max-width: 360px) {
  .site-footer .footer-inner { gap: 24px 14px; padding-left: 16px; padding-right: 16px; }
  .site-footer .footer-col a { font-size: .86rem; }
  .site-footer .footer-brand .logo-text { font-size: 1.1rem; }
}

/* =====================================================================
   HOMEPAGE (index.php)   — scoped with .vl to beat the page's inline <style>
   ===================================================================== */
@media (max-width: 960px) {
  .vl .vl-wrap { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
}
@media (max-width: 560px) {
  .vl .vl-wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

  .vl .vl-hero { padding: 32px 0 36px; }
  .vl h1 { font-size: clamp(2rem, 9.2vw, 2.6rem); }
  .vl .vl-lede { margin-top: 14px; font-size: 1.02rem; }
  .vl .vl-stage { margin-top: 22px; }
  .vl .vl-drop { min-height: 0; padding: 24px 16px; }
  .vl .vl-drop h3 { font-size: 1.25rem; }
  .vl .vl-up { width: 56px; height: 56px; }
  .vl .vl-btn { min-height: 48px; }
  .vl .vl-more { margin-top: 20px; }

  .vl .vl-tools, .vl .vl-how, .vl .vl-price { padding: 52px 0; }
  .vl .vl-top { margin-bottom: 26px; gap: 12px; }
  .vl .vl-h2 { font-size: clamp(1.7rem, 7.4vw, 2.1rem); }
  .vl .vl-top p { font-size: 1rem; }

  /* tool list -> compact rows (icon left, text right) */
  .vl .vl-grid { border-radius: 18px; }
  .vl .vl-tool {
    display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; row-gap: 2px;
    align-items: start; padding: 16px 44px 16px 16px;
  }
  .vl .vl-ico { grid-column: 1; grid-row: 1 / span 2; width: 44px; height: 44px; margin: 0; border-radius: 12px; }
  .vl .vl-tool h3 { grid-column: 2; grid-row: 1; align-self: end; font-size: 1rem; }
  .vl .vl-tool p { grid-column: 2; grid-row: 2; font-size: .88rem; line-height: 1.45; }
  .vl .vl-go, .vl .vl-tool:hover .vl-go, .vl .vl-tool:focus-visible .vl-go {
    top: 50%; right: 16px; width: 18px; height: 18px; opacity: .5; transform: translateY(-50%);
  }

  .vl .vl-step, .vl .vl-step + .vl-step { padding-top: 22px; padding-bottom: 22px; }
  .vl .vl-n { font-size: 2.4rem; }
  .vl .vl-step h3 { font-size: 1.15rem; margin-top: 12px; }

  .vl .vl-plans { gap: 18px; }
  .vl .vl-plan { padding: 26px 22px; border-radius: 20px; gap: 18px; }
  .vl .vl-amt { font-size: 2.9rem; }
  .vl .vl-badge { top: 18px; right: 18px; }
}
@media (max-width: 360px) {
  .vl .vl-wrap { padding-left: 14px; padding-right: 14px; }
  .vl .vl-meta span { white-space: normal; }
}

/* =====================================================================
   INNER PAGES: tool pages, cards, forms, auth  (<= 991px / <= 575px)
   ===================================================================== */
@media (max-width: 991px) {
  body .tool-page-head { padding-top: 36px; padding-bottom: 10px; }
  body .tool-workspace { padding-top: 16px; padding-bottom: 56px; gap: 18px; }
  .section { scroll-margin-top: 72px; }
}

@media (max-width: 575px) {
  .btn { min-height: 46px; }
  .btn-lg { padding: 14px 24px; }

  body .tool-page-head { padding-top: 24px; padding-bottom: 6px; }
  body .tool-page-head h1 { font-size: clamp(1.55rem, 7.2vw, 1.9rem); line-height: 1.15; }
  body .tool-page-head p { font-size: .98rem; }
  body .tool-workspace { padding-top: 14px; padding-bottom: 40px; gap: 16px; }

  body .card { padding: 20px 16px; border-radius: 18px; }
  body .tool-options .card + .card { margin-top: 14px; }
  body .dropzone { padding: 26px 14px; border-radius: 16px; }
  body .dropzone h3 { font-size: 1.05rem; }
  .dropzone-formats { font-size: 12px; }

  /* 16px form text stops iOS Safari from zooming in when a field is focused */
  .form-control, select.form-control, textarea.form-control { min-height: 46px; font-size: 16px; }
  textarea.form-control { min-height: 110px; }
  .form-group { margin-bottom: 16px; }

  .tabs button { min-height: 44px; }
  .result-box { padding: 12px 0; }
  .result-box .btn { flex: 1 1 100%; }
  .video-preview { max-width: 100% !important; }
  .meta-table td:first-child { width: 40%; }
  .meta-table td:last-child { overflow-wrap: anywhere; }
  .file-chip { padding: 10px 12px; }
  .batch-summary-row { flex-wrap: wrap; }
  .batch-summary-row .name { min-width: 0; overflow-wrap: anywhere; }
  .recorder-controls .btn { flex: 1 1 100%; }

  .auth-shell { margin: 28px auto 40px; padding: 0 16px; }
  .auth-shell h1 { font-size: 1.6rem; }

  .section { padding-top: 40px; padding-bottom: 40px; }
  .section-head { margin-bottom: 28px; }
  .price-card { padding: 24px 20px; }
  .price-amount { font-size: 34px; }

  .dash-shell { padding-top: 20px; padding-bottom: 48px; }
  .dash-shell h1 { font-size: 22px !important; }
  .stat-card { padding: 16px; }
  .stat-card .num { overflow-wrap: anywhere; }
  .empty-state { padding: 40px 12px; }
}

@media (max-width: 991px) {
  .mobile-tools-list a { font-weight: 500; }
}
