/* ===== 超级教师AI助手 · 共享样式（灰色系 + 克制彩色点缀） ===== */

:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2937;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --accent: #5b9bd5;
  --accent-soft: #eef6ff;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
  --maxw: 820px;
  --nav-h: 60px;
  --font: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ===== 页面主题色（每个模块一种克制的强调色） ===== */
body.theme-indigo { --accent: #5b9bd5; --accent-soft: #eef6ff; } /* 首页/新手入门：hero 水晶蓝 */
body.theme-teal    { --accent: #4db6ac; --accent-soft: #f0fdfa; } /* 基础设置：薄荷青 */
body.theme-blue   { --accent: #6ca9e8; --accent-soft: #eff6ff; } /* 应用场景：天空蓝 */
body.theme-violet { --accent: #9d8ee8; --accent-soft: #f5f3ff; } /* 技能配置：薰衣草紫 */
body.theme-amber  { --accent: #e8994f; --accent-soft: #fff7ed; } /* 实战案例：暖橙 */
body.theme-green  { --accent: #5da87a; --accent-soft: #f0fdf4; } /* 常见问题：鼠尾草绿 */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { text-decoration: underline; opacity: .85; }

/* ===== 顶部导航 ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.nav__brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.nav__brand:hover { text-decoration: none; opacity: 1; }
.nav__logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.nav__links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
}
.nav__links a {
  color: var(--text-2);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav__links a:hover { background: var(--accent-soft); text-decoration: none; color: var(--accent); }
.nav__links a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav__toggle {
  display: none;
  margin-left: auto;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px; height: 34px;
  cursor: pointer; color: var(--text);
  font-size: 18px;
}

/* ===== 容器 ===== */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 20px 100px;
}
.wrap--wide { max-width: 1080px; }

/* ===== 首页 Hero ===== */
.hero {
  position: relative;
  text-align: center;
  padding: 24px 20px 4px;
  background: transparent;
  overflow: hidden;
}
.hero__img {
  display: block;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ===== 卡片网格 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent, var(--accent));
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card.c-teal    { --card-accent: #4db6ac; }
.card.c-blue   { --card-accent: #6ca9e8; }
.card.c-violet { --card-accent: #9d8ee8; }
.card.c-amber  { --card-accent: #e8994f; }
.card.c-green  { --card-accent: #5da87a; }
.card:hover {
  text-decoration: none;
  border-color: var(--card-accent, var(--accent));
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08), 0 2px 6px rgba(0,0,0,.04);
}
.card__no {
  font-size: 12px;
  color: var(--card-accent, var(--accent));
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.card h3 { margin: 10px 0 8px; font-size: 18px; color: var(--text); }
.card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.65; }

/* ===== 图片/插画 ===== */
.fig {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 18px 0;
}
.fig--wide { width: 100%; }
.fig--center { margin-left: auto; margin-right: auto; }
.fig__caption {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin-top: -10px;
  margin-bottom: 18px;
}

/* ===== 文章标题区 ===== */
.page-head {
  position: relative;
  padding: 16px 0 18px;
  margin-bottom: 28px;
  border-left: 4px solid var(--accent);
  padding-left: 18px;
}
.page-head .kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.page-head h1 { font-size: 30px; margin: 8px 0 10px; line-height: 1.25; }
.page-head .lead { color: var(--text-2); margin: 0; font-size: 16px; line-height: 1.7; }

/* ===== 章节 ===== */
.section { margin: 40px 0; }
.section > h2 {
  font-size: 22px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.section h3 { font-size: 18px; margin: 24px 0 12px; }
.section h4 { font-size: 15px; margin: 16px 0 8px; color: var(--text-2); }

p { margin: 12px 0; }
ul, ol { padding-left: 24px; }
li { margin: 7px 0; }

/* ===== 步骤块 ===== */
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 18px 16px 66px;
  margin: 14px 0;
  box-shadow: var(--shadow-sm);
}
.step__no {
  position: absolute;
  left: 14px; top: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: grid; place-items: center;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.step h4 { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.step p { margin: 4px 0; font-size: 14.5px; color: var(--text-2); }

/* ===== 提示框 ===== */
.callout {
  border-left: 4px solid var(--border-strong);
  background: var(--surface-2);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 18px 0;
  font-size: 14.5px;
}
.callout p { margin: 4px 0; }
.callout .callout__t { font-weight: 700; display: block; margin-bottom: 3px; }
.callout.tip { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.tip .callout__t { color: var(--accent); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.warn .callout__t { color: var(--warn); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout.danger .callout__t { color: var(--danger); }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout.ok .callout__t { color: var(--ok); }

/* ===== 表格 ===== */
.tbl-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
  min-width: 520px;
}
table.tbl th, table.tbl td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.tbl th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.tag.p0 { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.tag.p1 { background: #fff7e6; color: #ad6800; border-color: #ffe2b8; }
.tag.p2 { background: var(--ok-soft); color: var(--ok); border-color: #bfe9d0; }

/* ===== 代码块（提示词模板） ===== */
.code {
  position: relative;
  background: #1e222b;
  color: #e6e9ef;
  border-radius: var(--radius);
  padding: 16px 16px 16px;
  margin: 14px 0;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.code__copy {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(255, 255, 255, .1);
  color: #e6e9ef;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s;
}
.code__copy:hover { background: rgba(255, 255, 255, .2); }
.code__copy.done { color: #7ee2a8; border-color: #7ee2a8; }

/* ===== 场景卡 ===== */
.scenario {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
}
.scenario__fig {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  background: var(--surface-2);
}
.scenario__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.scenario__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 18px;
  font-weight: 700;
  flex: none;
}
.scenario h3 { margin: 0; font-size: 19px; }
.scenario .sub { color: var(--text-3); font-size: 13px; margin: 3px 0 0; }

/* ===== 目录（页内） ===== */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0 34px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.toc__t { font-weight: 700; color: var(--text-3); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.toc a { color: var(--text-2); display: block; padding: 4px 0; border-radius: 4px; }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* ===== 页脚 ===== */
.foot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-size: 13px;
  padding: 28px 20px;
  text-align: center;
}
.foot a { color: var(--text-2); }

/* ===== 返回顶部 ===== */
.top-btn {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  display: none;
  z-index: 40;
  transition: background .15s, color .15s, transform .15s;
}
.top-btn.show { display: grid; place-items: center; }
.top-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-2px); }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .nav__links {
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 10px 14px;
    gap: 3px;
    display: none;
  }
  .nav__links.open { display: flex; }
  .nav__toggle { display: block; }
  .nav__links { margin-left: 0; }
  .hero { padding: 18px 18px 2px; }
  .hero h1 { font-size: 29px; }
  .hero p { font-size: 16px; }
  .page-head h1 { font-size: 25px; }
  .scenario { padding: 18px; }
}

/* ===== AI 问答组件（前端直连，用户自带 Key） ===== */
#chat-launch {
  position: fixed;
  right: 22px; bottom: 84px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  cursor: pointer;
  z-index: 50;
  padding: 0;
  display: grid; place-items: center;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
#chat-launch img { width: 100%; height: 100%; object-fit: contain; display: block; }
#chat-launch:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, .24); }
#chat-launch.hide { display: none; }

#chat-panel {
  position: fixed;
  right: 22px; bottom: 22px;
  width: min(390px, calc(100vw - 32px));
  height: min(72vh, 660px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
  font-size: 14px;
}
#chat-panel.hide { display: none; }
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--accent);
  color: #fff;
}
.chat-head__title { font-weight: 700; font-size: 15px; flex: 1; }
.chat-head__btn {
  background: rgba(255, 255, 255, .16);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer;
  font-size: 15px; line-height: 1;
  display: grid; place-items: center;
}
.chat-head__btn:hover { background: rgba(255, 255, 255, .3); }
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
.chat-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg.bot.thinking { color: var(--text-3); font-style: italic; }
.chat-msg__content { white-space: pre-wrap; word-break: break-word; }
.chat-msg__actions { display: flex; gap: 6px; justify-content: flex-end; }
.msg-act {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  border-radius: 6px;
  padding: 2px 9px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.msg-act:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.chat-msg .md-code { background: rgba(110,119,129,.16); border-radius: 5px; padding: 1px 5px; font-family: var(--mono); font-size: 12.5px; }
.chat-foot { border-top: 1px solid var(--border); padding: 10px 12px; background: var(--surface); }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
#chat-input {
  flex: 1; resize: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 11px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  max-height: 120px;
  color: var(--text);
  background: var(--surface);
}
#chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send {
  flex: none;
  background: var(--accent);
  color: #fff; border: none;
  border-radius: 10px;
  padding: 0 16px; height: 38px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.chat-send:disabled { opacity: .5; cursor: not-allowed; }
.chat-disclaimer { color: var(--text-3); font-size: 11px; margin-top: 7px; line-height: 1.5; }

/* 设置面板 */
.chat-settings {
  border-top: 1px solid var(--border);
  padding: 14px;
  background: var(--surface-2);
  display: none;
}
.chat-settings.show { display: block; }
.chat-settings h4 { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
.chat-field { margin-bottom: 10px; }
.chat-field label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.chat-field input, .chat-field select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  box-sizing: border-box;
}
.chat-field input:focus, .chat-field select:focus { outline: none; border-color: var(--accent); }
.chat-save {
  width: 100%;
  background: var(--accent);
  color: #fff; border: none;
  border-radius: 8px;
  padding: 9px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.chat-toast {
  position: absolute;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  z-index: 70;
}
.chat-toast.show { opacity: .94; }

