/* ============================================================
   欣然 · 心情访谈小助手 — 样式
   学生端：暖色、大按钮、圆角、亲和
   教师端：清爽工作台风格
   ============================================================ */

:root {
  --c-primary: #FF7A45;
  --c-primary-deep: #F0602B;
  --c-primary-soft: #FFF1E8;
  --c-bg-stu: #FFF9F2;
  --c-good: #16a34a;
  --c-watch: #d97706;
  --c-focus: #ea580c;
  --c-critical: #dc2626;
  --c-ink: #3D2E23;
  --c-ink-2: #8A7A6D;
  --c-line: #F0E4D8;
  --c-bg-t: #F4F6F9;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(120, 80, 40, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--c-ink);
  background: var(--c-bg-stu);
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

/* ================= 通用视图 ================= */
.view { display: none; min-height: 100vh; }
.view.active { display: flex; flex-direction: column; }

/* ================= 通用按钮 ================= */
.btn {
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  transition: transform .08s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, #FF9A62, var(--c-primary));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 122, 69, .35);
}
.btn-primary:hover { background: linear-gradient(135deg, #FF9A62, var(--c-primary-deep)); }
.btn-ghost { color: var(--c-ink-2); border: 2px solid var(--c-line); background: #fff; }
.btn-ghost:hover { color: var(--c-primary); border-color: var(--c-primary); }
.btn-big { padding: 14px 34px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: #fff; color: var(--c-critical); border: 1.5px solid #FECACA; }
.btn-danger:hover { background: #FEF2F2; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.link-btn {
  color: var(--c-primary);
  font-size: 13px;
  text-decoration: underline;
  padding: 2px 4px;
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 17px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(120, 80, 40, .12);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--c-primary-soft); }
.icon-btn.off { opacity: .4; }

/* ================= 角色选择页 ================= */
.role-wrap {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 15% 20%, #FFE8D6 0, transparent 40%),
    radial-gradient(circle at 85% 80%, #FFF3C9 0, transparent 45%),
    var(--c-bg-stu);
}
.brand { text-align: center; margin-bottom: 44px; }
.brand-mascot { font-size: 72px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
.brand h1 { font-size: 42px; letter-spacing: 4px; margin-top: 8px; }
.brand-sub { font-size: 15px; font-weight: 500; color: var(--c-ink-2); margin-left: 8px; letter-spacing: 2px; }
.brand-desc { color: var(--c-ink-2); margin-top: 10px; font-size: 15px; }
.role-cards { display: flex; gap: 26px; flex-wrap: wrap; justify-content: center; }
.role-card {
  width: 230px; padding: 34px 24px 28px;
  background: #fff; border-radius: 26px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .15s, box-shadow .15s;
  border: 3px solid transparent;
}
.role-card:hover { transform: translateY(-5px); box-shadow: 0 14px 34px rgba(120, 80, 40, .18); }
.card-student:hover { border-color: #FFD9BF; }
.card-teacher:hover { border-color: #CFE3FF; }
.role-icon { font-size: 52px; }
.role-title { font-size: 20px; font-weight: 700; }
.role-desc { font-size: 13px; color: var(--c-ink-2); }
.role-foot { margin-top: 40px; font-size: 12px; color: #B7A99C; }

/* ================= 学生登录 / 确认 ================= */
.stu-login-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 30px 20px;
}
.brand-mini { font-size: 20px; font-weight: 700; color: var(--c-primary); }
.stu-login-wrap h2 { font-size: 26px; }
.stu-login-tip { color: var(--c-ink-2); font-size: 14px; margin-top: -8px; }
.big-input {
  width: min(360px, 88vw);
  padding: 16px 22px;
  font-size: 19px;
  border: 2.5px solid var(--c-line);
  border-radius: 16px;
  text-align: center;
  outline: none;
  background: #fff;
}
.big-input:focus { border-color: var(--c-primary); }
.field-error { color: var(--c-critical); font-size: 13px; line-height: 1.6; }
.pin-tip { font-size: 12px; color: #B7A99C; }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.confirm-card {
  background: #fff; border-radius: var(--radius);
  padding: 26px 40px; box-shadow: var(--shadow);
  font-size: 18px; text-align: center; line-height: 2;
}
.confirm-card b { color: var(--c-primary-deep); font-size: 22px; }

/* ================= 访谈聊天界面 ================= */
.view-chat { height: 100vh; background: var(--c-bg-stu); }

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(120, 80, 40, .08);
  z-index: 5;
}
.chat-header-left { font-weight: 800; font-size: 18px; }
.chat-header-mid { text-align: center; }
#chat-stu-name { font-size: 13px; color: var(--c-ink-2); }
.chat-header-right { display: flex; gap: 10px; }

.stage-dots { display: flex; gap: 6px; margin-top: 4px; justify-content: center; }
.dot {
  font-size: 10px; color: #CBBBA9;
  padding: 1px 8px; border-radius: 999px;
  background: #F6EFE6;
  white-space: nowrap;
}
.dot.on { background: var(--c-primary-soft); color: var(--c-primary-deep); font-weight: 700; }

#chat-box {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 28px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 760px; width: 100%; margin: 0 auto;
}

.bubble-row { display: flex; gap: 10px; align-items: flex-end; }
.bubble-row.r-student { flex-direction: row-reverse; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(120, 80, 40, .12);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.bubble {
  max-width: 78%;
  padding: 13px 17px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.r-ai .bubble { background: #fff; border-bottom-left-radius: 6px; box-shadow: 0 2px 8px rgba(120, 80, 40, .07); }
.r-student .bubble {
  background: linear-gradient(135deg, #FF9A62, var(--c-primary));
  color: #fff; border-bottom-right-radius: 6px;
}
.r-sys { justify-content: center; }
.r-sys .bubble {
  background: none; box-shadow: none;
  color: #B7A99C; font-size: 12px; max-width: 90%; text-align: center;
}
.method-tag { font-size: 10px; color: rgba(255,255,255,.85); margin-top: 5px; text-align: right; }

/* E·教师关注点卡片（报告页） */
.focus-wrap { display: flex; flex-direction: column; gap: 8px; }
.focus-card {
  border-left: 4px solid #94A3B8; background: #F8FAFC;
  border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.focus-card b { font-size: 14px; }
.focus-card span { font-size: 13px; color: #64748B; }
.focus-card.fc-critical { border-left-color: #DC2626; background: #FEF2F2; }
.focus-card.fc-critical b { color: #B91C1C; }
.focus-card.fc-warn { border-left-color: #D97706; background: #FFFBEB; }
.focus-card.fc-warn b { color: #B45309; }
.focus-card.fc-info { border-left-color: #2563EB; background: #EFF6FF; }
.focus-card.fc-info b { color: #1D4ED8; }

/* E·开放回答主题归类 chip */
.topic-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-chip {
  background: #F5F0FF; color: #6D28D9; border: 1px solid #DDD6FE;
  border-radius: 999px; padding: 4px 12px; font-size: 13px;
}

/* F·语音识别结果确认条 */
.confirm-bar {
  background: #FFFBF3; border: 1px solid #F3E3C3; border-radius: 12px;
  padding: 10px 12px; margin-top: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.confirm-label { color: #B7A99C; font-size: 12px; }
.confirm-text { font-size: 15px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm-tip {
  font-size: 12px; color: #92400E; background: #FEF3C7;
  border-radius: 8px; padding: 6px 10px;
}


/* C·欣然思考中状态条（共情生成/过渡期间） */
.thinking-row { justify-content: center; }
.thinking-row .bubble {
  background: none; box-shadow: none; color: #C4A882;
  font-size: 12px; display: inline-flex; align-items: center; gap: 6px;
}
.thinking-dots { display: inline-flex; gap: 3px; }
.thinking-dots span {
  width: 5px; height: 5px; border-radius: 50%; background: #C4A882;
  animation: thinkBlink 1.2s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: .2s; }
.thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes thinkBlink {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-dots span { animation: none; opacity: .6; }
}

/* 系统横幅（存储降级等） */
.sys-banner {
  background: #FEF3C7; color: #92400E;
  font-size: 13px; padding: 8px 16px; text-align: center;
}

/* 输入区 */
.chat-input-area {
  background: #fff;
  padding: 12px 14px 16px;
  box-shadow: 0 -2px 12px rgba(120, 80, 40, .08);
}

#option-area { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; }
.option-card {
  display: flex; align-items: center; gap: 13px;
  text-align: left;
  background: #fff;
  border: 2.5px solid var(--c-line);
  border-radius: 16px;
  padding: 13px 16px;
  transition: border-color .12s, transform .08s, background .12s;
}
.option-card:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.option-card:active { transform: scale(.98); }
.option-emoji { font-size: 30px; flex-shrink: 0; }
.option-text { display: flex; flex-direction: column; gap: 2px; }
.option-label { font-size: 16px; font-weight: 700; }
.option-desc { font-size: 13px; color: var(--c-ink-2); }

/* V3.5·快捷提示词 chips 已移除（.chip-row/.chip 样式保留无害，供历史归档页兼容） */

.input-row { display: flex; gap: 10px; align-items: center; }
#chat-input {
  flex: 1;
  padding: 13px 18px;
  font-size: 16px;
  border: 2.5px solid var(--c-line);
  border-radius: 999px;
  outline: none;
}
#chat-input:focus { border-color: var(--c-primary); }

.mic-btn {
  width: 56px; height: 56px; border-radius: 50%;
  font-size: 24px;
  background: linear-gradient(135deg, #FF9A62, var(--c-primary));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 122, 69, .4);
  flex-shrink: 0;
  transition: transform .1s;
}
.mic-btn:active { transform: scale(.92); }
.mic-btn.listening {
  background: linear-gradient(135deg, #FF6B6B, #DC2626);
  animation: pulse 1.1s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); }
  50% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
}

.input-hints {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding: 0 4px;
}
.voice-hint { font-size: 12px; color: var(--c-ink-2); text-align: right; }

.listening-indicator {
  max-width: 760px; margin: 10px auto 0;
  text-align: center; font-size: 13px; color: var(--c-critical);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* 语音编辑工具条 + 播报控制条 */
.voice-tools, .tts-controls {
  display: flex; align-items: center; gap: 8px;
  max-width: 760px; margin: 8px auto 0;
  flex-wrap: wrap;
}
.tts-controls { justify-content: center; }
.vtool {
  background: var(--c-primary-soft); color: var(--c-primary-deep);
  border-radius: 999px; padding: 6px 14px; font-size: 13px;
  min-height: 34px;
}
.vtool:active { transform: scale(.96); }
.vtool-note { font-size: 11px; color: #B7A99C; }
.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c-critical);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .25; } }

/* ================= 结束页 ================= */
.finish-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 18px;
  background: radial-gradient(circle at 50% 0%, #FFE8D6 0, transparent 50%), var(--c-bg-stu);
}
.finish-card {
  background: #fff; border-radius: 28px; box-shadow: var(--shadow);
  padding: 44px 38px; max-width: 520px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
}
.finish-emoji { font-size: 64px; }
.finish-card h2 { font-size: 24px; }
.finish-text { color: var(--c-ink-2); line-height: 1.8; }
.resources-box {
  width: 100%;
  background: var(--c-primary-soft);
  border-radius: 16px; padding: 18px 22px;
  text-align: left;
}
.resources-title { font-weight: 700; margin-bottom: 10px; font-size: 15px; }
.resources-list { white-space: pre-line; font-size: 14px; line-height: 2; color: var(--c-ink); }

/* ================= 教师端 ================= */
.view-teacher { flex-direction: row !important; background: var(--c-bg-t); }

.t-sidebar {
  width: 220px; flex-shrink: 0;
  background: #2B3648; color: #fff;
  display: flex; flex-direction: column;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
}
.t-brand { font-weight: 800; font-size: 17px; padding: 0 10px 20px; }
.t-brand span { font-size: 11px; font-weight: 400; color: #9AA7BC; display: block; margin-top: 3px; }
.t-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.t-nav-btn {
  color: #C9D3E3; font-size: 15px; text-align: left;
  padding: 12px 16px; border-radius: 12px;
  display: flex; align-items: center; gap: 4px;
}
.t-nav-btn:hover { background: rgba(255,255,255,.08); }
.t-nav-btn.active { background: var(--c-primary); color: #fff; font-weight: 700; }
.badge {
  background: #DC2626; color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 8px; margin-left: 6px;
}
.t-exit { color: #8794AB; font-size: 13px; text-align: left; padding: 10px 16px; }
.t-exit:hover { color: #fff; }

.t-main { flex: 1; padding: 26px 32px; min-width: 0; }

.consent-banner {
  background: #FEF3C7; color: #92400E;
  padding: 10px 18px; border-radius: 12px; font-size: 14px;
  margin-bottom: 18px;
}

.t-panel h2 { font-size: 20px; margin-bottom: 18px; color: #1F2937; }
.t-panel h3 { font-size: 16px; margin: 22px 0 10px; color: #374151; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-card {
  background: #fff; border-radius: 14px; padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(20, 30, 60, .06);
}
.stat-num { font-size: 30px; font-weight: 800; }
.stat-label { font-size: 13px; color: #6B7280; margin-top: 2px; }
.stat-card.warn .stat-num { color: var(--c-critical); }
.stat-card.warn { background: #FEF2F2; }

.dist-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.dist-name { width: 64px; flex-shrink: 0; }
.dist-bar { height: 14px; border-radius: 999px; background: #EEF1F6; flex: 1; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 999px; transition: width .4s; }
.dist-count { width: 30px; text-align: right; color: #6B7280; }

.t-table-wrap { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(20,30,60,.06); }
.t-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-table th {
  text-align: left; padding: 12px 16px;
  background: #F8FAFC; color: #64748B; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.t-table td { padding: 12px 16px; border-top: 1px solid #F1F5F9; }
.t-table tr:hover td { background: #FAFBFD; }

.tag {
  display: inline-block; border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 3px 11px; white-space: nowrap;
}
.tag.good { background: #DCFCE7; color: #15803D; }
.tag.watch { background: #FEF3C7; color: #B45309; }
.tag.focus { background: #FFEDD5; color: #C2410C; }
.tag.critical { background: #FEE2E2; color: #B91C1C; }
.tag.none { background: #F1F5F9; color: #94A3B8; }

.toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="text"], .toolbar select {
  padding: 9px 14px; border: 1.5px solid #E2E8F0; border-radius: 10px; font-size: 14px; outline: none; background: #fff;
}
.toolbar input:focus { border-color: var(--c-primary); }

.btn-t { background: #fff; color: #374151; border: 1.5px solid #E2E8F0; border-radius: 10px; padding: 9px 16px; font-size: 14px; }
.btn-t:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-t.primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

.alert-card {
  background: #fff; border-left: 5px solid var(--c-critical);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(20,30,60,.07);
}
.alert-card.done { border-left-color: #CBD5E1; opacity: .7; }
.alert-title { font-weight: 700; color: var(--c-critical); margin-bottom: 4px; }
.alert-card.done .alert-title { color: #94A3B8; }
.alert-meta { font-size: 13px; color: #64748B; margin-bottom: 10px; }
.alert-reason { font-size: 13px; color: #475569; background: #FEF2F2; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; line-height: 1.7; }

/* ================= 档案页 ================= */
.archive-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.profile-card {
  background: #fff; border-radius: 14px; padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(20,30,60,.06); margin-bottom: 20px;
  font-size: 15px; line-height: 2;
}

/* ================= 报告页 ================= */
.view-report { background: var(--c-bg-t); padding: 26px 30px; overflow-y: auto; }
.report-page {
  max-width: 860px; margin: 0 auto 30px;
  background: #fff; border-radius: 16px;
  padding: 36px 44px;
  box-shadow: 0 2px 10px rgba(20,30,60,.07);
}
.report-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #F1F5F9; padding-bottom: 18px; margin-bottom: 8px; }
.report-head h1 { font-size: 22px; color: #1F2937; }
.report-sub { color: #6B7280; font-size: 13px; margin-top: 6px; }
.report-tools { display: flex; gap: 10px; flex-shrink: 0; }

.r-section { margin-top: 26px; }
.r-section-title { font-size: 15px; font-weight: 700; color: #374151; margin-bottom: 12px; padding-left: 10px; border-left: 4px solid var(--c-primary); }

.level-banner {
  border-radius: 12px; padding: 16px 20px; color: #fff;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.level-name { font-size: 22px; font-weight: 800; }
.level-action { font-size: 14px; opacity: .95; }

.dim-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px dashed #EEF2F7; font-size: 14px;
}
.dim-name { width: 130px; font-weight: 700; flex-shrink: 0; }
.dim-name small { display: block; font-weight: 400; color: #94A3B8; font-size: 11px; }
.dim-bar { flex: 1; height: 10px; background: #EEF1F6; border-radius: 999px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 999px; }
.dim-score { width: 60px; text-align: center; font-weight: 800; flex-shrink: 0; }
.dim-anchor { color: #64748B; width: 110px; flex-shrink: 0; }

.evidence-quote {
  background: #F8FAFC; border-left: 3px solid #CBD5E1;
  padding: 8px 14px; border-radius: 0 8px 8px 0;
  font-size: 13px; color: #475569; margin: 6px 0 4px; line-height: 1.8;
}
.evidence-quote b { color: #334155; }

.r-list { font-size: 14px; line-height: 2.1; color: #334155; padding-left: 20px; }

.review-box { background: #FFFBF7; border: 1.5px solid #FFE4CE; border-radius: 12px; padding: 18px 22px; }
.review-row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; font-size: 14px; }
.review-row select { padding: 8px 12px; border-radius: 8px; border: 1.5px solid #E2E8F0; font-size: 14px; }
.review-row textarea {
  width: 100%; min-height: 60px; padding: 10px 14px;
  border: 1.5px solid #E2E8F0; border-radius: 10px; font-size: 14px; resize: vertical;
}
.review-note { font-size: 12px; color: #9A8878; }

.disposal-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 6px; border-bottom: 1px dashed #EEF2F7; font-size: 14.5px;
}
.disposal-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--c-good); cursor: pointer; }
.disposal-item.checked .disposal-text { text-decoration: line-through; color: #94A3B8; }
.disposal-ts { font-size: 11px; color: #94A3B8; margin-left: auto; white-space: nowrap; }

details.transcript { background: #F8FAFC; border-radius: 12px; padding: 14px 20px; }
details.transcript summary { cursor: pointer; font-size: 14px; font-weight: 600; color: #475569; }
.tr-line { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #E8EDF3; font-size: 13px; line-height: 1.7; }
.tr-role { flex-shrink: 0; font-weight: 700; width: 46px; }
.tr-role.ai { color: #2563EB; } .tr-role.stu { color: var(--c-primary-deep); }
.tr-method { color: #B0BAC9; font-size: 11px; white-space: nowrap; margin-top: 3px; }

/* ================= 设置 ================= */
.settings-card {
  background: #fff; border-radius: 14px; padding: 22px 26px;
  box-shadow: 0 1px 4px rgba(20,30,60,.06); margin-bottom: 18px; max-width: 640px;
}
.settings-card h3 { font-size: 15px; margin-bottom: 14px; }
.settings-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; font-size: 14px; }
.settings-row label { min-width: 100px; color: #475569; }
.settings-row input[type="text"], .settings-row input[type="password"] {
  padding: 9px 14px; border: 1.5px solid #E2E8F0; border-radius: 10px; flex: 1; min-width: 160px; outline: none;
}
.settings-row textarea {
  width: 100%; min-height: 110px; padding: 10px 14px;
  border: 1.5px solid #E2E8F0; border-radius: 10px; font-size: 14px; line-height: 1.8; resize: vertical;
}
.settings-note { font-size: 12px; color: #94A3B8; line-height: 1.8; }
.danger-zone { border: 1.5px solid #FECACA; }

/* ================= 模态框 ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 20, 10, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0 } }
.modal-box {
  background: #fff; border-radius: 20px;
  max-width: 560px; width: 100%; max-height: 86vh; overflow-y: auto;
  padding: 28px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box h3 { font-size: 18px; margin-bottom: 16px; }
.modal-text { font-size: 15px; line-height: 1.9; color: #4B5563; margin-bottom: 18px; white-space: pre-line; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-box input[type="text"], .modal-box input[type="password"], .modal-box select {
  width: 100%; padding: 11px 15px; margin-bottom: 12px;
  border: 1.5px solid #E2E8F0; border-radius: 10px; font-size: 15px; outline: none;
}
.modal-box textarea {
  width: 100%; min-height: 160px; padding: 12px 15px;
  border: 1.5px solid #E2E8F0; border-radius: 10px; font-size: 13px;
  font-family: Consolas, monospace; resize: vertical;
}
.modal-box input:focus, .modal-box textarea:focus { border-color: var(--c-primary); }
.import-result { font-size: 13px; line-height: 2; background: #F8FAFC; border-radius: 10px; padding: 12px 16px; margin-top: 10px; }
.import-result .ok { color: var(--c-good); }
.import-result .bad { color: var(--c-critical); }

/* ================= Toast ================= */
#toast-root { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #2B3648; color: #fff;
  padding: 11px 24px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastIn .25s;
}
.toast.warn { background: #DC2626; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) } }

/* ============================================================
   响应式适配（生产级）
   桌面 ≥1024px：侧栏常驻、内容居中、鼠标悬停反馈
   平板 768–1023px：侧栏收窄为图标、触控目标加大
   手机 <768px：单列布局、教师表格卡片化、底部安全区
   ============================================================ */

/* ---------- 平板（768–1023px，含 Android 平板横竖屏） ---------- */
@media (max-width: 1023px) and (min-width: 768px) {
  .t-sidebar { width: 76px; }
  .t-brand, .t-exit { font-size: 0; }
  .t-brand span { display: none; }
  .t-nav-btn { justify-content: center; padding: 14px 0; font-size: 0; }
  .badge { margin: 0; }
  .t-main { padding: 22px 20px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 手机（<768px，Android 手机 / 平板竖屏分屏） ---------- */
@media (max-width: 767px) {
  /* 动态视口：解决 Android Chrome 地址栏伸缩导致的高度跳动 */
  .view-chat { height: 100dvh; }

  /* 教师端：侧栏转为顶部条 */
  .view-teacher { flex-direction: column !important; }
  .t-sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center;
    padding: 8px 12px; gap: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
  }
  .t-brand { padding: 0 6px 0 0; font-size: 15px; white-space: nowrap; }
  .t-brand span { display: none; }
  .t-nav { flex-direction: row; flex: 1; overflow-x: auto; }
  .t-nav-btn { padding: 10px 12px; font-size: 14px; white-space: nowrap; border-radius: 10px; }
  .t-exit { padding: 10px 8px; }
  .t-main { padding: 16px 12px; }

  /* 表格卡片化：保留语义，横向滚动兜底 */
  .t-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .t-table { min-width: 620px; }

  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-num { font-size: 24px; }

  /* 聊天：气泡更大、输入区适配软键盘弹出 */
  #chat-box { padding: 14px 10px 20px; }
  .bubble { max-width: 88%; font-size: 15.5px; padding: 12px 14px; }
  .avatar { width: 34px; height: 34px; font-size: 18px; }
  .option-card { padding: 14px; }
  .option-emoji { font-size: 26px; }
  .option-desc { font-size: 12.5px; }

  /* 输入行：麦克风与发送按钮加大触控面积 */
  .mic-btn { width: 52px; height: 52px; }
  #chat-input { padding: 12px 16px; }
  .chat-input-area { padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px)); }

  /* 报告页 */
  .view-report { padding: 16px 12px; }
  .report-page { padding: 22px 16px; border-radius: 12px; }
  .report-head { flex-direction: column; gap: 10px; }
  .report-tools { width: 100%; }
  .dim-anchor { display: none; }
  .dim-name { width: 96px; font-size: 13px; }
  .level-banner { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* 模态框：贴底弹出更易触达 */
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal-box {
    max-width: 100%; width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 88dvh;
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: sheetUp .22s ease-out;
  }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }

  /* 角色选择 */
  .role-cards { flex-direction: column; gap: 16px; }
  .role-card { width: 100%; max-width: 340px; padding: 26px 20px; }
  .brand h1 { font-size: 32px; }
  .brand-mascot { font-size: 56px; }

  /* 结束页 */
  .finish-card { padding: 30px 20px; }

  /* 工具条换行 */
  .toolbar { gap: 8px; }
  .toolbar input[type="text"] { flex: 1; min-width: 140px; }

  /* 系统横幅不遮挡 */
  .sys-banner { font-size: 12px; padding: 6px 10px; }
}

/* ---------- 超小屏（<380px） ---------- */
@media (max-width: 379px) {
  .stat-cards { grid-template-columns: 1fr; }
  .role-card { padding: 20px 16px; }
  .brand h1 { font-size: 26px; }
  .bubble { max-width: 92%; font-size: 15px; }
}

/* ---------- 桌面（≥1024px）：鼠标体验增强 ---------- */
@media (min-width: 1024px) and (pointer: fine) {
  .t-main { max-width: 1200px; margin: 0 auto; }
  .report-page { max-width: 900px; }
  /* 键盘可达性：焦点环 */
  .btn:focus-visible, .option-card:focus-visible, .icon-btn:focus-visible,
  .t-nav-btn:focus-visible, .chip:focus-visible {
    outline: 3px solid rgba(255,122,69,.55);
    outline-offset: 2px;
  }
}

/* ---------- 触控设备通用：禁用双击缩放残留、提高点选精度 ---------- */
@media (pointer: coarse) {
  .option-card, .btn, .chip, .mic-btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}

/* ---------- 用户偏好：减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .brand-mascot { animation: none; }
}

/* ---------- 横屏矮视口（手机横屏访谈） ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .chat-header { padding: 6px 12px; }
  #chat-box { padding: 8px 10px; }
  .bubble { font-size: 14px; padding: 9px 12px; }
  .avatar { width: 28px; height: 28px; font-size: 15px; }
  .mic-btn { width: 44px; height: 44px; font-size: 19px; }
  .input-hints { margin-top: 4px; }
}

/* ---------- 视口基础：移动端缩放与安全区 ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }

/* ================= 打印（报告导出 PDF） ================= */
@media print {
  body { background: #fff; }
  .view { display: none !important; }
  #view-report { display: block !important; padding: 0; overflow: visible; background: #fff; }
  .report-page { box-shadow: none; padding: 0; max-width: 100%; }
  .report-tools, .no-print { display: none !important; }
  details.transcript { open: true; }
  details.transcript > * { display: block; }
}


/* ================= 连接状态徽标（任务5·服务端同步） ================= */
.conn-badge {
  position: fixed; top: 10px; right: 12px; z-index: 60;
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  pointer-events: none; transition: opacity .3s;
  font-weight: 500; letter-spacing: .2px;
}
.conn-badge.online  { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.conn-badge.offline { background: #fff3e0; color: #ef6c00; border: 1px solid #ffcc80; }
.conn-badge.local   { opacity: 0; }
@media (max-width: 640px) {
  .conn-badge { font-size: 10px; top: 6px; right: 8px; padding: 3px 8px; }
}


/* ================= 系统/业务告警横幅（任务11·服务端告警规则） ================= */
.sys-alert-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 14px;
  border-radius: 8px; font-size: 13px; line-height: 1.5;
  background: #fff8e1; color: #8d6e00; border: 1px solid #ffe082;
}
.sys-alert-bar.high { background: #ffebee; color: #b71c1c; border-color: #ffcdd2; }
.sys-alert-bar .link-btn { margin-left: auto; white-space: nowrap; color: inherit; font-weight: 600; }
.obs-pip { position: fixed; top: 72px; right: 12px; z-index: 20; width: 96px; pointer-events: none; }
.obs-pip video { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: #0f172a; }
.obs-pip span { display: block; font-size: 11px; color: #0f766e; text-align: center; }
.obs-pip.hidden { display: none; }
.obs-bar { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.obs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.obs-table th, .obs-table td { border-bottom: 1px solid #e2e8f0; text-align: left; padding: 4px 6px; }
.obs-note { font-size: 12px; color: #64748b; line-height: 1.5; }
/* V3.5·六维多模态报告折叠卡 */
.mm-dim summary::-webkit-details-marker { display: none; }
.mm-dim summary::marker { content: ''; }
.mm-dim[open] summary { border-bottom: 1px solid #f1f5f9; background: #f8fafc; }
.mm-dim summary:hover { background: #f8fafc; }
