﻿/* Минималистичная тёмная тема в духе Linear / Vercel Geist:
   нейтральные серые, тонкие рамки, один акцент (белый), красный только для индикатора эфира. */
:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #171717;
  --hover: #1f1f1f;
  --border: #262626;
  --border-strong: #333333;
  --text: #ededed;
  --text-2: #a1a1a1;
  --muted: #737373;
  --live: #ef4444;
  --danger: #f87171;
  --radius: 8px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  letter-spacing: -0.006em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.sprite { position: absolute; }

/* ---------- Базовые элементы ---------- */
.i {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.mark { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; color: var(--text); }
.mark.small { width: 20px; height: 20px; }

button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
button:hover { background: var(--hover); border-color: var(--border-strong); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--text-2); outline-offset: 2px; }
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
button.primary:hover { background: #fff; }
button.big { height: 40px; padding: 0 16px; }
button.small { height: 28px; padding: 0 10px; font-size: 13px; }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--hover); color: var(--text); }
button.icon { width: 32px; padding: 0; background: transparent; border-color: transparent; color: var(--text-2); }
button.icon:hover { background: var(--hover); color: var(--text); }

input {
  height: 36px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .12s;
}
input::placeholder { color: var(--muted); }
input:hover { border-color: var(--border-strong); }
input:focus { border-color: var(--text-2); outline: none; }

a.button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  text-decoration: none; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 500;
  transition: background .12s, border-color .12s;
}
a.button:hover { background: var(--hover); border-color: var(--border-strong); }
a.button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
a.button.primary:hover { background: #fff; }

.muted { color: var(--text-2); }
.label { color: var(--muted); font-size: 12px; }
.error { color: var(--danger); margin: 0; font-size: 13px; }
.error:empty { display: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; width: 100%; }

.spinner {
  width: 20px; height: 20px; flex: none;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.small { width: 12px; height: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Карточки и экран входа ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 16px;
  overflow: auto;
  background: var(--bg);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: 20px;
}
.card h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.card h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.card p { margin: 0; }
.intro { display: flex; flex-direction: column; gap: 4px; }
.card label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.card label input { font-weight: 400; color: var(--text); }

.join-card { animation: appear .25s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
#join-fields { display: flex; flex-direction: column; gap: 14px; }

.roles { display: flex; flex-direction: column; gap: 8px; }
.role {
  justify-content: flex-start; gap: 12px;
  width: 100%; height: auto;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface);
}
.role:disabled { opacity: .5; cursor: not-allowed; }
.role:disabled:hover { background: var(--surface); border-color: var(--border); }
.role-icon { width: 18px; height: 18px; color: var(--text-2); }
.role-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.role-text b { font-weight: 500; }
.role-text small { color: var(--muted); font-size: 13px; font-weight: 400; }
.role-arrow { color: var(--muted); transition: transform .12s; }
.role:not(:disabled):hover .role-arrow { transform: translateX(2px); color: var(--text-2); }

.join-status { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }

/* ---------- Основной интерфейс ---------- */
#app { display: flex; flex-direction: column; height: 100%; }
#toolbar {
  display: flex; align-items: center; gap: 4px;
  height: 48px; flex: none;
  padding: 0 8px 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.divider { width: 1px; height: 18px; margin: 0 8px; background: var(--border); }

.live {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 6px;
  color: var(--text);
  font-size: 12px; font-weight: 500;
}
.live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }

#page { flex: 1; min-width: 0; display: flex; align-items: center; }
#page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.meta { color: var(--muted); font-size: 13px; white-space: nowrap; margin: 0 6px; }

.volume { display: flex; align-items: center; }
.volume input[type=range] {
  width: 84px; height: auto; padding: 0; border: 0; background: transparent;
  accent-color: var(--text);
}

main { flex: 1; display: flex; min-height: 0; position: relative; }

#stage { flex: 1; position: relative; min-width: 0; background: #000; }
#canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
#stage:fullscreen { background: #000; }

#stage-status {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 16px;
  background: var(--bg);
  pointer-events: none;
}
.status-card { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 320px; text-align: center; }
.status-icon { width: 28px; height: 28px; color: var(--muted); stroke-width: 1.5; }
#status-text { margin: 0; color: var(--text-2); }

/* ---------- Панель хоста ---------- */
.host-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(400px, calc(100% - 32px));
  max-height: calc(100% - 32px); overflow: auto;
}
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding-left: 30px; color: var(--text-2); }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-2);
  font: 500 11px/1 var(--mono);
}

.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 8px 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.code-box > div { display: flex; flex-direction: column; gap: 2px; }
.code-box b { font: 500 22px/1.2 var(--mono); letter-spacing: .3em; color: var(--text); }
.code-actions { display: flex; flex-direction: row !important; gap: 2px !important; }
.code-box.center { justify-content: center; text-align: center; padding: 14px; }
.code-box.center > div { align-items: center; }

/* ---------- Участники и чат ---------- */
#side {
  width: 280px; flex: none;
  background: var(--bg);
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
}
#side.hidden { display: none; }
#side h3 {
  display: flex; gap: 6px;
  margin: 16px 16px 8px;
  font-size: 12px; font-weight: 500; color: var(--muted);
}
#users-count { color: var(--muted); }
.side-users { max-height: 40%; overflow-y: auto; flex: none; }
#users { list-style: none; margin: 0; padding: 0 8px 12px; }
#users li { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 6px; }
#users li:hover { background: var(--surface); }
#users .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#users .you { color: var(--muted); }
#users .tag {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-2);
  font-size: 11px;
}
.avatar {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px; font-weight: 600;
}

#chat { flex: 1; display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--border); }
#messages { flex: 1; overflow-y: auto; padding: 0 16px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; animation: appear .15s ease-out; }
.msg-name { font-size: 12px; font-weight: 500; color: var(--text-2); }
.msg-text { overflow-wrap: anywhere; }
.msg.system { color: var(--muted); font-size: 12px; }
#chat-form { display: flex; align-items: center; gap: 6px; margin: 8px 12px 12px; padding: 4px 4px 4px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
#chat-form:focus-within { border-color: var(--border-strong); }
#chat-input { flex: 1; min-width: 0; height: 28px; border: 0; background: transparent; }
#chat-input:focus { outline: none; }
.send { width: 28px; height: 28px; background: var(--text); color: var(--bg); border-radius: 6px; }
button.icon.send:hover { background: #fff; color: var(--bg); }

/* ---------- Уведомления ---------- */
#toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(360px, calc(100% - 32px));
}
.toast {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  animation: appear .15s ease-out;
}

/* ---------- Страница запуска приложения ---------- */
.launch-card .actions { display: flex; flex-direction: column; gap: 8px; }
.note { color: var(--muted); font-size: 12.5px; }
.note b { color: var(--text-2); font-weight: 500; }

/* ---------- Узкое окно (например, мини-окно активности в Discord) ---------- */
@media (max-width: 760px) {
  #side { position: absolute; right: 0; top: 0; bottom: 0; z-index: 5; width: min(280px, 88vw); }
  .volume input[type=range] { width: 60px; }
  #host-badge, #host-toggle, .divider { display: none; }
}
@media (max-width: 480px) {
  .volume input[type=range] { display: none; }
}
