:root {
  --primary: #4F46E5;
  --secondary: #10B981;
  --accent: #F59E0B;
  --danger: #EF4444;
  --bg: #F3F4F6;
  --text-main: #1F2937;
  --text-sub: #6B7280;
  --border: #E5E7EB;
}
* { box-sizing: border-box; outline: none; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex: none;
}
.brand { font-weight: 800; font-size: 18px; color: var(--primary); }
.brand span { font-size: 12px; background: #EEF2FF; color: var(--primary); padding: 2px 8px; border-radius: 4px; margin-left: 6px; font-weight: normal; }
.connect-area { display: flex; gap: 8px; }
.connect-area input {
  width: 170px; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 16px; letter-spacing: 4px; text-align: center;
}
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text-main);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: #F9FAFB; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #4338CA; }
.btn.wide { width: 100%; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sub); min-width: 90px; }
#statusDot { width: 10px; height: 10px; border-radius: 50%; background: #D1D5DB; display: inline-block; }
#statusDot.on { background: var(--secondary); }
#statusDot.room { background: var(--accent); }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}
.panel {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0;
}
.panel-title { font-size: 12px; color: var(--text-sub); font-weight: 700; letter-spacing: 1px; }
.left video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.left select {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 13px;
  background: #fff; color: var(--text-main);
}
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.hint { font-size: 12px; color: var(--text-sub); line-height: 1.6; margin-top: auto; }

.board-wrap {
  position: relative; background: #fff; border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; min-height: 0;
}
#boardCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.board-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #9CA3AF; background: #fff;
}
.board-placeholder h2 { margin: 0 0 8px; font-size: 20px; color: #6B7280; }
.board-placeholder p { margin: 0; font-size: 14px; }
.frozen-chip {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  padding: 6px 14px; border-radius: 20px; z-index: 5; box-shadow: 0 4px 10px rgba(0,0,0,.15);
}
.parent-pip {
  position: absolute; right: 14px; top: 14px; width: 150px; height: 110px;
  object-fit: cover; border-radius: 10px; background: #000; border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 4;
}

.chat-list { flex: 1; overflow-y: auto; background: #F9FAFB; border-radius: 10px; padding: 10px; }
.chat-msg { margin-bottom: 10px; font-size: 13px; }
.chat-msg .who { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.chat-msg .who.parent { color: var(--secondary); }
.chat-msg .who.self { color: var(--accent); }
.chat-msg .who.system { color: #9CA3AF; }
.chat-msg span { display: inline-block; background: #fff; border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; }
.chat-msg.system span { background: #EEF2FF; border-color: transparent; color: var(--primary); }
.chat-input-area { display: flex; gap: 6px; }
.chat-input-area input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 13px; }
.hidden { display: none !important; }

/* 手机扫码传题弹窗 */
.qr-modal {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.qr-card {
  background: #fff; border-radius: 16px; padding: 22px; width: 280px;
  text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.qr-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
#qrBox { display: flex; justify-content: center; margin-bottom: 12px; }
#qrBox img, #qrBox canvas { display: block; }
.qr-hint { font-size: 12px; color: #6B7280; line-height: 1.7; margin-bottom: 14px; }
