/* Videos tab — the three-way split gate + the lane bar. See media/video-lanes.js.
   Direction: a neon marquee triptych. Three skewed panels, each lit in its own
   icon's hue over a dimmed wall of that lane's real posters; the seams draw in
   and wipe the panels open, hover widens a panel and dims the other two. */

.vsplit {
  --vs-skew: -7deg;
  position: relative;
  z-index: 1;
  height: calc(100vh - 60px - 41px - var(--np-h, 0px)); /* same slot as .layout: topbar + view-tabs */
  overflow: hidden;
  background: var(--bg);
}
.vsplit-videos { --lane: #f59e0b; --lane-2: #fb923c; --lane-rgb: 245, 158, 11; }
.vsplit-vr     { --lane: #60a5fa; --lane-2: #818cf8; --lane-rgb: 96, 165, 250; }
.vsplit-toons  { --lane: #2dd4bf; --lane-2: #22d3ee; --lane-rgb: 45, 212, 191; }
.vsplit-hentai { --lane: #e879f9; --lane-2: #f472b6; --lane-rgb: 232, 121, 249; }

/* The whole row is skewed; its outer slanted ends are pushed off-screen so only
   the two inner seams read as diagonals. Everything inside counter-skews. */
.vsplit-stage {
  display: flex;
  height: 100%;
  margin: 0 -80px;
  transform: skewX(var(--vs-skew));
}

.vsplit-panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  outline: none;
  transition: flex-grow .6s cubic-bezier(.2, .8, .2, 1), filter .5s ease, opacity .4s ease;
}

/* The seam: a lit edge on the left of every panel but the first. */
.vsplit-panel + .vsplit-panel::before {
  content: '';
  position: absolute;
  z-index: 4;
  top: 0; bottom: 0; left: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent 0%, #fff 18%, rgba(var(--lane-rgb), .9) 55%, transparent 100%);
  box-shadow: 0 0 14px 2px rgba(var(--lane-rgb), .55);
  transform-origin: top;
  pointer-events: none;
}

/* The Hearth mark riding each seam (same medallion as the Images/Games
   gates). The row is skewed, so the mark counter-skews to stay round; its
   glow blends the two lanes it sits between. */
.vsplit-seam {
  position: relative;
  z-index: 6;
  flex: 0 0 0;
  width: 0;
  pointer-events: none;
  --from: #f59e0b;
  --to: #2dd4bf;
}
.vsplit-seam-toons-hentai { --from: #2dd4bf; --to: #e879f9; }
.vsplit-mark {
  position: absolute;
  top: 50%;
  left: 0;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #241a12, #0b0c11 70%);
  border: 1px solid color-mix(in srgb, var(--to) 40%, transparent);
  box-shadow: 0 0 0 6px rgba(7, 8, 12, .65),
    -10px 0 24px color-mix(in srgb, var(--from) 40%, transparent),
    10px 0 24px color-mix(in srgb, var(--to) 40%, transparent);
  transform: skewX(calc(-1 * var(--vs-skew)));
}
.vsplit-mark img { width: 34px; height: 34px; }
.vsplit.is-in .vsplit-mark {
  animation: vsplit-mark-pop .5s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: calc(.3s + var(--i) * .1s);
}
@keyframes vsplit-mark-pop {
  from { transform: skewX(calc(-1 * var(--vs-skew))) scale(0) rotate(-40deg); opacity: 0; }
  to   { transform: skewX(calc(-1 * var(--vs-skew))); opacity: 1; }
}
.vsplit.is-leaving .vsplit-seam { opacity: 0; transition: opacity .25s ease; }

/* ── Poster wall ── */
.vsplit-wall {
  position: absolute;
  inset: -4% -130px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  transform: skewX(calc(-1 * var(--vs-skew))) scale(1.08);
  filter: blur(2px) saturate(.85) brightness(.5);
  transition: filter .6s ease, transform 1.2s cubic-bezier(.2, .8, .2, 1);
}
.vsplit-cell {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(var(--lane-rgb), .28), transparent 60%),
    var(--surface);
}
.vsplit-cell img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Each cell rolls its own crop, zoom and drift (video-lanes.js styleCell),
     so the wall never reads as a tiled repeat — even of a one-item lane. */
  object-position: var(--ox, 50%) var(--oy, 50%);
  opacity: 0;
  transform: scale(var(--z0, 1.06));
  transition: opacity 1.1s ease;
  animation: vsplit-drift var(--dur, 20s) ease-in-out var(--delay, 0s) infinite alternate;
}
.vsplit-cell img.in { opacity: 1; }
@keyframes vsplit-drift {
  from { transform: scale(var(--z0, 1.06)) translate(0, 0); }
  to   { transform: scale(var(--z1, 1.2)) translate(var(--dx, 0), var(--dy, 0)); }
}

.vsplit-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(70% 55% at 50% 46%, rgba(var(--lane-rgb), .30), transparent 70%),
    linear-gradient(to bottom, rgba(10, 11, 16, .55) 0%, rgba(10, 11, 16, .15) 40%, rgba(10, 11, 16, .85) 100%);
  transition: opacity .5s ease;
}

/* ── Centre stack ── */
.vsplit-body {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 64px;
  text-align: center;
  transform: skewX(calc(-1 * var(--vs-skew)));
}
/* The stage overhangs the window by 80px each side (see .vsplit-stage), so
   the outer panels centre their stack in the part you can actually see. */
.vsplit-panel:first-child .vsplit-body { padding-left: 144px; }
.vsplit-panel:last-child  .vsplit-body { padding-right: 144px; }
.vsplit-panel:first-child .vsplit-halo { left: calc(50% + 40px); }
.vsplit-panel:last-child  .vsplit-halo { left: calc(50% - 40px); }
.vsplit-panel:first-child .vsplit-key  { left: calc(50% + 40px); }
.vsplit-panel:last-child  .vsplit-key  { left: calc(50% - 40px); }
.vsplit-halo {
  position: absolute;
  top: 50%; left: 50%;
  width: 300px; height: 300px;
  margin: -210px 0 0 -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--lane-rgb), .38) 0%, rgba(var(--lane-rgb), .10) 42%, transparent 70%);
  filter: blur(6px);
  opacity: .55;
  transition: opacity .5s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}
