/* RUANGFLIX watch player v10: true fullscreen, no forced landscape */
html,body.watch-page{margin:0;background:#000;color:#fff;min-height:100%;overscroll-behavior:none}
body.watch-page{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}

.rf-opening{position:fixed;inset:0;z-index:999999;display:grid;place-items:center;overflow:hidden;background:radial-gradient(circle at 50% 45%,rgba(0,112,255,.18),transparent 34%),#02050a;opacity:1;visibility:visible;transition:opacity .38s ease,visibility .38s ease}
.rf-opening__center{width:min(84vw,640px);text-align:center}
.rf-opening__logo{display:block;width:min(100%,540px);height:auto;margin:auto;filter:drop-shadow(0 0 18px rgba(25,126,255,.55));animation:rfLogoIn .8s cubic-bezier(.2,.8,.2,1) both}
.rf-opening__tag{margin-top:18px;color:rgba(220,238,255,.78);font-size:10px;font-weight:800;letter-spacing:.30em;text-transform:uppercase}
.rf-opening__skip{position:absolute;right:max(18px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));border:1px solid rgba(255,255,255,.18);border-radius:999px;padding:9px 15px;background:rgba(10,18,32,.78);color:#fff;font-weight:800;cursor:pointer}
.rf-opening.is-exiting{opacity:0;visibility:hidden;pointer-events:none}
@keyframes rfLogoIn{from{opacity:0;transform:scale(.9);filter:blur(8px)}to{opacity:1;transform:scale(1);filter:drop-shadow(0 0 18px rgba(25,126,255,.55))}}

.watch-shell{min-height:100dvh;display:grid;place-items:center;padding:18px;background:#000;box-sizing:border-box}
.watch-stage{width:min(100%,1180px);display:grid;gap:12px;align-items:center}
.watch-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%}
.back-btn,.rf-wide-btn{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
.back-btn{width:44px;height:44px;display:grid;place-items:center;border:1px solid rgba(255,255,255,.16);border-radius:50%;background:#0b111b;color:#fff;text-decoration:none;font-size:26px;line-height:1;box-shadow:0 8px 28px rgba(0,0,0,.28)}
.rf-wide-btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 15px;border:1px solid rgba(255,255,255,.16);border-radius:999px;background:#0b111b;color:#fff;font:800 13px/1 system-ui,sans-serif;box-shadow:0 8px 28px rgba(0,0,0,.28);cursor:pointer}
.rf-wide-btn:active,.back-btn:active{transform:scale(.97)}

.player-frame{width:100%;aspect-ratio:16/9;background:#000;border-radius:12px;overflow:hidden;box-shadow:0 16px 44px rgba(0,0,0,.42);position:relative}
.player-frame video{display:block;width:100%;height:100%;object-fit:contain;object-position:center;background:#000}
.watch-title{display:flex;justify-content:space-between;gap:20px;align-items:center;color:#fff;padding:2px 2px 0}
.watch-title strong{font-size:15px}.watch-title span{color:#9aa7b7;font-size:11px;text-align:right}
.rf-wide-exit{display:none!important}

@media (max-width:768px){
  html,body.watch-page{width:100%;min-height:100dvh}
  .watch-shell{min-height:100dvh;padding:max(14px,env(safe-area-inset-top)) 12px max(14px,env(safe-area-inset-bottom));display:flex;align-items:center;justify-content:center}
  .watch-stage{width:100%;max-width:680px;gap:10px}
  .watch-toolbar{padding:0 2px}
  .player-frame{width:100%;aspect-ratio:16/9;border-radius:10px;box-shadow:none}
  .watch-title{display:none!important}
  .back-btn{width:46px;height:46px;font-size:27px;background:rgba(8,14,24,.94)}
  .rf-wide-btn{min-height:46px;padding:0 16px;background:rgba(8,14,24,.94);font-size:13px}
}

/* True browser/native fullscreen. No rotation transform and no orientation lock. */
.player-frame:fullscreen,.player-frame:-webkit-full-screen,
video:fullscreen,video:-webkit-full-screen{
  width:100vw!important;
  height:100vh!important;
  max-width:none!important;
  max-height:none!important;
  aspect-ratio:auto!important;
  border-radius:0!important;
  background:#000!important;
  object-fit:contain!important;
}

/* If the viewer rotates the phone themselves, the normal player simply adapts. */
@media (orientation:landscape) and (max-height:600px){
  .watch-shell{padding:8px max(8px,env(safe-area-inset-right)) 8px max(8px,env(safe-area-inset-left))}
  .watch-stage{max-width:min(100%,1100px)}
  .player-frame{max-height:calc(100dvh - 72px)}
}

/* RUANGFLIX video watermark v11 */
.rf-video-watermark{
  position:absolute;
  z-index:6;
  width:clamp(72px,14%,180px);
  max-height:18%;
  object-fit:contain;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
  opacity:.72;
  filter:drop-shadow(0 2px 5px rgba(0,0,0,.62));
}
.rf-video-watermark--top-left{top:3%;left:3%}
.rf-video-watermark--top-right{top:3%;right:3%}
.rf-video-watermark--bottom-left{bottom:58px;left:3%}
.rf-video-watermark--bottom-right{bottom:58px;right:3%}

/* Keep watermark inside fullscreen whenever the browser supports element fullscreen. */
.player-frame:fullscreen .rf-video-watermark,
.player-frame:-webkit-full-screen .rf-video-watermark{
  display:block!important;
  position:absolute!important;
  z-index:2147483646!important;
}

@media (max-width:768px){
  .rf-video-watermark{width:clamp(62px,18%,118px);max-height:16%;opacity:.70}
  .rf-video-watermark--top-left{top:10px;left:10px}
  .rf-video-watermark--top-right{top:10px;right:10px}
  .rf-video-watermark--bottom-left{bottom:48px;left:10px}
  .rf-video-watermark--bottom-right{bottom:48px;right:10px}
}

/* v12: desktop fullscreen must stay on .player-frame so HTML watermark never drops out. */
/* v13: fullscreen stays on .player-frame; exit via Esc, browser Back, or double-click. */
/* Chromium/WebKit: remove the video's own fullscreen control. Using that control
   fullscreenes only <video>, which cannot include the sibling watermark image. */
@media (min-width:769px){
  #player::-webkit-media-controls-fullscreen-button{display:none!important}
  #player::-webkit-media-controls-toggle-closed-captions-button{ }
}

/* Keep watermark above native media control painting while the frame itself is fullscreen. */
.player-frame:fullscreen .rf-video-watermark,
.player-frame:-webkit-full-screen .rf-video-watermark{
  visibility:visible!important;
  opacity:.78!important;
  transform:translateZ(0);
  will-change:transform;
}
