#box, .loader { position: fixed !important; }
  .loader, .loader::after, .loader::before { box-sizing: border-box; }

  #box {
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
    z-index: 9999 !important; display: none;
  }

  .jw-flag-small-player .jw-nextup-container,
  .jw-flag-small-player .jw-nextup-container .jw-nextup,
  .jw-icon-cc,
  .jw-icon.jw-icon-inline.jw-button-color.jw-reset.jw-icon-pip,
  .jw-icon.jw-icon-inline.jw-button-color.jw-reset.jw-icon-rewind,
  .jw-icon.jw-icon-inline.jw-button-color.jw-reset.jw-icon-rewind.jw-icon-next,
  .jw-rightclick,
  .jwplayer .jw-tooltip { display: none !important; }

  .jw-toggle.jw-off { color: #d8d8d8; }
  .jw-controlbar.jw-background-color.jw-reset {
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.25) 30%, rgba(0,0,0,.4) 70%, rgba(0,0,0,.5));
  }
  .jw-icon.jw-icon-rewind.jw-button-color.jw-reset { visibility: hidden; }
  .jw-logo.jw-logo-top-right.jw-reset {
    width: 100px !important; height: 24px !important;
    top: -15px !important; right: -15px !important;
  }

  .loader {
    width: 57px; height: 57px;
    border: 4px solid #fff; border-bottom-color: transparent; border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
    top: calc(50% - 28px) !important; left: calc(50% - 28px) !important;
    z-index: 99999 !important;
  }
  @keyframes rotation { to { transform: rotate(360deg); } }

  .banner-bottom { width: 100%; position: absolute; bottom: 0; left: 0; right: 0; }
  .banner-bottom img { max-height: 80px; width: 100%; }
  .jwplayer.jw-flag-ads .banner-bottom { display: none !important; }

  @media only screen and (max-width: 776px) {
    .jwplayer:not(.jw-flag-ads) .jw-controlbar { bottom: calc((100vw / 1035px) * 60px + 10px) !important; }
  }
  @media only screen and (min-width: 776px) {
    .jwplayer:not(.jw-flag-ads) .jw-controlbar { bottom: 90px !important; }
  }

  .jwplayer:not(.jw-flag-ads) video {
    --video-offset: min(80px, calc(100vw * 60 / 1035));
    --video-scale-y: calc(1 - (var(--video-offset) / 100vh));
    -webkit-transform: translateY(-40px) scale(var(--video-scale-y));
    transform: translateY(-40px) scale(var(--video-scale-y));
    -webkit-transform-origin: center center;
    transform-origin: center center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  @media only screen and (max-width: 576px) {
    .banner-bottom img { max-height: 25px; }
    .jwplayer:not(.jw-flag-ads) .jw-controlbar { bottom: 35px !important; }
    .jwplayer:not(.jw-flag-ads) video {
      --video-offset: min(35px, calc(100vw * 60 / 1035));
      --video-scale-y: calc(1 - (var(--video-offset) / 100vh));
      -webkit-transform: translateY(-17px) scale(var(--video-scale-y));
      transform: translateY(-17px) scale(var(--video-scale-y));
    }
  }

  .jw-flag-small-player:not(.jw-flag-audio-player):not(.jw-flag-ads) .jw-controlbar .jw-button-container > .jw-icon-playback {
    display: block !important; padding-top: 9px; padding-left: 9px;
  }

  /* ===== In-player banner: nút close ===== */
  .banner-bottom { z-index: 10; }
  .banner-bottom a { display: block; line-height: 0; }

  .banner-close {
    position: absolute;
    top: 3px; right: 3px;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    box-sizing: border-box;
    border-radius: 0;
    background: rgba(0,0,0,.6);
    border: 1px solid rgba(255,255,255,.55);
    color: #fff;
    cursor: pointer;
    z-index: 11;
    -webkit-tap-highlight-color: transparent;
  }
  .banner-close svg { width: 12px; height: 12px; display: block; pointer-events: none; }
  .banner-close:hover { background: rgba(0,0,0,.85); }

  @media only screen and (max-width: 576px) {
    .banner-close { top: 2px; right: 2px; width: 16px; height: 16px; }
    .banner-close svg { width: 9px; height: 9px; }
  }

  /* ===== Đã tắt banner: trả lại layout player ===== */
  body.tvc-banner-closed .banner-bottom { display: none !important; }
  body.tvc-banner-closed .jwplayer:not(.jw-flag-ads) .jw-controlbar { bottom: 0 !important; }
  body.tvc-banner-closed .jwplayer:not(.jw-flag-ads) video {
    -webkit-transform: none !important;
    transform: none !important;
  }
