:root {
  --bg: #0b1220;
  --bg2: #121a2b;
  --card: #182235;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --text: #e8eef8;
  --muted: #94a3b8;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; }
a { color: var(--accent2); text-decoration: none; }
button, input { font: inherit; }
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .85rem 1.25rem;
  background: rgba(11,18,32,.92); border-bottom: 1px solid #1f2a44; position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; letter-spacing: .02em; cursor: pointer; }
.nav { display: flex; gap: .5rem; flex: 1; flex-wrap: wrap; }
.nav a, .nav button {
  background: transparent; border: 0; color: var(--muted); padding: .45rem .75rem; border-radius: 8px; cursor: pointer;
}
.nav a.active, .nav button.active { color: var(--text); background: #1e293b; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.user-label { color: var(--muted); font-size: .9rem; }
.view { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid #243049; border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.tile {
  background: var(--bg2); border: 1px solid #243049; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile img { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: #0f172a; display: block; }
.tile .meta { padding: .65rem .75rem; }
.tile .title { font-size: .92rem; font-weight: 600; line-height: 1.3; }
.tile .sub { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: .65rem 1rem; cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--accent2); color: #0b1220; }
.btn.ghost { background: transparent; border: 1px solid #334155; color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.danger { background: #7f1d1d; }
.input {
  width: 100%; padding: .8rem 1rem; border-radius: 10px; border: 1px solid #334155; background: #0f172a; color: var(--text);
}
.input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-wrap { max-width: 420px; margin: 4rem auto; }
.login-wrap h1 { margin: 0 0 .5rem; font-size: 1.6rem; }
.login-wrap p { color: var(--muted); margin: 0 0 1.25rem; }
.error { color: var(--danger); margin-top: .75rem; font-size: .9rem; }
.hero-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.hero-card {
  padding: 1.5rem; border-radius: var(--radius); background: linear-gradient(135deg,#1e3a5f,#172554); border: 1px solid #2563eb55; cursor: pointer;
}
.hero-card h2 { margin: 0 0 .35rem; }
.hero-card p { margin: 0; color: #bfdbfe; font-size: .9rem; }
.layout-split { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; }
@media (max-width: 900px) { .layout-split { grid-template-columns: 1fr; } }
.side-list { max-height: 70vh; overflow: auto; }
.side-item {
  display: block; width: 100%; text-align: left; padding: .65rem .8rem; margin-bottom: .35rem;
  background: var(--bg2); border: 1px solid #243049; border-radius: 8px; color: var(--text); cursor: pointer;
}
.side-item.active { border-color: var(--accent); background: #1e3a5f; }
.search-row { display: flex; gap: .75rem; margin-bottom: 1rem; }
.player-shell { background: #000; border-radius: var(--radius); overflow: hidden; position: relative; }
.player-shell video { width: 100%; max-height: 70vh; background: #000; display: block; }
.player-controls {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem; background: var(--bg2); border-top: 1px solid #243049;
}
.player-controls input[type=range] { flex: 1; min-width: 120px; }
.detail-hero { display: grid; grid-template-columns: 180px 1fr; gap: 1.25rem; }
.detail-hero img { width: 100%; border-radius: var(--radius); object-fit: cover; }
.muted { color: var(--muted); }
.chip { display: inline-block; padding: .2rem .55rem; border-radius: 999px; background: #1e293b; font-size: .75rem; margin-right: .35rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }
.conn-warn { margin-bottom: 1rem; border-color: #92400e; background: #1c1917; }
.conn-warn strong { color: #fbbf24; display: block; margin-bottom: .35rem; }
.conn-warn p { margin: 0; color: #fde68a; font-size: .9rem; line-height: 1.45; }
.spinner { width: 28px; height: 28px; border: 3px solid #334155; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
