/* ============ YPlayer ============ */
.yp { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 18px; overflow: hidden; outline: none; color: #fff; user-select: none; -webkit-tap-highlight-color: transparent; box-shadow: 0 30px 80px -20px rgba(40, 0, 40, .55); }
.yp { touch-action: manipulation; }
.yp.is-fs { border-radius: 0; aspect-ratio: auto; height: 100%; }
.yp-stage, .yp-stage video, .yp-embed, .yp-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yp-stage video { object-fit: contain; background: #000; }
.yp-embed iframe { pointer-events: none; }
.yp:not(.started) .yp-stage { opacity: 0; }

/* Poster */
.yp-poster { position: absolute; inset: 0; z-index: 6; background: #160a17; display: grid; place-items: center; cursor: pointer; isolation: isolate; overflow: hidden; }
.yp-poster-blur, .yp-poster-img { position: absolute; inset: 0; background: center/cover no-repeat; }
.yp-poster-blur { inset: -24px; z-index: -2; filter: blur(22px) brightness(.55); }
.yp-poster-img { z-index: -1; background-size: contain; }
.yp-poster::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(20, 0, 20, .15), rgba(20, 0, 20, .7)); }
.yp-poster-title { position: absolute; left: 28px; right: 28px; bottom: 24px; z-index: 1; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.yp-poster-title h3 { font-size: clamp(16px, 2.4vw, 26px); }
.yp-poster-title p { opacity: .8; font-size: 14px; margin-top: 4px; }
.yp-bigplay { position: relative; z-index: 1; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #c81a53, #703171); box-shadow: 0 0 0 10px rgba(255, 255, 255, .14), 0 18px 40px rgba(200, 26, 83, .5); transition: transform .2s, box-shadow .2s; }
.yp-bigplay .ic { margin-left: 5px; }
.yp-poster:hover .yp-bigplay { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(255, 255, 255, .18), 0 22px 50px rgba(200, 26, 83, .6); }

/* Overlay chrome */
.yp-top, .yp-bottom { position: absolute; left: 0; right: 0; z-index: 4; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.yp-top { top: 0; padding: 16px 20px 40px; background: linear-gradient(180deg, rgba(0, 0, 0, .7), transparent); display: flex; align-items: center; gap: 10px; transform: translateY(-6px); }
.yp-top-title { flex: 1; min-width: 0; opacity: 0; }
.yp.is-fs .yp-top-title, .yp.is-theater .yp-top-title { opacity: 1; }
.yp-top-title h3 { font-size: 16px; } .yp-top-title p { font-size: 12.5px; opacity: .75; }
.yp-live .yp-top { opacity: 1; }
.yp-viewers { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; background: rgba(0, 0, 0, .5); padding: 3px 10px; border-radius: 99px; }
.yp-bottom { bottom: 0; padding: 50px 14px 10px; background: linear-gradient(0deg, rgba(10, 0, 12, .85) 0%, rgba(10, 0, 12, .4) 55%, transparent); transform: translateY(6px); }
.yp.started.show-ui .yp-top, .yp.started.show-ui .yp-bottom, .yp.started.is-paused .yp-top, .yp.started.is-paused .yp-bottom { opacity: 1; transform: none; pointer-events: auto; }
.yp.started:not(.show-ui):not(.is-paused) { cursor: none; }

/* Seek bar */
.yp-seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; margin: 0 6px 2px; }
.yp-live .yp-seek { pointer-events: none; }
.yp-seek-track { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); transition: height .15s; }
.yp-seek:hover .yp-seek-track, .yp-seek.dragging .yp-seek-track { height: 6px; }
.yp-seek-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.yp-buf { background: rgba(255, 255, 255, .35); }
.yp-hov { background: rgba(255, 255, 255, .25); }
.yp-cur { background: linear-gradient(90deg, #c81a53, #e2557f); box-shadow: 0 0 12px rgba(226, 85, 127, .6); }
.yp-thumb { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(200, 26, 83, .45); transform: scale(0); transition: transform .15s; }
.yp-seek:hover .yp-thumb, .yp-seek.dragging .yp-thumb { transform: scale(1); }
.yp-tip { position: absolute; bottom: 22px; transform: translateX(-50%); background: rgba(20, 6, 22, .92); padding: 4px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .15s; pointer-events: none; white-space: nowrap; }
.yp-seek:hover .yp-tip, .yp-seek.dragging .yp-tip { opacity: 1; }

/* Controls */
.yp-controls { display: flex; align-items: center; gap: 2px; }
.yp-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; opacity: .92; transition: background .15s, opacity .15s, transform .1s; }
.yp-btn:hover { background: rgba(255, 255, 255, .14); opacity: 1; }
.yp-btn:active { transform: scale(.92); }
.yp-speed-btn { width: auto; padding: 0 10px; border-radius: 99px; font-weight: 700; font-size: 13px; }
.yp-vol { display: flex; align-items: center; }
.yp-vol-range { -webkit-appearance: none; appearance: none; width: 0; opacity: 0; height: 4px; border-radius: 4px; background: linear-gradient(90deg, #fff var(--p, 100%), rgba(255, 255, 255, .3) var(--p, 100%)); transition: width .2s, opacity .2s, margin .2s; cursor: pointer; }
.yp-vol:hover .yp-vol-range, .yp-vol-range:focus { width: 80px; opacity: 1; margin: 0 10px 0 4px; }
.yp-vol-range::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.yp-vol-range::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.yp-time { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; padding: 0 8px; opacity: .95; white-space: nowrap; }
.yp-sep { opacity: .55; }
.yp-live .yp-time, .yp-live .yp-back, .yp-live .yp-fwd, .yp-live .yp-speed-btn { display: none; }

/* Menu */
.yp-menu { position: absolute; right: 14px; bottom: 70px; z-index: 8; min-width: 220px; max-height: 70%; overflow-y: auto; background: rgba(22, 10, 25, .94); backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 6px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); animation: ypPop .16s ease-out; }
@keyframes ypPop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.yp-menu-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 10px 12px 4px; }
.yp-menu button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 9px; font-size: 14px; color: #fff; text-align: left; }
.yp-menu button:hover { background: rgba(255, 255, 255, .08); }
.yp-menu button.on { color: #ff8db0; font-weight: 600; }
.yp-menu-note { font-size: 12px; opacity: .7; padding: 6px 12px 10px; line-height: 1.6; }

/* Feedback layers */
.yp-spinner { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .2s; }
.yp.is-loading.started .yp-spinner { opacity: 1; }
.yp-spinner div { width: 56px; height: 56px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .18); border-top-color: #e2557f; animation: spin .8s linear infinite; }
.yp-qnote { position: absolute; left: 50%; top: 18px; z-index: 6; transform: translate(-50%, -8px); max-width: calc(100% - 32px); padding: 7px 14px; border-radius: 99px; background: rgba(0, 0, 0, .72); color: #fff; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.yp-qnote.on { opacity: 1; transform: translate(-50%, 0); }
.yp-flash { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.yp-flash span { width: 76px; height: 76px; border-radius: 50%; background: rgba(0, 0, 0, .5); display: grid; place-items: center; opacity: 0; }
.yp-flash.on span { animation: ypFlash .55s ease-out; }
@keyframes ypFlash { 0% { opacity: 1; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.35); } }
.yp-ripple { position: absolute; top: 0; bottom: 0; width: 40%; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: none; opacity: 0; background: rgba(255, 255, 255, .14); font-size: 13px; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); transition: opacity .25s; }
.yp-ripple.l { left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0; }
.yp-ripple.r { right: 0; border-radius: 50% 0 0 50% / 50% 0 0 50%; }
.yp-ripple.on { opacity: 1; transition: none; }
.yp-ripple::before { content: ''; position: absolute; top: 50%; width: 70%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .22); transform: translateY(-50%) scale(0); opacity: 0; }
.yp-ripple.l::before { left: 15%; } .yp-ripple.r::before { right: 15%; }
.yp-ripple.on::before { animation: ypRing .55s ease-out; }
@keyframes ypRing { from { transform: translateY(-50%) scale(.2); opacity: 1; } to { transform: translateY(-50%) scale(1.25); opacity: 0; } }
/* Three arrows lighting up in turn (point left for rewind) */
.yp-arrows { display: flex; gap: 2px; }
.yp-arrows i { width: 0; height: 0; border-top: 9px solid transparent; border-bottom: 9px solid transparent; border-left: 13px solid #fff; opacity: .25; }
.yp-ripple.l .yp-arrows { flex-direction: row-reverse; }
.yp-ripple.l .yp-arrows i { border-left: 0; border-right: 13px solid #fff; }
.yp-ripple.on .yp-arrows i { animation: ypArrow .75s linear; }
.yp-ripple.on .yp-arrows i:nth-child(2) { animation-delay: .12s; }
.yp-ripple.on .yp-arrows i:nth-child(3) { animation-delay: .24s; }
@keyframes ypArrow { 0%, 100% { opacity: .25; } 30% { opacity: 1; } }
.yp-kbd { position: absolute; top: 14%; left: 50%; transform: translateX(-50%); z-index: 7; background: rgba(0, 0, 0, .65); padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: 15px; }
.yp-error { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(10, 0, 12, .85); text-align: center; padding: 24px; }
.yp-error.hidden { display: none; }
.yp-resume { position: absolute; left: 20px; bottom: 80px; z-index: 8; background: rgba(22, 10, 25, .92); backdrop-filter: blur(12px); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; animation: ypPop .2s; border: 1px solid rgba(255, 255, 255, .08); }
.yp-resume .btn:not(.btn-primary) { background: rgba(255, 255, 255, .12); color: #fff; }
.yp-upnext { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(10, 0, 12, .72); backdrop-filter: blur(6px); }
.yp-upnext-card { display: flex; flex-direction: column; gap: 12px; max-width: 380px; padding: 20px; }
.yp-upnext-card small { opacity: .75; }
.yp-upnext-thumb { width: 140px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; }
.yp-upnext-card h4 { font-size: 16px; }
.yp-upnext .btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; }
.yp-ring { position: absolute; width: 0; height: 0; }

@media (max-width: 640px) {
  .yp { border-radius: 0; }
  .yp-back, .yp-fwd, .yp-theater, .yp-vol-range { display: none; }
  .yp-btn { width: 38px; height: 38px; }
  .yp-bigplay { width: 64px; height: 64px; }
  .yp-upnext-thumb { width: 100px; }
}

/* ============ Watch page ============ */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.watch.theater { grid-template-columns: 1fr; }
.watch.theater .watch-side { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.watch-player-wrap { position: relative; }
.watch.theater .watch-player-wrap { margin: -24px -28px 0; background: #000; }
.watch.theater .yp { border-radius: 0; max-height: calc(100vh - var(--topbar-h)); aspect-ratio: 16/9; margin: 0 auto; box-shadow: none; }
.watch-ambient { position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center; filter: blur(70px) saturate(1.6); opacity: .35; border-radius: 40px; pointer-events: none; }
:root[data-theme="dark"] .watch-ambient { opacity: .45; }
.watch.theater .watch-ambient { display: none; }
.watch-info { margin-top: 18px; }
.watch-info h1 { font-size: 22px; }
.watch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.watch-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.watch-actions .btn { height: 40px; }
.watch-actions .btn.liked { background: #fde8ef; color: var(--magenta); }
:root[data-theme="dark"] .watch-actions .btn.liked { background: #3a1626; color: #ff8db0; }
.watch-desc { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--surface-2); white-space: pre-wrap; font-size: 14px; }
.watch-desc.collapsed { max-height: 120px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
.watch-side h3 { margin-bottom: 12px; }
.up-item { display: flex; gap: 12px; padding: 8px; border-radius: 12px; color: inherit; transition: background .15s; cursor: pointer; }
.up-item:hover { background: var(--surface-2); }
.up-item.current { background: var(--violet-50); }
.up-item .t { position: relative; width: 168px; flex: none; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.up-item .t img { width: 100%; height: 100%; object-fit: cover; }
/* Class posters are 9:16 */
.up-item .t.tall { width: 72px; aspect-ratio: 9/16; }
.up-item .t .dur { position: absolute; right: 5px; bottom: 5px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; }
.up-item .t .now { position: absolute; inset: 0; background: rgba(112, 49, 113, .65); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.up-item .t .lock { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; }
.up-item h4 { font-size: 14px; font-weight: 600; }
.up-item p { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.playlist { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin-bottom: 20px; }
.playlist-head { padding: 14px 16px; background: var(--grad); color: #fff; }
.playlist-head small { opacity: .85; }
.playlist-body { max-height: 460px; overflow-y: auto; padding: 6px; }
.day-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 8px 4px; }
@media (max-width: 1100px) { .watch { grid-template-columns: 1fr; } .watch-side { margin-top: 8px; } }
@media (max-width: 640px) {
  .watch-player-wrap { margin: -16px -16px 0; }
  .watch.theater .watch-player-wrap { margin: -16px -16px 0; }
  .up-item .t { width: 140px; }
  .watch-actions { margin-left: 0; width: 100%; }
}
.main { overflow-x: clip; }

/* Portrait player (Glow Break) */
.yp.yp-portrait { aspect-ratio: 9/16; width: min(100%, calc(72vh * 9 / 16)); margin: 0 auto; border-radius: 20px; }
.yp.yp-portrait.is-fs { width: 100%; aspect-ratio: auto; border-radius: 0; }
.yp.yp-portrait .yp-stage video { object-fit: cover; }
.yp.yp-portrait.is-fs .yp-stage video { object-fit: contain; }
.yp.yp-portrait .yp-theater, .yp.yp-portrait .yp-pip, .yp.yp-portrait .yp-vol-range, .yp.yp-portrait .yp-back, .yp.yp-portrait .yp-fwd { display: none; }
.yp.yp-portrait .yp-poster-title { left: 18px; right: 18px; }
.modal:has(.yp-portrait) { max-width: 440px; }
.modal:has(.yp-portrait) h3 { text-align: center; }
@media (max-width: 960px) { .modal:has(.yp-portrait) { max-width: 100%; } .yp.yp-portrait { width: min(100%, calc(70vh * 9 / 16)); } }

/* Edge-to-edge fullscreen used when the Fullscreen API isn't available (iPhone) or a rotation wasn't a tap */
.yp.yp-pseudo-fs { position: fixed; inset: 0; z-index: 500; width: 100vw; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; margin: 0; box-shadow: none; }
.yp.is-fs .yp-stage video { object-fit: contain; }
.yp.is-fs .yp-bottom { padding-bottom: max(10px, env(safe-area-inset-bottom)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.yp.is-fs .yp-top { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.yp.is-fs .yp-top-title { opacity: 1; }
html.yp-noscroll, html.yp-noscroll body { overflow: hidden; overscroll-behavior: none; }
/* Smooth hand-off while the device rotates */
.yp { transition: border-radius .25s ease; }
@media (orientation: landscape) and (pointer: coarse) { .yp.is-fs .yp-btn { width: 44px; height: 44px; } }

/* Center on-screen controls: −10s · play/pause · +10s (shown with the rest of the controls) */
.yp-center { position: absolute; left: 50%; top: 50%; z-index: 4; transform: translate(-50%, -50%); display: flex; align-items: center; gap: clamp(24px, 9vw, 72px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.yp.started.show-ui .yp-center, .yp.started.is-paused .yp-center { opacity: 1; }
/* Only the buttons take taps; the space between them still counts as the video (double-tap to seek). */
.yp.started.show-ui .yp-cbtn, .yp.started.is-paused .yp-cbtn { pointer-events: auto; }
.yp-cbtn { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .45); backdrop-filter: blur(4px); transition: transform .15s, background .15s; }
.yp-cbtn:hover { background: rgba(0, 0, 0, .65); }
.yp-cbtn:active { transform: scale(.9); }
.yp-c-play { width: 68px; height: 68px; background: linear-gradient(135deg, rgba(200, 26, 83, .9), rgba(112, 49, 113, .9)); }
.yp.is-loading .yp-c-play { visibility: hidden; }
@media (max-width: 600px) { .yp-cbtn { width: 44px; height: 44px; } .yp-c-play { width: 58px; height: 58px; } }

/* Mini player (scrolled out of view while playing) — draggable, snaps to a side */
.yp-mini-bar { display: none; }
.yp.yp-mini { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: min(340px, 56vw); height: auto; aspect-ratio: 16/9; border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); cursor: grab; touch-action: none; transition: left .2s ease, box-shadow .2s; animation: ypMiniIn .2s ease-out; }
.yp.yp-mini.yp-portrait { width: min(170px, 34vw); aspect-ratio: 9/16; }
.yp.yp-mini.yp-dragging { cursor: grabbing; transition: none; box-shadow: 0 22px 50px rgba(0, 0, 0, .55); }
.yp.yp-mini .yp-top, .yp.yp-mini .yp-bottom, .yp.yp-mini .yp-c-back, .yp.yp-mini .yp-c-fwd, .yp.yp-mini .yp-qnote, .yp.yp-mini .yp-upnext { display: none; }
.yp.yp-mini .yp-center { display: none; }
.yp-mini-ctl, .yp-mini-prog { display: none; }
.yp.yp-mini .yp-mini-ctl { display: flex; position: absolute; inset: 0; z-index: 6; align-items: center; justify-content: center; gap: 14px; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .2s; }
.yp.yp-mini .yp-mini-ctl .yp-m-play { width: 40px; height: 40px; background: linear-gradient(135deg, rgba(200, 26, 83, .9), rgba(112, 49, 113, .9)); }
.yp.yp-mini.show-ui .yp-mini-ctl, .yp.yp-mini.is-paused .yp-mini-ctl, .yp.yp-mini:hover .yp-mini-ctl { opacity: 1; }
.yp.yp-mini.yp-dragging .yp-mini-ctl { opacity: 0; }
.yp.yp-mini .yp-mini-prog { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 7; background: rgba(255, 255, 255, .25); pointer-events: none; }
.yp-mini-prog i { display: block; height: 100%; width: 0; background: var(--magenta, #c81a53); }
.yp.yp-mini .yp-mini-bar { display: flex; position: absolute; top: 6px; right: 6px; z-index: 7; gap: 6px; opacity: 0; transition: opacity .2s; }
.yp.yp-mini.show-ui .yp-mini-bar, .yp.yp-mini.is-paused .yp-mini-bar, .yp.yp-mini:hover .yp-mini-bar { opacity: 1; }
.yp-mini-btn { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, .6); }
@media (max-width: 960px) { .yp.yp-mini { bottom: 80px; } }
@keyframes ypMiniIn { from { opacity: 0; transform: scale(.85); } }
/* Hidden mini controls must not catch taps; the first tap reveals them. */
.yp.yp-mini .yp-mini-ctl button { pointer-events: none; }
.yp.yp-mini.show-ui .yp-mini-ctl button, .yp.yp-mini.is-paused .yp-mini-ctl button { pointer-events: auto; }
