:root {
  --bg: #070d18;
  --bg-soft: #0b1424;
  --panel: rgba(15, 26, 46, 0.82);
  --panel-solid: #0f1a2e;
  --panel-2: #111f36;
  --line: rgba(148, 178, 216, 0.16);
  --line-strong: rgba(148, 178, 216, 0.28);
  --text: #e8f1fc;
  --muted: #8fa5c2;
  --muted-2: #68809e;
  --brand: #5eead4;
  --brand-2: #38bdf8;
  --brand-soft: rgba(94, 234, 212, 0.12);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --warn: #fbbf24;
  --ok: #34d399;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
}

.hidden {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.screen {
  min-height: 100vh;
  width: 100%;
}

/* ==================== 大厅 ==================== */

.lobby-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 32px 22px;
  background:
    radial-gradient(1000px 620px at 12% 8%, rgba(56, 189, 248, 0.13), transparent 60%),
    radial-gradient(900px 600px at 92% 90%, rgba(94, 234, 212, 0.1), transparent 62%),
    linear-gradient(160deg, #060b14 0%, #08111f 48%, #07101c 100%);
}

.lobby-grid {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(148, 178, 216, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 178, 216, 0.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 38%, black 0%, transparent 72%);
  pointer-events: none;
}

.lobby-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  pointer-events: none;
}

.orb-a {
  width: 420px;
  height: 420px;
  left: -120px;
  top: 18%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18), transparent 68%);
  animation: float-a 12s ease-in-out infinite;
}

.orb-b {
  width: 480px;
  height: 480px;
  right: -160px;
  bottom: -120px;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.16), transparent 68%);
  animation: float-b 15s ease-in-out infinite;
}

@keyframes float-a {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(26px, -22px, 0); }
}

@keyframes float-b {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-30px, 20px, 0); }
}

