/* ========== 授课教室艺术化样式 ========== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&display=swap');

:root {
  --zj-gold: #c9a227;
  --zj-gold-light: #e8d179;
  --zj-purple: #8b5cf6;
  --zj-indigo: #6366f1;
  --zj-dark: #0f172a;
  --zj-panel: rgba(255, 255, 255, 0.08);
  --zj-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Serif SC', sans-serif;
  color: var(--text-main);
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('/images/campus3-hd.jpg') center center / cover no-repeat;
  opacity: 0.08;
  z-index: -1;
  filter: saturate(0.6);
}

/* 顶部栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 62px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--zj-border);
  color: #fff;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Noto Serif SC', serif;
}

.topbar-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--zj-gold), var(--zj-gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.topbar-divider {
  color: rgba(255,255,255,0.25);
}

.topbar-center {
  flex: 1;
  text-align: center;
}

.timer {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--zj-gold-light);
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(201, 162, 39, 0.35);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conn-status {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.conn-status.disconnected {
  background: rgba(100, 116, 139, 0.25);
  color: #cbd5e1;
}

.conn-status.connecting {
  background: rgba(217, 119, 6, 0.25);
  color: #fde68a;
}

.conn-status.connected {
  background: rgba(22, 163, 74, 0.22);
  color: #86efac;
}

.latency-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* 主区域 */
.main-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ========== 课前准备 ========== */

.pre-room-container {
  display: flex;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.pre-room-left {
  flex: 1;
  min-width: 0;
}

.pre-room-right {
  flex: 1;
  min-width: 0;
}

.card {
  background: var(--zj-panel);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  border: 1px solid var(--zj-border);
  padding: 22px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Noto Serif SC', serif;
}

.device-preview {
  position: relative;
  margin-bottom: 18px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  aspect-ratio: 16/9;
  border: 1px solid var(--zj-border);
}

.device-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 课前预览：竖屏摄像头也完整显示 */
.device-preview.portrait video {
  object-fit: contain;
  background: #000;
}

.audio-level-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(0,0,0,0.4);
}

.audio-level-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--zj-gold), var(--zj-gold-light));
  transition: width 0.08s ease;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 8px;
  font-weight: 500;
}

.select, .input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--zj-border);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.select:focus, .input:focus {
  border-color: var(--zj-gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

select option {
  background: #1e293b;
  color: #fff;
}

.music-mode-info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.25);
  margin-top: 18px;
}

.music-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.music-mode-info strong {
  color: var(--zj-gold-light);
  font-size: 14px;
}

.music-mode-info p {
  margin: 6px 0 0;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
}

.course-item {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--zj-border);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.course-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.course-item.is-live {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.08);
}

.badge-room {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #5eead4;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.4);
  border-radius: 999px;
  vertical-align: middle;
}

.badge-live {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #86efac;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 999px;
  vertical-align: middle;
}

/* 课堂大厅卡片：学生端置顶，突出在线老师课堂 */
#lobby-card {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.18), 0 8px 24px rgba(0, 0, 0, 0.25);
}
#lobby-card .card-title {
  color: #86efac;
}
.lobby-item {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.07);
}
.lobby-item:hover {
  border-color: rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.14);
}

.course-item-info {
  flex: 1;
}

.course-item-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.course-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== 授课中界面 ========== */

.classroom-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - 110px);
}

.video-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  position: relative;
}

/* ========== 自适应视频网格：教师本地 + 多名学生 tile ========== */
.video-grid {
  flex: 1;
  min-height: 0;
  position: relative;      /* 画中画/远端主画面的绝对定位锚点收拢到网格内，避免盖住钢琴条等兄弟元素 */
  overflow: hidden;
  display: grid;
  gap: 14px;
  grid-auto-rows: 1fr;
  align-content: center;
  padding: 2px;
  grid-template-columns: repeat(1, minmax(0, 1fr)); /* 列数由 JS 按人数更新 */
}

.video-tile {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  border: 1px solid var(--zj-border);
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
  aspect-ratio: 16 / 9;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 仅一个 tile 时占满整个视频区高度（单人/点对点占满） */
.video-grid[data-count="1"] .video-tile {
  aspect-ratio: auto;
  height: 100%;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 本地自拍镜像，符合直觉 */
#local-tile video {
  transform: scaleX(-1);
}

.video-tile.portrait video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.video-label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}

