/* Zroid — layout and tokens follow LyTV. */
:root {
  --side: 88px;
  --bg: #0b0b17; --bg2: #121220; --card: #181829; --card2: #1f1f35;
  --line: #2a2a44; --line2: #38385c;
  --text: #f0effa; --dim: #a5a3c0; --faint: #6e6c8a;
  --accent: #a78bfa; --accent2: #22d3ee;
  --radius: 14px;
  --amb: 50, 36, 96;
  --pad: clamp(16px, 3.2vw, 44px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 Inter, system-ui, sans-serif; min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .outfit { font-family: Outfit, Inter, sans-serif; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
::selection { background: var(--accent); color: #0b0b17; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- rail ---------- */
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 20;
  background: rgba(11, 11, 23, .92); backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; padding: 18px 0; gap: 6px;
}
.rail .brand svg { width: 42px; height: 42px; margin-bottom: 18px; }
.rail .grow { flex: 1; }
.rail .nav {
  position: relative; width: 70px; padding: 10px 0 8px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--dim); font-size: 11px; font-weight: 700; transition: background .15s, color .15s;
}
.rail .nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail .nav:hover { color: var(--text); background: var(--card); }
.rail .nav.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0b0b17; box-shadow: 0 6px 22px rgba(124, 108, 250, .45); }
.rail .nav.active::before { content: ""; position: absolute; right: -9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 10px var(--accent2); }

main { margin-left: var(--side); min-height: 100vh; }

/* ---------- page + ambient wash ---------- */
.page { position: relative; padding: 34px var(--pad) 80px; min-height: 100vh; isolation: isolate; }
.page::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 640px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(var(--amb), .55), transparent 70%),
    linear-gradient(180deg, rgba(var(--amb), .28), var(--bg) 100%);
  transition: background .6s;
}
.page-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); font-weight: 800; line-height: 1; }
.page-head .sub { color: var(--dim); font-weight: 500; margin-top: 8px; }
.page-head .spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; min-width: 240px;
  background: rgba(24, 24, 41, .8); border: 1px solid var(--line); border-radius: 999px;
}
.search svg { width: 18px; height: 18px; stroke: var(--faint); fill: none; stroke-width: 2; }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.search:focus-within { border-color: var(--line2); background: var(--card); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: rgba(24, 24, 41, .7); color: var(--dim);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--line2); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.section-title { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 14px; }
.section-title h2 { margin: 0; font-size: 22px; font-weight: 700; }
.section-title .count { color: var(--faint); font-weight: 600; font-size: 14px; }
.section-title .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line2); background: rgba(31, 31, 53, .85); color: var(--text);
  font-weight: 700; cursor: pointer; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--card2); border-color: #4b4b75; }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0b0b17; border: 0; box-shadow: 0 8px 24px rgba(124, 108, 250, .35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.danger { color: #ff8a8d; }

