:root {
  --bg: #0b0b0f;
  --surface: #16161d;
  --surface-2: #20202a;
  --text: #f4f4f7;
  --muted: #9a9aa8;
  --accent: #ff3d6e;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 1em; height: 1em; fill: currentColor; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(11, 11, 15, .85); backdrop-filter: blur(14px); border-bottom: 1px solid #ffffff10; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); font-size: 13px; padding-left: 2px; }
.search { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid #ffffff14; border-radius: 999px; padding: 8px 14px; color: var(--muted); }
.search:focus-within { border-color: #ffffff40; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.btn-primary { background: var(--accent); padding: 9px 16px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.btn-ghost:hover, .btn-ghost.active { background: #2c2c38; }
.btn-primary:disabled, .btn-ghost:disabled { opacity: .4; pointer-events: none; }
.btn-ghost svg { font-size: 18px; }
#wlCount { background: var(--accent); border-radius: 999px; font-size: 12px; padding: 0 7px; line-height: 20px; }

/* Watchlist page */
.watchlist { max-width: 860px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 60px; }
.wl-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.wl-head h1 { margin: 0; font-size: 26px; }
.wl-head .count { margin: 4px 0 0; }
.wl-actions { display: flex; gap: 10px; }
.wl-actions button { padding: 10px 18px; }
.wl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wl-item { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: var(--radius); background: var(--surface); }
.wl-item:hover { background: var(--surface-2); }
.wl-num { width: 22px; text-align: center; color: var(--muted); font-weight: 600; flex: none; }
.wl-thumb { position: relative; flex: none; width: 72px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; cursor: pointer; }
.wl-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.wl-info { flex: 1; min-width: 0; cursor: pointer; }
.wl-info b { display: block; font-size: 16px; }
.wl-info span { color: var(--muted); font-size: 13px; }
.wl-btns { display: flex; gap: 4px; flex: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; color: var(--muted); }
.icon-btn:hover { background: #ffffff14; color: var(--text); }
.icon-btn:disabled { opacity: .25; pointer-events: none; }
.queue-label { position: absolute; z-index: 2; top: calc(20px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px); padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; }

/* Upload page */
.up-pass { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.up-pass label { font-weight: 600; }
.up-pass input { flex: 1; min-width: 200px; background: var(--surface); border: 1px solid #ffffff20; border-radius: 10px;
  padding: 10px 12px; color: var(--text); font: inherit; }
.up-pass input:focus { outline: none; border-color: var(--accent); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 20px; text-align: center;
  border: 2px dashed #ffffff30; border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: .2s; }
.dropzone svg { font-size: 44px; color: var(--accent); margin-bottom: 6px; }
.dropzone b { font-size: 18px; }
.dropzone span { color: var(--muted); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #ff3d6e14; }
.up-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.up-item { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: var(--radius); background: var(--surface); }
.up-item video, .up-item img { flex: none; width: 64px; aspect-ratio: 9 / 16; object-fit: contain; background: #000; border-radius: 8px; }
.up-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.up-body input { width: 100%; background: var(--surface-2); border: 1px solid #ffffff14; border-radius: 8px;
  padding: 8px 10px; color: var(--text); font: inherit; }
.up-body input:focus { outline: none; border-color: #ffffff40; }
.up-meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-item.done .up-bar i { background: #3ecf8e; }
.up-item.error .up-meta { color: #ff6b6b; }
.up-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.up-actions > * { padding: 10px 18px; }

/* + watchlist button on cards */
.wl-btn { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0,0,0,.45); font-size: 22px; font-weight: 600; line-height: 1; transition: background .2s; }
.wl-btn:hover { background: #ffffff30; }
.wl-btn.on { background: #fff; color: var(--bg); font-size: 18px; }

/* Videos | Photos tabs */
.tabs { display: flex; gap: 28px; padding: 0 clamp(16px, 4vw, 40px); border-bottom: 1px solid #ffffff10; }
.tabs a { padding: 14px 2px 12px; font-weight: 700; font-size: 17px; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tabs b { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }

/* Photo viewer */
.viewer { position: fixed; inset: 0; z-index: 30; background: #000; }
.viewer-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  overflow: auto; cursor: zoom-in; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; }
.viewer.actual .viewer-stage { display: block; cursor: zoom-out; text-align: center; }
.viewer.actual .viewer-stage img { max-width: none; max-height: none; display: inline-block; margin: auto; }
.v-btn { position: absolute; z-index: 2; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(8px); font-size: 28px; transition: background .2s; }
.v-btn:hover { background: rgba(255,255,255,.2); }
.v-btn:disabled { opacity: 0; pointer-events: none; }
.v-close { top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }
.v-prev, .v-next { top: 50%; transform: translateY(-50%); }
.v-prev { left: 14px; }
.v-next { right: 14px; }
.v-bar { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 40px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0,0,0,.8), transparent); pointer-events: none; }
.v-bar > * { pointer-events: auto; }
.v-text { flex: 1; min-width: 0; }
.v-text b { display: block; font-size: 18px; }
.v-text span { color: #ffffffb0; font-size: 13px; }
.v-actions { display: flex; gap: 8px; }
.v-act { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 999px;
  background: rgba(255,255,255,.14); font-size: 18px; font-weight: 700; }
.v-act:hover { background: rgba(255,255,255,.25); }
.v-act.on { color: var(--accent); }
.viewer.actual #vZoom { background: var(--text); color: var(--bg); }
.viewer.actual .v-prev, .viewer.actual .v-next { display: none; }

/* Slideshow */
.count-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 12px; }
.count-row .count { margin: 0; }
.ss-progress { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 3px; opacity: 0; }
.ss-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.viewer.slideshow .ss-progress { opacity: 1; }
.viewer.slideshow #vPlay { background: var(--accent); }
#vSpeed { display: none; font-size: 14px; }
.viewer.slideshow #vSpeed { display: grid; }
.viewer-stage img { transition: opacity .35s ease; }
.viewer-stage img.loading { opacity: 0; }

/* Home */
.home { padding: 20px clamp(16px, 4vw, 40px) 60px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--surface-2); font-weight: 500; font-size: 14px; }
.chip:hover { background: #2c2c38; }
.chip.active { background: var(--text); color: var(--bg); }
.count { color: var(--muted); font-size: 13px; margin: 14px 0 12px; }
.grid { display: flex; gap: 14px; align-items: flex-start; }
.grid-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.empty { color: var(--muted); text-align: center; padding: 60px 0; }

.card { position: relative; display: block; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); aspect-ratio: 9 / 16; transition: transform .2s ease; }
.card:hover { transform: translateY(-3px); }
.card img, .card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card video { opacity: 0; transition: opacity .25s; }
.card.previewing video { opacity: 1; }
.card::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent 40%); }
.card-info { position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 1;
  display: flex; align-items: center; gap: 10px; }
.card-title { font-weight: 700; font-size: 19px; }
.card-sub { color: #ffffffb0; font-size: 14px; }
.expand { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%;
  background: rgba(0,0,0,.45); font-size: 18px; transition: background .2s; }
.expand:hover { background: var(--accent); }
.card-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; z-index: 2; background: #ffffff25; opacity: 0; }
.card-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.card.playing .card-progress { opacity: 1; }
.card.playing { transform: none; box-shadow: 0 0 0 2px var(--accent); }
.card { cursor: pointer; }
.card-text { flex: 1; min-width: 0; }
.play-btn { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%;
  color: #fff; background: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.4); transition: transform .2s; }
.play-btn svg { width: 20px; height: 20px; }
.play-btn .i-play { margin-left: 3px; }
.play-btn .i-pause, .card.playing:not(.paused) .play-btn .i-play { display: none; }
.card.playing:not(.paused) .play-btn .i-pause { display: block; }
.card:hover .play-btn { transform: scale(1.08); }
.badge { position: absolute; top: 8px; right: 8px; z-index: 1; background: rgba(0,0,0,.65);
  font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.badge.new { left: 8px; right: auto; background: var(--accent); }
.card .liked { position: absolute; top: 8px; left: 8px; z-index: 1; color: var(--accent); font-size: 18px; }

/* Feed (vertical swipe player) */
.feed { position: fixed; inset: 0; z-index: 20; background: #000; }
.feed-track { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; }
.feed-track::-webkit-scrollbar { display: none; }
.slide { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; justify-content: center; align-items: center; }
.slide-stage { position: relative; height: 100%; max-height: 100dvh; aspect-ratio: 9 / 16; max-width: 100%; }
.slide video { width: 100%; height: 100%; object-fit: contain; display: block; }
.slide-bg { position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: blur(40px) brightness(.35); transform: scale(1.2); }
.slide-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent 35%); }
.slide-meta { position: absolute; left: 16px; right: 80px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.slide-meta h2 { margin: 0 0 4px; font-size: 18px; }
.slide-meta p { margin: 0; color: #ffffffb8; font-size: 13px; }
.actions { position: absolute; right: 10px; bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 18px; align-items: center; }
.action { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.action span.ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.14); backdrop-filter: blur(8px); font-size: 24px; transition: transform .15s; }
.action:active span.ico { transform: scale(.88); }
.action.on span.ico { color: var(--accent); }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #ffffff25; cursor: pointer; }
.progress::before { content: ""; position: absolute; inset: -10px 0 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--text); }
.play-indicator { position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.45); font-size: 36px; pointer-events: none;
  opacity: 0; transition: opacity .2s; }
.slide.paused .play-indicator { opacity: 1; }
.heart-pop { position: absolute; font-size: 90px; color: var(--accent); pointer-events: none;
  animation: pop .8s ease forwards; transform: translate(-50%, -50%); }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.4); }
  20% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%,-90%) scale(1); } }
.feed-close { position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top, 0px)); left: 14px;
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.45); font-size: 26px; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; }

@media (max-width: 600px) {
  .topbar { gap: 10px; }
  .logo { font-size: 0; gap: 0; }
  .v-prev, .v-next { display: none; }
  .up-item img { width: 64px; }
  .wl-label { display: none; }
  .wl-item { gap: 10px; }
  .wl-num { display: none; }
  .btn-primary { padding: 8px 12px; font-size: 14px; }
  .grid, .grid-col { gap: 10px; }
  .play-btn { width: 40px; height: 40px; }
  .card-title { font-size: 16px; }
  .slide-stage { width: 100%; aspect-ratio: auto; }
}
