:root {
  --bg: #0b0d12;
  --panel: #151922;
  --line: #262c38;
  --text: #eef1f6;
  --muted: #9aa3b2;
  --accent: #ff3d5a;
  --ok: #2bd47d;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Rubik, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(11, 13, 18, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.meta { color: var(--muted); font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--accent); }

main { max-width: 820px; margin: 0 auto; padding: 12px 12px 32px; }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 72dvh;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.stage:fullscreen { border-radius: 0; max-height: none; aspect-ratio: auto; }
.player, .localwrap, .live { position: absolute; inset: 0; width: 100%; height: 100%; }
.player > div, .player iframe { width: 100% !important; height: 100% !important; }
.player .fb-video, .player .fb-video > span { display: flex !important; justify-content: center; align-items: center; height: 100% !important; }
.localwrap video, .live { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Covers the player so taps never reach it: only the host controls playback. */
.shield { position: absolute; inset: 0; z-index: 2; }
.notice {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px; color: var(--muted); background: #000;
}
.badge {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 3;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .7); font-size: 14px;
}

.title { margin: 10px 4px 0; font-weight: 600; min-height: 1.5em; overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 4px; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.ltr { direction: ltr; flex-wrap: nowrap; }
.ltr .btn:not(.big) { min-width: 64px; padding: 12px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-weight: 600; padding: 12px 18px; border-radius: 12px; min-height: 48px;
  cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible, .tab:focus-visible, input:focus-visible { outline: 3px solid #7aa7ff; outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: #ff8a9b; }
.btn.big { min-width: 140px; font-size: 18px; }

.panel {
  margin-top: 14px; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.panel h2 { font-size: 17px; margin: 0 0 10px; }
.timeline { display: flex; align-items: center; gap: 10px; direction: ltr; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.timeline input { flex: 1; accent-color: var(--accent); min-height: 32px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1; font: inherit; padding: 10px 6px; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.tab.active { color: #fff; background: #222838; border-color: #3a4256; }
.pane { display: flex; flex-direction: column; gap: 10px; }
.pane label { font-size: 15px; }
.pane input[type=url] {
  font: inherit; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0f1219; color: var(--text); direction: ltr; text-align: left;
}
.pane input[type=file] { font: inherit; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); padding: 6px 0; }

.alert { margin-bottom: 12px; padding: 12px; border-radius: 12px; background: #3a1620; color: #ffc2cc; }
body.locked .panel { opacity: .4; pointer-events: none; }

.join {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(5, 6, 10, .86); backdrop-filter: blur(6px); color: var(--muted); text-align: center; padding: 24px;
}
.join-btn {
  font: inherit; font-size: 22px; font-weight: 700; color: #fff;
  background: var(--accent); border: 0; border-radius: 18px; padding: 20px 30px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 61, 90, .35);
}

#toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; z-index: 30;
  transform: translate(-50%, 30px); opacity: 0; transition: .25s;
  max-width: 92vw; padding: 12px 16px; border-radius: 12px;
  background: #222838; color: var(--text); box-shadow: 0 6px 24px rgba(0, 0, 0, .5); pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
