/* BYD Kosova V39 - loaded after every model template's inline styles */
@media (max-width:800px){
  html,body{width:100%!important;max-width:100%!important;overflow-x:hidden!important}
  body main{max-width:100%!important;overflow-x:hidden!important}
  img,video,picture,iframe{max-width:100%!important}

  [class^="a2-"],[class*=" a2-"],
  [class^="a2d-"],[class*=" a2d-"],
  [class^="a3-"],[class*=" a3-"],
  [class^="dg-"],[class*=" dg-"],
  [class^="ds-"],[class*=" ds-"],
  [class^="seal-"],[class*=" seal-"],
  [class^="s6-"],[class*=" s6-"],
  [class^="tang-"],[class*=" tang-"],
  [class^="dolphin-"],[class*=" dolphin-"],
  [class^="model-"],[class*=" model-"]{box-sizing:border-box;max-width:100%}

  /* Full-width cinematic/video sections */
  .a2d-performance,.a2d-interior-hero,.a2d-connect,
  .dg-ocean,.dg-interior-hero,.dg-tech,
  .seal-performance,.seal-interior-hero,.seal-tech,
  .ds-hero,.ds-intro,.ds-interior,.ds-tech,
  .s6-cinema,.s6-full,.s6-tech,
  .tang-hero,.tang-story,.tang-safety,
  .dolphin-ocean,.dolphin-interior,
  .byd-model-hero,.a3-performance-new,.a3-cinematic{
    width:100%!important;max-width:100%!important;margin-left:0!important;margin-right:0!important;overflow:hidden!important
  }

  .a2d-performance video,.a2d-interior-hero video,.a2d-connect video,
  .dg-ocean video,.dg-interior-hero video,.dg-tech video,
  .seal-performance video,.seal-interior-hero video,.seal-tech video,
  .ds-hero video,.ds-intro video,.ds-interior video,.ds-tech video,
  .s6-cinema video,.s6-full video,.s6-tech video,
  .tang-hero video,.tang-story video,.tang-safety video,
  .dolphin-ocean video,.dolphin-interior video,
  .byd-model-hero video,.a3-performance-new video,.a3-cinematic video{
    width:100%!important;height:100%!important;max-width:none!important;margin:0!important;transform:none!important;object-fit:cover!important;object-position:center center!important
  }

  /* Overlay text always stays inside viewport */
  .a2d-performance-copy,.a2d-center-copy,.a2d-hero-copy,
  .dg-ocean-copy,.dg-film-copy,.dg-hero-copy,
  .seal-film-copy,.seal-hero-copy,
  .ds-hero-copy,.ds-intro-copy,.interior-title,.ds-tech-title,
  .s6-cinema-copy,.s6-hero-copy,
  .tang-hero-copy,.tang-color-copy,
  .dolphin-interior-copy,
  .model-hero-copy,.a3-performance-content,.a3-cinematic-copy{
    left:16px!important;right:16px!important;width:auto!important;max-width:none!important;margin-left:0!important;margin-right:0!important;overflow-wrap:break-word!important;word-break:normal!important
  }

  /* Horizontal subnavigation scrolls internally */
  .a2-subnav,.a2d-subnav,.a3-subnav,.dg-subnav,.ds-subnav,.seal-subnav,.s6-subnav,.model-anchor-bar{
    width:100%!important;max-width:100%!important;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch!important;scrollbar-width:none!important;white-space:nowrap!important
  }
  .a2-subnav::-webkit-scrollbar,.a2d-subnav::-webkit-scrollbar,.a3-subnav::-webkit-scrollbar,.dg-subnav::-webkit-scrollbar,.ds-subnav::-webkit-scrollbar,.seal-subnav::-webkit-scrollbar,.s6-subnav::-webkit-scrollbar,.model-anchor-bar::-webkit-scrollbar{display:none!important}

  /* Split layouts */
  .a2-editorial,.a2-duo,.a2-charge,
  .a2d-interior-split,.a2d-charge,
  .dg-interior-split,.dg-charge,.dg-sustain-grid,
  .seal-interior-split,.seal-charge,
  .s6-feature,.s6-feature.reverse,
  .tang-interior,
  .dolphin-detail-row,.dolphin-charge,
  .story-feature,
  .a3-safety-card,.a3-charge,.a3-connect-panel.active{
    grid-template-columns:minmax(0,1fr)!important
  }

  .a2-tech-grid,.a2d-card3,.a2d-tech-cards,
  .dg-card3,.dg-tech-cards,.dg-sustain-grid,
  .seal-card3,.seal-tech-cards,
  .s6-grid3,.dolphin-safety-grid,
  .feature-card-row,.a3-split-cards,.a3-feature-grid,.a3-tech-cards{
    grid-template-columns:minmax(0,1fr)!important
  }

  /* Interactive vehicle viewers */
  .a2-viewer,.a2d-viewer,.dg-viewer,.seal-viewer,.ds-viewer,.tang-viewer,.dolphin-viewer,.a3-viewer{max-width:100%!important;overflow:hidden!important}
  .a2-view-stage,.a2-view-controls,
  .a2d-view-stage,.a2d-view-controls,
  .dg-view-stage,.dg-view-controls,
  .seal-view-stage,.seal-view-controls,
  .viewer-stage,.viewer-controls,
  .tang-viewer,.tang-swatches,
  .dolphin-view-stage,.dolphin-view-controls,
  .a3-viewer-stage,.a3-viewer-controls{
    width:calc(100% - 24px)!important;max-width:calc(100% - 24px)!important;margin-left:auto!important;margin-right:auto!important
  }
  .a2-view-controls,.a2d-view-controls,.dg-view-controls,.seal-view-controls,.viewer-controls,.dolphin-view-controls,.a3-viewer-controls{flex-wrap:wrap!important;gap:12px!important}
  .a2-swatches,.a2d-swatches,.dg-swatches,.seal-swatches,.swatches,.tang-swatches,.dolphin-swatches,.a3-swatches{flex-wrap:wrap!important;justify-content:center!important}

  /* Performance sections: avoid the previous left-shift problem */
  .seal-performance,.a2d-performance,.a3-performance-new{position:relative!important;left:auto!important;right:auto!important;transform:none!important}
  .seal-film-copy,.a2d-performance-copy,.a3-performance-content{transform:none!important}

  /* Cards and long text */
  .a2 h1,.a2 h2,.a2 h3,.a2 p,
  .a2d h1,.a2d h2,.a2d h3,.a2d p,
  .a3-page h1,.a3-page h2,.a3-page h3,.a3-page p,
  .dg h1,.dg h2,.dg h3,.dg p,
  .ds h1,.ds h2,.ds h3,.ds p,
  .seal h1,.seal h2,.seal h3,.seal p,
  .s6 h1,.s6 h2,.s6 h3,.s6 p,
  .tang h1,.tang h2,.tang h3,.tang p,
  .dolphin-family h1,.dolphin-family h2,.dolphin-family h3,.dolphin-family p{
    max-width:100%!important;overflow-wrap:break-word!important;word-break:normal!important
  }
}