.video-thumbnails {
  display: flex;
  gap: 14px;
  height: 170px;
}

.video-thumb {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--zj-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 竖屏：完整显示，不裁切，居中 */
.video-thumb.portrait video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.control-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
/* 聊天 / 小黑板 入口常驻高亮，避免被一排按钮挤掉而「找不到」 */
#btn-chat, #btn-board {
  border-color: rgba(255, 207, 51, 0.6);
  background: rgba(255, 207, 51, 0.12);
}
#btn-chat .ctrl-label, #btn-board .ctrl-label { color: #ffcf33; font-weight: 600; }

.ctrl-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 14px;
  border: 1px solid var(--zj-border);
  background: rgba(255,255,255,0.07);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-btn:hover {
  background: rgba(255,255,255,0.12);
}

.ctrl-btn.muted {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.ctrl-btn.off {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.ctrl-icon {
  font-size: 24px;
}

.ctrl-label {
  font-size: 12px;
}

/* 录像按钮特殊样式 */
.ctrl-btn.recording {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  animation: rec-pulse 1.5s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.recording-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 13px;
  color: #fca5a5;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: rec-blink 1s ease-in-out infinite;
}

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.recording-timer {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #fff;
  margin-left: auto;
}

.audio-monitor {
  margin-bottom: 18px;
}

.audio-level-bar.wide {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: rgba(0,0,0,0.35);
  overflow: hidden;
}

.session-info {
  margin-bottom: 18px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--zj-border);
  font-size: 13px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-muted);
}

.info-value {
  color: #fff;
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-info {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

.music-mode-detail {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  color: #cbd5e1;
}

.music-mode-detail p {
  margin: 0 0 10px;
  color: var(--zj-gold-light);
  font-weight: 600;
}

.music-mode-detail ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.9;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(90deg, var(--zj-indigo), var(--zj-purple));
  border: none;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}

/* 空状态 */
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  top: 22px;
  right: 22px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--zj-border);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  z-index: 2000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 摄像头/麦克风授权失败的可操作指引横幅 */
.media-error {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(560px, 92vw);
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid #f87171;
  color: #fecaca;
  padding: 16px 18px;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
  z-index: 3000;
  font-size: 14px;
  line-height: 1.7;
  animation: slideUp 0.3s ease;
}
.media-error-body { color: #fff; }
.media-error-body b { color: #fde68a; }
.media-error-close {
  margin-top: 12px;
  background: #ef4444;
  color: #fff;
  border: 0;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* 录像上传中遮罩（锁页，防后台掐断请求） */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}
.upload-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 34px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--zj-border);
  border-radius: 16px;
  max-width: 88vw;
}
.upload-overlay-text { color: #fff; font-size: 15px; line-height: 1.7; text-align: center; }
.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 上传进度条 */
.upload-progress-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 280px;
  max-width: 82vw;
  margin-top: 2px;
}
.upload-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.16);
  border-radius: 999px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #22d3ee);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.upload-progress-pct {
  color: #e2e8f0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* 响应式 */
@media (max-width: 1024px) {
  .classroom-layout {
    flex-direction: column;
    height: auto;
  }
  .control-panel {
    width: 100%;
  }
  .video-thumbnails {
    height: 140px;
  }
  .pre-room-container {
    flex-direction: column;
  }
}

