:root {
  --bg: #0f1115; --surface: #181b22; --line: #272b35;
  --text: #e8eaf0; --muted: #8b92a3; --accent: #ff6b81;
  --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.muted { color: var(--muted); }
.error { color: var(--bad); }

.btn {
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0509; font-weight: 600; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
:is(.btn, .icon, .resume, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Home */
.card { max-width: 420px; margin: 12vh auto 0; padding: 24px 16px; display: grid; gap: 14px; }
.card h1 { margin: 0; font-size: 2rem; }
.card p { margin: 0; }
.or { text-align: center; color: var(--muted); font-size: 14px; }
#join-form { display: flex; gap: 8px; }
#join-form input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; text-transform: uppercase; letter-spacing: .1em;
}

/* Room */
#room { min-height: 100dvh; display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; }
.topbar { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; font-size: 14px; }
.code { display: flex; gap: 8px; align-items: center; }
.code strong { letter-spacing: .12em; font-size: 16px; }
.stats { display: flex; gap: 16px; margin: 0; padding: 0; list-style: none; color: var(--muted); }
.stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--bad); }
.dot.ok { background: var(--ok); } .dot.wait { background: var(--warn); }

.stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: #000; border-radius: 12px; overflow: hidden; }
.stage:fullscreen { border-radius: 0; }
video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.empty, .resume {
  position: absolute; inset: 0 0 56px; margin: auto; width: fit-content; height: fit-content;
  padding: 14px 24px; border-radius: 12px; background: var(--accent); color: #1a0509;
  font: 600 16px inherit; border: 0; cursor: pointer;
}
.controls { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--surface); }
.icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--text); cursor: pointer; }
.icon:hover { background: var(--line); }
.icon svg { width: 24px; height: 24px; fill: currentColor; }
.i-pause, .playing .i-play { display: none; } .playing .i-pause { display: block; }
.time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; }
#seek { flex: 1; min-width: 0; }
#volume { width: 80px; flex: none; }
input[type=range] { accent-color: var(--accent); height: 44px; cursor: pointer; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-status { margin: 0; font-size: 14px; color: var(--muted); flex: 1; min-width: 200px; }
.file-status.ok { color: var(--ok); } .file-status.warn { color: var(--warn); }

@media (max-height: 500px) {
  #room { padding: 4px 8px; gap: 4px; }
  .topbar { font-size: 12px; } .tools { display: none; }
  .controls { padding: 0 8px; } .icon, input[type=range] { height: 40px; }
}
@media (max-width: 560px) { #volume { display: none; } }
@media (prefers-reduced-motion: no-preference) { .btn, .icon { transition: border-color .15s, background .15s; } }