/* ---------- recently added row ---------- */
.row-wrap { position: relative; margin: 0 calc(-1 * var(--pad)) 40px; }
.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(250px, 23vw, 340px); gap: 16px;
  overflow-x: auto; padding: 4px var(--pad) 14px; scroll-snap-type: x proximity; scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row-arrow {
  position: absolute; top: 0; bottom: 60px; width: 54px; z-index: 3; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--text); opacity: 0; transition: opacity .2s;
}
.row-wrap:hover .row-arrow { opacity: 1; }
.row-arrow.l { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.row-arrow.r { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }
.row-arrow svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* ---------- video card ---------- */
.vcard { position: relative; cursor: pointer; outline: none; }
.vthumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--card);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3); transition: transform .2s, box-shadow .2s;
}
.vthumb > img { width: 100%; height: 100%; object-fit: cover; }
.vcard:hover .vthumb, .vcard:focus-visible .vthumb { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--accent), 0 14px 30px rgba(0, 0, 0, .45); }
.scrub { position: absolute; inset: 0; background: #000; display: none; justify-content: center; }
.scrub > div { height: 100%; background-repeat: no-repeat; }
.vcard.scrubbing .scrub { display: flex; }
.scrub-line { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.scrub-time { position: absolute; right: 8px; top: 8px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.7); padding: 2px 7px; border-radius: 6px; }
.badge {
  position: absolute; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px;
  background: rgba(10, 10, 22, .78); backdrop-filter: blur(6px);
}
.badge.dur { right: 8px; bottom: 8px; }
.badge.new { left: 8px; top: 8px; background: var(--accent); color: #0b0b17; letter-spacing: .04em; }
.vcard.scrubbing .badge { display: none; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.18); }
.progress i { display: block; height: 100%; background: var(--accent2); }
.vplay {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .2s;
  background: radial-gradient(circle, rgba(0,0,0,.35), transparent 60%); pointer-events: none;
}
.vplay svg { width: 52px; height: 52px; }
.vcard:hover .vplay { opacity: 1; }
.vcard.scrubbing .vplay { opacity: 0; }
.vmeta { display: flex; align-items: baseline; gap: 8px; padding: 10px 2px 0; }
.vmeta .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vmeta .s { color: var(--faint); font-size: 13px; white-space: nowrap; margin-left: auto; }
.vmeta .c { color: var(--accent); font-weight: 700; }
.more {
  position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(10, 10, 22, .75); display: grid; place-items: center; opacity: 0; transition: opacity .15s; z-index: 2;
}
.more svg { width: 18px; height: 18px; fill: var(--text); }
.vcard:hover .more, .pcard:hover .more { opacity: 1; }
.vcard.scrubbing .more { opacity: 0; }
.menu {
  position: fixed; z-index: 80; min-width: 190px; padding: 6px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line2); box-shadow: 0 18px 40px rgba(0,0,0,.5);
}
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 600; }
.menu button:hover { background: var(--line); }

/* ---------- collection ("folder") cards ---------- */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 22vw, 330px), 1fr)); gap: 34px 22px; }
.folders.pics { grid-template-columns: repeat(auto-fill, minmax(clamp(190px, 16vw, 250px), 1fr)); }
.folder { position: relative; display: block; padding-top: 14px; outline: none; }
.folder .stack { position: relative; }
.folder .stack::before, .folder .stack::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: -14px; height: 40px; border-radius: 12px 12px 0 0;
  background: var(--card2); border: 1px solid var(--line); z-index: 0; transition: transform .25s;
}
.folder .stack::after { left: 4%; right: 4%; top: -7px; background: #272742; }
.folder .art {
  position: relative; z-index: 1; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: var(--card);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45); transition: transform .25s, box-shadow .25s;
}
.folders.pics .folder .art { aspect-ratio: 4 / 5; }
.folder .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .5s, transform 6s ease-out; }
.folder .art img.next { opacity: 0; }
.folder .art::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, transparent 45%, rgba(8, 8, 20, .55) 70%, rgba(8, 8, 20, .92));
}
.folder .label { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 14px; }
.folder .label h3 { margin: 0; font-size: clamp(22px, 2vw, 28px); font-weight: 800; line-height: 1.05; text-shadow: 0 2px 12px rgba(0,0,0,.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .label p { margin: 4px 0 0; color: rgba(238, 241, 247, .78); font-size: 13px; font-weight: 600; }
.folder .pill {
  position: absolute; z-index: 2; top: 12px; right: 12px; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  background: rgba(10, 10, 22, .7); backdrop-filter: blur(8px);
}
.folder .pill.new { right: auto; left: 12px; background: var(--accent); color: #0b0b17; }
.folder:hover .art, .folder:focus-visible .art { transform: translateY(-6px); box-shadow: 0 0 0 2px var(--accent), 0 24px 44px rgba(0, 0, 0, .55); }
.folder:hover .stack::before { transform: translateY(-5px); }
.folder:hover .stack::after { transform: translateY(-3px); }
.folder:hover .art img.cur { transform: scale(1.06); }

.empty { color: var(--dim); padding: 60px 0; text-align: center; }

/* ---------- collection hero ---------- */
.hero { display: grid; grid-template-columns: minmax(260px, 520px) 1fr; gap: clamp(20px, 3vw, 44px); align-items: end; margin-bottom: 34px; }
.hero .logo { position: relative; aspect-ratio: 16 / 10; border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); background: var(--card); }
.hero.pics .logo { aspect-ratio: 4 / 5; max-width: 340px; }
.hero .logo img { width: 100%; height: 100%; object-fit: cover; }
.hero .logo .edit-logo {
  position: absolute; right: 12px; bottom: 12px; opacity: 0; transition: opacity .15s;
}
.hero .logo:hover .edit-logo { opacity: 1; }
.crumb { color: var(--dim); font-weight: 600; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.crumb:hover { color: var(--text); }
.crumb svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.hero h1 { margin: 0; font-size: clamp(40px, 6vw, 76px); font-weight: 800; line-height: .95; }
.hero .facts { display: flex; gap: 10px; flex-wrap: wrap; color: var(--dim); font-weight: 600; margin: 14px 0 22px; }
.hero .facts span + span::before { content: "•"; margin-right: 10px; color: var(--faint); }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(230px, 19vw, 300px), 1fr)); gap: 28px 18px; }

