:root {
  --bg: #0b0f17; --panel: #121826; --panel-2: #182033; --line: rgba(148, 163, 184, .14); --line-2: rgba(148, 163, 184, .26);
  --text: #eef2f8; --muted: #9aa8bf; --dim: #6f7d95; --accent: #ff6b35; --accent-2: #ff8f61; --accent-soft: rgba(255, 107, 53, .14);
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: rgba(11, 15, 23, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; text-decoration: none; }
.brand i { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand i svg { width: 14px; height: 14px; fill: #fff; stroke: none; }
.search { flex: 1; max-width: 420px; margin-left: auto; position: relative; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); outline: none; }
.search input:focus { border-color: var(--accent); }
.search .ico { position: absolute; left: 11px; top: 11px; color: var(--dim); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: none; }
.btn.danger:hover { border-color: var(--bad); color: #ffb4b4; }
.btn.sm { height: 34px; padding: 0 11px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { width: 40px; padding: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.head .sub { color: var(--muted); font-size: 14px; }
.head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 6px; }
.crumb:hover { color: var(--text); }
.note { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); margin-bottom: 16px; }
.note.warn { border-color: rgba(245, 158, 11, .45); color: #fcd9a0; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

/* grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); text-align: left; padding: 0; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.thumb { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1b2438, #10151f); display: grid; place-items: center; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { color: var(--dim); }
.thumb .ph .ico { width: 34px; height: 34px; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .75); font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s; background: rgba(0, 0, 0, .25); }
.thumb .play i { width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 107, 53, .95); display: grid; place-items: center; }
.thumb .play i svg { fill: #fff; stroke: none; width: 20px; height: 20px; margin-left: 3px; }
.card:hover .play { opacity: 1; }
.card .meta { padding: 11px 13px 13px; }
.card .meta b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta span { color: var(--muted); font-size: 13px; }
.badge { position: absolute; left: 8px; top: 8px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .75); color: #fcd9a0; }
.catcard .thumb { aspect-ratio: 16 / 10; }
.catcard .count { position: absolute; right: 10px; top: 10px; background: rgba(0, 0, 0, .7); font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.newcat { display: grid; place-items: center; min-height: 190px; border: 1px dashed var(--line-2); background: none; color: var(--muted); border-radius: var(--radius); gap: 6px; }
.newcat:hover { border-color: var(--accent); color: var(--text); }
.newcat .ico { width: 28px; height: 28px; }

/* dialogs */
.over { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .72); display: grid; place-items: center; padding: 16px; }
.dlg { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.dlg.wide { width: min(640px, 100%); }
.dlg h2 { margin: 0 0 6px; font-size: 20px; }
.dlg p { color: var(--muted); margin: 0 0 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.field input, .field select { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-weight: 400; outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.err { color: #ffb4b4; font-size: 14px; min-height: 0; margin: 4px 0 8px; }
.err:empty { display: none; }

/* player */
.player { width: min(1100px, 100%); background: #000; border-radius: 16px; overflow: hidden; border: 1px solid var(--line-2); }
.player video { display: block; width: 100%; max-height: 72vh; background: #000; }
.player .info { background: var(--panel); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.player .info .t { flex: 1; min-width: 200px; }
.player .info .t b { display: block; font-size: 17px; }
.player .info .t span { color: var(--muted); font-size: 13px; }
.player .msg { padding: 40px 20px; text-align: center; color: var(--muted); }

/* uploads */
.drop { border: 2px dashed var(--line-2); border-radius: 14px; padding: 30px 16px; text-align: center; color: var(--muted); margin-bottom: 14px; transition: border-color .15s, background .15s; }
.drop.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop b { color: var(--text); }
.drop .ico { width: 34px; height: 34px; margin-bottom: 6px; color: var(--accent); }
.ups { display: flex; flex-direction: column; gap: 8px; }
.up { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.up .row { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.up .row b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up .row span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.up .row .bad { color: #ffb4b4; white-space: normal; }
.up .row .good { color: var(--ok); }
.prog { height: 6px; border-radius: 6px; background: var(--panel-2); overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.uptray { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(360px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.uptray .hd { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.uptray .hd button { margin-left: auto; }
.uptray .ups { max-height: 40vh; overflow: auto; }

/* login */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .dlg { box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.gate .brand { margin-bottom: 14px; }

.menu { position: relative; }
.menu .pop { position: absolute; right: 0; top: 46px; min-width: 200px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); display: none; z-index: 30; }
.menu.open .pop { display: block; }
.menu .pop button { display: flex; width: 100%; gap: 9px; align-items: center; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; }
.menu .pop button:hover { background: var(--panel-2); }
.menu .pop .sep { height: 1px; background: var(--line); margin: 5px 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; background: var(--panel-2); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); max-width: calc(100% - 32px); }
.toast.bad { border-color: rgba(239, 68, 68, .6); }

@media (max-width: 640px) {
  .bar { padding: 10px 12px; flex-wrap: wrap; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  main { padding: 16px 12px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
  .head h1 { font-size: 22px; }
  .btn .lbl { display: none; }
}
