@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

.player-shell{
  --p-bg:       #0a0a0a;
  --p-bar:      #111;
  --p-surface:  #161616;
  --p-border:   rgba(255,255,255,0.07);
  --p-text:     #f0f0f0;
  --p-muted:    #4a4a4a;
  --p-ease:     cubic-bezier(0.4,0,0.2,1);
  --p-spring:   cubic-bezier(0.34,1.56,0.64,1);
  --p-font:     'DM Sans', system-ui, sans-serif;
  --p-r:        10px;
}

.player-shell{
  background:var(--p-bar);
  border-radius:var(--p-r);
  overflow:hidden;
  box-shadow:0 24px 80px rgba(0,0,0,0.85),0 0 0 1px rgba(255,255,255,0.04);
  font-family:var(--p-font);
  user-select:none;
  display:flex;
  flex-direction:column;
}

/* ── VIDEO AREA ── */
.video-wrap{
  position:relative;
  background:#000;
  aspect-ratio:16/9;
  width:100%;
  cursor:pointer;
  flex-shrink:0;
}
.video-wrap.hide-cursor{cursor:none}
.video-wrap video{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.video-placeholder{
  position:absolute;inset:0;
  display:flex;flex-direction:column;
  align-items:center;justify-content:center;
  gap:8px;pointer-events:none;
}
.video-placeholder p{font-size:10.5px;color:var(--p-muted);letter-spacing:0.09em;text-transform:uppercase}

/* Source corner button stays inside video */
.source-corner{
  position:absolute;
  bottom:14px;
  right:14px;
  z-index:18;
  opacity:0;
  transition:opacity 0.18s var(--p-ease);
  pointer-events:none;
}
.video-wrap:hover .source-corner{opacity:1;pointer-events:all}
.source-corner-btn{
  background:rgba(0,0,0,0.52);
  border:1px solid rgba(255,255,255,0.10);
  border-radius:6px;
  color:rgba(255,255,255,0.6);
  cursor:pointer;
  padding:5px 8px;
  display:flex;align-items:center;justify-content:center;
  backdrop-filter:blur(14px);
  transition:background 0.12s,color 0.12s,border-color 0.12s;
}
.source-corner-btn:hover{background:rgba(0,0,0,0.72);color:#fff;border-color:rgba(255,255,255,0.18)}

/* ── PROGRESS BAR — overlaid above the controls bar ── */
.scrubber-wrap{
  position:absolute;
  left:0; right:0; bottom:40px;
  height:22px;
  display:flex;
  align-items:center;
  cursor:pointer;
  z-index:10;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 100%);
  transition: opacity 0.2s var(--p-ease);
}
/* scrubber lives inside video-wrap only */
.video-wrap .scrubber-wrap { display:flex; }
.player-shell > .scrubber-wrap { display:none !important; }

.scrubber-track{
  position:relative;width:100%;height:3px;
  background:rgba(255,255,255,0.25);
  border-radius:99px;
  transition:height 0.15s var(--p-ease);
  margin: 0 14px;
}
.scrubber-wrap:hover .scrubber-track{height:5px}
.scrubber-fill{
  position:absolute;left:0;top:0;bottom:0;
  background:#fff;
  border-radius:99px;pointer-events:none;width:0%;
  will-change:width;
}
.scrubber-buffered{
  position:absolute;left:0;top:0;bottom:0;
  background:rgba(255,255,255,0.22);
  border-radius:99px;pointer-events:none;width:0%;
  will-change:width;
}
.scrubber-thumb{
  position:absolute;top:50%;
  transform:translate(-50%,-50%) scale(0);
  width:13px;height:13px;border-radius:50%;
  background:#fff;pointer-events:none;
  transition:transform 0.12s var(--p-spring);
  box-shadow:0 1px 5px rgba(0,0,0,0.7);
  will-change:transform,left;
}
.scrubber-wrap:hover .scrubber-thumb{transform:translate(-50%,-50%) scale(1)}
.scrubber-tooltip{
  position:absolute;bottom:26px;
  background:rgba(6,6,6,0.96);
  border:1px solid rgba(255,255,255,0.09);
  border-radius:4px;padding:3px 6px;
  font-size:10px;color:#fff;
  white-space:nowrap;pointer-events:none;opacity:0;
  transform:translateX(-50%) translateY(4px);
  transition:opacity 0.09s var(--p-ease),transform 0.09s var(--p-ease);
}
.scrubber-wrap:hover .scrubber-tooltip{opacity:1;transform:translateX(-50%) translateY(0)}
.scrubber-input{
  position:absolute;inset:-6px 0;width:100%;
  opacity:0;cursor:pointer;z-index:2;
}

/* ── TITLE BAR — overlaid at the top of the video ── */
.player-titlebar {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 28px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 100%);
  pointer-events: none;
}
.player-titlebar-center {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  letter-spacing: -0.01em;
  pointer-events: none;
}
.player-titlebar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  pointer-events: all;
}