/* ========== 手机端专属优化 ========== */
@media (max-width: 768px) {
  body {
    overflow: auto;
  }
  .topbar {
    padding: 0 12px;
    height: 54px;
    gap: 8px;
  }
  .topbar-left {
    gap: 6px;
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .topbar-logo span {
    display: none; /* 手机上隐藏校名全称，保留 logo */
  }
  .topbar-divider {
    display: none;
  }
  .topbar-right {
    gap: 8px;
  }
  .timer {
    font-size: 16px;
  }
  #room-info {
    display: none;
  }

  .main-area {
    padding: 12px;
    overflow-y: visible;
  }
  .pre-room-container {
    gap: 12px;
  }
  .card {
    padding: 16px;
  }

  /* 授课中：上下布局，视频在上、控制条在下 */
  .classroom-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 54px);
    gap: 12px;
  }
  .video-area {
    gap: 10px;
  }
  /* 主画面给足高度，竖屏手机远端也能完整显示 */
  .video-grid {
    min-height: 56vh;
  }
  .video-thumbnails {
    height: 120px;
  }
  /* 手机上画中画稍大，便于看清本地自拍 */
  .video-pip {
    width: 40%;
    max-width: 160px;
    top: 10px;
    right: 10px;
  }
  /* 手机端：教师/学生本地自拍画中画缩小；教师端右下角，学生端右上角 */
  .video-grid.teacher-view.has-remote #local-tile {
    width: 34%;
    max-width: 130px;
    bottom: 10px;
    right: 10px;
    top: auto;
  }
  .video-grid.student-view #local-tile {
    width: 34%;
    max-width: 130px;
    top: 10px;
    right: 10px;
  }

  /* 控制面板横向排布，关键操作优先 */
  .control-panel {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    overflow: visible;
  }
  .control-panel > .card {
    flex: 1 1 100%;
  }
  .control-buttons {
    gap: 10px;
    margin-bottom: 12px;
  }
  .ctrl-btn {
    padding: 12px 6px;
  }
  .ctrl-icon {
    font-size: 22px;
  }
  /* 手机上隐藏冗长的音频参数细节，保留核心控制 */
  .music-mode-detail {
    display: none;
  }

  /* 自拍预览：竖屏时完整显示 */
  .device-preview {
    aspect-ratio: auto;
    min-height: 240px;
  }
}

/* ========== 会议室 / 等候室 / 回课记录 新增样式 ========== */

.course-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.badge-no {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--zj-gold-light);
  background: rgba(201, 162, 39, 0.15);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 10px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0;
}

.waiting-room-box {
  max-width: 460px;
  margin: 40px auto;
  text-align: center;
  background: var(--zj-panel);
  border: 1px solid var(--zj-border);
  border-radius: 16px;
  padding: 36px 28px;
}
.waiting-room-box .waiting-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.waiting-room-box h3 {
  margin: 0 0 10px;
  color: var(--zj-gold-light);
}
.waiting-room-box p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.6;
}

.waiting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 8px;
}
.waiting-name {
  font-weight: 600;
  color: var(--text-main);
}

/* 回课档案列表 */
.return-rec-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.return-rec-item:hover {
  background: rgba(201,162,39,0.12);
}
.return-rec-top {
  font-weight: 600;
  color: var(--text-main);
}
.return-rec-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========== 模态框 ========== */
.mw-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 3000;
}
.mw-modal-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: #1a1f33;
  border: 1px solid var(--zj-border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 3001;
  animation: mwPop 0.2s ease;
}
@keyframes mwPop {
  from { transform: translate(-50%, -46%); opacity: 0; }
  to { transform: translate(-50%, -50%); opacity: 1; }
}
.mw-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--zj-border);
}
.mw-modal-head h3 {
  margin: 0;
  color: var(--zj-gold-light);
  font-size: 18px;
}
.mw-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.mw-modal-close:hover { color: var(--text-main); }
.mw-modal-body {
  padding: 18px 20px;
}
.mw-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--zj-border);
}
.rec-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}
.rec-k {
  width: 72px;
  flex-shrink: 0;
  color: var(--zj-gold-light);
  font-weight: 600;
}
.rec-v {
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ========== 学生端布局：老师大画面 + 自己画中画 ========== */
.video-grid.student-view {
  position: relative;
  grid-template-columns: 1fr;
}
.video-grid.student-view #remote-main-tile {
  display: block;
  aspect-ratio: auto;
  height: 100%;
}
.video-grid.student-view #local-tile {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28%;
  max-width: 300px;
  aspect-ratio: 16 / 9;
  height: auto;
  z-index: 40;
  border: 2px solid rgba(201, 162, 39, 0.85);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