/* ---------- pictures ---------- */
.masonry { columns: 5 220px; column-gap: 14px; }
.pcard { position: relative; break-inside: avoid; margin-bottom: 14px; border-radius: 12px; overflow: hidden; cursor: zoom-in; background: var(--card); }
.pcard img { width: 100%; height: auto; transition: transform .3s; }
.pcard:hover img { transform: scale(1.03); }
.pcard .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; font-size: 12px; font-weight: 700; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .2s; }
.pcard:hover .cap { opacity: 1; }
.prow .pcard { margin: 0; aspect-ratio: 3 / 4; }
.prow .pcard img { height: 100%; object-fit: cover; }
.row.prow { grid-auto-columns: clamp(160px, 13vw, 210px); }

.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(5, 7, 12, .96); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: calc(100vw - 140px); max-height: calc(100vh - 90px); object-fit: contain; border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,.6); user-select: none; }
.lightbox .lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.lightbox .lb-top .t { font-weight: 700; } .lightbox .lb-top .n { color: var(--dim); font-size: 13px; }
.lightbox .lb-top .spacer { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); color: var(--text);
  display: grid; place-items: center; cursor: pointer; flex: none; transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.18); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.fill svg { fill: currentColor; stroke: none; }
.lightbox .nav-l, .lightbox .nav-r { position: absolute; top: 50%; transform: translateY(-50%); width: 54px; height: 54px; }
.lightbox .nav-l { left: 16px; } .lightbox .nav-r { right: 16px; }

