* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d1014; --panel: #161b22; --panel2: #1c232d; --line: #28303b;
  --text: #e7ecf2; --muted: #8b97a7; --accent: #3b82f6; --accent2: #2563eb;
  --rec: #ef4444; --ok: #34d399;
}
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* ── Login ── */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.card { background: var(--panel); padding: 2rem; border-radius: 16px; width: min(340px, 100%);
  display: flex; flex-direction: column; gap: .8rem; border: 1px solid var(--line); box-shadow: 0 10px 40px #0009; }
.card h1 { text-align: center; font-size: 1.4rem; margin-bottom: .4rem; }
.card input { padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 1rem; }
.card input:focus { outline: none; border-color: var(--accent); }
.card button { padding: .8rem; border: 0; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; }
.card button:hover { background: var(--accent2); }
.err { color: #f87171; font-size: .85rem; text-align: center; min-height: 1em; }

/* ── Header ── */
header { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.1rem;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; }
.brand svg { stroke: var(--accent); }
.status { margin-left: auto; display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .85rem; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.live .dot { background: var(--ok); box-shadow: 0 0 0 0 #34d39988; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #34d39977; } 70% { box-shadow: 0 0 0 6px #34d39900; } 100% { box-shadow: 0 0 0 0 #34d39900; } }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: .4rem;
  border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--panel2); }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }

/* ── Video stage ── */
.stage { position: relative; background: #000; border-radius: 14px; overflow: hidden;
  aspect-ratio: 4 / 3; max-height: 76vh; margin: 0 auto; border: 1px solid var(--line); }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage:fullscreen { border: 0; border-radius: 0; aspect-ratio: auto; max-height: none; }
.stage:fullscreen video { width: 100%; height: 100%; }

.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .6rem; color: var(--muted); pointer-events: none; }
.placeholder svg { width: 40px; height: 40px; opacity: .5; }
.placeholder span { font-size: .9rem; }
.stage.connected .placeholder { display: none; }

.rec-badge { position: absolute; top: .7rem; left: .7rem; display: flex; align-items: center;
  background: #000000aa; backdrop-filter: blur(4px); color: #fff; padding: .3rem .6rem;
  border-radius: 8px; font-size: .8rem; font-weight: 600; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); margin-right: .4rem;
  animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

.overlay { position: absolute; right: .6rem; bottom: .6rem; display: flex; gap: .4rem; }
.ov-btn { width: 42px; height: 42px; border: 0; border-radius: 10px; cursor: pointer;
  background: #11161dcc; backdrop-filter: blur(6px); color: #fff; display: grid; place-items: center; }
.ov-btn:hover { background: #1c2632dd; }
.ov-btn .i-on { display: none; }
.ov-btn.audio-on .i-on { display: block; }
.ov-btn.audio-on .i-off { display: none; }

/* ── Action bar ── */
.actions { display: flex; gap: .55rem; margin: .9rem 0; }
.action { display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1rem; border: 1px solid var(--line); border-radius: 11px; background: var(--panel);
  color: var(--text); font-size: .95rem; font-weight: 500; cursor: pointer; flex: 1; }
.action:hover { background: var(--panel2); }
.action svg { width: 18px; height: 18px; }
.action.rec svg { stroke: var(--rec); fill: var(--rec); }
.action.rec.on { background: var(--rec); border-color: var(--rec); color: #fff; }
.action.rec.on svg { fill: #fff; stroke: #fff; }
.action.subtle { color: var(--muted); flex: 0 0 auto; }
@media (min-width: 620px) { .action { flex: 0 0 auto; } .action.subtle { margin-left: auto; } }

.stats { background: #000a; color: var(--ok); font-family: ui-monospace, monospace; font-size: .8rem;
  line-height: 1.6; padding: .7rem .9rem; border-radius: 10px; border: 1px solid var(--line);
  margin-bottom: .9rem; white-space: pre; overflow-x: auto; }

/* ── Recordings ── */
.recordings h2 { font-size: 1rem; margin-bottom: .7rem; color: var(--text); }
#recList { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
#recList li { display: flex; align-items: center; gap: .7rem; background: var(--panel);
  border: 1px solid var(--line); padding: .65rem .85rem; border-radius: 11px; }
.rinfo { display: flex; flex-direction: column; min-width: 0; }
.rname { font-family: ui-monospace, monospace; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmeta { color: var(--muted); font-size: .76rem; }
.ractions { margin-left: auto; display: flex; gap: .25rem; }
.ractions a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  color: var(--muted); }
.ractions a:hover { background: var(--panel2); color: var(--text); }
.ractions a.del:hover { color: var(--rec); }
.muted { color: var(--muted); }
