:root {
  --bg: #0b0d12; --panel: #141821; --panel2: #1b2030; --line: #262c3d;
  --text: #e9ecf3; --muted: #8e97ad; --accent: #5b8cff; --accent2: #3f6fe6;
  --ok: #34c37a; --warn: #f0b44c; --bad: #ef5d5d; --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1000px 500px at 50% -10%, #1d2a52 0%, transparent 60%); }
.auth .card { width: 100%; max-width: 400px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent);
  display: grid; place-items: center; }
.brand .logo::after { content: ""; border-left: 11px solid #fff; border-top: 7px solid transparent;
  border-bottom: 7px solid transparent; margin-left: 3px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.auth h1 { font-size: 22px; margin: 22px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 6px; }
input, textarea, select { width: 100%; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.otp { letter-spacing: 10px; font-size: 24px; text-align: center; font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; border-radius: 10px; padding: 11px 18px; font-weight: 600; }
.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--panel2); }
.btn.danger { background: transparent; border: 1px solid #5a2a2a; color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

/* shell */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: rgba(11,13,18,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 4px; margin-left: 12px; }
.brand, .top nav a, .who .btn { white-space: nowrap; }
.top nav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.top nav a.on, .top nav a:hover { color: var(--text); background: var(--panel2); }
.top .sp { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center;
  font-weight: 700; color: var(--text); border: 1px solid var(--line); }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h2 { margin: 0 0 16px; font-size: 22px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row .sp { flex: 1; }

/* library */
.search { max-width: 320px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 18px; }
.tile { cursor: pointer; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--panel2);
  border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.tile:hover .thumb img { transform: scale(1.04); }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.75); padding: 1px 7px;
  border-radius: 6px; font-size: 12px; font-weight: 600; }
.tile h3 { font-size: 15px; margin: 10px 0 2px; line-height: 1.35; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }

/* watch */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.player { background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16/9; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.watch h1 { font-size: 21px; margin: 16px 0 6px; }
.desc { white-space: pre-wrap; color: #c7cddb; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; margin-top: 12px; }
.side .tile { display: grid; grid-template-columns: 150px 1fr; gap: 10px; margin-bottom: 12px; }
.side .tile h3 { margin: 0; font-size: 14px; }

/* admin */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .k { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
.tbl { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td .mini { width: 96px; aspect-ratio: 16/9; border-radius: 6px; object-fit: cover; background: var(--panel2); display: block; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); }
.pill.ok { color: var(--ok); background: rgba(52,195,122,.12); }
.pill.warn { color: var(--warn); background: rgba(240,180,76,.12); }
.pill.bad { color: var(--bad); background: rgba(239,93,93,.12); }
.pill.acc { color: var(--accent); background: rgba(91,140,255,.12); }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 36px; text-align: center; cursor: pointer; color: var(--muted); }
.drop.over { border-color: var(--accent); background: rgba(91,140,255,.06); }
.uploads { margin-top: 18px; display: grid; gap: 10px; }
.up { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.bar { height: 6px; background: var(--panel2); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal .card { width: 100%; max-width: 520px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text); margin: 0; }
.toggle input { width: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2);
  border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; z-index: 60; }

@media (max-width: 900px) {
  .watch { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 16px; }
  .top { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .top nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
  .who .email { display: none; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hide-sm { display: none; }
  th, td { padding: 9px 10px; }
}
