@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box }
html, body { width: 100%; height: 100%; background: #000; font-family: 'Inter', sans-serif; overflow: hidden }
#player { position: relative; width: 100vw; height: 100vh; background: #000; overflow: hidden; cursor: none }
#player.show-ui { cursor: default }
#video { width: 100%; height: 100%; object-fit: contain; display: block }
#video.rot-90, #video.rot-270 { position: absolute; top: 50%; left: 50%; width: 100vh; height: 100vw; max-width: none; max-height: none }
#video.rot-90 { transform: translate(-50%,-50%) rotate(90deg) }
#video.rot-270 { transform: translate(-50%,-50%) rotate(270deg) }
#video.rot-180 { transform: rotate(180deg) }
#clickZone { position: absolute; inset: 0; z-index: 2; cursor: pointer }
#topBar { position: absolute; top: 0; left: 0; right: 0; height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; z-index: 10; background: linear-gradient(to bottom, rgba(0,0,0,.85), transparent); transition: opacity .3s }
.top-L { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 }
#backBtn { background: none; border: none; color: #fff; cursor: pointer; padding: 6px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background .15s; flex-shrink: 0 }
#backBtn:hover { background: rgba(255,255,255,.12) }
#vidTitle { font-size: .95rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px }
.top-R { display: flex; align-items: center; gap: 8px; flex-shrink: 0 }
#qualBtn { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.18); color: #fff; padding: 6px 12px; border-radius: 20px; font-size: .75rem; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; transition: background .15s; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); white-space: nowrap }
#qualBtn:hover { background: rgba(255,255,255,.15) }
#qualBtn svg { width: 14px; height: 14px; fill: #fff; flex-shrink: 0 }
#qualBtn.hidden { display: none }
#qualMenu { position: absolute; top: 58px; right: 16px; z-index: 25; background: rgba(15,15,20,.96); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 6px; min-width: 150px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 8px 30px rgba(0,0,0,.6); display: none; max-height: 60vh; overflow-y: auto }
#qualMenu.on { display: block; animation: qFade .2s ease }
@keyframes qFade { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
.q-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: .8rem; color: rgba(255,255,255,.8); font-family: 'Inter', sans-serif; transition: background .12s; gap: 10px }
.q-item:hover { background: rgba(255,255,255,.08) }
.q-item.sel { color: #1fb8ff; background: rgba(31,184,255,.1) }
.q-item .q-check { font-size: .85rem; visibility: hidden; color: #1fb8ff }
.q-item.sel .q-check { visibility: visible }
.q-item .q-badge { font-size: .62rem; background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 3px; color: rgba(255,255,255,.55); margin-left: auto }
.q-item.sel .q-badge { background: rgba(31,184,255,.18); color: rgba(31,184,255,.9) }
.q-item.q-empty { color: rgba(255,255,255,.4); cursor: default; justify-content: center }
.q-item.q-empty:hover { background: none }
#bottomArea { position: absolute; bottom: 0; left: 0; right: 0; z-index: 10; background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.4) 65%, transparent 100%); padding: 0 0 8px; transition: opacity .3s }
#progWrap { padding: 12px 0 5px; cursor: pointer; position: relative; margin: 0 20px }
#progTrack { position: relative; height: 3px; background: rgba(255,255,255,.2); border-radius: 2px; transition: height .15s }
#progWrap:hover #progTrack { height: 4px }
#progBuf { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.3); border-radius: 2px; width: 0 }
#progFill { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; border-radius: 2px; width: 0 }
#progFill.live-fill { background: linear-gradient(90deg, #ff4444, #ff6b6b) }
#progThumb { position: absolute; top: 50%; width: 13px; height: 13px; background: #fff; border-radius: 50%; transform: translate(-50%,-50%) scale(0); transition: transform .15s; pointer-events: none; box-shadow: 0 0 5px rgba(0,0,0,.6) }
#progWrap:hover #progThumb { transform: translate(-50%,-50%) scale(1) }
#progTip { position: absolute; bottom: 14px; transform: translateX(-50%); background: rgba(20,20,20,.9); color: #fff; font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 4px; pointer-events: none; white-space: nowrap; opacity: 0 }
#progWrap:hover #progTip { opacity: 1 }
#btmRow { display: flex; align-items: center; justify-content: space-between; padding: 2px 16px 4px }
.bL, .bC, .bR { display: flex; align-items: center; gap: 2px }
.ibtn { background: none; border: none; color: #fff; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background .15s; flex-shrink: 0 }
.ibtn:hover { background: rgba(255,255,255,.1) }
.skip-btn { display: flex; align-items: center; gap: 3px; background: none; border: none; color: #fff; cursor: pointer; padding: 8px; border-radius: 8px; font-size: .83rem; font-weight: 700; font-family: 'Inter', sans-serif; transition: background .15s }
.skip-btn:hover { background: rgba(255,255,255,.1) }
.skip-btn svg { width: 19px; height: 19px; fill: #fff }
#timeLbl { font-size: .82rem; color: rgba(255,255,255,.9); white-space: nowrap; padding: 0 6px; letter-spacing: .02em }
#liveBadge { display: none; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: .76rem; font-weight: 700; font-family: 'Inter', sans-serif; cursor: pointer; transition: all .2s; border: none; letter-spacing: .04em }
#liveBadge.at-live { background: #e53e3e; color: #fff; animation: livePulse 2s infinite }
#liveBadge.at-live:hover { background: #c53030 }
#liveBadge.behind-live { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.18) }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(229,62,62,.5) } 70% { box-shadow: 0 0 0 8px rgba(229,62,62,0) } 100% { box-shadow: 0 0 0 0 rgba(229,62,62,0) } }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: dotBlink 1.2s ease-in-out infinite; flex-shrink: 0 }
#liveBadge.behind-live .live-dot { background: #ff6b6b; animation: none }
@keyframes dotBlink { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
#delayLbl { display: none; font-size: .72rem; font-weight: 600; color: rgba(255,150,150,.9); padding: 0 4px; white-space: nowrap }
.vol-row { display: flex; align-items: center; gap: 2px }
.vol-slide-wrap { width: 0; overflow: hidden; transition: width .25s }
.vol-row:hover .vol-slide-wrap, .vol-row:focus-within .vol-slide-wrap { width: 76px }
#volSlider { -webkit-appearance: none; appearance: none; width: 76px; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; outline: none; cursor: pointer; margin-left: 4px }
#volSlider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; cursor: pointer }
#floatCtrls { position: absolute; right: 18px; bottom: calc(104px + env(safe-area-inset-bottom, 0px)); z-index: 15; display: flex; flex-direction: column; gap: 10px; transition: opacity .3s; pointer-events: auto }
.fbtn { width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 2px 10px rgba(0,0,0,.45) }
.fbtn:hover { background: rgba(255,255,255,.2) }
#rotBtn.on { color: #1fb8ff; background: rgba(31,184,255,.22); border-color: rgba(31,184,255,.55) }
#player.hide-ui #floatCtrls { opacity: .55 }
#spinWrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 8; pointer-events: none }
#spin { width: 50px; height: 50px; border: 3px solid rgba(255,255,255,.12); border-top: 3px solid #fff; border-radius: 50%; animation: spin .75s linear infinite; display: none }
#spin.on { display: block }
@keyframes spin { to { transform: rotate(360deg) } }
#cAnim { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); pointer-events: none; opacity: 0; z-index: 9 }
#cAnim.pop { animation: cpop .55s ease forwards }
@keyframes cpop { 0% { opacity: 1; transform: translate(-50%,-50%) scale(.5) } 55% { opacity: 1; transform: translate(-50%,-50%) scale(1.15) } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.4) } }
#cAnim svg { width: 68px; height: 68px; fill: rgba(255,255,255,.85) }
.sflash { position: absolute; top: 50%; transform: translateY(-50%); pointer-events: none; opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 9 }
#sfl { left: 80px }
#sfr { right: 80px }
.sflash.pop { animation: cpop .55s ease forwards }
.sflash svg { width: 44px; height: 44px; fill: rgba(255,255,255,.85) }
.sflash span { font-size: .7rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 10px }
.hide-ui #topBar, .hide-ui #bottomArea { opacity: 0; pointer-events: none }
#toast { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.72); color: #fff; font-size: .78rem; font-weight: 500; padding: 5px 14px; border-radius: 20px; z-index: 20; pointer-events: none; opacity: 0; transition: opacity .2s; white-space: nowrap }
#toast.on { opacity: 1 }
#err { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 9; color: #fff; padding: 20px; text-align: center }
#err h3 { font-size: 1rem }
#errMsg { font-size: .82rem; color: rgba(255,255,255,.5); max-width: 420px; line-height: 1.5 }
#errRetry { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); color: #fff; padding: 8px 18px; border-radius: 8px; font-size: .8rem; cursor: pointer; font-family: 'Inter', sans-serif; margin-top: 4px; transition: background .15s }
#errRetry:hover { background: rgba(255,255,255,.18) }
@media(max-width:640px) {
  #topBar { height: 55px; padding: 0 10px }
  #vidTitle { max-width: 140px; font-size: .85rem }
  #qualBtn { padding: 5px 9px; font-size: .68rem }
  #qualBtn svg { width: 12px; height: 12px }
  #qualMenu { top: 48px; right: 10px; min-width: 130px }
  #delayLbl { display: none !important }
  #bottomArea { padding-bottom: 4px }
  #progWrap { margin: 0 10px; padding: 8px 0 4px }
  #btmRow { padding: 0 8px 2px }
  .ibtn { width: 36px; height: 36px }
  .skip-btn { font-size: .72rem; padding: 4px }
  .skip-btn svg { width: 15px; height: 19px }
  #playToggleBtn svg { width: 24px; height: 24px }
  #timeLbl { font-size: .72rem; padding: 0 2px }
  .vol-row { display: none !important }
}