@media(max-width:390px){
  .a2d-performance-copy,.a2d-center-copy,.a2d-hero-copy,
  .dg-ocean-copy,.dg-film-copy,.dg-hero-copy,
  .seal-film-copy,.seal-hero-copy,
  .ds-hero-copy,.ds-intro-copy,.interior-title,.ds-tech-title,
  .s6-cinema-copy,.s6-hero-copy,
  .tang-hero-copy,.tang-color-copy,
  .dolphin-interior-copy,
  .model-hero-copy,.a3-performance-content,.a3-cinematic-copy{
    left:14px!important;right:14px!important
  }
}


/* ===== V40 global anti-overflow for every vehicle template ===== */
@media(max-width:767px){html,body{max-width:100%!important;overflow-x:hidden!important}main,.a3-page,section,article{max-width:100%!important}img,video,picture,source{max-width:100%!important}.video-only-hero video,[class*="hero"] video,[class*="performance"] video,[class*="cinematic"] video{left:0!important;right:0!important;width:100%!important;max-width:none!important;transform:none!important;object-fit:cover!important}.a3-performance-content,.seal-film-copy,.dg-film-copy,.ds-film-copy,[class*="performance-copy"],[class*="hero-copy"],[class*="cinematic-copy"]{max-width:calc(100% - 30px)!important;box-sizing:border-box!important;overflow-wrap:anywhere!important}.a3-subnav,.seal-subnav,.dg-subnav,.ds-subnav,[class*="subnav"]{max-width:100vw!important;overflow:hidden!important}.a3-subnav>div,.seal-subnav>div,.dg-subnav>div,.ds-subnav>div,[class*="subnav"]>div{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;scrollbar-width:none!important}.a3-viewer-controls,.seal-view-controls,.dg-view-controls,.a2-view-controls,[class*="viewer-controls"],[class*="view-controls"]{max-width:calc(100% - 24px)!important;margin-left:auto!important;margin-right:auto!important}.a3-tech-cards,.seal-tech-cards,.dg-tech-cards,[class*="feature-grid"],[class*="split-cards"]{min-width:0!important}.a3-tech-cards>* ,.seal-tech-cards>* ,.dg-tech-cards>* ,[class*="feature-grid"]>* ,[class*="split-cards"]>*{min-width:0!important}.a3-performance-stats{grid-template-columns:repeat(3,minmax(0,1fr))!important}.a3-performance-stat{min-width:0!important}}