.lobby-wrap {
  position: relative;
  z-index: 2;
  width: min(1120px, 100%);
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px 4px;
  color: #cfe0f4;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #06111f;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 26px rgba(94, 234, 212, 0.28);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.brand-tag {
  margin-left: 2px;
  padding: 3px 8px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 999px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.lobby-card {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 42px;
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(18, 33, 58, 0.9), rgba(9, 18, 33, 0.88)),
    radial-gradient(600px 320px at 0% 0%, rgba(56, 189, 248, 0.12), transparent 65%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.lobby-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lobby-copy h1 {
  margin: 0;
  color: #f3f8ff;
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.16;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.lobby-copy h1 span {
  color: transparent;
  background: linear-gradient(100deg, #8df5e3 0%, #5eead4 35%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.lead {
  max-width: 500px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.feature-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #b9cbe1;
  font-size: 12px;
}

.feature-row .icon {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.demo-steps {
  margin-top: 30px;
  padding: 18px 20px;
  border: 1px dashed rgba(148, 178, 216, 0.24);
  border-radius: var(--radius-md);
  background: rgba(7, 15, 28, 0.42);
}

.steps-title {
  margin: 0 0 10px;
  color: #d7e5f6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.demo-steps ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}

.demo-steps b {
  color: #e8f1fc;
  font-weight: 700;
}

.join-panel {
  align-self: center;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(6, 13, 24, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.join-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.join-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.secure-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: 999px;
  color: var(--ok);
  background: rgba(52, 211, 153, 0.08);
  font-size: 10px;
  font-weight: 700;
}

.secure-pill .icon {
  width: 12px;
  height: 12px;
}

.role-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.role-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.role-card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-1px);
}

.role-card.active {
  border-color: rgba(94, 234, 212, 0.58);
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.12), rgba(56, 189, 248, 0.06));
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.07);
}

.role-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #9db4cf;
  background: rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}

.role-card.active .role-icon {
  color: #06211d;
  background: linear-gradient(135deg, var(--brand), #7dd3fc);
}

.role-icon .icon {
  width: 18px;
  height: 18px;
}

.role-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.role-text b {
  color: #eaf3ff;
  font-size: 13px;
  white-space: nowrap;
}

.role-text small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  white-space: nowrap;
}

.role-check {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 17px;
  height: 17px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #05231d;
  background: var(--brand);
}

.role-check .icon {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

.role-card.active .role-check {
  display: inline-flex;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  color: #b9cbe1;
  font-size: 11.5px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder {
  color: #5d7492;
}

.field input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  min-width: 0;
}

.mini-btn {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #b9cbe1;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.mini-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  cursor: pointer;
}

.switch-line input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #91a8c3;
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch-line input:checked + .switch-ui {
  border-color: rgba(94, 234, 212, 0.6);
  background: rgba(94, 234, 212, 0.18);
}

.switch-line input:checked + .switch-ui::after {
  transform: translateX(16px);
  background: var(--brand);
}

.switch-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.switch-copy b {
  color: #cfe0f4;
  font-size: 12px;
}

.switch-copy small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10.5px;
}

.primary-btn {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 12px;
  color: #041b18;
  background: linear-gradient(100deg, #7df3df, var(--brand) 45%, #60d9fb);
  box-shadow: 0 14px 36px rgba(94, 234, 212, 0.2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(94, 234, 212, 0.27);
  filter: brightness(1.03);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn .icon {
  width: 17px;
  height: 17px;
}

.join-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.65;
}

.lobby-footer {
  margin: 18px 4px 0;
  color: #4e6480;
  font-size: 11px;
  text-align: right;
}

/* ==================== 课堂 ==================== */

.classroom-screen {
  height: 100vh;
  min-height: 560px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(56, 189, 248, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(94, 234, 212, 0.06), transparent 60%),
    #060c16;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 15, 27, 0.78);
  backdrop-filter: blur(16px);
  z-index: 4;
}

.top-left,
.top-right {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.top-right {
  justify-content: flex-end;
}

.room-meta {
  min-width: 0;
}

.room-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.room-title b {
  color: #eef6ff;
  font-size: 14px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.room-pill {
  padding: 3px 8px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 7px;
  color: #8bdcf7;
  background: rgba(56, 189, 248, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.room-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10.5px;
}

.dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #405775;
}

.network-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.network-text .icon {
  width: 12px;
  height: 12px;
}

.network-text.good { color: var(--ok); }
.network-text.fair { color: var(--warn); }
.network-text.bad { color: var(--danger); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #b9cbe1;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.icon-btn.tiny {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.icon-btn.tiny .icon {
  width: 13px;
  height: 13px;
}

.icon-btn.danger {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.22);
  background: rgba(251, 113, 133, 0.1);
}

.icon-btn.danger:hover {
  background: rgba(251, 113, 133, 0.18);
}

.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(251, 113, 133, 0.25);
  border-radius: 999px;
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.1);
  font-size: 11px;
  font-weight: 700;
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.13);
  animation: rec-pulse 1.4s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.86); }
}

.ghost-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #c5d7eb;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ghost-btn:hover {
  border-color: rgba(94, 234, 212, 0.36);
  background: rgba(94, 234, 212, 0.08);
}

.ghost-btn .icon {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.ghost-btn.small {
  min-height: 34px;
  margin-top: 14px;
  font-size: 11px;
}

.classroom-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 382px;
  gap: 14px;
  min-height: 0;
  padding: 14px 14px 0;
}

/* ---- 视频舞台 ---- */

.stage {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(700px 420px at 50% 30%, rgba(56, 189, 248, 0.08), transparent 70%),
    #050a13;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.24);
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #050a13;
}

#remoteVideo {
  position: absolute;
  inset: 0;
}

/* 帧中继降级画面：WebRTC 无法直连时由老师端推送 JPEG 帧 */
.relay-frame {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050a13;
}

.sound-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 999px;
  color: #dffff9;
  background: rgba(5, 14, 25, 0.86);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transform: translate(-50%, -50%);
  transition: background 0.18s ease, transform 0.18s ease;
}

.sound-hint:hover {
  background: rgba(14, 38, 48, 0.94);
  transform: translate(-50%, -50%) scale(1.03);
}

