:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e2e2de;
  --accent: #e2531f;
  --accent-text: #ffffff;
  --mine: #e2531f;
  --theirs: #ecece8;
  --danger: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --card: #1e1e1e;
    --text: #f1f1f1;
    --muted: #a0a0a0;
    --line: #333;
    --theirs: #2b2b2b;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.wrap { max-width: 480px; margin: 0 auto; padding: 48px 16px; }
h1 { font-size: 28px; margin: 0 0 4px; }
h1 span { color: var(--accent); }
.sub { color: var(--muted); margin: 0 0 28px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
input[type=text], input[type=password] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 14px;
}
button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.full { width: 100%; }
.row { display: flex; gap: 8px; }
.row input { margin: 0; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 8px 0 0; }
.hidden { display: none !important; }
.note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.points { color: var(--muted); font-size: 14px; padding-left: 18px; margin: 24px 0 0; }

/* Chat room */
.room { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto; }
.bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.bar .who { flex: 1; min-width: 0; }
.bar .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .who small { color: var(--muted); }
.bar button { padding: 8px 12px; font-size: 14px; }
.videos { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 8px 16px 0; position: relative; }
.videos video { width: 100%; max-height: 42vh; background: #000; border-radius: 12px; object-fit: cover; }
.videos video#localVideo {
  position: absolute; right: 24px; top: 16px; width: 28%; max-width: 180px;
  border: 2px solid var(--card); transform: scaleX(-1);
}
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: var(--mine); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--theirs); border-bottom-left-radius: 4px; }
.sys { align-self: center; font-size: 13px; color: var(--muted); }
.compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--card); }
.compose input { margin: 0; }
.ended { text-align: center; }
.spaced { margin-top: 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.install { margin-top: 16px; }
.install .note { margin-top: 6px; }
.wide { max-width: 860px; }
.tag { font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; vertical-align: middle; }
.wrap-row { flex-wrap: wrap; }
.wrap-row input[type=text] { flex: 1 1 220px; margin: 0; }
.wrap-row input[type=number] { width: 110px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 16px; }
textarea { width: 100%; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td.actions button { padding: 6px 10px; font-size: 13px; }
.docs h2 { font-size: 20px; margin: 28px 0 8px; }
.docs pre { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.docs code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.docs li { margin: 4px 0; }