/* ========== 教师端布局：学生大画面 + 自己画中画 ========== */
/* 用绝对定位让主学生画面始终占满网格，避免依赖 grid 行高导致半屏 */
.video-grid.teacher-view {
  position: relative;
  grid-template-columns: 1fr;
}
/* 主学生画面：绝对定位占满整个视频区（display 控制显隐） */
.video-grid.teacher-view #remote-main-tile {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
/* 无远端（等待学生）时老师本地画面占满 */
.video-grid.teacher-view #local-tile {
  aspect-ratio: auto;
  height: 100%;
}
/* 有远端后：本地画面变为右下角画中画（绝对定位，不占网格行；聊天窗默认收起，不冲突） */
.video-grid.teacher-view.has-remote #local-tile {
  position: absolute;
  bottom: 16px;
  right: 16px;
  top: auto;
  width: 28%;
  max-width: 300px;
  aspect-ratio: 16 / 9;
  height: auto;
  z-index: 40;
  border: 2px solid rgba(201, 162, 39, 0.85);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
/* 教师端：主学生满屏；其余在线学生排成底部缩略图条（横向滚动） */
.student-strip {
  display: none;
  flex-shrink: 0;
  gap: 10px;
  height: 152px;
  padding: 2px 4px;
  overflow-x: auto;
  overflow-y: hidden;
}
.video-area.teacher-has-strip .student-strip {
  display: flex;
}
.student-strip .video-tile {
  flex: 0 0 auto;
  width: 224px;
  aspect-ratio: 16 / 9;
  height: auto;
  cursor: pointer;
  border: 2px solid rgba(201, 162, 39, 0.6);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.student-strip .video-tile .video-label {
  bottom: 8px;
  left: 8px;
  font-size: 11px;
}
.video-grid.teacher-view #remote-main-tile,
.video-grid.teacher-view .video-tile[id^="remote-tile-"] {
  cursor: zoom-in;
}
.video-grid.teacher-view #remote-main-tile::after {
  content: "⛶ 点击全屏";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.video-grid.teacher-view #remote-main-tile:hover::after {
  opacity: 1;
}
.video-grid.teacher-view:fullscreen {
  background: #000;
  padding: 0;
  gap: 0;
}

/* ========== 教师端：学生申请加入 - 左上角醒目横幅 ========== */
.join-request-banner {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100% - 32px);
}
.join-req-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(201, 162, 39, 0.9);
  border-left: 5px solid #c9a227;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  animation: joinPulse 1.5s ease-in-out infinite;
}
@keyframes joinPulse {
  0%, 100% { box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 8px 30px rgba(201, 162, 39, 0.6); }
}
.join-req-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: reqBlink 1.1s infinite;
}
@keyframes reqBlink {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.join-req-text {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
}

/* ========== 登录用户信息卡 ========== */
.user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px;
}
.user-avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--zj-indigo), var(--zj-purple));
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.user-avatar.student {
  background: linear-gradient(135deg, #0ea5a4, #14b8a6);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}
.user-meta {
  min-width: 0;
  flex: 1;
}
.user-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-role {
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
  color: var(--zj-gold-light);
  background: rgba(201, 162, 39, 0.15);
  border: 1px solid rgba(201, 162, 39, 0.4);
}
.user-role.student {
  color: #5eead4;
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.4);
}
.user-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.user-room {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
}
.user-room b {
  color: var(--zj-gold-light);
  font-size: 16px;
  letter-spacing: 1px;
  margin: 0 6px;
}
/* 专属徽标 */
.badge-dedicated {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #5eead4;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.4);
  border-radius: 10px;
}
/* 超小按钮（复制会议号） */
.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

/* ========== 屏幕共享 ========== */
/* 学生端：教师共享的大画面（优先铺满），共享时视频网格缩为底部小窗 */
.screen-share-area {
  flex: 1 1 auto;
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--zj-border);
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
}
.screen-share-area video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
/* 学生端共享：教师屏幕铺满主画面，教师摄像头浮右上角，学生自己浮右下角，去除黑底提示文字 */
.video-area.has-screen .screen-share-area {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.video-area.has-screen .video-grid {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  z-index: 6;
}
.video-area.has-screen .video-grid .video-tile {
  position: absolute;
  width: 26%;
  max-width: 320px;
  min-width: 160px;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(224, 185, 74, 0.85);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  background: #000;
  pointer-events: auto;
}
.video-area.has-screen #remote-main-tile {
  top: 14px; right: 14px; bottom: auto; left: auto;
}
/* 学生自己的画面：共享态下缩成更小的画中画（不影响观看教师屏幕） */
.video-area.has-screen #local-tile {
  bottom: 12px; right: 12px; top: auto; left: auto;
  width: 15%;
  max-width: 168px;
  min-width: 104px;
  border-width: 1.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.video-area.has-screen .screen-label { display: none; }
