/* Layout: a cinema-dark library — sticky search bar, a hashtag rail, a poster grid; the watch page puts the player first with related videos beside it. */
:root {
  --bg: #0d0e11; --bg2: #14161b; --panel: #1a1d23; --line: #262a32; --hover: #22262e;
  --text: #eceef2; --muted: #9aa0ab; --dim: #6b717c;
  --accent: #ff5a3c; --accent2: #ff8a5b; --accent-ink: #1a0802; --good: #2fbf71; --bad: #ff4d5e;
  --f-ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--f-ui); font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px clamp(16px, 3vw, 32px); background: rgba(13, 14, 17, .86); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.logo i { width: 30px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; }
.search { flex: 1; max-width: 620px; margin: 0 auto; display: flex; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 16px; }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 10px 0; }
.search button { border: 0; background: var(--panel); border-radius: 999px; width: 36px; height: 30px; cursor: pointer; display: grid; place-items: center; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- hashtag rail ---------- */
.wrap { padding-inline: clamp(16px, 3vw, 32px); padding-block: 0 60px; max-width: 1680px; margin: 0 auto; }
.rail { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.chip small { color: var(--dim); font-weight: 500; margin-left: 4px; }
.chip.on small { color: var(--bg); opacity: .6; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.bar h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; text-wrap: balance; }
.seg { display: flex; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--panel); color: var(--text); }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 26px 18px; }
.card { display: grid; gap: 10px; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: var(--panel); max-width: 100%; }
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb .dur { z-index: 2; position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .78); color: #fff; font: 600 12px var(--f-num); padding: 2px 6px; border-radius: 5px; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 34px; }
.card h3 { margin: 0; font-size: 15.5px; line-height: 1.35; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { color: var(--accent2); font-size: 13px; font-weight: 600; }
.tag:hover { text-decoration: underline; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

/* ---------- watch page ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 26px; padding-top: 18px; }
.player { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r); overflow: hidden; max-width: 100%; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.wtitle { margin: 16px 0 8px; font-size: 22px; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.wmeta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.desc { margin-top: 14px; background: var(--panel); border-radius: var(--r); padding: 14px 16px; line-height: 1.6; }
.desc .tags { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.desc p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; max-width: 75ch; }
.desc.clamp p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { border: 0; background: transparent; color: var(--text); font-weight: 700; cursor: pointer; padding: 6px 0 0; }
.side h4 { margin: 0 0 12px; font-size: 15px; }
.mini { display: grid; grid-template-columns: 168px 1fr; gap: 10px; margin-bottom: 12px; }
.mini .thumb { border-radius: 10px; }
.mini h3 { margin: 0; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 140%); background: var(--text); color: var(--bg); font-weight: 700; padding: 10px 18px; border-radius: 999px; transition: transform .3s ease; z-index: 50; }
.toast.on { transform: translate(-50%, 0); }

@media (max-width: 1100px) { .watch { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .top { gap: 10px; } .logo span { display: none; }
  .grid { grid-template-columns: 1fr; gap: 22px; }
  .mini { grid-template-columns: 140px 1fr; }
  .wtitle { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- admin ---------- */
.adm { max-width: 1200px; margin: 0 auto; padding-inline: clamp(16px, 3vw, 32px); padding-block: 22px 80px; display: grid; gap: 18px; }
.box { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.box h2 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat small { color: var(--muted); font-size: 12.5px; }
.stat b { display: block; font-size: 24px; margin-top: 4px; font-family: var(--f-num); }
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.inp { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
.inp:focus { border-color: var(--accent); }
textarea.inp { resize: vertical; min-height: 90px; }
.up { display: grid; grid-template-columns: 320px 1fr; gap: 18px; }
.drop { border: 2px dashed var(--line); border-radius: var(--r); aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 16px; cursor: pointer; color: var(--muted); position: relative; overflow: hidden; background: var(--bg); max-width: 100%; }
.drop.over { border-color: var(--accent); color: var(--text); }
.drop video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.drop b { display: block; color: var(--text); margin-bottom: 4px; }
.prog { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.ufields { display: grid; gap: 12px; align-content: start; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tagpreview { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.tagpreview span { background: rgba(255, 90, 60, .14); color: var(--accent2); font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t img { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; display: block; background: var(--panel); }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.pill.on { background: rgba(47, 191, 113, .14); color: var(--good); }
.pill.off { background: var(--panel); color: var(--muted); }
.taglist { display: flex; gap: 8px; flex-wrap: wrap; }
.taglist .chip { cursor: default; display: inline-flex; gap: 6px; align-items: center; }
.taglist .chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; }
.taglist .chip button:hover { color: var(--text); }
.login { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 12px; text-align: center; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal .box { width: min(640px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 12px; }
@media (max-width: 860px) { .up { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr 1fr; } .two { grid-template-columns: 1fr; } }