.sound-hint .icon {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(420px 260px at 50% 42%, rgba(94, 234, 212, 0.08), transparent 68%),
    linear-gradient(160deg, rgba(13, 25, 44, 0.72), rgba(5, 10, 19, 0.9));
}

.video-placeholder b {
  margin-top: 8px;
  color: #e8f1fc;
  font-size: 15px;
}

.video-placeholder p {
  max-width: 360px;
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.7;
}

.placeholder-avatar {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 50%;
  color: #bff8ee;
  background: linear-gradient(145deg, rgba(94, 234, 212, 0.17), rgba(56, 189, 248, 0.08));
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 0 0 10px rgba(94, 234, 212, 0.035);
}

.pulse-ring {
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 50%;
  animation: ring-pulse 2.2s ease-out infinite;
}

@keyframes ring-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  80%, 100% { transform: scale(1.45); opacity: 0; }
}

.video-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #eaf3ff;
  background: rgba(4, 10, 19, 0.64);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 700;
  max-width: calc(100% - 24px);
}

.remote-label {
  position: absolute;
  left: 12px;
  top: 12px;
}

.role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.role-dot.me {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.13);
}

.local-pip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: clamp(132px, 22%, 224px);
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(94, 234, 212, 0.32);
  border-radius: 13px;
  overflow: hidden;
  background: #050a13;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
}

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

.local-label {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 4px 7px;
  font-size: 9.5px;
  gap: 4px;
}

.fake-tag {
  padding: 2px 5px;
  border-radius: 4px;
  color: #06211d;
  background: var(--brand);
  font-size: 8px;
  font-weight: 800;
}

.cam-off {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f96b2;
  background: rgba(4, 9, 17, 0.82);
  backdrop-filter: blur(4px);
}

.cam-off .icon {
  width: 28px;
  height: 28px;
}

.stage-footer {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 260px);
}

.stage-badge,
.hand-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #9fb3cb;
  background: rgba(4, 10, 19, 0.64);
  backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 700;
}

.hand-badge {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.1);
}

.hand-badge .icon {
  width: 12px;
  height: 12px;
}

/* ---- 侧栏 ---- */

.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(12, 22, 39, 0.76);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.2);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 7px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 12, 22, 0.35);
}

.tab {
  position: relative;
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  transition: color 0.18s ease, background 0.18s ease;
}

.tab:hover {
  color: #d4e2f2;
  background: rgba(255, 255, 255, 0.04);
}

.tab.active {
  color: #dffff9;
  background: rgba(94, 234, 212, 0.1);
}

.tab .icon {
  width: 15px;
  height: 15px;
}

.unread {
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 999px;
  color: #04211c;
  background: var(--brand);
  font-size: 9px;
  font-weight: 800;
}

.pane {
  display: none;
  flex: 1;
  min-height: 0;
}

.pane.active {
  display: flex;
  flex-direction: column;
}

/* ---- 白板 ---- */

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 11, 21, 0.28);
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-dot {
  width: 17px;
  height: 17px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-dot:hover {
  transform: scale(1.12);
}

.color-dot.active {
  box-shadow: 0 0 0 2px #0b1424, 0 0 0 3.5px var(--c);
}

.brush-size {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--muted-2);
  font-size: 9.5px;
  white-space: nowrap;
}

.brush-size input {
  width: 56px;
  accent-color: var(--brand);
}

.board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(400px 300px at 50% 45%, rgba(56, 189, 248, 0.05), transparent 70%),
    #08111f;
}

#whiteboard {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 2;
}

.board-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #516a88;
  pointer-events: none;
  z-index: 1;
}

.board-empty .icon {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  color: #3f5875;
}

.board-empty b {
  color: #6f86a3;
  font-size: 12px;
}

.board-empty span {
  font-size: 10px;
}

/* ---- 聊天 ---- */

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 11px 8px;
  scrollbar-width: thin;
  scrollbar-color: #253a56 transparent;
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #253a56;
}