.screen-label {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
}
/* 共享屏幕按钮激活态 */
.ctrl-btn.active {
  background: linear-gradient(135deg, #c9a227, #e0b94a);
  color: #1a1206;
  border-color: #e0b94a;
}
.ctrl-btn.active .ctrl-icon,
.ctrl-btn.active .ctrl-label { color: #1a1206; }

/* ========== 教师端共享布局 ========== */
/* 共享时：共享画面最大化铺满网格区，教师主摄像头与在场学生小窗浮于底部 */
.video-area.teacher-sharing .video-grid { position: relative; min-height: 0; }
.video-area.teacher-sharing .local-screen-area {
  z-index: 1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
}
.video-area.teacher-sharing .local-screen-area video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-area.teacher-sharing .local-screen-area .video-label {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 3px 10px; border-radius: 8px; font-size: 12px; pointer-events: none;
}
.video-area.teacher-sharing .video-tile:not(.local-screen-area) {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--zj-gold, #e0b94a);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  background: #000;
}
.video-area.teacher-sharing .video-tile:not(.local-screen-area) video { width: 100%; height: 100%; object-fit: cover; }

/* ========== 任务1：屏幕共享布局（学生主画面=老师屏幕，学生自视频缩为小窗） ========== */
.screen-share-area {
  position: absolute; inset: 0; z-index: 5;
  display: none; align-items: center; justify-content: center;
  background: #000; border-radius: 16px; overflow: hidden;
}
.screen-share-area video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.screen-share-area .screen-label {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: rgba(0,0,0,0.6); color: #fff; padding: 4px 12px; border-radius: 8px; font-size: 13px;
}
/* 共享屏幕时：学生端隐藏所有视频（老师摄像头 + 学生自己画面），只显示教师共享的屏幕大画面 */
.video-area.has-screen .video-grid {
  display: none !important;
}
.video-area.has-screen .video-grid .video-tile {
  position: relative !important; width: 100% !important; height: 0 !important;
  padding-bottom: 56.25%; aspect-ratio: auto; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--zj-gold, #e0b94a); box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.video-area.has-screen .video-grid .video-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-area.has-screen #local-screen-area { display: none !important; }
.video-area.has-screen #student-strip { display: none; }

/* 学生端共享屏幕：放大 / 全屏查看控件（⛶ 进入专注模式后可双指缩放、拖动查看乐谱细节） */
.screen-zoom-bar {
  position: absolute; top: 10px; right: 10px; z-index: 12;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.45); padding: 5px 8px; border-radius: 999px;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.screen-zoom-bar .sz-btn {
  width: 34px; height: 34px; border-radius: 50%; padding: 0;
  border: 1px solid rgba(255,255,255,0.28); background: rgba(20,28,45,0.85); color: #fff;
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.screen-zoom-bar .sz-btn:active { transform: scale(0.94); }
.screen-zoom-bar .sz-close { background: rgba(211,47,47,0.9); }
.screen-zoom-bar .sz-scale { color: #fff; font-size: 12px; min-width: 34px; text-align: center; }
/* 全屏聚焦模式：铺满整个屏幕，盖住控制栏 / 钢琴条，可自由缩放查看细节 */
.screen-share-area.focus {
  position: fixed !important; inset: 0 !important; z-index: 300 !important;
  border-radius: 0; border: none; box-shadow: none;
}
.screen-share-area.focus video { touch-action: none; will-change: transform; }
.screen-share-area.focus .screen-zoom-bar { top: calc(env(safe-area-inset-top, 0px) + 10px); }

/* 教师共享遮罩（防死循环：覆盖视频区，不回显自己屏幕） */
.teacher-share-cover {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(10, 12, 20, 0.82); backdrop-filter: blur(2px);
}
.share-cover-box { text-align: center; color: #fff; max-width: 420px; padding: 24px; }
.share-cover-icon { font-size: 56px; margin-bottom: 10px; }
.share-cover-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; color: var(--zj-gold, #e0b94a); }
.share-cover-sub { font-size: 14px; line-height: 1.7; color: #d8dce6; }
/* 控制面板层级高于共享遮罩，保证「停止共享」按钮可点 */
.control-panel { position: relative; z-index: 100; }

/* ========== 任务2：聊天面板（紧凑弹出层，依附于功能菜单/聊天按钮，不再是独立大窗） ========== */
.chat-panel {
  position: fixed; bottom: 16px; right: 16px; width: 286px; height: 320px; max-height: 70vh; z-index: 120;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  display: none; flex-direction: column; overflow: hidden;
}
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #1f2533; color: #fff; font-weight: 600; }
.chat-close { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; background: #f6f7fb; }
.chat-msg { margin-bottom: 10px; max-width: 92%; }
.chat-msg .chat-meta { display: block; font-size: 11px; color: #333; margin-bottom: 2px; }
.chat-msg .chat-text { display: inline-block; padding: 7px 11px; border-radius: 10px; font-size: 14px; line-height: 1.5; color: #111; background: #fff; border: 1px solid #e5e7ef; }
.chat-msg.from-teacher .chat-text { background: #fff6df; border-color: #f0d98a; }
.chat-input-row { display: flex; gap: 6px; border-top: 1px solid #e5e7ef; background: #fff; padding: 8px; }
.chat-input { flex: 1; min-width: 0; border: 1px solid #d0d4de; border-radius: 8px; padding: 9px 10px; font-size: 14px; color: #111; outline: none; }
.chat-input:focus { border-color: #c79a3a; }
.chat-send { border: none; background: #1f2533; color: #fff; padding: 0 16px; border-radius: 8px; cursor: pointer; flex-shrink: 0; }

/* ========== 任务2：小黑板（角落小面板，实时同步） ========== */
.board-modal {
  position: fixed; left: 16px; bottom: 16px; z-index: 130; display: none;
  flex-direction: column; background: #fff; border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4); overflow: hidden;
  width: 380px; max-width: calc(100vw - 32px);
}
.board-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: #1f2533; color: #fff; }
.board-header > span { font-weight: 700; }
.board-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.board-tool-btn { border: 1px solid #d0d4de; background: #fff; color: #1f2533; border-radius: 8px; padding: 4px 9px; cursor: pointer; font-size: 12px; }
.board-tool-btn.board-close { background: #e23b3b; color: #fff; border-color: #e23b3b; }
.board-canvas { background: #fff; display: block; width: 100%; height: 240px; max-width: none; max-height: none; touch-action: none; cursor: crosshair; }

/* ========== 任务3：断线恢复横幅 ========== */
.reconnect-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: linear-gradient(90deg, #ff8a00, #ff5e3a); color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.reconnect-inner { display: flex; align-items: center; gap: 14px; padding: 12px 20px; max-width: 960px; margin: 0 auto; }
.reconnect-icon { font-size: 24px; }
.reconnect-text { flex: 1; display: flex; flex-direction: column; }
.reconnect-text strong { font-size: 15px; }
.reconnect-text span { font-size: 13px; opacity: 0.92; }
.reconnect-btn { border: none; background: #fff; color: #e2552a; font-weight: 700; padding: 8px 18px; border-radius: 10px; cursor: pointer; }

/* ========== 任务6：音量 / 话筒面板 ========== */
.volume-panel {
  position: fixed; right: 16px; bottom: 16px; width: 320px; z-index: 65;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  display: none; padding: 16px;
}
.volume-header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 12px; }
.volume-close { background: none; border: none; font-size: 16px; cursor: pointer; }
.volume-row { margin-bottom: 14px; }
.volume-row label { display: block; font-size: 13px; color: #444; margin-bottom: 6px; }
.volume-row input[type=range] { width: 100%; }
.volume-val { display: inline-block; margin-left: 8px; font-size: 12px; color: #1f2533; }
.peer-audio-list { margin: 6px 0 12px; }
.peer-audio-row { font-size: 13px; color: #333; display: flex; align-items: center; gap: 6px; }
.volume-hint { font-size: 12px; color: #8a90a0; line-height: 1.6; border-top: 1px solid #eee; padding-top: 10px; }

/* ========== 桌面端屏幕源选择弹窗 ========== */
.screen-picker-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,18,28,0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
}
.screen-picker {
  width: min(880px, 94vw); max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 16px; padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.sp-title { font-size: 18px; font-weight: 700; color: #1f2533; margin-bottom: 14px; }
.sp-audio { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #444; margin-bottom: 16px; cursor: pointer; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.sp-card {
  border: 2px solid #e6e8ef; border-radius: 12px; padding: 10px; cursor: pointer;
  background: #fafbfe; transition: border-color .15s, transform .1s; text-align: center;
}
.sp-card:hover { border-color: #c79a3a; transform: translateY(-2px); }
.sp-thumb { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; background: #eef0f6; display: block; }
.sp-name { margin-top: 8px; font-size: 12px; color: #333; line-height: 1.4; word-break: break-all; }
.sp-actions { margin-top: 18px; text-align: right; }
.sp-btn { border: none; border-radius: 8px; padding: 8px 18px; font-size: 14px; cursor: pointer; }
.sp-cancel { background: #eef0f6; color: #333; }
.sp-cancel:hover { background: #e2e5ee; }

/* 窄屏（手机/平板）：聊天面板缩小为只看文字的小窗，避免遮挡主画面 */
@media (max-width: 980px) {
  .chat-panel { right: 12px; width: min(88vw, 300px); height: 38vh; max-height: 240px; }
  .chat-messages { font-size: 13px; }
  /* 小黑板在手机端同样确保完整可见，并避免被底部控制栏裁切 */
  .board-modal { max-width: calc(100vw - 24px); }
  .board-canvas { height: 200px; }
}

/* ========== 功能菜单（☰）：把聊天/小黑板/音量等收进同一菜单 ========== */
.feature-menu {
  position: fixed; top: 62px; right: 14px; z-index: 1500;
  background: #fff; border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  padding: 8px; min-width: 184px; display: none; flex-direction: column; gap: 4px;
  animation: slideInMenu 0.18s ease;
}
@keyframes slideInMenu { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.feature-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border: none; border-radius: 10px; background: transparent;
  color: #1f2533; font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
}
.feature-menu-item span { font-size: 18px; width: 22px; text-align: center; }
.feature-menu-item:hover { background: #f3f4f8; }
.feature-menu-item.active { background: #fff6df; color: #8a6d1f; }

/* ========== 连接学生进度条 ========== */
.connect-progress {
  position: fixed; inset: 0; z-index: 1400;
  display: none; align-items: flex-start; justify-content: center;
  background: rgba(10, 12, 20, 0.35); backdrop-filter: blur(2px);
  pointer-events: none;
}
.cp-card {
  margin-top: 14vh; width: min(420px, 90vw);
  background: rgba(26, 31, 51, 0.96); border: 1px solid var(--zj-border, #2a3148);
  border-radius: 16px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  color: #fff;
}
.cp-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--zj-gold-light, #e8d179); }
.cp-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; }
.cp-fill {
  height: 100%; width: 8%; border-radius: 6px;
  background: linear-gradient(90deg, var(--zj-indigo, #6366f1), var(--zj-gold, #c9a227));
  transition: width 0.4s ease;
}
.cp-steps { display: flex; justify-content: space-between; margin-top: 16px; gap: 6px; }
.cp-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: #94a3b8; }
.cp-step .cp-dot { font-size: 10px; line-height: 1; color: #475569; transition: color 0.3s; }
.cp-step.active { color: #e2e8f0; }
.cp-step.active .cp-dot { color: var(--zj-gold-light, #e8d179); }
.cp-step.done .cp-dot { color: #4ade80; }
.cp-step.done { color: #cbd5e1; }
.connect-progress.error .cp-title { color: #fca5a5; }
.connect-progress.error .cp-fill { background: linear-gradient(90deg, #ef4444, #f97316); }


/* ========== 视频通话窗口下方：可弹奏钢琴键盘（小字组G~小字二组G / G3~G5，两个八度） ========== */
/* 底部悬浮 dock：全端固定可见（手机竖屏也不会被视频层盖住/滚出视野） */
:root { --piano-dock-h: 196px; }
.piano-bar {
  position: fixed;
  left: 50%;
  bottom: 92px;                      /* 抬到控制栏(约76px高)正上方，互不遮挡 */
  transform: translateX(-50%);
  z-index: 110;                      /* 高于底部控制栏(100)，低于聊天(120)/小黑板(130) 弹窗 */
  display: none;                     /* 默认隐藏，进入课堂(body.in-room)才显示 */
  width: min(700px, calc(100vw - 20px));
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.97), rgba(15, 23, 42, 0.97));
  border: 1px solid var(--zj-border, #2a3140);
  border-radius: 14px;
  padding: 8px 14px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
/* 进入课堂后(body.in-room)才显示钢琴条；手动关闭时加 body.piano-hidden（优先级最高） */
body.in-room .piano-bar { display: block; }
body.piano-hidden .piano-bar { display: none !important; }
/* 钢琴条打开时：若钢琴仍在底部原位（未被拖动），聊天/小黑板/音量弹窗自动上移避让 */
body.piano-open:not(.piano-moved) .chat-panel { bottom: calc(10px + var(--piano-dock-h, 196px)); }
body.piano-open:not(.piano-moved) .board-modal { bottom: calc(10px + var(--piano-dock-h, 196px)); }
body.piano-open:not(.piano-moved) .volume-panel { bottom: calc(10px + var(--piano-dock-h, 196px)); }
/* 可拖动：钢琴键盘 / 聊天 / 小黑板，按住标题栏即可拖到合适位置 */
.piano-bar-head, .chat-header, .board-header { cursor: grab; user-select: none; -webkit-user-select: none; }
.piano-bar.dragging, .chat-panel.dragging, .board-modal.dragging { cursor: grabbing; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5); }
.chat-close, .board-tool-btn, .board-close, .piano-close, .piano-shift-btn { cursor: pointer; }
.piano-bar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 12px; }
.piano-title { font-size: 12px; color: #cbd5e1; font-weight: 600; }
.piano-title small { color: #64748b; font-weight: 400; margin-left: 8px; font-size: 11px; }
.piano-close { background: transparent; border: none; color: #94a3b8; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.piano-close:hover { color: #e2e8f0; }
.piano-shift { display: flex; align-items: center; gap: 6px; }
.piano-shift-btn {
  border: 1px solid #3b4658; background: #26314a; color: #cbd5e1;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.piano-shift-btn:hover { background: #33405e; color: #fff; }
.piano-shift-btn:active { transform: translateY(1px); }
.piano-wrap { overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.piano {
  --wk: 42px;            /* 白键宽 */
  --bw: 26px;            /* 黑键宽 */
  position: relative;
  height: 132px;
  width: calc(var(--wk) * 15);   /* 15 个白键：G3 A3 B3 C4 D4 E4 F4 G4 A4 B4 C5 D5 E5 F5 G5 */
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.piano-key { position: absolute; bottom: 0; box-sizing: border-box; cursor: pointer; }
.piano-key.white {
  width: var(--wk);
  height: 132px;
  background: linear-gradient(180deg, #ffffff, #eef2f7);
  border: 1px solid #cbd5e1;
  border-radius: 0 0 6px 6px;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7px;
  color: #475569; font-size: 11px; font-weight: 600; z-index: 1;
}
.piano-key.black {
  width: var(--bw);
  height: 84px;
  top: 0;                    /* 黑键从顶部下垂（真钢琴样式）：白键在下、黑键在上 */
  bottom: auto;
  background: linear-gradient(180deg, #334155, #0b1220);
  border: 1px solid #000;
  border-radius: 0 0 4px 4px;
  z-index: 2;
}
.piano-key.white.active { background: linear-gradient(180deg, #bfdbfe, #93c5fd); border-color: #60a5fa; }
.piano-key.black.active { background: linear-gradient(180deg, #60a5fa, #1d4ed8); }
.pk-label { pointer-events: none; }

/* 窄屏（手机/平板）：缩小琴键，整条可横向滚动；dock 高度同步变小，弹窗避让距离跟着变 */
@media (max-width: 980px) {
  :root { --piano-dock-h: 168px; }
  .piano-bar { width: calc(100vw - 16px); bottom: 104px; padding: 6px 10px 10px; }
  /* 手机端：钢琴条打开时给页面底部留出空间，避免盖住控制按钮（钢琴被拖动走后取消） */
  body.piano-open:not(.piano-moved) .main-area { padding-bottom: calc(var(--piano-dock-h) + 24px); }
  .piano { --wk: 30px; --bw: 18px; height: 110px; }
  .piano-key.white { height: 110px; font-size: 9px; }
  .piano-key.black { height: 70px; }
}
