:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1c2230;
  --border: #232a39;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #2dd4bf;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
input, button { font-family: inherit; }

.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06251f; font-weight: 700; }
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------- login / mensagem ---------- */
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 16px 48px rgba(0,0,0,.4);
}
.login-card h1 { font-size: 22px; }
.login-card h1 span, .brand span { color: var(--accent); }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.msg-err { color: var(--err); font-size: 13px; margin-bottom: 10px; }
.center { text-align: center; }
.msg-ico { font-size: 34px; margin-bottom: 10px; }

/* ---------- app ---------- */
.screen#screenApp { min-height: 100vh; display: block; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 13px; color: var(--muted); }
.app-main { display: grid; grid-template-columns: 320px 1fr; gap: 16px; padding: 16px 20px 40px; align-items: start; }

.channels { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.channels h2 { font-size: 15px; margin-bottom: 2px; }
.ch-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.cat { margin-bottom: 14px; }
.cat-name { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); margin: 0 0 6px 2px; }
.ch-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; margin-bottom: 6px; padding: 9px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 13.5px; cursor: pointer;
}
.ch-item:hover { border-color: var(--accent); }
.ch-item.playing { border-color: var(--accent); background: rgba(45, 212, 191, .08); }
.dot-play { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.ch-item .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading, .empty { text-align: center; color: var(--muted); padding: 20px 8px; font-size: 13px; }

/* ---------- player ---------- */
.player-area { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.player-viewport { position: relative; background: #000; max-height: 58vh; }
.player-viewport video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.p2p-badge {
  position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text); background: rgba(10, 12, 17, .72);
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 999px; padding: 4px 12px;
  pointer-events: none;
}
.p2p-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.p2p-badge .dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.p2p-badge .dot.warn { background: var(--warn); }
.p2p-badge .dot.err { background: var(--err); }
.p2p-stats { font: 12px/1.6 monospace; font-variant-numeric: tabular-nums; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--border); }
.player-area .btn { margin: 0 0 12px 14px; }

/* ---------- responsivo ---------- */
@media (max-width: 760px) {
  .app-main { grid-template-columns: 1fr; }
  .channels { order: 2; }
  .player-area { order: 1; }
}