:root {
  --bg: #0e0e11;
  --bg2: #17171c;
  --bg3: #22222a;
  --line: #2e2e38;
  --fg: #ececf1;
  --muted: #9a9aa8;
  --accent: #ff4f7b;
  --accent2: #ff7a9a;
  --danger: #e5484d;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: .2em 0 .5em; }
h2 { font-size: 1.1rem; margin: 0 0 .6em; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55em .75em;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 8px;
  padding: .55em 1em; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: .3em .7em; font-size: .85rem; }

.chip {
  display: inline-flex; align-items: center; gap: .35em;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px;
  padding: .25em .75em; font-size: .85rem; cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.sm { padding: .1em .55em; font-size: .75rem; }
.chip .count { color: var(--muted); font-size: .75rem; }
.chip.on .count { color: #ffe0e8; }

/* ---------- layout ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.2rem;
  background: rgba(14, 14, 17, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--accent); white-space: nowrap; }
.search { flex: 1; max-width: 460px; }
.links { display: flex; gap: 1rem; font-size: .92rem; }
.links a { text-decoration: none; color: var(--muted); }
.links a:hover, .links a[aria-current] { color: var(--fg); }
.user { margin-left: auto; display: flex; gap: .4rem; }
.spacer { flex: 1; }
.wrap { width: 100%; max-width: 1500px; margin: 0 auto; padding: 1rem 1.2rem 2rem; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--line); margin-top: 1rem; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; margin-bottom: .8rem; }
.foot nav a { color: var(--fg); text-decoration: none; }
.foot p { max-width: 760px; margin: .4rem auto; }
.center { text-align: center; margin-top: 1.5rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.between input { width: auto; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 3rem 0; }

.toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.toolbar select { width: auto; margin-left: auto; }
.active-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-panel { margin-bottom: 1.2rem; }
.tag-panel summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-cloud.small { gap: .3rem; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { text-decoration: none; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--bg2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.04); }
.nothumb { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 1.6rem; }
.dur {
  position: absolute; right: .4rem; bottom: .4rem;
  background: rgba(0, 0, 0, .8); border-radius: 5px; padding: .05em .4em; font-size: .78rem; font-variant-numeric: tabular-nums;
}
.card-title { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; }
.card:hover .card-title { color: var(--accent2); }
.card-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- watch ---------- */
.watch { max-width: 1200px; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { display: block; width: 100%; max-height: 78vh; background: #000; }
.watch h1 { margin-top: .8rem; }
.meta { color: var(--muted); font-size: .9rem; margin-bottom: .7rem; }
.desc { white-space: pre-wrap; color: #d4d4dc; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.4rem; align-items: start; }
.watch-layout.no-side { grid-template-columns: minmax(0, 1fr); }
.watch-side { position: sticky; top: 4.5rem; display: flex; flex-direction: column; gap: 1rem; }
.meta-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; font-size: .9rem; }
.btn.on { border-color: var(--accent); color: var(--accent2); }
.related, .comments { margin-top: 2.2rem; }
.comment-list { list-style: none; padding: 0; margin: 0 0 1.2rem; display: flex; flex-direction: column; gap: .9rem; }
.comment { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.comment-head { display: flex; gap: .6rem; align-items: baseline; font-size: .88rem; }
.comment p { margin: .3rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; max-width: 720px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: .8rem; text-decoration: underline; }
.link-btn:hover { color: var(--danger); }
form.inline { display: inline; margin: 0; }

/* ---------- listings ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.page-head h1 { margin: 0; }
.intro { color: #d4d4dc; max-width: 900px; margin: 0 0 1rem; white-space: pre-wrap; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .tabs { margin: 0; }
.tabs a { text-decoration: none; padding: .35em .85em; border-radius: 999px; border: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2rem; }

/* ---------- ads ---------- */
.ad { display: flex; justify-content: center; align-items: center; overflow: hidden; max-width: 100%; }
body > .ad { padding: .7rem 1rem 0; }
.ad-below-player { margin: 1.2rem 0; }
.grid-ad { min-height: 250px; background: var(--bg2); border-radius: var(--radius); }
.ad iframe, .ad img { max-width: 100%; }

/* ---------- age overlay ---------- */
body.gated { overflow: hidden; }
body.gated > header, body.gated > main, body.gated > footer, body.gated > .ad { filter: blur(14px); pointer-events: none; user-select: none; }
.age-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem;
  background: rgba(8, 8, 10, .72);
}
.gate-card {
  max-width: 460px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; padding: 2rem; text-align: center; box-shadow: 0 20px 60px #000a;
}
.gate-card h2 { font-size: 1.35rem; margin: .6rem 0; }
.gate-card p { color: #cfcfd8; font-size: .92rem; }
.badge {
  display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--accent); color: var(--accent); font-weight: 800; font-size: 1.3rem;
}
.gate-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.4rem; }

/* ---------- forms, prose ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.check input { width: auto; margin-top: .2em; }
.prose { max-width: 820px; margin: 0 auto; }
.prose h2 { margin-top: 1.4rem; }
.prose p, .prose li { color: #d4d4dc; }
.prose address { font-style: normal; background: var(--bg3); padding: .8rem 1rem; border-radius: 8px; }
.danger-zone { margin-top: 3rem; color: var(--muted); font-size: .9rem; }
.danger-zone summary { cursor: pointer; }
.danger-zone form { display: flex; gap: .6rem; margin-top: .7rem; max-width: 480px; }

/* ---------- admin ---------- */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem; margin-bottom: 1.4rem; }
.panel.narrow { max-width: 380px; margin: 3rem auto; display: flex; flex-direction: column; gap: .8rem; }
.drop {
  display: block; border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 1.6rem; text-align: center; cursor: pointer; color: var(--muted); margin-bottom: 1rem;
  overflow-wrap: anywhere;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--fg); }
.drop input { display: none; }
.upload-grid { display: grid; grid-template-columns: 280px 1fr; gap: 1.2rem; margin-bottom: 1rem; }
.thumb-pick { display: flex; flex-direction: column; gap: .5rem; }
.fields { display: flex; flex-direction: column; gap: .55rem; min-width: 0; }
progress { width: 100%; height: 8px; margin-bottom: .8rem; accent-color: var(--accent); }
.admin-list { display: flex; flex-direction: column; gap: .9rem; }
.admin-row { display: grid; grid-template-columns: 200px 1fr; gap: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.admin-row:last-child { border-bottom: 0; }
.tag-row { display: flex; flex-direction: column; gap: .4rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.tag-row:last-child { border-bottom: 0; }
.comment-body { margin: 0; white-space: pre-wrap; color: #d4d4dc; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .watch-layout { grid-template-columns: minmax(0, 1fr); }
  .watch-side { position: static; }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .links { gap: .8rem; }
}
@media (max-width: 700px) {
  .top { gap: .6rem; padding: .6rem .8rem; }
  .links { order: 6; flex-basis: 100%; justify-content: space-around; }
  .brand { font-size: 1rem; }
  .wrap { padding: .8rem .8rem 2rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
  .upload-grid, .admin-row { grid-template-columns: 1fr; }
}
