/* ============================================
   智慧课堂 AI 互动 — 设计系统
   完整的设计令牌、组件、动画
   ============================================ */

/* --- 字体导入 --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* ============================================
   设计令牌 (CSS Custom Properties)
   ============================================ */
:root {
  /* 主色 */
  --color-primary: hsl(230, 80%, 65%);
  --color-primary-rgb: 91, 106, 191;
  --color-primary-light: hsl(230, 80%, 75%);
  --color-primary-dark: hsl(230, 80%, 50%);

  /* 强调色 */
  --color-accent: hsl(160, 70%, 55%);
  --color-accent-rgb: 54, 201, 160;
  --color-accent-light: hsl(160, 70%, 65%);
  --color-accent-dark: hsl(160, 70%, 40%);

  /* 次要强调色 (暖橙) */
  --color-secondary: hsl(25, 90%, 60%);
  --color-secondary-rgb: 240, 142, 56;

  /* 危险/录音色 */
  --color-danger: hsl(0, 84%, 60%);
  --color-danger-rgb: 239, 68, 68;

  /* 成功色 */
  --color-success: hsl(142, 71%, 45%);
  --color-success-rgb: 34, 197, 94;

  /* 背景色 */
  --bg-deepest: #0a0a1a;
  --bg-mid: #1a1040;
  --bg-surface: #0d1530;

  /* 文字色 */
  --text-primary: #f0f0f5;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.35);
  --text-inverse: #0a0a1a;

  /* 玻璃效果 */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-hover: rgba(255, 255, 255, 0.18);
  --glass-blur: 20px;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow-primary: 0 0 30px rgba(var(--color-primary-rgb), 0.3);
  --shadow-glow-accent: 0 0 30px rgba(var(--color-accent-rgb), 0.3);

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* 字体 */
  --font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* 字号 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
}

/* ============================================
   重置 / 基础
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: linear-gradient(160deg, var(--bg-deepest) 0%, var(--bg-mid) 40%, var(--bg-surface) 100%);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* 背景装饰光效 */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(var(--color-primary-rgb), 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(var(--color-accent-rgb), 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(var(--color-secondary-rgb), 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-light);
}

img {
  max-width: 100%;
  display: block;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* 选择文字色 */
::selection {
  background: rgba(var(--color-primary-rgb), 0.4);
  color: var(--text-primary);
}

/* ============================================
   布局容器
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
  z-index: 1;
}

.container-sm {
  max-width: 640px;
}

.container-md {
  max-width: 860px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-col-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.full-height {
  min-height: 100vh;
}

/* ============================================
   导航栏
   ============================================ */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.75);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.nav-bar .nav-title {
  font-size: var(--text-lg);
  font-weight: 600;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-bar .nav-back {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  font-family: var(--font-family);
}

.nav-bar .nav-back:hover {
  color: var(--text-primary);
}

.nav-bar .nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ============================================
   卡片 (玻璃态)
   ============================================ */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-md);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-primary);
}

.card-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-glow-primary);
}

/* ============================================
   按钮
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* 主按钮 */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), hsl(245, 75%, 60%));
  color: white;
  box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 6px 25px rgba(var(--color-primary-rgb), 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

/* 次按钮 */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
}

/* 强调按钮 */
.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(var(--color-accent-rgb), 0.3);
}

.btn-accent:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 6px 25px rgba(var(--color-accent-rgb), 0.45);
}

/* 危险按钮 */
.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), hsl(0, 84%, 50%));
  color: white;
}

/* 图标按钮 */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

.btn-icon:hover {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
}

/* 小按钮 */
.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

/* ============================================
   麦克风按钮 (核心交互)
   ============================================ */
.btn-mic {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), hsl(250, 80%, 55%));
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  position: relative;
  box-shadow:
    0 8px 32px rgba(var(--color-primary-rgb), 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 外圈光晕 */
.btn-mic::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(var(--color-primary-rgb), 0.25);
  transition: all var(--transition-base);
}

.btn-mic::after {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(var(--color-primary-rgb), 0.1);
  transition: all var(--transition-base);
}