/* ── CONTROLS BAR — overlaid at the bottom of the video ── */
.controls-chrome {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 17;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 28px 6px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
  pointer-events: all;
}

/* Only show controls when inside video-wrap */
.video-wrap .controls-chrome { display: flex; }
.player-shell > .controls-chrome { display: none !important; }
.player-shell > .scrubber-wrap  { display: none !important; }

.ctrl-row{
  display:flex;
  align-items:center;
  width: 100%;
  justify-content: space-between;
}
.ctrl-left{
  display:flex;
  align-items:center;
  gap: 12px;
  flex:1;
}
.ctrl-right{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-direction:row;
  flex-shrink: 0;
}

/* Re-order right controls */
.ctrl-right .source-wrap { order: 1; }
.ctrl-right #sourceBtn { order: 1; }
.ctrl-right #pipBtn { order: 2; }
.ctrl-right .settings-wrap { order: 3; }
.ctrl-right #settingsBtn { order: 3; }
.ctrl-right #fullscreenBtn { order: 4; }

/* Language indicator - hidden */
.language-indicator {
  display: none;
}

.player-shell .time-display{
  position:absolute;
  bottom:52px;
  right:14px;
  font-size:11px;
  color:rgba(255,255,255,0.75);
  white-space:nowrap;
  letter-spacing:0.01em;
  font-variant-numeric:tabular-nums;
  pointer-events:none;
  z-index:11;
  text-shadow:0 1px 4px rgba(0,0,0,0.8);
}
.player-shell .time-display span{color:rgba(255,255,255,0.9)}

.ctrl-btn{
  background:none;border:none;
  color:rgba(255,255,255,0.7);
  cursor:pointer;padding:8px;border-radius:7px;
  display:flex;align-items:center;justify-content:center;
  transition:background 0.1s,color 0.1s,transform 0.09s var(--p-spring);
}
.ctrl-btn:hover{background:rgba(255,255,255,0.09);color:#fff}
.ctrl-btn:active{transform:scale(0.83)}
.ctrl-btn.active{color:#fff}

.ctrl-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
}

.vol-group{
  display:flex;align-items:center;
  overflow:hidden;
  max-width:30px;
  transition:max-width 0.22s var(--p-ease);
}
.vol-group:hover,.vol-group:focus-within{max-width:116px}
.vol-group .ctrl-btn{flex-shrink:0}
.vol-slider-wrap{
  width:62px;
  padding:0 6px 0 2px;
  display:flex;
  align-items:center;
  flex-shrink:0;
}
.vol-slider{
  width:100%;
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
  background:transparent;
  height:18px;
  display:block;
  --vol-pct:100%;
}
.vol-slider::-webkit-slider-container{align-items:center}
.vol-slider::-webkit-slider-runnable-track{
  height:3px;
  border-radius:99px;
  background:linear-gradient(to right,rgba(255,255,255,0.9) var(--vol-pct),rgba(255,255,255,0.2) var(--vol-pct));
}
.vol-slider::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:12px;
  height:12px;
  border-radius:50%;
  background:#fff;
  margin-top:-4.5px;
  box-shadow:0 1px 4px rgba(0,0,0,0.6);
  transition:transform 0.1s var(--p-spring);
  cursor:pointer;
}
.vol-slider::-webkit-slider-thumb:hover{transform:scale(1.3)}
.vol-slider::-moz-range-track{
  height:3px;
  border-radius:99px;
  background:rgba(255,255,255,0.2);
}
.vol-slider::-moz-range-progress{
  height:3px;
  border-radius:99px;
  background:rgba(255,255,255,0.9);
}
.vol-slider::-moz-range-thumb{
  width:12px;
  height:12px;
  border-radius:50%;
  background:#fff;
  border:none;
  box-shadow:0 1px 4px rgba(0,0,0,0.6);
  cursor:pointer;
}

