*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2d3a4d;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --danger: #f56565;
}
body {
  font-family: -apple-system, 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero p { color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  font-size: 14px;
}
.pw-field { position: relative; }
.pw-field input { padding-right: 42px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
}
.pw-toggle:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); color: #0a0a0a; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.mono {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
  background: #0d1117;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.video-box {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
}
.video-box video { width: 100%; height: 100%; object-fit: contain; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(61, 139, 253, 0.2);
  color: var(--accent);
}
.badge.live { background: rgba(62, 207, 142, 0.2); color: var(--ok); }
.badge.pending { background: rgba(240, 180, 41, 0.2); color: var(--warn); }
.list { list-style: none; }
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tip { font-size: 12px; color: var(--muted); margin-top: 8px; }
.numpad-hint {
  background: rgba(61, 139, 253, 0.1);
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
}
.kbd {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: #2d3a4d;
  font-family: monospace;
  font-size: 12px;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
  display: none;
}
.toast.show { display: block; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.modal h3 { font-size: 18px; margin-bottom: 10px; }
.modal p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.modal .countdown { font-size: 28px; font-weight: 700; color: var(--warn); margin: 8px 0 16px; }
.guide-list { padding-left: 20px; font-size: 14px; color: var(--muted); }
.guide-list li { margin: 8px 0; }
.inline-code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: #0d1117;
  padding: 2px 6px;
  border-radius: 4px;
}
.chat-box {
  height: 220px;
  overflow-y: auto;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}
.chat-line { margin-bottom: 8px; word-break: break-word; }
.chat-line .who { color: var(--accent); margin-right: 6px; }
.chat-line.system .who { color: var(--warn); }
.chat-input-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-input-row input { flex: 1; }
.qr-box { text-align: center; margin-top: 10px; }
.qr-box img { border-radius: 8px; background: #fff; padding: 6px; }
.hand-on { color: var(--warn); }
.waiting-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 14px;
  text-align: center;
  padding: 16px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 6px;
  text-align: left;
}
.data-table th { color: var(--muted); font-weight: 500; }
.poll-option {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  cursor: pointer;
}
.poll-option:hover { border-color: var(--accent); }
.poll-bar-wrap { margin: 6px 0 10px; }
.poll-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(61, 139, 253, 0.25);
  overflow: hidden;
}
.poll-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.poll-meta { font-size: 12px; color: var(--muted); }
.grid-poll { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 700px) { .grid-poll { grid-template-columns: 1fr; } }
.danmaku-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.danmaku-item {
  position: absolute;
  right: -20%;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.6);
  animation: danmaku-move 12s linear forwards;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
}
@keyframes danmaku-move {
  from { transform: translateX(0); }
  to { transform: translateX(-130%); }
}
.danmaku-row { display: flex; gap: 8px; margin-top: 8px; }
.danmaku-row input { flex: 1; }
.stage-wrap { position: relative; }
.stage {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
}
.stage > video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.stage-overlay .stu-tile { pointer-events: auto; }
.stu-tile {
  position: absolute;
  background: rgba(10, 14, 20, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
}
.stu-tile.size-sm { width: 160px; height: 120px; }
.stu-tile.size-half { width: 50%; height: 50%; left: 25% !important; top: 25% !important; }
.stu-tile.size-full { width: 100%; height: 100%; left: 0 !important; top: 0 !important; }
.stu-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px;
  background: rgba(0,0,0,0.55);
  cursor: move;
  font-size: 11px;
  user-select: none;
}
.stu-tile-name { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stu-tile-tools button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
}
.stu-tile-tools button:hover { color: #fff; }
.stu-tile-body { flex: 1; min-height: 0; background: #000; }
.stu-tile-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.interact-status { font-size: 13px; color: var(--muted); margin-top: 8px; }
.interact-status .on { color: var(--ok); }
.warn-box {
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.45);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
