:root {
  --bg: #0f0f0f; --panel: #1b1b1b; --panel2: #272727; --text: #f1f1f1; --muted: #aaaaaa;
  --accent: #ff3b31; --border: #303030; --radius: 12px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #ffffff; --panel: #f3f3f3; --panel2: #e9e9e9; --text: #0f0f0f; --muted: #606060; --border: #dddddd; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
[hidden] { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 18px; color: var(--accent); white-space: nowrap; }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-weight: 600; }
.topbar nav a.active { color: var(--text); }
.search { margin-left: auto; }
.search input { width: 220px; max-width: 45vw; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.content { max-width: 1200px; margin: 0 auto; padding: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.muted { color: var(--muted); }
.error { background: rgba(255,59,49,.12); border: 1px solid rgba(255,59,49,.4); padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
h1 { font-size: 22px; margin: 6px 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
select, input[type=text], input[type=password], input[type=url] { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 14px; }
.card { display: block; }
.thumb { position: relative; aspect-ratio: 16/9; background: var(--panel2); border-radius: var(--radius); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px; }
.thumb .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.35); }
.thumb .bar i { display: block; height: 100%; background: var(--accent); }
.card .t { margin: 8px 0 2px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .m { color: var(--muted); font-size: 13px; }
.chanlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.chan { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--panel); border-radius: var(--radius); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--panel2); object-fit: cover; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 72px; height: 72px; font-size: 22px; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; max-height: 75vh; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.vtitle { font-size: 20px; font-weight: 700; margin: 14px 0 4px; }
.desc { white-space: pre-wrap; word-break: break-word; background: var(--panel); padding: 12px 14px; border-radius: var(--radius); margin-top: 12px; max-height: 120px; overflow: hidden; cursor: pointer; }
.desc.open { max-height: none; }
.chapters { list-style: none; padding: 0; margin: 12px 0; }
.chapters li { display: flex; gap: 12px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.chapters li.current { background: var(--panel2); }
.chapters .ts { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 60px; }
.login { max-width: 380px; margin: 60px auto; display: flex; flex-direction: column; gap: 12px; }
.login input { width: 100%; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.hscroll .card { flex: none; width: 240px; }
table.kv { border-collapse: collapse; }
table.kv td { padding: 4px 12px 4px 0; vertical-align: top; }
table.kv td:first-child { color: var(--muted); }
.notice { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
progress { width: 100%; }
@media (max-width: 640px) {
  .topbar { gap: 10px; flex-wrap: wrap; }
  .brand { font-size: 17px; }
  .topbar nav { order: 3; width: 100%; justify-content: space-between; }
  .search { margin-left: auto; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
}
