:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-2: #36c98b;
  --danger: #ff5c5c;
  --radius: 14px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #232733;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.net-stat { font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--panel-2); }
.net-stat.ok { color: var(--accent-2); }
.net-stat.bad { color: var(--danger); }
main { padding: 16px; max-width: 920px; margin: 0 auto; }
.screen { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* 首页 */
h1 { font-size: 22px; margin: 8px 0 4px; }
.sub { color: var(--muted); margin: 0 0 18px; line-height: 1.6; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .role-cards { grid-template-columns: 1fr; } }
.role-card {
  text-align: left; background: var(--panel); border: 1px solid #262b36; border-radius: var(--radius);
  padding: 18px; cursor: pointer; color: var(--text); transition: .15s;
}
.role-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.role-ico { font-size: 30px; }
.role-title { font-weight: 700; margin: 8px 0 6px; }
.role-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }
.tip { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* 通用控件 */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 14px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid #2c3240; font-weight: 500; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { background: var(--panel-2); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

/* 邀请框 */
.invite { background: var(--panel); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.invite label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input {
  flex: 1; background: var(--panel-2); border: 1px solid #2c3240; color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; min-width: 0;
}
.pin-line { margin-top: 8px; font-size: 13px; color: var(--muted); }
.pin-line b { color: var(--text); }

/* 分享与二维码 */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.qr-canvas { display: flex; align-items: center; justify-content: center; min-height: 162px; }
.qr-canvas canvas, .qr-canvas img { background: #fff; border-radius: 10px; padding: 6px; display: block; }
.qr-fallback { font-size: 12px; color: var(--muted); text-align: center; padding: 12px; line-height: 1.6; }
.qr-tip { font-size: 12px; color: var(--muted); }

/* 视频舞台 */
.stage-wrap { position: relative; width: 100%; max-width: 880px; margin: 0 auto; }
.stage-wrap:fullscreen { width: 100vw; height: 100vh; max-width: none; display: flex; flex-direction: column; background: #000; }
.stage {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  width: 100%; aspect-ratio: 16/9;
}
.stage-wrap:fullscreen .stage { aspect-ratio: auto; flex: 1; border-radius: 0; }
.main-video {
  width: 100%; height: 100%; object-fit: contain; background: #000; display: block; touch-action: none;
}
.pip-wrap { position: absolute; right: 10px; bottom: 70px; display: flex; flex-wrap: wrap; gap: 8px; max-width: 60%; justify-content: flex-end; z-index: 4; }
.pip {
  width: 132px; height: 99px; background: #000; border-radius: 10px; overflow: hidden;
  border: 2px solid #2c3240; position: relative;
}
.pip video { width: 100%; height: 100%; object-fit: cover; }
.pip .pip-name { position: absolute; left: 4px; top: 4px; font-size: 11px; background: rgba(0,0,0,.5); padding: 1px 6px; border-radius: 6px; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); color: var(--text); font-size: 14px; text-align: center; padding: 20px;
}
.overlay.hidden { display: none; }

/* 控制条（悬浮在画面底部，全屏时也可见；无操作时自动淡出） */
.ctrl-bar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center;
  padding: 8px 10px; margin: 0; max-width: calc(100% - 16px);
  background: rgba(20,22,28,.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid #2c3240; border-radius: 999px; z-index: 6;
  opacity: 1;
  transition: opacity .35s ease, transform .35s ease;
}
.ctrl-bar[hidden] { display: none; }
/* 空闲淡出：整体下沉 + 透明，且不再拦截点击 */
.ctrl-bar.idle {
  opacity: 0; pointer-events: none;
  transform: translateX(-50%) translateY(14px);
}
.ctrl-bar .btn, .ctrl-bar select { padding: 8px 12px; }
.members-line { text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; }

/* 加入框 */
.join-box { background: var(--panel); border-radius: var(--radius); padding: 16px; max-width: 480px; margin: 10px auto; }
.join-box p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.join-box input {
  width: 100%; background: var(--panel-2); border: 1px solid #2c3240; color: var(--text);
  border-radius: var(--radius-sm); padding: 10px; font-size: 14px; margin-bottom: 10px;
}
.join-box .btn { width: 100%; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #2a2f3a; color: var(--text); padding: 10px 16px; border-radius: 999px;
  font-size: 13px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
