:root {
  color-scheme: dark;
  --bg: #101418;
  --panel: #171d24;
  --panel-2: #1e2630;
  --line: #2c3642;
  --text: #e7edf2;
  --muted: #8b98a5;
  --accent: #2f81f7;
  --accent-2: #1d6adf;
  --danger: #e5534b;
  --ok: #3dba7c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47, 129, 247, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  padding: 10px 14px;
  cursor: pointer;
}

button:hover { background: var(--accent-2); }

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

button.ghost:hover { background: var(--panel-2); }

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1318;
  padding: 10px 12px;
  outline: none;
}

input:focus { border-color: var(--accent); }

label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

label input { margin-top: 6px; }

.error {
  min-height: 1.2em;
  color: var(--danger);
  font-size: 13px;
}

.home {
  max-width: 920px;
  margin: 0 auto;
  padding: 64px 20px 40px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sub, .hint, .status-line {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 8px; font-size: 18px; }

.meeting {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 20, 24, 0.92);
}

.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spacer { flex: 1; }

.pill, .who {
  color: var(--muted);
  font-size: 13px;
}

.pill b { color: var(--text); letter-spacing: 0.08em; }

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.video-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.video-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.45);
}

.overlay p { margin: 0; }

.help {
  max-width: 460px;
  color: var(--muted);
  font-size: 13px;
}

.obs {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 16px 14px;
}

.obs h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

.obs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.obs-grid span { grid-column: 1 / -1; }

.obs-grid button { white-space: nowrap; }

.obs-grid span { color: var(--muted); font-size: 13px; }

.mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  background: #0e1318;
  border-radius: 8px;
  padding: 8px 10px;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.messages {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.msg { margin: 0 0 12px; }

.msg b { font-size: 13px; }

.msg.mine b { color: var(--accent); }

.msg p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat form input { flex: 1; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate .card { width: min(420px, 100%); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ok);
  color: #062214;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}

@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  .home { padding-top: 32px; }
  .meeting { display: block; height: auto; min-height: 100vh; }
  .stage { display: block; }
  .video-wrap { flex: none; height: 42vh; min-height: 220px; }
  .chat { height: 360px; border-left: 0; border-top: 1px solid var(--line); }
  .topbar { flex-wrap: wrap; }
}
