:root {
  --bg: #0b0a0a;
  --surface: #141111;
  --elevated: #1c1818;
  --fg: #f0ece8;
  --muted: #8a7f7a;
  --faint: #5c5552;
  --accent: #c94b5a;
  --accent-fg: #fff7f5;
  --border: rgba(240, 236, 232, 0.1);
  --border-strong: rgba(240, 236, 232, 0.18);
  --radius: 8px;
  --wrap: 72rem;
  --font: "Commissioner", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--font); line-height: 1.5; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.main { flex: 1; padding: 1.5rem 0 3rem; }
.grow { flex: 1; }

.top { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: rgba(11, 10, 10, 0.92); backdrop-filter: blur(12px); }
.top-inner { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; }
.logo { flex-shrink: 0; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.03em; }
.logo span { color: var(--accent); }
.search { flex: 1; min-width: 0; }
.search input,
.stack input,
.stack textarea,
.stack select,
label input,
label textarea,
label select {
  width: 100%;
  min-height: 2.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--elevated);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0.55rem 0.9rem;
}
.search input { padding-left: 0.9rem; }
.search input:focus,
.stack input:focus,
.stack textarea:focus,
.stack select:focus { box-shadow: 0 0 0 1px rgba(201, 75, 90, 0.7); outline: none; }
textarea { min-height: 7rem; resize: vertical; }
.ghost, .btn, .danger, .linkish {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0 1rem; border: 0; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600;
}
.ghost { background: var(--elevated); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1); color: var(--fg); }
.btn { background: var(--accent); color: var(--accent-fg); }
.btn:hover { filter: brightness(1.05); }
.danger { background: transparent; color: #f0a0a8; box-shadow: 0 0 0 1px rgba(201, 75, 90, 0.35); }
.linkish { background: none; color: var(--muted); min-height: auto; padding: 0; font-weight: 500; }
.linkish:hover, .ghost:hover { color: var(--fg); }

.kicker { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-top: 0.4rem; }
.lead, .muted { color: var(--muted); font-size: 0.95rem; margin-top: 0.75rem; max-width: 42rem; }
.h { margin: 2rem 0 1rem; font-size: 1.125rem; }
.crumbs { color: var(--muted); font-size: 0.875rem; margin-bottom: 0.75rem; }
.crumbs a:hover { color: var(--fg); }

.cats { display: flex; gap: 0.4rem; overflow-x: auto; padding: 1rem 0; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a {
  flex-shrink: 0; padding: 0.4rem 0.75rem; border-radius: 999px; font-size: 0.8rem;
  background: var(--elevated); box-shadow: 0 0 0 1px var(--border); color: var(--muted);
}
.cats a.on, .cats a:hover { color: var(--fg); box-shadow: 0 0 0 1px var(--accent); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 0.75rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem 1rem; } }

.card { display: block; }
.thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(145deg, #1c1818 0%, #2a1a1d 55%, #141111 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 45%, rgba(0, 0, 0, 0.1));
  pointer-events: none;
}
.badge, .dur {
  position: absolute; z-index: 1; padding: 0.15rem 0.4rem; border-radius: 4px;
  background: rgba(0, 0, 0, 0.72); font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
}
.badge.l { top: 0.5rem; left: 0.5rem; }
.badge.r { top: 0.5rem; right: 0.5rem; }
.dur { right: 0.5rem; bottom: 0.5rem; font-size: 11px; font-variant-numeric: tabular-nums; }
.card h3 { margin-top: 0.5rem; font-size: 0.875rem; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card:hover h3 { color: var(--accent); }
.meta { margin-top: 0.35rem; display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta a:hover { color: var(--fg); }

.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--border); }
.empty p { color: var(--muted); margin-top: 0.4rem; }
.empty .btn { margin-top: 1.25rem; }

.pager { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.75rem; }
.pager a { min-width: 2.5rem; min-height: 2.5rem; display: grid; place-items: center; border-radius: var(--radius); background: var(--elevated); font-size: 0.875rem; }
.pager a.on { background: var(--accent); color: var(--accent-fg); }

.player {
  position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.player iframe, .play-start, .play-start img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play-start { display: grid; place-items: center; padding: 0; border: 0; background: #000; color: var(--fg); }
.play-start img { object-fit: cover; }
.play-start::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.play-btn {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 3.5rem; padding: 0 1.35rem; border-radius: 999px; background: var(--accent); color: var(--accent-fg);
  font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.play-btn::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor; }
.player-bar { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0.75rem; background: var(--elevated); border-radius: 0 0 12px 12px; margin-top: -2px; font-size: 0.75rem; color: var(--muted); }
.player-bar a:hover { color: var(--fg); }
.vt { margin-top: 1.25rem; font-size: 1.35rem; }
.q { color: var(--accent); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0 1.25rem; }
.tags a { padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--elevated); font-size: 0.8rem; box-shadow: 0 0 0 1px var(--border); }
.tags a:hover { box-shadow: 0 0 0 1px var(--accent); }
.box { background: var(--surface); border-radius: 12px; padding: 1.1rem 1.2rem; box-shadow: 0 0 0 1px var(--border); margin: 1rem 0 2rem; }
.box h2 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.box p { color: var(--muted); font-size: 0.95rem; }

.taglist { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.5rem; }
@media (min-width: 640px) { .taglist { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .taglist { grid-template-columns: 1fr 1fr 1fr; } }
.taglist a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.taglist a:hover { box-shadow: 0 0 0 1px var(--accent); }
.taglist a span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

.foot { margin-top: auto; border-top: 1px solid var(--border); padding: 1.5rem 0 2rem; color: var(--muted); font-size: 0.8rem; }
.foot .links { display: flex; gap: 1rem; margin-top: 0.6rem; }
.foot a:hover { color: var(--fg); }

#age-gate {
  display: none; position: fixed; inset: 0; z-index: 80; align-items: center; justify-content: center;
  padding: 1.25rem; background: var(--bg);
  background-image: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(201, 75, 90, 0.16), transparent 60%);
}
html:not(.age-ok) body:not(.admin) #age-gate { display: flex; }
html:not(.age-ok) body:not(.admin) .page { visibility: hidden; }
.age-card { width: min(100%, 32rem); background: var(--surface); border-radius: 16px; padding: 1.75rem 1.6rem; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1); }
.age-card h1 { font-size: 1.65rem; }
.age-card .lead { margin: 0.85rem 0 1.4rem; }
.row-btns { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.row-btns .btn, .row-btns .ghost { flex: 1; min-width: 10rem; }

body.admin { background: var(--bg); }
.login-card { width: min(100% - 2rem, 26rem); margin: 12vh auto; background: var(--surface); padding: 1.75rem 1.5rem; border-radius: 16px; box-shadow: 0 0 0 1px var(--border); }
.login-card h1 { margin-bottom: 0.4rem; }
.login-card form { display: grid; gap: 0.75rem; margin-top: 1.1rem; }
.login-card label, .stack label { display: grid; gap: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.admin-top { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; font-size: 0.875rem; color: var(--muted); }
.admin-top a:hover { color: var(--fg); }
.admin-nav { display: flex; gap: 0.35rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.admin-nav a { padding: 0.45rem 0.8rem; border-radius: 999px; font-size: 0.85rem; color: var(--muted); }
.admin-nav a.on { background: var(--elevated); color: var(--fg); box-shadow: 0 0 0 1px var(--border); }
.admin-main { padding: 1.5rem 0 3rem; }
.admin-main h1 { margin-bottom: 0.75rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.stats > div { background: var(--surface); padding: 0.9rem 1rem; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--border); }
.stats small { color: var(--muted); font-size: 0.75rem; }
.stats strong { display: block; margin-top: 0.2rem; }
.stack { display: grid; gap: 0.85rem; max-width: 40rem; }
.stack h2 { margin-top: 0.6rem; font-size: 1.05rem; }
.check { display: flex !important; align-items: center; gap: 0.55rem; color: var(--fg) !important; font-size: 0.9rem !important; }
.check input { width: auto; min-height: 0; box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.6rem; background: var(--elevated); border-radius: 999px; font-size: 0.8rem; }
.chip input { width: auto; min-height: 0; box-shadow: none; }
.admin-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.6rem; }
.admin-list li { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 0.85rem; align-items: center; background: var(--surface); padding: 0.55rem; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--border); }
.admin-list img { width: 5.5rem; height: 3.1rem; object-fit: cover; border-radius: 4px; background: #000; }
.admin-list p { color: var(--muted); font-size: 0.75rem; margin-top: 0.2rem; }
.err { color: #f0a0a8; background: rgba(201, 75, 90, 0.12); padding: 0.6rem 0.8rem; border-radius: var(--radius); }
.ok { color: #b7e0c2; background: rgba(60, 140, 90, 0.15); padding: 0.6rem 0.8rem; border-radius: var(--radius); }
.help { max-width: 44rem; }
.help h2 { margin: 1.5rem 0 0.5rem; font-size: 1.05rem; }
.help ol, .help p { color: var(--muted); }
.help li { margin: 0.35rem 0; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }
pre { background: var(--elevated); padding: 0.85rem 1rem; border-radius: var(--radius); overflow: auto; color: var(--fg); white-space: pre-wrap; }

@media (max-width: 640px) {
  .top-inner { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .admin-list li { grid-template-columns: 4.5rem 1fr; }
  .admin-list form { grid-column: 1 / -1; }
}