.vsplit-icon {
  position: relative;
  width: 148px;
  height: 148px;
  margin-bottom: 10px;
  filter: drop-shadow(0 10px 28px rgba(var(--lane-rgb), .45));
  animation: vsplit-float 5.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * -1.4s);
  transition: filter .5s ease;
}
@keyframes vsplit-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-9px) rotate(-2deg); }
}
.vsplit-kicker {
  position: relative;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--lane);
}
.vsplit-title {
  position: relative;
  font-size: clamp(36px, 4.2vw, 68px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.035em;
  color: #fff;
  text-shadow: 0 0 34px rgba(var(--lane-rgb), .55), 0 2px 0 rgba(0, 0, 0, .35);
}
.vsplit-count {
  position: relative;
  min-height: 1.5em;
  font-size: 14px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.vsplit-enter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(var(--lane-rgb), .6);
  background: rgba(var(--lane-rgb), .14);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .45s cubic-bezier(.2, .8, .2, 1), background .3s ease;
}
.vsplit-key {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 11, 16, .6);
  color: var(--text-mute);
  font: 600 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Hover / focus: widen the one you're on, dim the rest ── */
.vsplit-stage[data-hover] .vsplit-panel { filter: saturate(.55) brightness(.62); }
.vsplit-stage[data-hover="videos"] .vsplit-videos,
.vsplit-stage[data-hover="vr"]     .vsplit-vr,
.vsplit-stage[data-hover="toons"]  .vsplit-toons,
.vsplit-stage[data-hover="hentai"] .vsplit-hentai {
  flex-grow: 1.55;
  filter: none;
}
.vsplit-stage[data-hover="videos"] .vsplit-videos .vsplit-wall,
.vsplit-stage[data-hover="vr"]     .vsplit-vr     .vsplit-wall,
.vsplit-stage[data-hover="toons"]  .vsplit-toons  .vsplit-wall,
.vsplit-stage[data-hover="hentai"] .vsplit-hentai .vsplit-wall {
  filter: blur(0) saturate(1.05) brightness(.62);
  transform: skewX(calc(-1 * var(--vs-skew))) scale(1.14);
}
.vsplit-stage[data-hover="videos"] .vsplit-videos .vsplit-halo,
.vsplit-stage[data-hover="vr"]     .vsplit-vr     .vsplit-halo,
.vsplit-stage[data-hover="toons"]  .vsplit-toons  .vsplit-halo,
.vsplit-stage[data-hover="hentai"] .vsplit-hentai .vsplit-halo {
  opacity: 1;
  transform: scale(1.18);
}
.vsplit-stage[data-hover="videos"] .vsplit-videos .vsplit-icon,
.vsplit-stage[data-hover="vr"]     .vsplit-vr     .vsplit-icon,
.vsplit-stage[data-hover="toons"]  .vsplit-toons  .vsplit-icon,
.vsplit-stage[data-hover="hentai"] .vsplit-hentai .vsplit-icon {
  animation: vsplit-bounce .7s cubic-bezier(.3, 1.6, .5, 1) both, vsplit-float 5.5s ease-in-out .7s infinite;
  filter: drop-shadow(0 14px 40px rgba(var(--lane-rgb), .8)) brightness(1.08);
}
.vsplit-stage[data-hover="videos"] .vsplit-videos .vsplit-enter,
.vsplit-stage[data-hover="vr"]     .vsplit-vr     .vsplit-enter,
.vsplit-stage[data-hover="toons"]  .vsplit-toons  .vsplit-enter,
.vsplit-stage[data-hover="hentai"] .vsplit-hentai .vsplit-enter {
  opacity: 1;
  transform: none;
}
@keyframes vsplit-bounce {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(-16px) scale(1.12) rotate(-4deg); }
  100% { transform: translateY(0) scale(1.06); }
}
.vsplit-panel:focus-visible .vsplit-tint {
  box-shadow: inset 0 0 0 3px rgba(var(--lane-rgb), .9);
}

