/* =========================================================
   博南学堂 · 设计系统
   一本做成产品的"书院刊物"：暖纸、衬线、留白从容
   ========================================================= */

:root {
  --paper: #F7F3EA;
  --surface: #FFFDF8;
  --ink: #1F4536;
  --ink-deep: #16322799;
  --cinnabar: #BF4B33;
  --gold: #A97E3C;
  --text: #2C2A26;
  --muted: #7A756B;
  --line: #D9D2C2;
  --line-soft: #E8E2D4;
  --shadow-card: 0 6px 20px rgba(70, 60, 40, .08);
  --serif: "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", serif;
  --mono-num: ui-monospace, "PingFang SC", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--text);
  font: 14px/1.75 var(--sans);
  padding-top: 56px;
  min-width: 1280px;
}
body.bare { padding-top: 0; }

/* 极淡纸纹 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .3 0 0 0 .03 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: rgba(191, 75, 51, .14); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- 印章 logo ---------- */
.seal { display: inline-block; vertical-align: middle; }
.seal svg { display: block; }

/* ---------- 顶部导航 ---------- */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topnav-in {
  height: 56px; max-width: 1280px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; gap: 4px;
}
.brand {
  display: flex; align-items: center; gap: 10px; margin-right: 28px;
  flex: none;
}
.brand-name {
  font: 600 19px/1 var(--serif); letter-spacing: 2px; color: var(--ink);
  white-space: nowrap;
}
.navlink {
  position: relative; display: flex; align-items: center; gap: 6px;
  height: 56px; padding: 0 16px; flex: none; white-space: nowrap;
  font-size: 14px; color: var(--muted); letter-spacing: 1px;
  transition: color .15s;
}
.navlink:hover { color: var(--text); }
.navlink.on { color: var(--ink); }
.navlink.on::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 10px;
  height: 3px; background: var(--cinnabar); border-radius: 2px;
}
.navlink .ic { width: 16px; height: 16px; }
.navlink .dot {
  position: absolute; top: 14px; right: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--cinnabar); color: #fff;
  font: 600 10px/16px var(--sans); text-align: center;
}
.topnav-sp { flex: 1; }