.chat-row {
  display: flex;
  gap: 7px;
  margin-bottom: 11px;
  align-items: flex-start;
}

.chat-row.self {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #bff8ee;
  background: rgba(94, 234, 212, 0.12);
  font-size: 10px;
  font-weight: 800;
}

.chat-row.self .chat-avatar {
  color: #d8ecff;
  background: rgba(56, 189, 248, 0.16);
}

.chat-body {
  min-width: 0;
  max-width: 82%;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--muted-2);
  font-size: 9px;
}

.chat-row.self .chat-meta {
  justify-content: flex-end;
}

.chat-meta b {
  color: #a9bdd5;
  font-size: 9.5px;
  font-weight: 700;
}

.chat-bubble {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 3px 11px 11px 11px;
  color: #d8e6f6;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
}

.chat-row.self .chat-bubble {
  border-color: rgba(56, 189, 248, 0.2);
  border-radius: 11px 3px 11px 11px;
  background: rgba(56, 189, 248, 0.11);
}

.chat-system {
  margin: 9px 0;
  color: #5d7492;
  font-size: 9.5px;
  line-height: 1.6;
  text-align: center;
}

.quick-phrases {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 0 10px 8px;
  scrollbar-width: none;
}

.quick-phrases::-webkit-scrollbar {
  display: none;
}

.quick-phrases button {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #91a8c3;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: 9.5px;
  white-space: nowrap;
}

.quick-phrases button:hover {
  color: #d4e2f2;
  border-color: var(--line-strong);
}

.chat-form {
  display: flex;
  gap: 7px;
  padding: 9px 10px 11px;
  border-top: 1px solid var(--line);
  background: rgba(5, 11, 21, 0.28);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  font-size: 11.5px;
}

.chat-form input:focus {
  border-color: rgba(94, 234, 212, 0.45);
}

.chat-form input::placeholder {
  color: #5d7492;
}

.send-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  color: #05211c;
  background: linear-gradient(135deg, var(--brand), #67dcf9);
  cursor: pointer;
}

.send-btn .icon {
  width: 17px;
  height: 17px;
}

/* ---- 成员 ---- */

.member-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 11px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  margin-bottom: 8px;
}

.member-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #bff8ee;
  background: rgba(94, 234, 212, 0.12);
  font-size: 13px;
  font-weight: 800;
}

.member-avatar.student {
  color: #d8ecff;
  background: rgba(56, 189, 248, 0.14);
}

.member-avatar .hand-mark {
  position: absolute;
  right: -5px;
  top: -5px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #3d2a00;
  background: var(--warn);
}

