:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #0b0d12;
  --muted: #4a505c;
  --line: #d4d7de;
  --accent: #0b57d0;
  --accent-text: #ffffff;
  --live: #0a7d32;
  --warn: #9a5b00;
  --danger: #b3261e;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

/* ---------- shared controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
  font-weight: 600; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-quiet { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1.5px solid var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select {
  min-height: 48px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); width: 100%;
}
.field input:focus, .field select:focus, .btn:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.error { color: var(--danger); font-weight: 600; margin: 0; }

/* ---------- login ---------- */
.login-main {
  max-width: 380px; margin: 0 auto; padding: 18vh 16px 32px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------- dashboard ---------- */
.dash { max-width: 560px; margin: 0 auto; padding: 12px 16px 48px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card h2 { margin-bottom: 12px; }

.channels { list-style: none; margin: 0; padding: 0; }
.channels li {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; border-top: 1px solid var(--line);
}
.channels li:first-child { border-top: 0; }
.channels .name { flex: 1; font-weight: 600; }
.channels .state { color: var(--muted); font-size: .9rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: var(--live); box-shadow: 0 0 0 4px rgba(10, 125, 50, .18); }

.create { display: grid; gap: 12px; }
.create .row { display: grid; grid-template-columns: 1fr 110px; gap: 12px; }
.result { display: grid; gap: 8px; }
.result input { font-family: ui-monospace, monospace; font-size: .8rem; }
.copied { color: var(--live); font-weight: 600; margin: 0; }

.links { list-style: none; margin: 0; padding: 0; }
.links li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.links li:first-child { border-top: 0; }
.links .info { flex: 1; min-width: 0; }
.links .title { font-weight: 600; overflow-wrap: anywhere; }
.links .sub { color: var(--muted); font-size: .85rem; }
.links .revoked .title { text-decoration: line-through; color: var(--muted); }
.empty { color: var(--muted); margin: 0; }

/* ---------- watch ---------- */
body.watch { background: #0b0d12; color: #f2f3f5; }
.watch-main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 24px; }
.watch-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 10px;
}
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.unmute {
  position: absolute; left: 12px; bottom: 12px;
  min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: #0b0d12; font-weight: 700; cursor: pointer;
}
.watch-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px;
  margin: 10px 0 0; color: #b9bec8; font-size: .9rem;
}
.watch-meta time { color: #f2f3f5; font-variant-numeric: tabular-nums; font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: #3a3f4a; color: #fff; white-space: nowrap;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-live { background: #c4221a; }
.badge-reconnecting { background: #9a5b00; }
.badge-offline { background: #3a3f4a; }

.notice { max-width: 420px; margin: 0 auto; padding: 22vh 16px 32px; text-align: center; }
.notice p { color: #b9bec8; }