.btn-mic:hover {
  transform: scale(1.05);
  box-shadow:
    0 12px 40px rgba(var(--color-primary-rgb), 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-mic:active {
  transform: scale(0.95);
}

/* 录音状态 */
.btn-mic.recording {
  background: linear-gradient(135deg, var(--color-danger), hsl(15, 90%, 50%));
  box-shadow:
    0 8px 32px rgba(var(--color-danger-rgb), 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: recording-pulse 1.5s infinite;
}

.btn-mic.recording::before {
  border-color: rgba(var(--color-danger-rgb), 0.3);
  animation: recording-ring-1 1.5s infinite;
}

.btn-mic.recording::after {
  border-color: rgba(var(--color-danger-rgb), 0.15);
  animation: recording-ring-2 1.5s infinite 0.3s;
}

/* 处理中状态 */
.btn-mic.processing {
  background: linear-gradient(135deg, var(--color-secondary), hsl(35, 85%, 55%));
  pointer-events: none;
}

.btn-mic.processing .mic-icon {
  animation: spin 1s linear infinite;
}

/* ============================================
   输入框
   ============================================ */
.input,
.textarea,
.select {
  width: 100%;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--text-base);
  transition: all var(--transition-base);
  outline: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-tertiary);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15), 0 0 20px rgba(var(--color-primary-rgb), 0.1);
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: var(--space-2xl);
  cursor: pointer;
}

.select option {
  background: var(--bg-deepest);
  color: var(--text-primary);
}

.input-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.input-group {
  margin-bottom: var(--space-lg);
}

.input-code {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  letter-spacing: 0.5em;
  text-align: center;
  text-transform: uppercase;
  padding: var(--space-lg);
}

/* ============================================
   聊天消息
   ============================================ */
.messages-container {
  --chat-bottom-safe-area: 0px;
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--chat-bottom-safe-area));
  scroll-padding-bottom: calc(var(--space-lg) + var(--chat-bottom-safe-area));
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scroll-behavior: smooth;
}

.message {
  max-width: 80%;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  animation: fadeInUp 0.4s ease backwards;
  position: relative;
  line-height: 1.7;
  font-size: var(--text-base);
  word-wrap: break-word;
}

.message-ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: var(--space-xs);
}

.message-ai-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  align-self: flex-start;
  max-width: 85%;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(var(--color-accent-rgb), 0.2);
}

.message-student {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--color-primary), hsl(245, 70%, 55%));
  border-bottom-right-radius: var(--space-xs);
  box-shadow: 0 2px 12px rgba(var(--color-primary-rgb), 0.2);
}

.message-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.message-audio-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.message-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.message-text p {
  margin: 0;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.message-visuals {
  margin-top: var(--space-sm);
}

.visual-aid-pending {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: rgba(var(--color-accent-rgb), 0.12);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.visual-aid-error {
  background: rgba(var(--color-danger-rgb), 0.12);
  color: var(--color-danger);
}

.message-visual-aid {
  margin: var(--space-sm) 0 0;
  max-width: min(360px, 100%);
}

.message-visual-aid img {
  display: block;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
}

.message-visual-aid figcaption {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* 打字指示器 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-md) var(--space-lg);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--text-tertiary);
  animation: typing-dots 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ============================================
   上传区域
   ============================================ */
.upload-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  background: rgba(0, 0, 0, 0.15);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.05);
  box-shadow: inset 0 0 30px rgba(var(--color-primary-rgb), 0.05), var(--shadow-glow-primary);
}

.upload-zone.drag-over {
  transform: scale(1.01);
}

.upload-zone-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  display: block;
}

