/* ============ 基础 ============ */
:root {
  --c-border: #e5e7eb;
  --c-text: #111827;
  --c-text-2: #6b7280;
  --c-accent: #4f46e5;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color: var(--c-text);
}
[hidden] { display: none !important; }

/* ============ 视角切换 ============ */
body.view-teacher [data-student] { display: none !important; }
body.view-student [data-teacher] { display: none !important; }

.role-toggle { display: flex; background: #f3f4f6; border-radius: 8px; padding: 2px; }
.role-toggle button {
  padding: 5px 12px; font-size: 13px; font-weight: 500; color: #6b7280; border-radius: 6px;
  cursor: pointer; transition: background .15s, color .15s; border: none; background: transparent;
}
.role-toggle button.active { background: #fff; color: #111827; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; animation: pulse 2s infinite; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; display: inline-block; }
.one-on-one-pill { font-size: 12px; color: #4f46e5; background: #eef2ff; padding: 3px 10px; border-radius: 999px; font-weight: 500; }

.hdr-btn {
  padding: 7px 12px; font-size: 13px; color: #374151; border: 1px solid var(--c-border);
  border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; background: #fff; cursor: pointer; transition: background .15s, border-color .15s;
}
.hdr-btn:hover { background: #f9fafb; }
.hdr-danger { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.hdr-danger:hover { background: #fee2e2; }
.hdr-hand { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.hdr-hand:hover { background: #fef3c7; }
.hdr-hand.active { color: #fff; border-color: #f59e0b; background: #f59e0b; }
.stu-pip.raised { animation: handPulse 1.2s infinite; }
@keyframes handPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.5), 0 4px 12px rgba(0,0,0,.25); } 50% { box-shadow: 0 0 0 6px rgba(245,158,11,0), 0 4px 12px rgba(0,0,0,.25); } }
.pip-hand { width: 16px; height: 16px; color: #fcd34d; margin-left: 2px; flex-shrink: 0; }

/* ============ 主 Tab ============ */
.main-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500; color: #9ca3af; border-bottom: 2px solid transparent;
  cursor: pointer; background: none; border-top: none; border-left: none; border-right: none; transition: color .15s, border-color .15s;
}
.main-tab:hover { color: #d1d5db; }
.main-tab.tab-active { color: #fff; border-bottom-color: #6366f1; }

.tab-pane { position: absolute; inset: 0; top: 52px; bottom: 64px; display: flex; align-items: center; justify-content: center; padding: 20px; }
.tab-pane.hidden { display: none !important; }

/* ============ 课堂内容 ============ */
.content-pane { padding: 0; }
.content-toolbar {
  position: absolute; top: 0; left: 0; right: 0; height: 46px; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: rgba(15,23,42,.55); backdrop-filter: blur(4px); z-index: 2;
}
.content-label { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.content-switch { display: flex; background: rgba(255,255,255,.1); border-radius: 7px; padding: 2px; }
.cs-btn { padding: 4px 12px; font-size: 12px; color: #cbd5e1; background: transparent; border: none; border-radius: 5px; cursor: pointer; }
.cs-btn.cs-active { background: #fff; color: #111827; }
.content-hint { margin-left: auto; font-size: 12px; color: #94a3b8; }
.content-stage { position: absolute; top: 46px; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; padding: 20px; }
.content-image, .content-video { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

/* ============ 课件卡片 ============ */
.slide-card { width: min(680px, 90%); background: #fff; border-radius: 12px; padding: 36px 40px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.slide-title { font-size: 22px; font-weight: 600; color: #111827; }
.slide-sub { font-size: 13px; color: #9ca3af; margin-top: 6px; }
.slide-body { margin-top: 28px; }
.eq { font-size: 26px; font-weight: 600; color: #4f46e5; font-family: Consolas, monospace; }
.eq-sub { font-size: 16px; color: #374151; margin-top: 12px; font-family: Consolas, monospace; }
.eq-note { font-size: 14px; color: #6b7280; margin-top: 10px; }
.page-dots { display: flex; gap: 6px; justify-content: center; margin-top: 30px; }
.page-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; }
.page-dots .dot.active { background: #4f46e5; width: 18px; border-radius: 4px; }

/* 课件缩略图（摄像头关闭时的退化显示） */
.cw-thumb { background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 4px 14px rgba(0,0,0,.2); width: 100%; max-width: 240px; }
.cw-thumb-title { font-size: 14px; font-weight: 600; color: #111827; }
.cw-thumb-eq { font-size: 16px; font-weight: 600; color: #4f46e5; margin-top: 8px; font-family: Consolas, monospace; }
.cw-thumb-note { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* ============ 白板 ============ */
.board { width: 100%; height: 100%; background-color: #fff; background-image: radial-gradient(#e5e7eb 1px, transparent 1px); background-size: 22px 22px; border-radius: 10px; }
.board-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.board-tool { width: 32px; height: 32px; border-radius: 7px; border: 1px solid #e5e7eb; background: #fff; color: #4b5563; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.board-tool:hover { background: #f9fafb; }
.board-hint { margin-left: auto; font-size: 12px; color: #9ca3af; }

/* ============ 视频 ============ */
.video-stage { width: 100%; height: 100%; position: relative; background: #0f172a; border-radius: 10px; }
.video-paused-badge { position: absolute; top: 14px; left: 14px; font-size: 12px; color: #fca5a5; background: rgba(239,68,68,.12); padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.video-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #cbd5e1; }
.video-play { width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; color: #fff; }
.video-cap { font-size: 14px; }

/* ============ 在线状态条（老师和学生的小窗都做成细长 chip，减少视觉重量） ============ */
.stu-pip,
.teacher-pip {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.stu-pip .pip-av,
.teacher-pip .pip-av {
  width: 32px; height: 32px; border-radius: 50%;
  color: #fff; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stu-pip .pip-label,
.teacher-pip .pip-label {
  font-size: 12px; color: #e2e8f0; white-space: nowrap;
  background: transparent; padding: 0; border-radius: 0;
}

/* 学生摄像头开启时：头像加一个细绿环 */
.stu-pip.live .pip-av { box-shadow: inset 0 0 0 2px #10b981; }
.stu-pip.live .pip-label::after { content: " · 摄像头已开"; color: #6ee7b7; }

/* 提醒脉冲：作用在整条 chip 上更克制 */
.stu-pip.remind { animation: remindPulseChip 1s infinite; }
@keyframes remindPulseChip { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.45), 0 4px 12px rgba(0,0,0,.25); } 50% { box-shadow: 0 0 0 6px rgba(245,158,11,0), 0 4px 12px rgba(0,0,0,.25); } }

/* ============ 我的画面 PiP（仅学生，唯一操作：摄像头开关） ============ */
.self-pip { position: absolute; bottom: 16px; right: 16px; z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.self-pip .pip-box { width: 120px; height: 84px; border-radius: 10px; background: #0f172a; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 2px solid rgba(255,255,255,.45); box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.self-pip .pip-av { width: 40px; height: 40px; border-radius: 50%; color: #fff; font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.self-pip .pip-thumb { width: 100%; padding: 8px; }
.self-pip .pip-thumb .cw-thumb-title { font-size: 12px; }
.self-pip .pip-toggle { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s; }
.self-pip .pip-toggle:hover { background: rgba(255,255,255,.26); }

/* 举手按钮（学生主画面底部居中，与顶栏退出按钮拉开距离） */
.raise-hand-fab { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 6; }
.raise-hand-fab .hdr-btn { box-shadow: 0 6px 16px rgba(0,0,0,.35); padding: 9px 18px; font-size: 14px; }

/* 学生端：不显示内容切换（由老师控制） */
body.view-student .content-switch { display: none; }

/* ============ 学生端状态卡（无 tab） ============ */
.stu-status { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid var(--c-border); border-radius: 10px; }
.stu-status-av { width: 38px; height: 38px; border-radius: 9px; color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stu-status-name { font-size: 13px; font-weight: 600; color: #111827; }
.stu-status-sub { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.stu-content-card { margin-top: 12px; padding: 12px; background: #f9fafb; border-radius: 10px; }
.stu-content-label { font-size: 11px; color: #9ca3af; }
.stu-content-title { font-size: 14px; font-weight: 600; color: #111827; margin-top: 4px; }
.stu-content-sub { font-size: 12px; color: #9ca3af; margin-top: 4px; line-height: 1.5; }

/* ============ 底部控制条 ============ */
.display-controls { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: rgba(17,24,39,.85); backdrop-filter: blur(6px); display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.control-btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: #d1d5db; border-radius: 7px; cursor: pointer; border: none; background: none; transition: background .15s, color .15s; }
.control-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ============ 侧 Tab ============ */
.side-tab { padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--c-text-2); border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none; border-left: none; border-right: none; transition: color .15s, border-color .15s; }
.side-tab:hover { color: var(--c-text); }
.side-tab.side-tab-active { color: var(--c-text); border-bottom-color: var(--c-accent); }
.side-pane { padding: 12px; }
.side-pane.hidden { display: none !important; }

/* ============ 摄像头 ============ */
.cam-wrap { height: 100%; display: flex; flex-direction: column; gap: 10px; }
.cam-on, .cam-off { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.cam-video { flex: 1; min-height: 0; border-radius: 10px; background: #0f172a; display: flex; align-items: center; justify-content: center; }
.cam-av { width: 64px; height: 64px; border-radius: 50%; color: #fff; font-size: 22px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.cam-bar { display: flex; align-items: center; gap: 8px; }
.cam-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--c-border); background: #fff; color: #4b5563; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cam-btn:hover { background: #f9fafb; }
.cam-label { margin-left: auto; font-size: 12px; color: #9ca3af; }

/* ============ 作业学情（单名学生） ============ */
.hw-summary { border: 1px solid var(--c-border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.hw-summary-top { display: flex; align-items: center; gap: 10px; }
.hw-av { width: 36px; height: 36px; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hw-summary-meta { flex: 1; min-width: 0; }
.hw-summary-name { font-size: 14px; font-weight: 600; color: #111827; }
.hw-summary-sub { font-size: 12px; color: #9ca3af; margin-top: 1px; }
.hw-progress-num { font-size: 15px; font-weight: 600; color: #10b981; }
.hw-progress-bar { height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 10px 0 8px; }
.hw-progress-bar .bar { height: 100%; background: #10b981; border-radius: 999px; }
.hw-current { font-size: 12px; color: #6b7280; line-height: 1.5; }

.hw-list { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.hw-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--c-border); border-radius: 10px; }
.hw-avatar { width: 34px; height: 34px; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hw-meta { flex: 1; min-width: 0; }
.hw-name { font-size: 13px; font-weight: 500; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-time { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.hw-badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; flex-shrink: 0; }
.hw-badge.done { color: #047857; background: #ecfdf5; }
.hw-badge.todo { color: #b45309; background: #fffbeb; }

/* ============ 计时提醒（老师） ============ */
.timer-panel { height: 100%; display: flex; flex-direction: column; gap: 14px; }
.sw-display { font-size: 40px; font-weight: 700; color: #111827; font-variant-numeric: tabular-nums; text-align: center; font-family: Consolas, monospace; }
.sw-buttons { display: flex; gap: 8px; justify-content: center; }
.sw-btn { padding: 8px 18px; font-size: 13px; font-weight: 500; color: #fff; background: #4f46e5; border: none; border-radius: 8px; cursor: pointer; }
.sw-btn:hover { background: #4338ca; }
.sw-btn-ghost { background: #fff; color: #374151; border: 1px solid var(--c-border); }
.sw-btn-ghost:hover { background: #f9fafb; }
.reminder-box { border-top: 1px solid #f3f4f6; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.reminder-title { font-size: 13px; font-weight: 600; color: #111827; }
.reminder-row { display: flex; align-items: center; gap: 8px; }
.reminder-row label { font-size: 12px; color: #6b7280; width: 60px; flex-shrink: 0; }
.reminder-row input { flex: 1; min-width: 0; padding: 7px 10px; font-size: 13px; border: 1px solid var(--c-border); border-radius: 8px; }
.reminder-row input:focus { outline: none; border-color: #4f46e5; }
.rem-set-btn { padding: 9px; font-size: 13px; font-weight: 500; color: #4f46e5; background: #eef2ff; border: none; border-radius: 8px; cursor: pointer; }
.rem-set-btn:hover { background: #e0e7ff; }
.rem-status { font-size: 12px; color: #9ca3af; }

/* ============ 聊天（师生共用同一条线程） ============ */
#chat-messages { font-size: 13px; }
.chat-msg { display: flex; gap: 8px; }
.chat-avatar { width: 28px; height: 28px; border-radius: 50%; font-size: 12px; font-weight: 600; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-body { min-width: 0; }
.chat-meta { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.chat-name { font-size: 12px; font-weight: 600; color: #374151; }
.chat-time { font-size: 11px; color: #9ca3af; }
.chat-text { font-size: 13px; color: #1f2937; background: #f3f4f6; padding: 7px 11px; border-radius: 10px; display: inline-block; max-width: 100%; word-break: break-word; line-height: 1.5; }
.chat-teacher .chat-text { background: #eef2ff; color: #312e81; }
.chat-system { justify-content: center; }
.chat-system .chat-text { background: transparent; color: #9ca3af; font-size: 12px; padding: 2px 0; }

/* 头像色板（纯色） */
.avatar-indigo { background: #6366f1; }
.avatar-amber { background: #f59e0b; }
.avatar-rose { background: #f43f5e; }
.avatar-emerald { background: #10b981; }
.avatar-sky { background: #0ea5e9; }
.avatar-violet { background: #8b5cf6; }
.avatar-teal { background: #14b8a6; }
.avatar-fuchsia { background: #d946ef; }

/* ============ 滚动条 ============ */
.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ============ 提示条 ============ */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%) translateY(-10px);
  background: #111827; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; transition: opacity .2s, transform .2s; z-index: 50; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 动画 ============ */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