/* ── Entrance: seams draw, panels wipe open from their centres, stack rises ── */
.vsplit.is-in .vsplit-panel + .vsplit-panel::before {
  animation: vsplit-seam .5s cubic-bezier(.6, 0, .2, 1) both;
}
.vsplit.is-in .vsplit-wall {
  animation: vsplit-wipe .85s cubic-bezier(.7, 0, .2, 1) both;
  animation-delay: calc(.22s + var(--i) * .08s);
}
/* The wall opens from its centre behind two halves of a veil that slide off
   to the panel's edges — transform + opacity only. (Wiping the blurred,
   drifting wall with an animated clip made every frame re-clip and re-blur
   it on the main thread.) The veil sits over the wall, under the tint. */
.vsplit-veil {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
  visibility: hidden;
}
.vsplit-veil i { flex: 1 1 0; background: var(--bg-2); will-change: transform; }
.vsplit-veil i:first-child { transform-origin: left center; }
.vsplit-veil i:last-child { transform-origin: right center; }
.vsplit.is-in .vsplit-veil { visibility: visible; }
.vsplit.is-in .vsplit-veil i {
  animation: vsplit-veil .85s cubic-bezier(.7, 0, .2, 1) both;
  animation-delay: calc(.22s + var(--i) * .08s);
}
@keyframes vsplit-veil { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.vsplit.is-in .vsplit-body > * {
  animation: vsplit-rise .6s cubic-bezier(.2, .9, .3, 1.15) both;
}
.vsplit.is-in .vsplit-icon {
  animation: vsplit-pop .7s cubic-bezier(.3, 1.5, .5, 1) both, vsplit-float 5.5s ease-in-out .9s infinite;
  animation-delay: calc(.38s + var(--i) * .09s), calc(1.1s + var(--i) * -1.4s);
}
.vsplit.is-in .vsplit-halo    { animation-delay: calc(.35s + var(--i) * .09s); }
.vsplit.is-in .vsplit-kicker  { animation-delay: calc(.50s + var(--i) * .09s); }
.vsplit.is-in .vsplit-title   { animation-delay: calc(.56s + var(--i) * .09s); }
.vsplit.is-in .vsplit-count   { animation-delay: calc(.62s + var(--i) * .09s); }
.vsplit.is-in .vsplit-key     { animation-name: vsplit-rise-key; animation-delay: calc(.8s + var(--i) * .09s); }
.vsplit.is-in .vsplit-enter   { animation: none; }
@keyframes vsplit-seam { from { transform: scaleY(0); opacity: 1; } to { transform: scaleY(1); } }
@keyframes vsplit-wipe { from { opacity: .2; } to { opacity: 1; } }
@keyframes vsplit-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes vsplit-rise-key { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes vsplit-pop {
  from { opacity: 0; transform: scale(.55) rotate(-10deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

/* ── Leaving: the pick takes the stage, the others fold away ── */
.vsplit.is-leaving { pointer-events: none; }
.vsplit.is-leaving .vsplit-panel { flex-grow: .0001; opacity: 0; }
.vsplit.is-leaving .vsplit-stage[data-pick="videos"] .vsplit-videos,
.vsplit.is-leaving .vsplit-stage[data-pick="vr"]     .vsplit-vr,
.vsplit.is-leaving .vsplit-stage[data-pick="toons"]  .vsplit-toons,
.vsplit.is-leaving .vsplit-stage[data-pick="hentai"] .vsplit-hentai {
  flex-grow: 8;
  opacity: 1;
  filter: none;
}
.vsplit.is-leaving .vsplit-stage[data-pick] .vsplit-body {
  transition: transform .45s cubic-bezier(.5, 0, .2, 1), opacity .4s ease .05s;
  transform: skewX(calc(-1 * var(--vs-skew))) scale(1.12);
  opacity: 0;
}

/* ── Minor lane (VR): a pill in the top-right corner, not a panel ── */
.vsplit-mini {
  --lane-rgb: 96, 165, 250;
  position: absolute;
  z-index: 6;
  top: 18px;
  right: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 16px 5px 6px;
  border: 1px solid rgba(var(--lane-rgb), .45);
  border-radius: 999px;
  background: rgba(10, 11, 16, .72);
  backdrop-filter: blur(12px);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  transition: border-color .25s ease, background .25s ease, box-shadow .3s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.vsplit-mini img {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 2px 10px rgba(var(--lane-rgb), .55));
  transition: transform .45s cubic-bezier(.3, 1.6, .5, 1);
}
.vsplit-mini-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.vsplit-mini-count { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.vsplit-mini:hover,
.vsplit-mini:focus-visible {
  border-color: rgba(var(--lane-rgb), .9);
  background: rgba(var(--lane-rgb), .16);
  box-shadow: 0 6px 28px rgba(var(--lane-rgb), .35);
  transform: translateY(-2px);
  outline: none;
}
.vsplit-mini:hover img,
.vsplit-mini:focus-visible img { transform: rotate(-8deg) scale(1.12); }
.vsplit.is-in .vsplit-mini { animation: vsplit-mini-in .5s cubic-bezier(.2, .9, .3, 1.2) .75s both; }
.vsplit.is-leaving .vsplit-mini { opacity: 0; transition: opacity .25s ease; }
@keyframes vsplit-mini-in { from { opacity: 0; transform: translateY(-10px) scale(.9); } to { opacity: 1; transform: none; } }

/* ── Narrow windows: stack the lanes, seams go horizontal ── */
@media (max-width: 760px) {
  .vsplit-stage { flex-direction: column; margin: 0; transform: none; }
  .vsplit-wall, .vsplit-body { transform: none; }
  .vsplit-panel:first-child .vsplit-body,
  .vsplit-panel:last-child  .vsplit-body { padding: 12px 24px; }
  .vsplit-panel:first-child .vsplit-halo,
  .vsplit-panel:last-child  .vsplit-halo,
  .vsplit-panel:first-child .vsplit-key,
  .vsplit-panel:last-child  .vsplit-key { left: 50%; }
  .vsplit-stage[data-hover="videos"] .vsplit-videos .vsplit-wall,
  .vsplit-stage[data-hover="vr"]     .vsplit-vr     .vsplit-wall,
  .vsplit-stage[data-hover="toons"]  .vsplit-toons  .vsplit-wall,
  .vsplit-stage[data-hover="hentai"] .vsplit-hentai .vsplit-wall { transform: scale(1.1); }
  .vsplit.is-leaving .vsplit-stage[data-pick] .vsplit-body { transform: scale(1.1); }
  .vsplit-panel + .vsplit-panel::before {
    top: 0; left: 0; right: 0; bottom: auto;
    width: auto; height: 2px;
    background: linear-gradient(to right, transparent, #fff 25%, rgba(var(--lane-rgb), .9) 60%, transparent);
    transform-origin: left;
  }
  @keyframes vsplit-seam { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .vsplit-seam { width: auto; height: 0; }
  .vsplit-mark { top: 0; left: auto; right: 18px; width: 40px; height: 40px; margin: -20px 0 0; transform: none; }
  .vsplit-mark img { width: 26px; height: 26px; }
  .vsplit.is-in .vsplit-mark { animation-name: vsplit-mark-pop-flat; }
  @keyframes vsplit-mark-pop-flat { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
  .vsplit-body { gap: 2px; padding: 12px 24px; }
  .vsplit-icon { width: 64px; height: 64px; margin-bottom: 2px; }
  .vsplit-halo { width: 140px; height: 140px; margin: -95px 0 0 -70px; }
  .vsplit-title { font-size: 30px; }
  .vsplit-enter, .vsplit-key { display: none; }
  .vsplit-mini { top: 10px; right: 10px; min-height: 40px; padding: 4px 12px 4px 4px; }
  .vsplit-mini img { width: 30px; height: 30px; }
  .vsplit-mini-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .vsplit *, .vsplit *::before { animation: none !important; transition: none !important; }
  .vsplit-veil { display: none; }
}

/* ── Lane bar: the switch at the top of each lane's grid ── */
.vlane-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
}
.vlane-bar:empty { display: none; }
.vlane-split,
.vlane-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font: 600 13px/1 inherit;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.vlane-split { justify-content: center; width: 40px; padding: 0; }
.vlane-btn { padding: 0 16px 0 8px; }
.vlane-btn img {
  width: 26px;
  height: 26px;
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
/* Hearth's own lanes (Videos, VR, Toons, Anime) wear their lane colour as a
   plate behind the icon — the at-a-glance tell against the user's libraries,
   whose icons sit bare. The plate is on the img so the dock-art theme (which
   repaints the pill itself) can't cover it. */
.vlane-btn.vlane-corepill img {
  width: 30px;
  height: 30px;
  padding: 3px;
  box-sizing: border-box;
  border-radius: 9px;
  background: rgba(var(--lane-rgb), .16);
  box-shadow: inset 0 0 0 1px rgba(var(--lane-rgb), .38);
}
/* The slice between the user's libraries and Hearth's lanes. */
.vlane-sep {
  width: 1px;
  align-self: stretch;
  margin: 3px 5px;
  background: linear-gradient(180deg, transparent, var(--border-strong) 30%, var(--border-strong) 70%, transparent);
}
/* Rearrange: pills drag (owners only — fillLanePills sets draggable). */
.vlane-btn[draggable="true"] { cursor: grab; }
.vlane-btn.vlane-dragging { opacity: .4; cursor: grabbing; }
.vlane-videos { --lane-rgb: 245, 158, 11; }
.vlane-vr     { --lane-rgb: 96, 165, 250; }
.vlane-toons  { --lane-rgb: 45, 212, 191; }
.vlane-hentai { --lane-rgb: 232, 121, 249; }
.vlane-split:hover,
.vlane-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.vlane-btn:hover img { transform: scale(1.14) rotate(-6deg); }
.vlane-btn.active {
  color: #fff;
  border-color: rgba(var(--lane-rgb), .7);
  background: rgba(var(--lane-rgb), .14);
  box-shadow: 0 0 18px rgba(var(--lane-rgb), .22);
}
.vlane-split:focus-visible,
.vlane-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .vlane-split, .vlane-btn, .vlane-btn img { transition: none; }
}