.upload-zone-title {
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.upload-zone-hint {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.upload-zone input[type="file"] {
  display: none;
}

/* 上传进度 */
.upload-progress {
  margin-top: var(--space-md);
  border-radius: var(--radius-full);
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: none;
}

.upload-progress.active {
  display: block;
}

.upload-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  background-size: 200% 100%;
  animation: shimmer 2s infinite linear;
  transition: width 0.3s ease;
  width: 0%;
}

/* 已上传文件 */
.uploaded-file {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(var(--color-success-rgb), 0.08);
  border: 1px solid rgba(var(--color-success-rgb), 0.2);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

.uploaded-file-icon {
  font-size: var(--text-xl);
}

.uploaded-file-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
}

.uploaded-file-remove {
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
  background: transparent;
  border: 0;
  font: inherit;
  padding: 0;
}

.uploaded-file-remove:hover {
  color: var(--color-danger);
}

.uploaded-file.is-processing {
  background: rgba(var(--color-primary-rgb), 0.08);
  border-color: rgba(var(--color-primary-rgb), 0.24);
}

.uploaded-file.is-failed,
.uploaded-file.is-canceled {
  background: rgba(var(--color-danger-rgb), 0.08);
  border-color: rgba(var(--color-danger-rgb), 0.24);
}

.uploaded-file-status {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.material-status-panel {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
}

.material-status-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
}

.material-status-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--text-tertiary);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.material-status-dot.is-active {
  background: var(--color-primary-light);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.15);
  animation: pulse 1.4s infinite;
}

.material-status-dot.is-ready {
  background: var(--color-success);
  box-shadow: 0 0 0 4px rgba(var(--color-success-rgb), 0.14);
}

.material-status-dot.is-error {
  background: var(--color-danger);
  box-shadow: 0 0 0 4px rgba(var(--color-danger-rgb), 0.14);
}

.material-status-copy {
  min-width: 0;
}

.material-status-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

.material-status-message {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.material-progress {
  display: block;
  margin-top: var(--space-md);
}

.material-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.material-reupload input[type="file"] {
  display: none;
}

@media (max-width: 640px) {
  .material-status-row {
    grid-template-columns: auto 1fr;
  }
  .material-status-row .badge {
    grid-column: 2;
    justify-self: flex-start;
  }
}

/* ============================================
   状态指示器
   ============================================ */
.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  height: 24px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* 录音中 */
.status-recording .status-dot {
  background: var(--color-danger);
  animation: pulse 1s infinite;
  box-shadow: 0 0 8px rgba(var(--color-danger-rgb), 0.5);
}

/* 思考中 */
.status-thinking {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.status-thinking .thinking-dots {
  display: flex;
  gap: 3px;
}

.status-thinking .thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  animation: typing-dots 1.4s infinite ease-in-out;
}

.status-thinking .thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.status-thinking .thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* 回答中 */
.status-speaking .waveform-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
}

.status-speaking .waveform-bars span {
  width: 3px;
  border-radius: 2px;
  background: var(--color-accent);
  animation: waveform 0.8s infinite ease-in-out;
}

.status-speaking .waveform-bars span:nth-child(1) { animation-delay: 0s; height: 8px; }
.status-speaking .waveform-bars span:nth-child(2) { animation-delay: 0.1s; height: 14px; }
.status-speaking .waveform-bars span:nth-child(3) { animation-delay: 0.2s; height: 6px; }
.status-speaking .waveform-bars span:nth-child(4) { animation-delay: 0.3s; height: 18px; }
.status-speaking .waveform-bars span:nth-child(5) { animation-delay: 0.4s; height: 10px; }

/* ============================================
   步骤指示器
   ============================================ */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-2xl);
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  border: 2px solid var(--glass-border);
  color: var(--text-tertiary);
  transition: all var(--transition-base);
}

.step-item.active .step-number {
  background: linear-gradient(135deg, var(--color-primary), hsl(250, 80%, 55%));
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 0 15px rgba(var(--color-primary-rgb), 0.3);
}

.step-item.completed .step-number {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--text-inverse);
}

.step-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  transition: color var(--transition-base);
  display: none;
}

.step-item.active .step-label {
  color: var(--text-primary);
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--glass-border);
  transition: background var(--transition-base);
}

.step-line.completed {
  background: var(--color-accent);
}

@media (min-width: 640px) {
  .step-label {
    display: block;
  }
}

/* ============================================
   邀请码显示
   ============================================ */