.speed-wrap{position:relative}
.speed-pill{
  background:none;
  border:1px solid rgba(255,255,255,0.1);
  border-radius:5px;
  color:rgba(255,255,255,0.55);
  font-family:var(--p-font);
  font-size:11px;font-weight:500;
  letter-spacing:0.04em;
  padding:4px 8px;cursor:pointer;
  transition:border-color 0.1s,background 0.1s,color 0.1s;
}
.speed-pill:hover{border-color:rgba(255,255,255,0.25);background:rgba(255,255,255,0.06);color:#fff}

.speed-popup,.settings-popup{
  position:absolute;bottom:calc(100% + 7px);right:0;
  background:rgba(12,12,12,0.98);
  border:1px solid rgba(255,255,255,0.09);
  border-radius:8px;padding:4px;
  z-index:20;
  opacity:0;transform:translateY(6px) scale(0.93);pointer-events:none;
  transition:opacity 0.12s var(--p-ease),transform 0.12s var(--p-ease);
  backdrop-filter:blur(24px);
  display:flex;flex-direction:column;gap:1px;
}
.speed-popup{min-width:86px}
.settings-popup{min-width:180px}
.speed-popup.open,.settings-popup.open{opacity:1;transform:translateY(0) scale(1);pointer-events:all}

.settings-header {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.settings-opt {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-family: var(--p-font);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  transition: background 0.09s, color 0.09s;
}
.settings-opt:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.settings-opt-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.settings-opt-label svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.settings-opt-value {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
}
.settings-opt-chevron {
  opacity: 0.4;
  transition: opacity 0.09s;
  flex-shrink: 0;
}
.settings-opt:hover .settings-opt-chevron {
  opacity: 0.8;
}

.settings-sub {
  position: absolute;
  bottom: 0;
  right: 100%;
  margin-right: 4px;
  background: rgba(12,12,12,0.98);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 8px;
  padding: 4px;
  min-width: 160px;
  z-index: 21;
  opacity: 0;
  transform: translateX(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.12s var(--p-ease), transform 0.12s var(--p-ease);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.settings-sub.open {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: all;
}
.settings-sub-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
  cursor: pointer;
  transition: color 0.09s;
}
.settings-sub-header:hover {
  color: rgba(255,255,255,0.9);
}
.settings-sub-header svg {
  width: 14px;
  height: 14px;
}

.sub-opt {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-family: var(--p-font);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  transition: background 0.09s, color 0.09s;
}
.sub-opt:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sub-opt.active {
  color: #8b78e8;
}
.sub-opt.active::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8b78e8;
  flex-shrink: 0;
}

.settings-section {
  padding: 4px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.settings-section:first-child {
  border-top: none;
}

.subtitle-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.subtitle-opt {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-family: var(--p-font);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.09s, color 0.09s;
}
.subtitle-opt:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.subtitle-opt.active {
  color: #8b78e8;
  background: rgba(139,120,232,0.1);
}

.source-popup{
  position:absolute;bottom:calc(100% + 7px);right:0;
  background:rgba(12,12,12,0.98);
  border:1px solid rgba(255,255,255,0.09);
  border-radius:10px;padding:4px;
  display:flex;flex-direction:column;gap:1px;
  min-width:215px;max-width:285px;max-height:235px;
  overflow-y:auto;z-index:9999;
  opacity:0;transform:translateY(6px) scale(0.94);pointer-events:none;
  transition:opacity 0.13s var(--p-ease),transform 0.13s var(--p-ease);
  backdrop-filter:blur(24px);
}
.source-popup.open{opacity:1;transform:translateY(0) scale(1);pointer-events:all}
.source-popup-header{
  font-size:9px;letter-spacing:0.2em;text-transform:uppercase;
  color:var(--p-muted);padding:5px 10px;
  border-bottom:1px solid var(--p-border);margin-bottom:3px;
}
.source-opt{
  background:none;border:none;
  color:rgba(255,255,255,0.6);
  font-family:var(--p-font);font-size:11px;
  padding:7px 10px;border-radius:6px;
  cursor:pointer;text-align:left;
  display:flex;align-items:center;gap:8px;width:100%;
  transition:background 0.09s,color 0.09s;
}
.source-opt:hover{background:rgba(255,255,255,0.06);color:#fff}
.source-opt.active{color:#fff}
.source-cloud-icon{flex-shrink:0;width:14px;height:14px;color:var(--p-muted)}
.source-opt:hover .source-cloud-icon,.source-opt.active .source-cloud-icon{color:rgba(255,255,255,0.7)}
.source-opt-info{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}
.source-opt-name{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.source-opt-meta{font-size:9px;letter-spacing:0.06em;color:var(--p-muted)}
.source-active-dot{
  width:4px;height:4px;border-radius:50%;
  background:#fff;flex-shrink:0;opacity:0;margin-left:auto;
}
.source-opt.active .source-active-dot{opacity:1}
.source-empty{font-size:10px;color:var(--p-muted);padding:14px 10px;text-align:center}

.center-flash{
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  pointer-events:none;opacity:0;
}
.center-flash .flash-ring{
  width:54px;height:54px;border-radius:50%;
  background:rgba(255,255,255,0.07);
  border:1px solid rgba(255,255,255,0.16);
  display:flex;align-items:center;justify-content:center;
  backdrop-filter:blur(10px);
}
.center-flash.pop{animation:p-flash-pop 0.45s var(--p-spring) forwards}
@keyframes p-flash-pop{
  0%{opacity:0;transform:scale(0.6)}
  28%{opacity:1;transform:scale(1.06)}
  55%{opacity:0.75;transform:scale(1)}
  100%{opacity:0;transform:scale(1.03)}
}

.loading-overlay{
  position:absolute;inset:0;
  background:rgba(0,0,0,0.6);
  backdrop-filter:blur(4px);
  display:flex;flex-direction:column;
  align-items:center;justify-content:center;
  gap:10px;z-index:15;
}
.player-shell .spinner{
  width:22px;height:22px;
  border:1.5px solid rgba(255,255,255,0.08);
  border-top-color:rgba(255,255,255,0.9);
  border-radius:50%;animation:p-spin 0.65s linear infinite;
}
@keyframes p-spin{to{transform:rotate(360deg)}}
.loading-overlay p{font-size:10.5px;color:rgba(255,255,255,0.4);letter-spacing:0.13em;text-transform:uppercase}

.seek-loading{
  position:absolute;inset:0;
  background:rgba(0,0,0,0.35);
  display:flex;align-items:center;justify-content:center;
  flex-direction:column;gap:10px;
  z-index:16;pointer-events:none;opacity:0;
  transition:opacity 0.15s var(--p-ease);
}
.seek-loading.visible{opacity:1}
.seek-spinner{
  width:32px;height:32px;
  border:2px solid rgba(255,255,255,0.1);
  border-top-color:rgba(255,255,255,0.95);
  border-radius:50%;animation:p-spin 0.5s linear infinite;
}
.seek-loading p{font-size:10.5px;color:rgba(255,255,255,0.5);letter-spacing:0.09em;text-transform:uppercase}

.video-wrap video::cue{
  background:rgba(0,0,0,0.82);
  color:#fff;
  font-family:var(--p-font);
  font-size:1em;
  line-height:1.4;
  border-radius:3px;
  padding:0.1em 0.3em;
}

.info-overlay{
  position:absolute;
  left:0;right:0;bottom:0;
  padding:0 18px 14px;
  pointer-events:none;
  z-index:12;
  opacity:0;
  transition:opacity 0.5s var(--p-ease);
  will-change:opacity;
  background:linear-gradient(to top,rgba(0,0,0,0.82) 0%,rgba(0,0,0,0.38) 52%,transparent 100%);
}
.info-overlay.visible{opacity:1}
.info-overlay-tag{
  font-size:9.5px;
  letter-spacing:0.16em;
  text-transform:uppercase;
  color:rgba(255,255,255,0.4);
  margin-bottom:6px;
  font-weight:500;
}
.info-overlay-title{
  font-size:clamp(20px,3.5vw,36px);
  font-weight:700;
  color:#fff;
  line-height:1.05;
  letter-spacing:-0.02em;
  margin-bottom:6px;
  text-shadow:0 2px 16px rgba(0,0,0,0.7);
}
.info-overlay-meta{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:11px;
  color:rgba(255,255,255,0.55);
  margin-bottom:8px;
  flex-wrap:wrap;
}
.info-overlay-meta-sep{
  width:2px;height:2px;border-radius:50%;
  background:rgba(255,255,255,0.28);
  flex-shrink:0;
}
.info-overlay-desc{
  font-size:11.5px;
  color:rgba(255,255,255,0.58);
  line-height:1.55;
  max-width:480px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  line-clamp:2;
  overflow:hidden;
  text-shadow:0 1px 6px rgba(0,0,0,0.5);
}

/* ── FULLSCREEN ── */
.player-shell.fs-active {
  border-radius: 0;
  position: relative;
}
.player-shell.fs-active .video-wrap {
  aspect-ratio: unset;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Hide when idle in fullscreen */
.player-shell.fs-active.fs-controls-hidden .player-titlebar,
.player-shell.fs-active.fs-controls-hidden .controls-chrome {
  opacity: 0; pointer-events: none;
}
.player-shell.fs-active.fs-controls-hidden .player-titlebar { transform: translateY(-100%); }
.player-shell.fs-active.fs-controls-hidden .controls-chrome { transform: translateY(100%); }
.player-shell.fs-active.fs-controls-hidden .scrubber-wrap,
.player-shell.fs-active.fs-controls-hidden .time-display { opacity: 0; }

/* ── SVG ICON STYLING ── */
.ctrl-btn svg,
.source-corner-btn svg,
.settings-opt-label svg,
.settings-sub-header svg,
.source-cloud-icon {
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  transition: stroke 0.1s ease;
}

/* Color inheritance */
.ctrl-btn {
  color: rgba(255,255,255,0.75);
}
.ctrl-btn:hover svg,
.ctrl-btn.active svg {
  stroke: #ffffff;
}
.ctrl-btn:hover,
.ctrl-btn.active {
  color: #fff;
}

/* Force controls visibility on all pages */
.video-wrap .controls-chrome,
.video-wrap .scrubber-wrap {
  display: flex !important;
}