/* ---------- player ---------- */
.player { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; align-items: center; justify-content: center; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player.idle { cursor: none; }
.p-top, .p-bottom { position: absolute; left: 0; right: 0; transition: opacity .3s; z-index: 2; }
.player.idle .p-top, .player.idle .p-bottom { opacity: 0; pointer-events: none; }
.p-top { top: 0; display: flex; align-items: center; gap: 14px; padding: 18px 22px 50px; background: linear-gradient(rgba(0,0,0,.75), transparent); }
.p-top .tt { font-family: Outfit, sans-serif; font-weight: 700; font-size: 20px; }
.p-top .cc { color: var(--accent); font-weight: 700; font-size: 13px; }
.p-bottom { bottom: 0; padding: 60px 22px 16px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.timeline { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.timeline .bar { position: relative; width: 100%; height: 5px; background: rgba(255,255,255,.22); border-radius: 5px; transition: height .12s; }
.timeline:hover .bar, .timeline.drag .bar { height: 8px; }
.timeline .buf, .timeline .fill, .timeline .hov { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.timeline .buf { background: rgba(255,255,255,.3); }
.timeline .hov { background: rgba(255,255,255,.25); display: none; }
.timeline:hover .hov { display: block; }
.timeline .fill { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.timeline .knob { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.timeline:hover .knob, .timeline.drag .knob { transform: scale(1); }
.preview {
  position: absolute; bottom: 30px; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.timeline:hover .preview, .timeline.drag .preview { display: flex; }
.preview .frame { border-radius: 8px; border: 2px solid rgba(255,255,255,.9); background-color: #0b0b17; background-repeat: no-repeat; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.preview .time { font-weight: 800; font-size: 13px; background: rgba(0,0,0,.75); padding: 3px 8px; border-radius: 6px; }
.controls { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.controls .icon-btn { background: transparent; width: 42px; height: 42px; }
.controls .icon-btn:hover { background: rgba(255,255,255,.12); }
.controls .time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; color: #dfe3ec; margin: 0 8px; }
.controls .spacer { flex: 1; }
.vol { width: 90px; accent-color: var(--accent); }
.speed { background: transparent; border: 1px solid rgba(255,255,255,.25); color: var(--text); border-radius: 8px; padding: 4px 6px; font-weight: 700; font: inherit; font-size: 13px; }
.speed option { background: var(--card2); }
.upnext {
  position: absolute; right: 26px; bottom: 120px; z-index: 3; width: 320px; border-radius: 14px; overflow: hidden;
  background: rgba(24, 24, 41, .95); border: 1px solid var(--line2); box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
.upnext img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.upnext .b { padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.upnext .b .l { flex: 1; } .upnext .b small { color: var(--dim); display: block; font-weight: 600; }
.p-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 1; }
.p-center .spin { width: 54px; height: 54px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: none; }
.player.loading .p-center .spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dialog / settings ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 70; background: rgba(4, 6, 12, .7); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); }
.modal { width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg2); border: 1px solid var(--line2); border-radius: 18px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h2 { margin: 0 0 18px; font-size: 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 13px; color: var(--dim); margin-bottom: 7px; }
.field .hint { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.input, select.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--card); color: var(--text); font: inherit; outline: none;
}
.input:focus { border-color: var(--accent); }
.logo-edit { display: flex; gap: 14px; align-items: center; }
.logo-edit img { width: 150px; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; background: var(--card); }
.logo-edit .btns { display: flex; flex-direction: column; gap: 8px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--card2); font-size: 13px; font-weight: 600; }
.tag button { border: 0; background: var(--line2); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.panel { background: rgba(24, 24, 41, .8); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; max-width: 820px; }
.panel h2 { margin: 0 0 12px; font-size: 19px; }
.stat { display: grid; grid-template-columns: 170px 1fr auto; align-items: center; gap: 14px; padding: 8px 0; }
.stat .k { color: var(--dim); font-weight: 600; }
.meter { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--dim); word-break: break-all; }
.panel p { color: var(--dim); margin: 6px 0; }
.panel code { background: var(--card2); padding: 1px 6px; border-radius: 5px; color: var(--text); }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); opacity: 0; z-index: 90; background: var(--card2); border: 1px solid var(--line2); padding: 12px 18px; border-radius: 12px; font-weight: 600; transition: all .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --side: 0px; --pad: 16px; }
  .rail {
    inset: auto 0 0 0; width: auto; height: calc(64px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around;
    padding: 6px 8px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line);
  }
  .rail .brand, .rail .grow { display: none; }
  .rail .nav { width: 84px; }
  .rail .nav.active::before { display: none; }
  main { padding-bottom: 72px; }
  .page { padding-top: 22px; }
  .search { min-width: 0; width: 100%; }
  .hero { grid-template-columns: 1fr; }
  .folders { grid-template-columns: repeat(2, 1fr); gap: 26px 12px; }
  .folders.pics { grid-template-columns: repeat(2, 1fr); }
  .folder .label { left: 12px; right: 12px; bottom: 10px; }
  .folder .label h3 { font-size: 19px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 12px; }
  .row { grid-auto-columns: 72vw; }
  .masonry { columns: 2; column-gap: 8px; } .pcard { margin-bottom: 8px; }
  .vol { display: none; }
  .lightbox img { max-width: 100vw; max-height: calc(100vh - 80px); border-radius: 0; }
  .lightbox .nav-l, .lightbox .nav-r { display: none; }
  .upnext { left: 16px; right: 16px; width: auto; }
  .stat { grid-template-columns: 110px 1fr auto; }
  .more { opacity: 1; }
}

/* ---------- libraries, picker, photo cards ---------- */
.vcard.photo .vthumb { cursor: zoom-in; }
.vcard.photo .badge.dur { padding: 3px 5px; display: grid; place-items: center; }
.vcard.photo .badge.dur svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
section.lib { margin-bottom: 46px; }
.welcome { max-width: 520px; margin: 14vh auto 0; text-align: center; }
.welcome h1 { font-size: 44px; margin: 0 0 10px; }
.welcome p { color: var(--dim); margin: 0 0 26px; font-size: 17px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.spacer { flex: 1; }
.libitem { display: grid; grid-template-columns: 1fr 230px auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.libitem:first-of-type { border-top: 0; }
.li-name { font-family: Outfit, sans-serif; font-weight: 700; font-size: 18px; margin-bottom: 3px; }
.li-btns { display: flex; gap: 6px; align-items: center; }
.li-btns .icon-btn { width: 34px; height: 34px; }
.li-btns .icon-btn svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.err { color: #ff8a8d; }
.modal.wide { width: min(680px, 100%); }
.modal .foot { align-items: center; }
.picker { border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--card); }
.pk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--card2); }
.pk-bar .icon-btn { width: 34px; height: 34px; }
.pk-bar .icon-btn svg { width: 18px; height: 18px; }
.pk-bar .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk-list { max-height: 300px; overflow: auto; padding: 6px; }
.pk-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 600; }
.pk-item:hover { background: var(--line); }
.pk-item svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint.pad { padding: 10px; }
.chosen { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; margin-bottom: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.chosen .mono { flex: 1; }
.chosen .icon-btn { width: 30px; height: 30px; }
.chosen .icon-btn svg { width: 16px; height: 16px; }
@media (max-width: 760px) {
  .libitem { grid-template-columns: 1fr; }

}
#lib-nav { display: contents; }

/* ---------- top bar + large poster row ---------- */
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: clamp(26px, 3vw, 36px); font-weight: 800; }
.big-wrap { position: relative; margin: 0 calc(-1 * var(--pad)) 46px; }
.big-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(300px, 58vw, 1040px); column-gap: 20px;
  overflow-x: auto; padding: 6px var(--pad) 18px; scroll-snap-type: x mandatory; scroll-padding: 0 var(--pad);
  scrollbar-width: none;
}
.big-row::-webkit-scrollbar { display: none; }
.big-row > .vcard { scroll-snap-align: start; }
.vcard.big .vthumb { border-radius: 20px; box-shadow: 0 22px 50px rgba(0, 0, 0, .55); }
.vcard.big:hover .vthumb { transform: none; box-shadow: 0 0 0 2px var(--accent), 0 0 40px rgba(124, 108, 250, .35), 0 22px 50px rgba(0, 0, 0, .55); }
.vcard.big .vplay svg { width: 84px; height: 84px; }
.vcard.big .scrub-line { height: 5px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.vcard.big .scrub-time { font-size: 15px; padding: 4px 10px; right: 14px; top: 14px; }
.vcard.big .badge.new { left: 14px; top: 14px; font-size: 12px; padding: 4px 10px; }
.vcard.big .more { right: 14px; top: 14px; width: 38px; height: 38px; }
.big-wrap .row-arrow { bottom: 18px; top: 6px; width: 70px; }
.big-wrap .row-arrow svg { width: 36px; height: 36px; }
.chip.shuf { display: inline-flex; align-items: center; gap: 6px; }
.chip.shuf svg { width: 14px; height: 14px; }
.scrub-line { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.shuffle-nav { border: 0; background: none; cursor: pointer; font: inherit; }
@media (max-width: 760px) {
  .big-row { grid-auto-columns: 86vw; column-gap: 12px; }
  .vcard.big .vthumb { border-radius: 14px; }
  .topbar .search { order: 3; }
}
.folder .fshuf {
  position: absolute; z-index: 3; right: 14px; bottom: 14px; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #0b0b17; background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 22px rgba(124, 108, 250, .45); opacity: 0; transform: translateY(6px) scale(.9); transition: opacity .2s, transform .2s;
}
.folder .fshuf svg { width: 20px; height: 20px; }
.folder:hover .fshuf, .folder:focus-within .fshuf { opacity: 1; transform: none; }
.folder .fshuf:hover { transform: scale(1.08); }
@media (hover: none) { .folder .fshuf { opacity: 1; transform: none; width: 38px; height: 38px; } }

/* ---------- sign-in ---------- */
body.signed-out .rail { display: none; }
body.signed-out main { margin-left: 0; }
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(80% 60% at 30% 10%, rgba(124, 108, 250, .28), transparent 70%), radial-gradient(70% 50% at 80% 90%, rgba(34, 211, 238, .16), transparent 70%), var(--bg);
}
.login-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center;
  background: rgba(24, 24, 41, .85); border: 1px solid var(--line2); border-radius: 22px; padding: 34px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); backdrop-filter: blur(12px);
}
.login-logo { width: 64px; height: 64px; margin: 0 auto 4px; filter: drop-shadow(0 8px 24px rgba(124, 108, 250, .5)); }
.login-card h1 { margin: 0; font-size: 34px; font-weight: 800; }
.login-card p { margin: 0 0 6px; color: var(--dim); }
.login-card .btn { justify-content: center; margin-top: 4px; }
.pw-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pw-row .input { flex: 1 1 180px; width: auto; }
.masonry .vcard { break-inside: avoid; margin-bottom: 16px; }
.masonry .vthumb { aspect-ratio: auto; }
.masonry .vthumb > img { height: auto; }
.masonry .vmeta { padding-top: 6px; }
.section-title h2 a:hover { color: var(--accent); }
/* exact preview frame shown full-screen while the video seeks */
.seek-frame { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: #000; z-index: 1; pointer-events: none; }
.seek-frame.on { display: flex; }
.seek-frame > div { height: 100%; max-width: 100%; background-repeat: no-repeat; image-rendering: auto; }
@media (max-aspect-ratio: 16/9) { .seek-frame > div { height: auto; width: 100%; } }

/* ---------- drifting posters (LyTV-style endless row) ---------- */
.drift { position: relative; overflow: hidden; margin: 0 calc(-1 * var(--pad)) 34px; padding: 6px 0 18px var(--pad); }
.drift::before, .drift::after { content: ""; position: absolute; top: 0; bottom: 0; width: var(--pad); z-index: 2; pointer-events: none; }
.drift::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.drift::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }
.drift-track {
  display: flex; width: max-content; will-change: transform;
  /* one poster's width every 5.5 s (videos), round and round */
  animation: drift calc(var(--n) * 5.5s) linear infinite;
}
.drift:hover .drift-track, .drift:focus-within .drift-track { animation-play-state: paused; }
.drift-track > .vcard { flex: 0 0 auto; width: clamp(260px, 31vw, 560px); margin-right: 18px; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .drift-track { animation: none; } .drift { overflow-x: auto; } }
@media (max-width: 760px) { .drift-track > .vcard { width: 78vw; margin-right: 12px; } }