.member-avatar .hand-mark .icon {
  width: 10px;
  height: 10px;
  stroke-width: 2.4;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.member-name b {
  overflow: hidden;
  color: #dce9f8;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role {
  padding: 2px 5px;
  border-radius: 4px;
  color: #9fb3cb;
  background: rgba(255, 255, 255, 0.06);
  font-size: 8.5px;
  font-weight: 700;
  white-space: nowrap;
}

.member-role.teacher {
  color: #bff8ee;
  background: rgba(94, 234, 212, 0.1);
}

.member-state {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.member-state .icon {
  width: 11px;
  height: 11px;
}

.member-state .on {
  color: var(--ok);
}

.member-state .off {
  color: #617895;
}

.member-empty {
  padding: 26px 12px;
  color: #5d7492;
  font-size: 11px;
  text-align: center;
  line-height: 1.7;
}

.member-tip {
  display: flex;
  gap: 7px;
  padding: 10px 11px;
  border-top: 1px solid var(--line);
  color: #5d7492;
  background: rgba(5, 11, 21, 0.28);
  font-size: 9.5px;
  line-height: 1.6;
}

.member-tip .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: #6f86a3;
}

/* ---- 底部工具栏 ---- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px 16px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.center-group {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.tool-btn {
  min-width: 68px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: #a9bdd5;
  background: rgba(15, 26, 46, 0.78);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 700;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.tool-btn:hover {
  color: #e8f1fc;
  border-color: var(--line-strong);
  background: rgba(24, 40, 67, 0.9);
  transform: translateY(-1px);
}

.tool-btn .icon {
  width: 19px;
  height: 19px;
}

.tool-btn.active {
  color: #cffff8;
  border-color: rgba(94, 234, 212, 0.36);
  background: rgba(94, 234, 212, 0.1);
}

.tool-btn.off {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.24);
  background: rgba(251, 113, 133, 0.08);
}

.tool-btn.record-btn.active {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.38);
  background: rgba(251, 113, 133, 0.12);
}

.tool-btn.end-btn {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.2);
  background: rgba(251, 113, 133, 0.09);
}

.tool-btn.end-btn:hover {
  border-color: rgba(251, 113, 133, 0.38);
  background: rgba(251, 113, 133, 0.16);
}

/* ---- 结束弹窗 / Toast ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(2, 7, 14, 0.72);
  backdrop-filter: blur(12px);
}

.summary-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(400px 240px at 50% 0%, rgba(94, 234, 212, 0.12), transparent 70%),
    #0c1728;
  box-shadow: var(--shadow);
  text-align: center;
}

.summary-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  border: 1px solid rgba(94, 234, 212, 0.32);
  border-radius: 50%;
  color: #06211d;
  background: linear-gradient(135deg, var(--brand), #7dd3fc);
  box-shadow: 0 0 0 8px rgba(94, 234, 212, 0.05);
}

.summary-icon .icon {
  width: 25px;
  height: 25px;
  stroke-width: 2.4;
}

.summary-card h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.summary-card > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.summary-grid > div {
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
}

.summary-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.summary-grid b {
  color: #dffff9;
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: #e8f1fc;
  background: rgba(12, 23, 40, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==================== 响应式 ==================== */

@media (max-width: 1080px) {
  .lobby-card {
    gap: 28px;
    padding: 32px;
  }

  .classroom-main {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .center-group {
    position: static;
    transform: none;
  }

  .toolbar {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .lobby-screen {
    min-height: 100dvh;
    align-items: flex-start;
    padding: 24px 14px;
  }

  .lobby-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 26px 20px;
  }

  .lobby-copy h1 {
    font-size: clamp(30px, 8vw, 42px);
  }

  .demo-steps {
    display: none;
  }

  .join-panel {
    padding: 18px;
  }

  .classroom-screen {
    height: 100dvh;
    min-height: 0;
  }

  .topbar {
    padding: 10px 12px;
  }

  .room-title b {
    font-size: 12px;
  }

  .room-sub {
    font-size: 9.5px;
  }

  .ghost-btn {
    display: none;
  }

  .classroom-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.2fr) minmax(220px, 0.8fr);
    gap: 10px;
    padding: 10px 10px 0;
  }

  .stage {
    border-radius: 16px;
  }

  .side-panel {
    border-radius: 16px;
  }

  .local-pip {
    width: 120px;
  }

  .stage-footer {
    max-width: calc(100% - 150px);
  }

  .toolbar {
    padding: 8px 10px 10px;
    gap: 6px;
  }

  .tool-group {
    gap: 5px;
  }

  .tool-btn {
    min-width: 56px;
    height: 48px;
    border-radius: 11px;
    font-size: 8.5px;
  }

  .tool-btn .icon {
    width: 17px;
    height: 17px;
  }

  .recording-badge {
    padding: 6px 8px;
    font-size: 9.5px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .brand-line {
    margin-bottom: 14px;
    font-size: 12px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .lobby-card {
    border-radius: 20px;
  }

  .feature-row span {
    padding: 7px 9px;
    font-size: 10.5px;
  }

  .role-picker {
    grid-template-columns: 1fr;
  }

  .room-title b {
    display: none;
  }

  .top-right {
    gap: 6px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .tool-btn span {
    display: none;
  }

  .tool-btn {
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
  }

  .stage-footer {
    display: none;
  }

  .toast {
    bottom: 72px;
  }
}