.invite-code {
  font-family: var(--font-mono);
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  padding: var(--space-xl);
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  user-select: all;
}

.invite-code-wrapper {
  text-align: center;
  padding: var(--space-2xl);
}

.invite-code-wrapper .label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

/* ============================================
   学生列表
   ============================================ */
.student-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.student-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
}

.student-item:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border);
}

.student-item.active {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.08);
}

.student-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.student-info {
  flex: 1;
  min-width: 0;
}

.student-name {
  font-weight: 500;
  font-size: var(--text-sm);
}

.student-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.student-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* ============================================
   徽章
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.badge-primary {
  background: rgba(var(--color-primary-rgb), 0.15);
  color: var(--color-primary-light);
}

.badge-accent {
  background: rgba(var(--color-accent-rgb), 0.15);
  color: var(--color-accent);
}

.badge-danger {
  background: rgba(var(--color-danger-rgb), 0.15);
  color: var(--color-danger);
}

.badge-secondary {
  background: rgba(var(--color-secondary-rgb), 0.15);
  color: var(--color-secondary);
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: rgba(20, 20, 40, 0.95);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.modal-header .modal-title {
  margin-bottom: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--text-xl);
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.classroom-detail-modal {
  max-width: 720px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.detail-meta-grid div {
  padding: var(--space-md);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.detail-meta-grid span {
  display: block;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  margin-bottom: var(--space-xs);
}

.detail-meta-grid strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.join-settings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(110px, 140px) auto;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.join-settings-copy p {
  margin: 0 0 var(--space-xs);
  color: var(--text-primary);
  font-weight: 600;
}

.join-settings-copy span {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.join-settings-limit {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.join-settings-limit .input {
  min-width: 0;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-switch span {
  position: relative;
  width: 44px;
  height: 24px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.toggle-switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform var(--transition-fast);
}

.toggle-switch input:checked + span {
  border-color: rgba(var(--color-primary-rgb), 0.55);
  background: rgba(var(--color-primary-rgb), 0.5);
}

.toggle-switch input:checked + span::after {
  transform: translateX(20px);
}

.toggle-switch input:focus-visible + span {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   Markdown 内容
   ============================================ */
.markdown-content {
  line-height: 1.8;
  color: var(--text-primary);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.markdown-content h1 { font-size: var(--text-2xl); }
.markdown-content h2 { font-size: var(--text-xl); }
.markdown-content h3 { font-size: var(--text-lg); }

.markdown-content p {
  margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.markdown-content li {
  margin-bottom: 0.3em;
}

.markdown-content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.markdown-content pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: 1em;
  overflow-x: auto;
}

.markdown-content pre code {
  background: none;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-md);
  margin-bottom: 1em;
  color: var(--text-secondary);
}

.markdown-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   人设选择器
   ============================================ */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
}

.persona-card {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  cursor: pointer;
}

.persona-card .persona-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.persona-card .persona-name {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.persona-card .persona-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ============================================
   错误/提示消息
   ============================================ */
.error-message {
  color: var(--color-danger);
  font-size: var(--text-sm);
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.success-message {
  color: var(--color-success);
  font-size: var(--text-sm);
}

.toast {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-md) var(--space-xl);
  background: rgba(20, 20, 40, 0.95);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  z-index: 2000;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   渐变文字
   ============================================ */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-warm {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-danger));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   底部输入区域 (学生端)
   ============================================ */
.chat-bottom {
  padding: var(--space-lg);
  border-top: 1px solid var(--glass-border);
  background: rgba(10, 10, 26, 0.5);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: all var(--transition-base);
  z-index: 20;
}

.student-material-panel {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  border: 1px solid rgba(var(--color-primary-rgb), 0.24);
  border-radius: var(--radius-md);
  background: rgba(var(--color-primary-rgb), 0.08);
}

.chat-bottom.material-blocked .mic-area,
.chat-bottom.material-blocked .text-input-row {
  opacity: 0.55;
}

.mic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
}

.mic-status {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  height: 24px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-interrupt {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 12px;
  border: 0;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  font-size: var(--text-xs);
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.text-input-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.text-input-row .input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
}

.text-input-row .btn {
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
}

.chat-bottom.compact-streaming {
  position: fixed;
  right: max(var(--space-lg), env(safe-area-inset-right));
  bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  width: 96px;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.chat-bottom.compact-streaming .student-material-panel,
.chat-bottom.compact-streaming .text-input-row {
  display: none;
}

.chat-bottom.compact-streaming .mic-area {
  padding: 0;
  gap: var(--space-xs);
  align-items: flex-end;
  pointer-events: auto;
}

.chat-bottom.compact-streaming .mic-status {
  order: 2;
  height: auto;
  justify-content: flex-end;
}

.chat-bottom.compact-streaming #statusText {
  display: none;
}

.chat-bottom.compact-streaming #btnInterrupt {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  padding: 0 !important;
  border-radius: var(--radius-full);
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0;
  overflow: hidden;
  white-space: nowrap;
}

.chat-bottom.compact-streaming #btnInterrupt::before {
  content: '■';
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1;
}

.chat-bottom.compact-streaming .btn-mic {
  width: 58px;
  height: 58px;
  font-size: var(--text-xl);
  box-shadow:
    0 6px 18px rgba(var(--color-primary-rgb), 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.chat-bottom.compact-streaming .btn-mic::before {
  inset: -5px;
}

.chat-bottom.compact-streaming .btn-mic::after {
  display: none;
}

/* ============================================
   教师监控面板
   ============================================ */
.monitor-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-lg);
  min-height: calc(100vh - 64px);
}

.monitor-sidebar {
  border-right: 1px solid var(--glass-border);
  padding: var(--space-lg);
  overflow-y: auto;
}

.monitor-main {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
}

.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-lg);
}

@media (max-width: 768px) {
  .monitor-layout {
    grid-template-columns: 1fr;
  }
  .monitor-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    max-height: 40vh;
  }
}

/* ============================================
   教师课堂库
   ============================================ */
.teacher-workspace {
  min-height: calc(100vh - 72px);
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.workspace-kicker {
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.workspace-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.workspace-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.workspace-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-lg);
  align-items: start;
}

.teacher-login-shell {
  grid-template-columns: minmax(280px, 420px);
  justify-content: center;
}

.teacher-workspace-shell {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.panel-header,
.library-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.panel h2,
.library-toolbar h2 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.panel p,
.library-toolbar p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 120px;
  color: var(--text-secondary);
}

.auth-loading p {
  margin: 0;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 2px solid var(--glass-border);
  border-top-color: var(--color-accent);
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  padding: var(--space-xs);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  cursor: pointer;
}

.auth-tab.active {
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--text-primary);
}

.teacher-account-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.teacher-account-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.teacher-account-name {
  color: var(--text-primary) !important;
  font-weight: 600;
}

.teacher-account-email {
  color: var(--text-tertiary) !important;
}

.library-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-filter {
  display: inline-flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.library-filter-btn {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
}

.library-filter-btn.active {
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--text-primary);
}

.library-search {
  width: min(300px, 100%);
}

.quota-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.16);
}