/* ---------- delete ---------- */
.menu button.danger { color: #ff8a8d; }
.menu button.danger:hover { background: rgba(255, 90, 95, .14); }
.btn.danger-solid { background: #e5484d; border: 0; color: #fff; }
.btn.danger-solid:hover { background: #f2555a; }
.btn.danger-solid svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.confirm-bg { z-index: 120; }
.modal.confirm { width: min(460px, 100%); text-align: center; }
.cf-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: rgba(229, 72, 77, .15); color: #ff8a8d; }
.cf-icon svg { width: 28px; height: 28px; }
.cf-file { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); margin-bottom: 14px; }
.cf-file img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex: none; background: var(--card2); }
.cf-file b { display: block; word-break: break-all; }
.cf-file .mono { display: block; font-size: 12px; margin-top: 2px; }
.cf-warn { color: var(--dim); margin: 0 0 6px; }
.cf-warn b { color: #ff8a8d; }
.modal.confirm .foot { justify-content: center; }
.p-top .spacer { flex: 1; }

.slider { width: 100%; accent-color: var(--accent); }

/* Photos page: much bigger drifting photos, each frame shaped like its photo (nothing cropped) */
.drift.photos .drift-track > .vcard { width: auto; height: clamp(340px, 66vh, 820px); }
.drift.photos .vthumb { height: 100%; width: auto; aspect-ratio: var(--ar, 3 / 4); background: #08080f; border-radius: 18px; }
.drift.photos .vthumb > img { object-fit: contain; }
@media (max-width: 760px) { .drift.photos .drift-track > .vcard { height: 52vh; width: auto; } }

/* Photos drift slower per poster than videos (7 s vs 5.5 s) */
.drift.photos .drift-track { animation-duration: calc(var(--n) * 7s); }
/* Home: bigger drifting video posters (about 2–2.5 across) */
.drift:not(.photos) .drift-track > .vcard { width: clamp(320px, 42vw, 900px); margin-right: 22px; }
.drift:not(.photos) .vcard.big .vthumb { border-radius: 22px; }
@media (max-width: 760px) { .drift:not(.photos) .drift-track > .vcard { width: 86vw; margin-right: 12px; } }

/* ---------- rename ---------- */
.modal.rename { width: min(480px, 100%); }
.rn-row { display: flex; align-items: center; gap: 8px; }
.rn-row .input { flex: 1; }
.rn-ext { color: var(--dim); font-weight: 600; font-family: ui-monospace, Consolas, monospace; }

/* search results */
#files .search-grid { margin-bottom: 40px; }
#files .vmeta .c { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* file name under the drifting video posters */
.vcard.big .big-name { padding: 10px 4px 0; }
.vcard.big .big-name .t { font-size: 15px; font-weight: 700; color: var(--text); }
.drift.photos .big-name { display: none; }
/* choose thumbnail */
.modal.thumbpick { width: min(720px, 100%); }
.tp-view { position: relative; width: 100%; max-height: 56vh; margin: 0 auto 12px; border-radius: 12px; overflow: hidden; background: #000; display: flex; justify-content: center; }
.tp-frame { height: 100%; width: 100%; background-repeat: no-repeat; }
.tp-exact { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .12s; }
.tp-exact.on { opacity: 1; }
.tp-time { position: absolute; right: 10px; bottom: 10px; font-weight: 800; font-size: 14px; background: rgba(0,0,0,.7); padding: 3px 9px; border-radius: 7px; }
.tp-steps { display: flex; gap: 6px; margin: 8px 0 6px; }

/* ---------- Photos page: full-page scroll with a folder menu at the bottom ---------- */
.photo-page { position: relative; height: 100vh; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(120% 80% at 30% 0%, rgba(var(--amb), .35), transparent 70%), var(--bg); }
.pscroll { flex: 1; min-height: 0; display: flex; align-items: center; }
.pscroll .drift.full { margin: 0; padding: 18px 0; width: 100%; }
.pscroll .drift.full::before, .pscroll .drift.full::after { width: 40px; }
.drift.photos.full .drift-track > .vcard { height: calc(100vh - 120px); margin-right: 20px; }
/* the whole page is the scroll: only a photo under the mouse stops it (not the gaps) */
.drift.full:hover .drift-track { animation-play-state: running; }
.drift.full .drift-track:has(.vcard:hover) { animation-play-state: paused; }
.drift.full .drift-track.paused { animation-play-state: paused !important; }
.pbar { flex: none; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 0 16px 22px; }
.pselect { height: 40px; padding: 0 36px 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(24, 24, 41, .92);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; appearance: none; max-width: min(360px, 70vw);
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.pselect option { background: var(--card2); }
.pbar .icon-btn { width: 40px; height: 40px; background: rgba(24, 24, 41, .92); border: 1px solid var(--line2); }
.pbar .icon-btn svg { width: 18px; height: 18px; }
.photo-page .empty { margin: auto; max-width: 420px; }
@media (max-width: 760px) {
  .photo-page { height: calc(100vh - 64px - env(safe-area-inset-bottom)); }
  .drift.photos.full .drift-track > .vcard { height: calc(100vh - 64px - 110px); }
  .pbar { padding-bottom: 14px; }
}

/* skip buttons in the player */
.controls .icon-btn.skip svg { width: 26px; height: 26px; }
.controls .icon-btn.skip { width: 44px; }
.controls .icon-btn.skip:active { transform: scale(.92); }
@media (max-width: 760px) { .controls .icon-btn.skip { width: 36px; } .controls .icon-btn.skip svg { width: 22px; height: 22px; } #p-prev, #p-next { display: none; } }

.signout-nav { border: 0; background: none; cursor: pointer; font: inherit; }
.signout-nav:hover { color: #ff8a8d !important; }
.st-icon { background: rgba(124, 108, 250, .16); color: var(--accent); }
.still-bg { z-index: 130; }

/* ---------- Home: even bigger drifting posters, large Recently Added and folder videos ---------- */
.drift:not(.photos) .drift-track > .vcard { width: clamp(360px, 58vw, 1240px); margin-right: 24px; }
.row.big-recent { grid-auto-columns: clamp(320px, 42vw, 900px); gap: 22px; }
.big-recent .vthumb, .big-grid .vthumb { border-radius: 18px; }
.big-recent .vmeta .t, .big-grid .vmeta .t { font-size: 16px; }
.folder-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 16px; }
.folder-bar h2 { margin: 0 6px 0 0; font-size: 22px; font-weight: 700; }
.folder-bar .btn.small { height: 40px; }
.big-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(320px, 40vw, 880px)), 1fr)); gap: 30px 22px; margin-bottom: 50px; }
.big-grid .vplay svg, .big-recent .vplay svg { width: 70px; height: 70px; }
@media (max-width: 760px) {
  .drift:not(.photos) .drift-track > .vcard { width: 88vw; }
  .row.big-recent { grid-auto-columns: 82vw; }
}

/* touch scrubbing: let sideways slides reach the page, keep vertical scrolling */
.vcard:not(.photo) .vthumb { touch-action: pan-y; }
/* a drifting poster being scrubbed by touch holds the row still */
.drift-track:has(.vcard.scrubbing) { animation-play-state: paused; }

/* player: what Next plays */
.chip.next-mode { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: var(--text); margin-right: 6px; }
.chip.next-mode svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
@media (max-width: 760px) { .chip.next-mode { padding: 6px 10px; font-size: 12px; } }

/* scroll bar under the drifting rows */
.drift-bar { display: block; width: min(560px, calc(100% - 32px)); margin: -14px auto 30px; height: 18px; background: transparent; accent-color: var(--accent); cursor: pointer; }
.drift-bar::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); }
.drift-bar::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 34px; height: 12px; margin-top: -4px; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent2)); border: 0; }
.drift-bar { -webkit-appearance: none; appearance: none; }
.drift-bar::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); }
.drift-bar::-moz-range-thumb { width: 34px; height: 12px; border-radius: 8px; border: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.pscroll { flex-direction: column; justify-content: center; }
.pscroll .drift-bar { margin: 4px auto 0; }
@media (max-width: 760px) { .drift-bar { height: 28px; margin-top: -10px; } .drift-bar::-webkit-slider-thumb { width: 44px; height: 18px; margin-top: -7px; } }
.drift.photos.full .drift-track > .vcard { height: calc(100vh - 150px); }
@media (max-width: 760px) { .drift.photos.full .drift-track > .vcard { height: calc(100vh - 64px - 150px); } }

/* touch gestures in the player */
.player { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.p-gesture { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none; display: none;
  padding: 14px 22px; border-radius: 18px; background: rgba(0, 0, 0, .62); text-align: center; color: #fff; }
.p-gesture.on { display: block; }
.p-gesture.left { left: 22%; } .p-gesture.right { left: 78%; }
.p-gesture b { display: block; font-family: Outfit, sans-serif; font-weight: 800; font-size: 28px; }
.p-gesture small { display: block; margin-top: 2px; font-size: 13px; font-weight: 600; opacity: .8; }
.p-gesture svg { width: 30px; height: 30px; }
