/* Vietlish Study mobile motion patch V17.6
 * Add after existing styles. Only smartphones / touch devices.
 * Keeps color, cards, gradients, shadows, layouts and podcast controls.
 * Motion restricted to compositor-friendly transforms and opacity.
 */
@media (max-width: 700px) and (hover: none) {
  html.vl-mobile-motion {
    /* Preserve browser-native scroll momentum; don't force smooth scroll. */
    -webkit-tap-highlight-color: transparent;
  }

  /* Existing mobile CSS disables animation for nearly everything.
     Restore a FEW meaningful transitions rather than re-animating every card. */
  html.vl-mobile-motion .app-header {
    animation: vlm-enter .44s cubic-bezier(.2,.75,.2,1) both;
  }
  html.vl-mobile-motion .page-stage > :first-child:not(.vl-pod-mini) {
    animation: vlm-enter .38s cubic-bezier(.2,.75,.2,1) both;
  }
  @keyframes vlm-enter {
    from { opacity: .72; transform: translate3d(0,9px,0); }
    to   { opacity: 1; transform: translate3d(0,0,0); }
  }

  /* Touch feedback: no expensive dynamic shadow/filter/gradient repaint. */
  html.vl-mobile-motion .btn,
  html.vl-mobile-motion .ico,
  html.vl-mobile-motion .chip,
  html.vl-mobile-motion .nav button,
  html.vl-mobile-motion .pod-mcq-options label,
  html.vl-mobile-motion .vl-mini-controls button {
    transition: transform .19s cubic-bezier(.2,.75,.2,1),opacity .16s ease !important;
    -webkit-tap-highlight-color: transparent;
  }
  html.vl-mobile-motion .btn:hover:not(:disabled),
  html.vl-mobile-motion .ico:hover,
  html.vl-mobile-motion .chip:hover,
  html.vl-mobile-motion .card:hover {
    transform: none !important;
    filter: none !important;
  }
  html.vl-mobile-motion .btn:active:not(:disabled),
  html.vl-mobile-motion .ico:active,
  html.vl-mobile-motion .pod-mcq-options label:active,
  html.vl-mobile-motion .vl-mini-controls button:active {
    transform: scale(.975) !important;
  }
  html.vl-mobile-motion .nav .on {
    transform: translate3d(0,-2px,0) !important;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), background-color .2s ease !important;
  }
  /* Floating assistant: 1 element, GPU-friendly movement; same gradients. */
  html.vl-mobile-motion .fab:not(.vl-helper-panel) {
    animation: vlm-float 4.4s ease-in-out infinite !important;
  }
  @keyframes vlm-float {
    0%,100% {transform:translate3d(0,0,0)}
    50% {transform:translate3d(0,-5px,0)}
  }
  html.vl-mobile-motion .fab:active {animation:none!important;transform:scale(.96)!important}

  /* Replace two enormous blurred animated orbs with small translucent
     radial-gradient orbs. No animated filter/backdrop-filter or bg-position. */
  html.vl-mobile-motion .bg::before,
  html.vl-mobile-motion .bg::after {
    display:block !important;
    filter:none !important;
    -webkit-filter:none !important;
    width:42vmax !important;
    height:42vmax !important;
    opacity:.42 !important;
    pointer-events:none;
    background:radial-gradient(circle,rgba(255,122,198,.50) 0%,rgba(255,122,198,.20) 37%,transparent 70%) !important;
    animation:vlm-orb 18s ease-in-out infinite alternate !important;
  }
  html.vl-mobile-motion .bg::before {left:-18vmax!important;top:-11vmax!important}
  html.vl-mobile-motion .bg::after {
    right:-18vmax!important;bottom:-10vmax!important;
    left:auto!important;top:auto!important;
    background:radial-gradient(circle,rgba(106,140,255,.48) 0%,rgba(106,140,255,.17) 40%,transparent 70%) !important;
    animation-duration:22s!important;
    animation-delay:-9s!important;
  }
  @keyframes vlm-orb {
    from { transform:translate3d(0,0,0) scale(.98) }
    to { transform:translate3d(14px,12px,0) scale(1.06) }
  }

  /* Preserve colorful gradients, but avoid continuous background repaint. */
  html.vl-mobile-motion h1,
  html.vl-mobile-motion h2,
  html.vl-mobile-motion .btn:not(.s),
  html.vl-mobile-motion .bar i {
    animation:none!important;
  }
  /* Preserve audio mini-player's exact center transform and functionality. */
  html.vl-mobile-motion .vl-pod-mini,
  html.vl-mobile-motion .vl-pod-mini * { animation:none!important; }

  /* Lower the expense of oversize shadow rasterization. Glass-like border
     and visual styling remain unchanged. */
  html.vl-mobile-motion .card {
    box-shadow:0 4px 14px rgba(70,50,160,.13)!important;
    transition:none!important;
  }
  html.vl-mobile-motion .nav { box-shadow:0 6px 19px rgba(27,23,64,.18)!important; }
  html.vl-mobile-motion .vl-helper-panel { animation:none!important; }
  /* Avoid rendering all offscreen answer panels during first layout.
     Only target known repeated MCQ cards, not player/sticky elements. */
  @supports (content-visibility:auto) {
    html.vl-mobile-motion section[aria-label='Bài tập trắc nghiệm nghe hiểu'] > .card {
      content-visibility:auto;
      contain-intrinsic-size:auto 165px;
    }
  }
}

/* Phones with small memory / users requesting less motion:
   keep the original visual design, remove only nonessential ambient motion. */
@media (max-width: 700px) and (hover: none) {
  html.vl-mobile-motion.vl-low-power .bg::before,
  html.vl-mobile-motion.vl-low-power .bg::after,
  html.vl-mobile-motion.vl-low-power .fab { animation:none!important; }
}
@media (prefers-reduced-motion: reduce) {
  html.vl-mobile-motion *,html.vl-mobile-motion *::before,html.vl-mobile-motion *::after {
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
}