.quota-summary-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.quota-meter-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.quota-meter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.quota-meter-label strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.quota-meter {
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
}

.quota-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

.quota-summary-full {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.08);
}

.quota-summary-full .quota-meter-block:first-child .quota-meter span {
  background: var(--color-secondary);
}

.quota-summary-hint {
  margin: 0;
  color: var(--color-secondary) !important;
  font-size: var(--text-sm);
}

.continue-card,
.classroom-row,
.empty-state {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.18);
}

.continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.continue-card h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-sm);
}

.continue-card p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.classroom-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.classroom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  padding: var(--space-md);
}

.classroom-row-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}

.classroom-row-title h3 {
  font-size: var(--text-base);
  font-weight: 600;
}

.classroom-row-main p,
.classroom-row-meta {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.classroom-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-sm);
  white-space: nowrap;
}

.classroom-row-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.classroom-actions-menu {
  position: relative;
}

.classroom-actions-popover {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-xs));
  z-index: 20;
  min-width: 148px;
  padding: var(--space-xs);
  background: rgba(13, 18, 30, 0.96);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.classroom-actions-menu.open .classroom-actions-popover {
  display: flex;
  flex-direction: column;
}

.classroom-actions-popover button {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  padding: var(--space-sm);
  text-align: left;
}

