/* =====================================================================
   Video - player. The stage is always dark (it's a screen); the sidebar
   and home screen follow the system theme.
   ===================================================================== */
.app-video { background: #05060a; }
.video-root { flex: 1; min-height: 0; display: flex; position: relative; }
.video-stage {
  position: relative; flex: 1; min-width: 0; background: #000; overflow: hidden; outline: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.video-el { width: 100%; height: 100%; display: block; background: #000; }
.video-root.is-empty .video-el { visibility: hidden; }
.video-el::cue { background: rgba(0, 0, 0, .72); color: #fff; font-family: var(--font); font-size: 1.15em; line-height: 1.35; }

/* top title (fades with controls) */
.video-topbar {
  position: absolute; left: 0; right: 0; top: 0; padding: 14px 18px 30px; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent); display: flex; flex-direction: column; gap: 2px;
  font-size: 14px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); transition: opacity .25s;
}
.video-topbar:empty { display: none; }
.video-topbar small { font-size: 11.5px; font-weight: 500; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-stage.idle .video-topbar, .video-stage:not(.is-paused):not(:hover) .video-topbar { opacity: 0; }
.video-stage.has-overlay .video-topbar { display: none; }

/* controls */
.video-controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 10px; z-index: 3;
  background: linear-gradient(0deg, rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 60%, transparent);
  transition: opacity .25s, transform .25s var(--ease);
}
.video-stage.idle { cursor: none; }
.video-stage.idle .video-controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
.video-stage.has-overlay .video-controls, .video-root.is-empty .video-controls { display: none; }
.video-crow { display: flex; align-items: center; gap: 2px; min-width: 0; }
.video-cspacer { flex: 1; min-width: 4px; }
.video-cbtn {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: #fff; padding: 0; flex: 0 0 auto;
  display: inline-grid; place-items: center; cursor: pointer; transition: background .12s, transform .1s; opacity: .92;
}
.video-cbtn:hover { background: rgba(255, 255, 255, .14); opacity: 1; }
.video-cbtn:active { transform: scale(.94); }
.video-cbtn:disabled { opacity: .3; pointer-events: none; }
.video-cbtn.on { color: #c4b5fd; background: rgba(167, 139, 250, .18); }
.video-cbtn-play { width: 42px; height: 42px; border-radius: 50%; }
.video-cbtn:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 0; }
.video-speed { width: auto; min-width: 40px; padding: 0 8px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.video-time { font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: .9; padding: 0 10px; white-space: nowrap; }
.video-volwrap { display: inline-flex; align-items: center; }
.video-vol { width: 0; opacity: 0; transition: width .2s var(--ease), opacity .2s, margin .2s; margin: 0; --p: 64%; background: linear-gradient(90deg, #fff var(--p), rgba(255, 255, 255, .25) var(--p)); height: 4px; }
.video-volwrap:hover .video-vol, .video-volwrap:focus-within .video-vol { width: 84px; opacity: 1; margin: 0 6px 0 2px; }
.video-vol::-webkit-slider-thumb { width: 13px; height: 13px; }

/* seek bar */
.video-seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; margin: 0 4px 4px; touch-action: none; outline: none; }
.video-seek-track { position: relative; flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); overflow: hidden; transition: height .12s; }
.video-seek:hover .video-seek-track, .video-seek.dragging .video-seek-track, .video-seek:focus-visible .video-seek-track { height: 6px; }
.video-seek-buf, .video-seek-play { position: absolute; left: 0; top: 0; bottom: 0; width: 0; display: block; }
.video-seek-buf { background: rgba(255, 255, 255, .3); }
.video-seek-play { background: linear-gradient(90deg, #a78bfa, #c084fc); }
.video-seek-thumb {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); transform: scale(0); transition: transform .12s; display: block;
}
.video-seek:hover .video-seek-thumb, .video-seek.dragging .video-seek-thumb, .video-seek:focus-visible .video-seek-thumb { transform: scale(1); }
.video-prev {
  position: absolute; bottom: 22px; left: 0; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none;
}
.video-prev.on { display: flex; }
.video-prev-frame { display: none; width: 160px; height: 90px; border-radius: 8px; background: #000; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .8), 0 8px 24px rgba(0, 0, 0, .5); }
.video-prev.has-frame .video-prev-frame { display: block; }
.video-prev-time { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .75); }

/* flashes, osd, spinner */
.video-flash {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: #fff; opacity: 0; pointer-events: none; z-index: 2;
}
.video-flash.on { animation: video-flash .55s ease-out; }
@keyframes video-flash { 0% { opacity: .95; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.25); } }
.video-osd {
  position: absolute; top: 18px; left: 50%; transform: translate(-50%, -6px); display: inline-flex; align-items: center; gap: 8px; z-index: 4;
  padding: 8px 14px; border-radius: 20px; background: rgba(15, 15, 22, .78); font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.video-osd.on { opacity: 1; transform: translate(-50%, 0); }
.video-loading { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; z-index: 1; }
.video-loading.on { display: grid; }
.video-loading .spinner { width: 42px; height: 42px; border-width: 3px; border-color: rgba(255, 255, 255, .2); border-top-color: #fff; }

/* overlay states (home, placeholder, errors) */
.video-overlay { position: absolute; inset: 0; display: none; z-index: 5; }
.video-overlay.on { display: flex; }
.video-state {
  margin: auto; max-width: 440px; padding: 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.video-state h3 { margin: 6px 0 0; font-size: 18px; font-weight: 700; }
.video-state p { margin: 0; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, .72); }
.video-state-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); }
.video-state-ic.is-error { color: #fca5a5; background: rgba(239, 68, 68, .16); }
.video-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.video-overlay .btn:not(.btn-primary) { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.video-overlay .btn:not(.btn-primary):hover { background: rgba(255, 255, 255, .2); }
.video-ph-poster {
  position: relative; width: 300px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; margin-bottom: 10px;
  display: grid; place-items: center; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.video-ph-play { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.video-ph-len { position: absolute; right: 10px; bottom: 10px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .55); font-variant-numeric: tabular-nums; }

/* home screen follows the system theme */
.video-home { flex: 1; background: var(--surface); color: var(--text); padding: 0 0 28px; }
.video-overlay .video-home .btn:not(.btn-primary) { background: var(--tile); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.video-overlay .video-home .btn:not(.btn-primary):hover { background: var(--tile-hover); }
.video-home-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 34px 24px 26px;
  background: radial-gradient(80% 120% at 50% 0%, rgba(167, 139, 250, .22), transparent 70%), var(--surface-2); border-bottom: 1px solid var(--line);
}
.video-home-logo { width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #a78bfa, #6d28d9); box-shadow: 0 10px 26px -10px rgba(109, 40, 217, .7), inset 0 1px 0 rgba(255, 255, 255, .3); }
.video-home-hero h2 { margin: 10px 0 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.video-home-hero p { margin: 0; max-width: 460px; font-size: 13.5px; color: var(--text-2); }
.video-home-hero .video-state-actions { margin-top: 10px; }
.video-url-row { display: flex; gap: 8px; width: min(520px, 100%); margin-top: 12px; }
.video-url-row .search-field { flex: 1; }
.video-home-sec { max-width: 900px; margin: 0 auto; padding: 22px 24px 0; }
.video-home-sec h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.video-home-making { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 12.5px; color: var(--text-2); }
.video-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.video-home-card { display: flex; flex-direction: column; gap: 3px; padding: 0; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; min-width: 0; }
.video-home-thumb {
  aspect-ratio: 16 / 9; border-radius: 10px; display: grid; place-items: center; color: #fff; margin-bottom: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); transition: transform .15s var(--ease), box-shadow .15s;
}
.video-home-thumb .ic { width: 38px; height: 38px; padding: 9px; border-radius: 50%; background: rgba(0, 0, 0, .3); }
.video-home-card:hover .video-home-thumb { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent), 0 10px 24px -10px rgba(0, 0, 0, .5); }
.video-home-card:focus-visible { outline: none; }
.video-home-card:focus-visible .video-home-thumb { box-shadow: 0 0 0 3px var(--accent); }
.video-home-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-home-meta { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sidebar */
.video-side { width: 0; flex: 0 0 auto; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-left: 1px solid var(--line); transition: width .22s var(--ease); }
.video-root.side-on .video-side { width: 300px; }
.video-side-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px 8px 10px; min-width: 300px; }
.video-side-seg { flex: 1; }
.video-side-seg button { flex: 1; justify-content: center; }
.video-side-body { flex: 1; min-width: 300px; padding: 2px 8px 8px; }
.video-side-foot { padding: 8px 10px 10px; border-top: 1px solid var(--line); min-width: 300px; }
.video-side-empty { margin: 14px 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.video-rows { display: flex; flex-direction: column; gap: 2px; }
.video-row {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 8px; border: 0; border-radius: 10px; background: none;
  color: var(--text); text-align: left; cursor: pointer; width: 100%; font: inherit;
}
.video-row:hover { background: var(--hover); }
.video-row.on { background: rgba(167, 139, 250, .16); }
.video-row.dragging { opacity: .4; }
.video-row.drop { box-shadow: inset 0 2px 0 var(--accent); }
.video-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.video-row-thumb { position: relative; width: 64px; height: 36px; border-radius: 6px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; overflow: hidden; }
.video-row-thumb i { position: absolute; left: 0; bottom: 0; height: 3px; background: #c4b5fd; }
.video-row-num { width: 22px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-3); flex: 0 0 auto; display: grid; place-items: center; }
.video-row.on .video-row-num { color: #8b5cf6; }
.video-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.video-row-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-row-meta { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-row-x { width: 26px; height: 26px; opacity: 0; }
.video-row:hover .video-row-x, .video-row:focus-within .video-row-x { opacity: 1; }
.video-rows.is-big .video-row { min-height: 56px; }

/* drop target */
.video-root.drop-on::after {
  content: 'Drop videos or subtitles to play them'; position: absolute; inset: 10px; z-index: 10; border-radius: 14px;
  display: grid; place-items: center; font-size: 15px; font-weight: 600; color: #fff;
  background: rgba(109, 40, 217, .35); box-shadow: inset 0 0 0 2px #a78bfa; pointer-events: none;
}

/* full screen */
.video-stage:fullscreen { width: 100vw; height: 100vh; }
.video-root.is-full .video-cbtn { width: 44px; height: 44px; }

/* narrow + phone */
@media (max-width: 759px) {
  .video-root.side-on .video-side { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 88%); z-index: 8; box-shadow: var(--shadow-pop); }
  .video-cbtn { width: 40px; height: 40px; }
  .video-volwrap .video-vol { display: none; }
  .video-controls { padding: 22px 6px 8px; }
  .video-home-hero { padding: 26px 16px 20px; }
  .video-home-sec { padding: 18px 16px 0; }
  .video-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .video-url-row { flex-direction: column; }
}
.app-video .video-root:not(.side-on) .video-side { border-left: 0; }
.video-root.is-narrow .opt-a, .video-root.is-tiny .opt-b, .video-root.is-tiny .opt-c, .video-root.is-tiny .video-volwrap .video-vol { display: none; }
.video-root.is-tiny .video-time { padding: 0 4px; font-size: 11.5px; }