/* 角色切换开关 */
.roleswitch {
  display: flex; gap: 2px; flex: none;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px; margin: 0 14px 0 0;
}
.roleswitch button {
  padding: 3px 12px; border-radius: 5px; font-size: 12px;
  color: var(--muted); letter-spacing: 2px;
  font-family: var(--serif);
  transition: all .18s;
}
.roleswitch button.on { background: var(--ink); color: #F4EFE3; }

.identity {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px; border-radius: 8px;
  font-size: 13px; color: var(--text); white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s;
}
.identity .who { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.identity:hover { background: var(--paper); }
.identity .who { color: var(--muted); }
.identity .who b { font-weight: 500; color: var(--text); font-family: var(--serif); }
.identity .caret { width: 12px; height: 12px; color: var(--muted); }
.identity-menu {
  position: absolute; top: 46px; right: 0; width: 232px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-card); padding: 6px; display: none; z-index: 70;
}
.identity-menu.open { display: block; }
.identity-menu .head {
  padding: 10px 12px 8px; border-bottom: 1px solid var(--line-soft);
  font: 500 14px/1.6 var(--serif); color: var(--ink);
}
.identity-menu .head small { display: block; font: 12px/1.6 var(--sans); color: var(--muted); }
.identity-menu .mi {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; border-radius: 6px; text-align: left; font-size: 13px;
  white-space: nowrap;
}
.identity-menu .mi:hover { background: var(--paper); }
.identity-menu .mi .ic { width: 15px; height: 15px; color: var(--muted); }

/* ---------- 页面骨架 ---------- */
.page {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto; padding: 36px 32px 88px;
}
.page-head { margin-bottom: 26px; }
.eyebrow {
  font-size: 12px; letter-spacing: 3px; color: var(--gold);
  margin-bottom: 8px;
}
.page-title {
  font: 600 30px/1.4 var(--serif); color: var(--ink);
  letter-spacing: 1px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.page-title::after {
  content: ""; width: 34px; height: 3px; background: var(--cinnabar);
  border-radius: 2px; transform: translateY(-6px);
}
.page-sub { color: var(--muted); margin-top: 6px; font-size: 13px; }
.page-head .title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.section { margin-top: 34px; }
.section-title {
  font: 600 18px/1.5 var(--serif); color: var(--ink);
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.section-title::before {
  content: ""; width: 8px; height: 8px; background: var(--cinnabar);
  border-radius: 2px; flex: none;
}
.section-title .count { font: 400 13px var(--sans); color: var(--muted); }

/* 课程上下文条 */
.course-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; margin-bottom: 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--muted);
}
.course-strip .cname { font: 500 14px var(--serif); color: var(--ink); letter-spacing: 1px; }
.course-strip a { color: var(--gold); }
.course-strip a:hover { color: var(--cinnabar); }

/* 横向子导航（课程空间） */
.subnav {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 28px;
  flex-wrap: wrap;
}
.subnav a {
  padding: 9px 16px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  letter-spacing: 1px; transition: color .15s;
}
.subnav a:hover { color: var(--text); }
.subnav a.on { color: var(--ink); border-bottom-color: var(--cinnabar); font-family: var(--serif); font-size: 14px; }

/* ---------- 目录式步骤条（其一 · 其二…） ---------- */
.steps {
  display: flex; gap: 0; margin: 0 0 30px; padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.step {
  flex: 1; display: flex; align-items: center; gap: 12px;
  position: relative; padding-right: 18px; min-width: 0;
}
.step:not(:last-child)::after {
  content: ""; position: absolute; right: 9px; top: 50%;
  width: 18px; height: 1px; background: var(--line);
}
.step .num {
  font: 600 22px/1 var(--serif); color: var(--line);
  flex: none; letter-spacing: 2px;
}
.step .t { min-width: 0; }
.step .t b {
  display: block; font: 500 15px/1.5 var(--serif); color: var(--muted);
  letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.step .t small { display: block; font-size: 12px; color: var(--muted); }
.step.done .num { color: var(--gold); }
.step.done .t b { color: var(--text); }
.step.on .num { color: var(--cinnabar); }
.step.on .t b { color: var(--ink); }
a.step-link { cursor: pointer; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 1px 0 var(--line-soft);
  padding: 20px 22px;
  transition: box-shadow .22s, border-color .22s, transform .22s;
}
.card + .card { margin-top: 14px; }
.card.lift:hover { box-shadow: var(--shadow-card); border-color: #CFC6B2; transform: translateY(-1px); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-title { font: 600 16px/1.5 var(--serif); color: var(--ink); letter-spacing: .5px; }
.card-note { font-size: 12px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ---------- 统计 ---------- */
.stat .k { font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.stat .v {
  font: 600 30px/1.3 var(--serif); color: var(--ink);
  font-variant-numeric: tabular-nums; margin: 2px 0 4px;
}
.stat .v .u { font-size: 14px; color: var(--muted); font-weight: 400; }
.stat .note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.stat.alert .v { color: var(--cinnabar); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 16px; border-radius: 8px;
  background: var(--ink); color: #F4EFE3; font-size: 13px; letter-spacing: 1px;
  border: 1px solid var(--ink);
  transition: background .18s, transform .1s, opacity .18s;
  white-space: nowrap;
}
.btn:hover { background: #2A5A47; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .ic { width: 14px; height: 14px; }
.btn-line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-line:hover { background: rgba(31, 69, 54, .06); }
.btn-red { background: transparent; border-color: var(--cinnabar); color: var(--cinnabar); }
.btn-red:hover { background: rgba(191, 75, 51, .07); }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12px; border-radius: 6px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: #C4BBA6; background: transparent; }

/* ---------- chip / 标签 / 徽章 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 4px;
  border: 1px solid rgba(191, 75, 51, .5); color: var(--cinnabar);
  font-size: 11px; letter-spacing: 1px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='p'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .75 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='60' height='60' filter='url(%23p)'/%3E%3C/svg%3E");
}
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 4px; font-size: 11px; letter-spacing: 1px;
  background: var(--paper); border: 1px solid var(--line); color: var(--muted);
}
.tag.ink { color: var(--ink); border-color: rgba(31, 69, 54, .35); background: rgba(31, 69, 54, .06); }
.tag.gold { color: var(--gold); border-color: rgba(169, 126, 60, .4); background: rgba(169, 126, 60, .07); }
.tag.ok { color: var(--ink); border-color: rgba(31, 69, 54, .4); }
.tag.wait { color: var(--cinnabar); border-color: rgba(191, 75, 51, .45); background: rgba(191, 75, 51, .05); }

/* 角标"新" */
.newflag {
  position: absolute; top: -7px; right: -7px; z-index: 2;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 4px; background: var(--cinnabar); color: #FFF6EE;
  font: 600 10px/18px var(--sans); text-align: center; letter-spacing: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
}

/* ---------- 表格 ---------- */
table.plat {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden;
}
.plat th {
  text-align: left; font: 500 13px/1.6 var(--serif); color: var(--ink);
  letter-spacing: 1px; padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: rgba(31, 69, 54, .03); white-space: nowrap;
}
.plat td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.plat tr:last-child td { border-bottom: 0; }
.plat td.num, .plat th.num { font-variant-numeric: tabular-nums; }

/* 行 hover 出操作 */
.rows-hover tr { transition: background .12s; }
.rows-hover tr:hover td { background: #FBF7EE; }
.row-ops { opacity: 0; transition: opacity .15s; display: inline-flex; gap: 6px; }
tr:hover .row-ops { opacity: 1; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); letter-spacing: 2px; margin-bottom: 6px; }
.inp, textarea.inp, select.inp {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.7;
  transition: border-color .15s, box-shadow .15s, background .25s;
}
.inp:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 69, 54, .09); }
/* 角色切换闪烁：用 transition 实现；类名避开全局 .flash（闪卡翻转组件，含 height:210px） */
.inp.role-flash { border-color: var(--cinnabar); box-shadow: 0 0 0 3px rgba(191, 75, 51, .12); background: rgba(191, 75, 51, .05); }
textarea.inp { resize: vertical; min-height: 96px; font-family: inherit; }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237A756B' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  padding: 5px 13px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--muted); letter-spacing: 0; cursor: pointer;
  transition: all .15s;
}
.radios input { display: none; }
.radios label.on { border-color: var(--ink); color: var(--ink); background: rgba(31, 69, 54, .06); }

input[type="range"].rng { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; }
.rng::-webkit-slider-runnable-track { height: 2px; background: var(--line); border-radius: 1px; }
.rng::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 50%;
  cursor: pointer;
}
.rng::-moz-range-track { height: 2px; background: var(--line); }
.rng::-moz-range-thumb { width: 12px; height: 12px; background: var(--surface); border: 2px solid var(--ink); border-radius: 50%; cursor: pointer; }

/* 文件选择 */
.filepick {
  display: flex; align-items: center; gap: 10px;
  border: 1px dashed var(--line); border-radius: 8px; padding: 12px 16px;
  background: var(--surface); cursor: pointer; transition: border-color .18s;
  font-size: 13px; color: var(--muted);
}
.filepick:hover { border-color: var(--gold); }
.filepick .ic { width: 18px; height: 18px; color: var(--gold); flex: none; }
.filepick input[type="file"] { display: none; }
.filelist { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.filelist .fi {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font-variant-numeric: tabular-nums;
}
.filelist .fi .ic { width: 14px; height: 14px; color: var(--muted); flex: none; }
.filelist .fi .sz { color: var(--muted); margin-left: auto; }

/* 勾选行 */
.pick {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 13px; cursor: pointer;
  transition: border-color .15s;
}
.pick + .pick { margin-top: 8px; }
.pick:hover { border-color: #C4BBA6; }
.pick input { accent-color: var(--ink); width: 15px; height: 15px; }
.pick .sz { margin-left: auto; color: var(--muted); font-size: 12px; }
.pick .meta { color: var(--muted); font-size: 12px; }

/* 开关 */
.sw { position: relative; width: 36px; height: 20px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw i {
  position: absolute; inset: 0; background: var(--line); border-radius: 10px;
  transition: background .18s;
}
.sw i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: var(--surface); border-radius: 50%; transition: transform .18s;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.sw input:checked + i { background: var(--ink); }
.sw input:checked + i::after { transform: translateX(16px); }

/* ---------- 提示条 ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(169, 126, 60, .07); border: 1px solid rgba(169, 126, 60, .35);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 22px; font-size: 13px;
}
.banner .ic { width: 18px; height: 18px; color: var(--gold); flex: none; margin-top: 2px; }
.banner b { color: var(--ink); font-weight: 500; }
.banner .acts { margin-left: auto; display: flex; gap: 8px; flex: none; align-items: center; }
.banner-link { color: var(--gold); cursor: pointer; font-size: 12px; }
.banner-link:hover { color: var(--cinnabar); }
.banner-detail { margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px dashed rgba(169,126,60,.4); padding-top: 10px; }
.banner-detail .bd-file { font-family: var(--serif); color: var(--text); }

/* ---------- 抽屉 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(44, 42, 38, .28); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw; z-index: 81;
  background: var(--surface); border-left: 2px solid var(--cinnabar);
  box-shadow: -12px 0 32px rgba(70, 60, 40, .14);
  transform: translateX(102%); transition: transform .28s cubic-bezier(.3,.8,.35,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 20px 24px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px; flex: none;
}
.drawer-head h3 { font: 600 18px/1.5 var(--serif); color: var(--ink); letter-spacing: 1px; }
.drawer-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.drawer-x { margin-left: auto; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.drawer-x:hover { background: var(--paper); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 24px 28px; }
.drawer-foot { flex: none; padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 气泡弹层（轻确认） ---------- */
.pop {
  position: absolute; z-index: 90; width: 250px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-card); padding: 14px 16px; font-size: 13px;
  opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.pop.open { opacity: 1; transform: none; pointer-events: auto; }
.pop::before {
  content: ""; position: absolute; top: -5px; left: 26px; width: 8px; height: 8px;
  background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.pop.above::before { top: auto; bottom: -5px; transform: rotate(225deg); }
.pop .msg { line-height: 1.7; color: var(--text); margin-bottom: 12px; }
.pop .msg b { color: var(--cinnabar); font-weight: 600; }
.pop .acts { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #F1EADB; font-size: 13px; letter-spacing: .5px;
  padding: 9px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(30, 45, 38, .28);
  opacity: 0; transform: translateY(8px); transition: all .3s;
  max-width: 560px;
}
.toast.in { opacity: 1; transform: none; }
.toast .ic { width: 15px; height: 15px; color: #9FC6B2; flex: none; }
.toast.warn { background: var(--cinnabar); }
.toast.warn .ic { color: #F5CFC2; }

/* ---------- 划词浮条 ---------- */
.selbar {
  position: absolute; z-index: 75; display: none;
  background: var(--ink); border-radius: 8px; box-shadow: 0 6px 18px rgba(30,45,38,.3);
  padding: 4px; gap: 2px;
}
.selbar.open { display: flex; }
.selbar button {
  padding: 5px 12px; color: #EAE4D3; font-size: 12px; letter-spacing: 1px;
  display: inline-flex; align-items: center; gap: 5px; border-radius: 6px;
  font-family: var(--serif);
}
.selbar button:hover { background: rgba(255, 253, 248, .12); }
.selbar button + button { border-left: 1px solid rgba(255,255,255,.14); border-radius: 0; }
.selbar button + button:hover { border-radius: 6px; }
.selbar .ic { width: 13px; height: 13px; }

/* ---------- 打字机 / AI 段落 ---------- */
.ai-stream { font-family: var(--serif); font-size: 13.5px; }
.ai-label {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1 var(--sans); color: var(--cinnabar); letter-spacing: 2px;
  margin-bottom: 10px;
}
.ai-label .ic { width: 14px; height: 14px; }
.cursor {
  display: inline-block; width: 8px; height: 15px; margin-left: 2px;
  background: var(--cinnabar); vertical-align: -2px;
  animation: blink .9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
blockquote.quote {
  font-family: var(--serif); font-size: 13.5px; line-height: 1.9;
  color: var(--text); border-left: 2px solid var(--cinnabar);
  padding: 4px 0 4px 16px; margin: 10px 0; background: none;
}
.quote .h { color: var(--ink); font-weight: 600; letter-spacing: 1px; margin-right: 8px; }

/* 骨架与spinner */
.skeleton {
  background: linear-gradient(90deg, var(--paper) 25%, #EFE9DA 50%, var(--paper) 75%);
  background-size: 200% 100%; animation: skl 1.3s infinite; border-radius: 4px; height: 12px; margin: 7px 0;
}
@keyframes skl { to { background-position: -200% 0; } }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 大纲树 ---------- */
.outline { font-size: 13.5px; }
.outline .node {
  display: flex; align-items: center; gap: 8px; position: relative;
  padding: 5px 10px 5px 0; border-radius: 6px;
}
.outline .node:hover { background: #FBF7EE; }
.outline .node.sel { background: rgba(31, 69, 54, .07); }
.outline .node.sel > .nlabel { color: var(--ink); font-weight: 600; }
.outline .tw {
  width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; border-radius: 4px;
}
.outline .tw:hover { background: var(--line-soft); }
.outline .tw svg { width: 10px; height: 10px; transition: transform .18s; }
.outline .tw.closed svg { transform: rotate(-90deg); }
.outline .tw.leaf { visibility: hidden; }
.outline .nlabel { cursor: pointer; letter-spacing: .3px; }
.outline .nlabel.root-l { font: 600 16px var(--serif); color: var(--ink); }
.outline .nlabel.b-l { font: 500 14.5px var(--serif); color: var(--ink); }
.outline .ndot { width: 6px; height: 6px; border-radius: 2px; background: var(--gold); flex: none; }
.outline .node.lv0 .ndot { background: var(--cinnabar); }
.outline .kids { margin-left: 26px; border-left: 1px dashed var(--line); padding-left: 6px; }
.outline .kids.hidden { display: none; }
.outline .nops { margin-left: auto; display: inline-flex; gap: 4px; opacity: 0; transition: opacity .15s; flex: none; }
.outline .node:hover .nops { opacity: 1; }
.outline .nop { width: 24px; height: 24px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.outline .nop:hover { background: var(--line-soft); color: var(--ink); }
.outline .nop .ic { width: 13px; height: 13px; }
.outline input.rename {
  font: inherit; background: var(--surface); border: 1px solid var(--ink);
  border-radius: 5px; padding: 1px 8px; width: 240px;
}

/* ---------- 思维导图 ---------- */
.mapwrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; position: relative;
}
.mapwrap svg { display: block; width: 100%; }
.mnode { cursor: pointer; }
.mnode rect, .mnode circle { transition: all .18s; }
.mnode text { font-family: var(--serif); fill: var(--text); }
.mnode:hover rect, .mnode:hover circle { filter: brightness(.97); }
.mnode.sel rect, .mnode.sel circle { stroke-width: 2.4; }
.medge { fill: none; stroke: var(--line); stroke-width: 1.3; transition: stroke .3s, opacity .3s; }
.map-legend {
  position: absolute; left: 14px; bottom: 12px; display: flex; gap: 14px;
  font-size: 11px; color: var(--muted);
}

/* ---------- 手写扫描页 ---------- */
.hw-scan {
  position: relative; font-family: var(--kai); color: #3A372F;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.6' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .4 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(transparent 0 33px, rgba(122, 117, 107, .16) 33px 34px),
    #FBF6E9;
  border: 1px solid var(--line); border-radius: 4px;
  padding: 26px 30px 30px; transform: rotate(-.6deg);
  font-size: 16.5px; line-height: 34px;
  box-shadow: inset 0 0 40px rgba(150, 130, 90, .07);
}
.hw-scan::after {
  content: ""; position: absolute; right: 14px; bottom: 12px;
  width: 34px; height: 34px; border: 2px solid var(--cinnabar); border-radius: 5px;
  color: var(--cinnabar); font: 600 11px/30px var(--serif); text-align: center;
  letter-spacing: 0;
}
.hw-scan .hw-title {
  font-size: 18px; letter-spacing: 3px; margin-bottom: 8px;
}
.hw-scan .hw-diagram { margin: 14px 0 4px; }
.hw-scan .hw-stamp {
  position: absolute; top: 16px; right: 18px; width: 46px; height: 46px;
  border: 2px solid rgba(191, 75, 51, .7); border-radius: 50%;
  color: rgba(191, 75, 51, .8); font: 600 10px/1.2 var(--serif);
  display: flex; align-items: center; justify-content: center; text-align: center;
  letter-spacing: 1px; transform: rotate(8deg);
}

/* ---------- 播放 / 波形 ---------- */
.player-screen {
  position: relative; aspect-ratio: 16 / 9; background: #22201B; border-radius: 8px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.pscreen-scene { position: absolute; inset: 0; transition: background .6s; }
.pscreen-time {
  position: absolute; top: 14px; right: 16px; z-index: 3;
  font: 400 13px/1 var(--mono-num); font-variant-numeric: tabular-nums;
  color: rgba(247, 243, 234, .75); letter-spacing: 1px;
}
.pscreen-label {
  position: absolute; left: 18px; bottom: 16px; z-index: 3;
  font: 500 15px/1 var(--serif); color: rgba(247, 243, 234, .9); letter-spacing: 3px;
}
.pscreen-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.psubtitle {
  position: absolute; left: 0; right: 0; bottom: 46px; z-index: 4; text-align: center;
  padding: 0 40px;
}
.psubtitle span {
  display: inline-block; background: rgba(24, 22, 18, .72); color: #F4EFE3;
  font-size: 14px; line-height: 1.6; padding: 4px 14px; border-radius: 4px;
  font-family: var(--serif); letter-spacing: 1px;
}
.psubtitle.th span, .psubtitle.my span { font-family: var(--sans); font-size: 13px; }
.scrub {
  position: relative; height: 26px; cursor: pointer; margin: 4px 0 0;
  display: flex; align-items: center;
}
.scrub-rail { position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: var(--line); border-radius: 2px; }
.scrub-fill { position: absolute; left: 0; top: 11px; height: 4px; background: var(--ink); border-radius: 2px; }
.scrub-mark { position: absolute; top: 8px; width: 2px; height: 10px; background: var(--gold); border-radius: 1px; opacity: .8; }
.scrub-head {
  position: absolute; top: 6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--ink);
  transform: translateX(-7px); box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.pctrl { display: flex; align-items: center; gap: 14px; padding-top: 10px; }
.pbtn { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #F1EADB; display: flex; align-items: center; justify-content: center; flex: none; }
.pbtn:hover { background: #2A5A47; }
.pbtn .ic { width: 15px; height: 15px; }
.pbtn.sm { width: 28px; height: 28px; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.pbtn.sm:hover { color: var(--ink); border-color: var(--ink); }
.ptime { font: 400 13px/1 var(--mono-num); font-variant-numeric: tabular-nums; color: var(--muted); letter-spacing: .5px; }

.wave { display: flex; align-items: center; gap: 2px; height: 34px; }
.wave i { width: 3px; border-radius: 2px; background: var(--line); transition: background .2s, height .15s; }
.wave.playing i { animation: wv 1s ease-in-out infinite alternate; }
@keyframes wv { from { transform: scaleY(.45); } to { transform: scaleY(1); } }

/* 声音指示 */
.voice-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px 4px 8px;
  font-size: 12px; color: var(--muted); background: var(--surface);
}
.voice-pill .vdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }

/* ---------- 闪卡 ---------- */
.flash { perspective: 1200px; height: 210px; cursor: pointer; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .55s; transform-style: preserve-3d; }
.flash.flip .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 22px; display: flex; flex-direction: column;
  box-shadow: 0 1px 0 var(--line-soft);
}
.flash-face.front { align-items: center; justify-content: center; text-align: center; }
.flash-face.front .f-t { font: 600 26px/1.5 var(--serif); color: var(--ink); letter-spacing: 3px; }
.flash-face.back { transform: rotateY(180deg); }
.flash-face.back .f-b { font-family: var(--serif); font-size: 14px; line-height: 1.9; overflow-y: auto; }
.flash .f-tag { position: absolute; top: 12px; left: 14px; }
.flash .f-foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- 目录锚点（长页） ---------- */
.with-toc { display: flex; gap: 40px; align-items: flex-start; }
.with-toc .main { flex: 1; min-width: 0; }
.toc { position: sticky; top: 84px; width: 168px; flex: none; font-size: 12.5px; }
.toc .tt { color: var(--muted); letter-spacing: 3px; margin-bottom: 10px; font-family: var(--serif); }
.toc a {
  display: block; padding: 5px 0 5px 14px; color: var(--muted);
  border-left: 2px solid var(--line); transition: all .15s;
}
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--ink); border-left-color: var(--cinnabar); font-family: var(--serif); }

/* ---------- 进度 ---------- */
.prog { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width .3s; }
.prog.gold i { background: var(--gold); }

/* ---------- 对话 ---------- */
.chat { display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 86%; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: 1px; }
.msg .bub {
  padding: 10px 14px; border-radius: 8px; font-size: 13.5px; line-height: 1.8;
}
.msg.me { align-self: flex-end; }
.msg.me .bub { background: var(--ink); color: #F1EADB; border-bottom-right-radius: 3px; }
.msg.ai .bub { background: #FBF7EC; border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 3px; font-family: var(--serif); font-size: 13.5px; }
.msg.ai .bub .h { color: var(--cinnabar); font-weight: 600; margin-right: 6px; }
.msg .tools { margin-top: 6px; display: flex; gap: 8px; }
.msg .tools button { font-size: 11.5px; color: var(--muted); }
.msg .tools button:hover { color: var(--cinnabar); }

/* ---------- 列表行 ---------- */
.lrow {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.lrow + .lrow { margin-top: 8px; }
.lrow:hover { border-color: #C8BFA9; box-shadow: 0 2px 8px rgba(70,60,40,.05); }
.lrow .t { min-width: 0; }
.lrow .t b { font-weight: 500; font-family: var(--serif); color: var(--ink); font-size: 14px; }
.lrow .t small { display: block; color: var(--muted); font-size: 12px; }
.lrow .acts { margin-left: auto; display: flex; gap: 8px; flex: none; align-items: center; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--muted); padding: 46px 20px; font-size: 13px; }
.empty .ic { width: 34px; height: 34px; color: var(--line); margin: 0 auto 10px; display: block; }

/* ---------- 数字人头像 ---------- */
.avatar-svg { border-radius: 50%; background: var(--paper); display: block; }
.lip .mouth { transform-origin: center; }
.lip.talking .mouth { animation: mouth .35s ease-in-out infinite alternate; }
@keyframes mouth { from { transform: scaleY(.2); } to { transform: scaleY(1); } }
/* 真实形象（图片） */
.avatar-img { border-radius: 50%; object-fit: cover; display: block; background: var(--paper);
  border: 1px solid var(--line); flex: none; }
.lip.talking.avatar-img { animation: avtalk .5s ease-in-out infinite alternate; }
@keyframes avtalk {
  from { transform: translateY(0) scale(1); box-shadow: 0 0 0 0 rgba(191,75,51,.28); }
  to   { transform: translateY(-1.5px) scale(1.03); box-shadow: 0 0 0 5px rgba(191,75,51,.10); }
}
/* 形象选择栅格 */
.avgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.avcell { display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px 7px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.avcell:hover { border-color: var(--muted); }
.avcell.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.avcell span { font: 500 12px/1.2 var(--serif); color: var(--ink); }
.avcell small { font-size: 10.5px; color: var(--muted); letter-spacing: .5px; text-align: center; }
/* 形象切换式选择：套 tab + 单行缩略图 */
.avset-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.avtab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--muted);
  background: var(--surface); cursor: pointer; transition: all .15s; }
.avtab .cnt { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.avtab.on { border-color: var(--ink); color: var(--ink); background: rgba(31, 69, 54, .06); font-family: var(--serif); }
.avtab.on .cnt { color: var(--ink); }
.avstrip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; }
.avstrip::-webkit-scrollbar { height: 6px; }
.avstrip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.avchip { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none;
  padding: 5px 7px 4px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.avchip:hover { border-color: var(--muted); }
.avchip.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.avchip span { font: 500 11px/1.2 var(--serif); color: var(--ink); white-space: nowrap; }
.statlamp { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.statlamp.on { background: #3E8A63; box-shadow: 0 0 0 3px rgba(62, 138, 99, .18); animation: lamp 1.4s infinite; }
@keyframes lamp { 50% { box-shadow: 0 0 0 6px rgba(62, 138, 99, .08); } }

/* 合成小窗里的数字人位 */
.stage-pos { position: absolute; z-index: 3; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center;
}
.login-card { width: 560px; text-align: center; position: relative; }
.login-seal { animation: stamp .7s cubic-bezier(.2, .9, .3, 1.2) both; display: inline-block; }
@keyframes stamp {
  0% { transform: scale(2.6) rotate(-14deg); opacity: 0; }
  60% { transform: scale(.94) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.login-title { font: 600 44px/1.4 var(--serif); color: var(--ink); letter-spacing: 12px; text-indent: 12px; margin-top: 18px; }
.login-sub { color: var(--muted); letter-spacing: 4px; margin-top: 8px; font-size: 13px; }
.login-rule { width: 34px; height: 3px; background: var(--cinnabar); border-radius: 2px; margin: 26px auto; }
.login-entries { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; text-align: left; }
.entry {
  display: block; padding: 20px 22px; background: var(--surface); position: relative;
  border: 1px solid var(--line); border-radius: 8px; transition: all .22s;
}
.entry:hover { border-color: var(--ink); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.entry:active { transform: translateY(-1px) scale(.985); }
.entry.active {
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 1px var(--cinnabar) inset, var(--shadow-card);
  transform: translateY(-2px);
}
.entry .e-t { font: 600 17px/1.6 var(--serif); color: var(--ink); letter-spacing: 2px; transition: color .2s; }
.entry.active .e-t { color: var(--cinnabar); }
.entry .e-d { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.entry .e-go { margin-top: 14px; font-size: 12px; color: var(--gold); letter-spacing: 2px; display: flex; align-items: center; gap: 6px; transition: color .2s; }
.entry:hover .e-go, .entry.active .e-go { color: var(--cinnabar); }
.entry .e-mark {
  position: absolute; top: 12px; right: 12px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--cinnabar); color: #FFF6EE;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.3); transition: transform .32s cubic-bezier(.2, .9, .3, 1.5), opacity .22s;
}
.entry.active .e-mark { opacity: 1; transform: scale(1); }
.entry .e-mark .ic { width: 11px; height: 11px; }
.login-form { margin-top: 26px; text-align: left; }
.login-foot { margin-top: 34px; font-size: 12px; color: var(--muted); }

/* ---------- 页脚 ---------- */
.footer {
  position: relative; z-index: 1; margin-top: 30px; color: var(--muted);
  border-top: 1px solid var(--line); background: var(--surface);
}
.footer-in { max-width: 1100px; margin: 0 auto; padding: 26px 32px 30px; font-size: 12px; position: relative; }
.footer .mountain { display: block; width: 100%; height: 46px; margin-bottom: 18px; opacity: .8; }
.footer .copyright { letter-spacing: .5px; }
.footer .fl-brand { font: 600 15px/1 var(--serif); color: var(--ink); letter-spacing: 3px; margin-bottom: 6px; }

/* ---------- 加载态 ---------- */
.pload { position: fixed; inset: 0; background: var(--paper); z-index: 99; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; transition: opacity .4s; }
.pload.hide { opacity: 0; pointer-events: none; }
.pload .seal { animation: sealpulse 1.2s ease-in-out infinite; }
@keyframes sealpulse { 50% { transform: scale(.9) rotate(-3deg); opacity: .7; } }
.pload small { color: var(--muted); font-size: 12px; letter-spacing: 4px; }

/* ---------- 其他工具 ---------- */
.flex { display: flex; } .aic { align-items: center; } .jcb { justify-content: space-between; }
.gap6 { gap: 6px; } .gap10 { gap: 10px; } .gap14 { gap: 14px; }
.wrap { flex-wrap: wrap; } .mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; } .mt26 { margin-top: 26px; }
.mb0 { margin-bottom: 0; } .right { text-align: right; }
.muted { color: var(--muted); } .ink-c { color: var(--ink); } .red-c { color: var(--cinnabar); } .gold-c { color: var(--gold); }
.serif { font-family: var(--serif); } .big-num { font-variant-numeric: tabular-nums; }
.fs12 { font-size: 12px; } .fs13 { font-size: 13px; }
.hr { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }
.link { color: var(--gold); cursor: pointer; } .link:hover { color: var(--cinnabar); }
.kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; }

.ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 时间线（编排） */
.tl { display: flex; gap: 0; align-items: stretch; overflow-x: auto; padding-bottom: 6px; }
.tl-seg {
  flex: none; width: 150px; margin-right: 10px; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.tl-seg .p { font: 600 13px/1 var(--serif); color: var(--gold); letter-spacing: 1px; }
.tl-seg .s { font-size: 12.5px; color: var(--text); font-family: var(--serif); margin: 6px 0 4px; }
.tl-seg .m { font-size: 11px; color: var(--muted); }
.tl-seg .move { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; }
.tl-seg .move button { width: 20px; height: 20px; color: var(--muted); border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.tl-seg .move button:hover { background: var(--paper); color: var(--ink); }
.tl-seg .move .ic { width: 12px; height: 12px; }
.tl-plus, .tl-minus { width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.tl-plus:hover, .tl-minus:hover { border-color: var(--ink); color: var(--ink); }

/* 结果成品卡 */
.result-card {
  display: flex; gap: 18px; align-items: center;
  border: 1px solid rgba(31, 69, 54, .35); background: rgba(31, 69, 54, .04);
}

/* 打印/减弱动效 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