.classroom-actions-popover button:hover {
  background: rgba(var(--color-primary-rgb), 0.18);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
  color: var(--text-tertiary);
}

@media (max-width: 900px) {
  .workspace-header,
  .panel-header,
  .library-toolbar,
  .continue-card {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-actions,
  .library-controls,
  .classroom-row-actions {
    justify-content: stretch;
  }

  .library-filter {
    width: 100%;
  }

  .library-filter-btn {
    flex: 1;
  }

  .library-search {
    width: 100%;
  }

  .quota-summary-main {
    grid-template-columns: 1fr;
  }

  .detail-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .join-settings-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .workspace-actions .btn,
  .continue-card .btn,
  .classroom-row-actions .btn {
    width: 100%;
  }

  .classroom-actions-menu {
    width: 100%;
  }

  .classroom-actions-popover {
    position: static;
    margin-top: var(--space-xs);
    width: 100%;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .classroom-row {
    grid-template-columns: 1fr;
  }

  .classroom-row-meta {
    align-items: stretch;
    white-space: normal;
  }
}

/* ============================================
   Landing 页面特殊样式
   ============================================ */
.landing-hero {
  text-align: center;
  padding: var(--space-3xl) 0;
}

.landing-logo {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  display: block;
  filter: drop-shadow(0 0 20px rgba(var(--color-primary-rgb), 0.3));
  animation: float 6s ease-in-out infinite;
}

.landing-title {
  font-size: var(--text-5xl);
  font-weight: 700;
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.landing-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-3xl);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
  max-width: 680px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .role-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
  }
  .landing-title {
    font-size: var(--text-4xl);
  }
}

.role-card {
  padding: var(--space-2xl);
  text-align: center;
}

.role-card .role-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-lg);
  display: block;
}

.role-card .role-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.role-card .role-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.landing-footer {
  text-align: center;
  padding: var(--space-2xl) 0;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ============================================
   步骤内容
   ============================================ */
.step-content {
  display: none;
  animation: fadeInUp 0.5s ease;
}

.step-content.active {
  display: block;
}

.step-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin-bottom: var(--space-lg);
  text-align: center;
}

.step-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* ============================================
   内容预览区
   ============================================ */
.content-preview {
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-lg);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  margin-top: var(--space-md);
  display: none;
}

.content-preview.active {
  display: block;
}

/* ============================================
   全屏聊天布局 (学生端)
   ============================================ */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.chat-header {
  padding: var(--space-md) var(--space-lg);
  background: rgba(10, 10, 26, 0.75);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.chat-header-title {
  font-weight: 600;
}

.chat-header-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ============================================
   隐藏/显示工具类
   ============================================ */
.hidden {
  display: none !important;
}

.visible {
  display: block;
}

.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mt-xl {
  margin-top: var(--space-xl);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

/* ============================================
   动画关键帧
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes recording-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(var(--color-danger-rgb), 0.4),
      0 8px 32px rgba(var(--color-danger-rgb), 0.3);
  }
  70% {
    box-shadow:
      0 0 0 20px rgba(var(--color-danger-rgb), 0),
      0 8px 32px rgba(var(--color-danger-rgb), 0.3);
  }
}

@keyframes recording-ring-1 {
  0%, 100% { inset: -8px; opacity: 1; }
  70% { inset: -30px; opacity: 0; }
}

@keyframes recording-ring-2 {
  0%, 100% { inset: -20px; opacity: 1; }
  70% { inset: -50px; opacity: 0; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes waveform {
  0%, 100% { height: 4px; }
  50% { height: 20px; }
}

@keyframes typing-dots {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 减少动效 (辅助功能) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
