:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b35;
  --text: #e6e8ec;
  --muted: #8b93a1;
  --accent: #4c8dff;
  --good: #37c07a;
  --bad: #e5615e;
}

* { box-sizing: border-box; }

/* hidden 属性靠浏览器默认样式里的 [hidden]{display:none} 生效，
   而作者样式表优先级更高 —— 只要给元素设过 display（比如 .gate{display:grid}），
   hidden 就会被压制，JS 里设 element.hidden = true 完全没有效果。
   这条规则把它钉死，避免以后再踩。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
code { background: #22262f; padding: 1px 6px; border-radius: 4px; font-size: .9em; }

/* ---------- 登录页 ---------- */
.center { display: grid; place-items: center; min-height: 100vh; padding: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: min(360px, 100%);
}

/* ---------- 主布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.player-wrap { position: relative; background: #000; border-radius: 10px; overflow: hidden; }
video { width: 100%; display: block; aspect-ratio: 16 / 9; background: #000; }

.gate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: rgba(8, 10, 14, .82);
  backdrop-filter: blur(2px);
}

.side { display: grid; gap: 14px; }

.side section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

/* ---------- 控件 ---------- */
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
label.row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: 0; }
label.row input { margin: 0; }

input[type="text"], input:not([type]), input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  background: #10131a;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 14px;
}

input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  margin-top: 12px;
  width: 100%;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }

button.link {
  width: auto;
  margin: 0;
  padding: 3px 0;
  background: none;
  color: var(--accent);
  font-weight: 400;
  text-align: left;
}

/* ---------- 状态栏 ---------- */
.statusbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.pill.good { color: var(--good); border-color: #1e4d38; }
.pill.bad { color: var(--bad); border-color: #5a2a2a; }

.notice { font-size: 13px; color: var(--accent); }
.msg { color: var(--bad); font-size: 13px; min-height: 20px; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.muted { color: var(--muted); }

/* ---------- 列表 ---------- */
.members, .files { list-style: none; margin: 0; padding: 0; }
.members li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.members li:last-child { border-bottom: 0; }
.members li.self { color: var(--accent); }
.files li { padding: 2px 0; font-size: 13px; }

details { margin-top: 12px; }
summary { cursor: pointer; font-size: 13px; color: var(--muted); }

/* ---------- 聊天 ---------- */
.chat-log {
  height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;   /* 聊天记录滚到底后，别接着把整页也带着滚 */
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.chat-log:empty::after {
  content: "还没有人说话。";
  color: var(--muted);
}

.chat-msg { line-height: 1.45; word-break: break-word; }
.chat-msg .who { color: var(--muted); font-size: 12px; margin-right: 6px; }
.chat-msg.self .who { color: var(--accent); }
.chat-msg .text { white-space: pre-wrap; }

/* 系统广播：整条走灰色小字，和人说的话明显区分开 */
.chat-msg.system {
  color: var(--muted);
  font-size: 12px;
  border-left: 2px solid var(--line);
  padding-left: 8px;
}

.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1; min-width: 0; }
.chat-form button { width: auto; margin-top: 0; flex-shrink: 0; padding: 9px 16px; }

/* 手机上侧栏在播放器下面，聊天框矮一点，免得一屏放不下 */
@media (max-width: 900px) {
  .chat-log { height: 180px; }
}

/* ---------- 播放健康度 ---------- */
.members li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

.health {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;   /* 数字等宽，跳动时不会左右晃 */
  white-space: nowrap;
}
.health.warn { color: #d3a33a; }
.health.bad { color: var(--bad); }
