/* ============================================================
   CCH Khóa Mới — theme-embedding fixes for the lesson player.
   engine.css was written for a standalone fullscreen page: it
   makes <body> a flex container with overflow hidden and sizes
   #app to 100dvh. Loaded AFTER engine.css and scoped to the
   player body class (cch-km-player), these overrides keep the
   theme header/footer layout intact and frame the lesson app
   inside the page content area instead. engine.css itself is
   shipped byte-identical to the standalone build.
   ============================================================ */
body.cch-km-player {
  display: block;
  overflow: visible;
  min-height: 0;
}
body.cch-km-player #app {
  height: calc(100dvh - 32px);
  min-height: 600px;
  max-height: 900px;
  margin: 16px auto 28px;
  border-radius: 28px;
}

/* #btnNext must stay fully visible at scroll 0 on EVERY screen (bug 3.2
   mobile + 3.3 desktop): absolute inside #app clips it whenever #app's
   bottom edge sits below the viewport bottom — mobile: the 64px dock
   covered 16px; desktop 1920x930 screenshot: the viewport edge itself
   cut 28px off the button (#app bottom 52px below the viewport).
   Pin it to the viewport instead (no transformed ancestor between
   #btnNext and the viewport, so fixed is viewport-relative). The right
   offset tracks the card's right edge: card is 560px wide (640px at
   >=900px, full-width <=768px). Bottom: 24px on desktop, 80px on
   mobile (64px dock + 16px gap); z-index above the dock's 9999. */
body.cch-km-player #btnNext {
  position: fixed;
  right: max(20px, calc((100vw - 560px) / 2 + 20px));
  bottom: 24px;
  z-index: 10000;
}
@media (min-width: 900px) {
  body.cch-km-player #btnNext {
    right: max(20px, calc((100vw - 640px) / 2 + 20px));
  }
}
@media (max-width: 768px) {
  body.cch-km-player #btnNext {
    right: 20px;
    bottom: 80px;
  }
}
