/* ============================================================
   60 天训练营 · 学习系统
   样式表：双主题 / 响应式 / 组件化
   ============================================================ */

/* ---------- 1. 设计变量 ---------- */
:root{
  --bg:            #f4f2ed;
  --bg-2:          #eae7e0;
  --surface:       #ffffff;
  --surface-2:     #faf9f6;
  --surface-3:     #f0eee8;
  --ink:           #1b1d1f;
  --ink-2:         #565d66;
  --ink-3:         #8d949d;
  --line:          #e2ded5;
  --line-2:        #cfc9bc;

  --primary:       #1f6f5c;
  --primary-ink:   #14513f;
  --primary-soft:  #e6f0ec;
  --primary-ring:  rgba(31,111,92,.18);

  --accent:        #b9761c;
  --accent-soft:   #fbf0dd;

  --done:          #1e8449;
  --done-soft:     #e6f4ec;
  --weak:          #b9770e;
  --weak-soft:     #fdf3e2;
  --none:          #bf3b2f;
  --none-soft:     #fceceb;
  --unknown:       #98a0a9;
  --unknown-soft:  #f0f1f2;

  --shadow-1:      0 1px 2px rgba(30,25,15,.05), 0 2px 8px rgba(30,25,15,.04);
  --shadow-2:      0 4px 12px rgba(30,25,15,.07), 0 12px 32px rgba(30,25,15,.06);
  --shadow-3:      0 12px 40px rgba(20,17,10,.16);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --topbar-h: 60px;
  --wrap: 1180px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"]{
  --bg:            #121417;
  --bg-2:          #0d0f11;
  --surface:       #1b1e23;
  --surface-2:     #21252b;
  --surface-3:     #272c33;
  --ink:           #e9ecef;
  --ink-2:         #a8b0ba;
  --ink-3:         #757e89;
  --line:          #2d333a;
  --line-2:        #3b434c;

  --primary:       #4fae90;
  --primary-ink:   #7fd0b4;
  --primary-soft:  #12241f;
  --primary-ring:  rgba(79,174,144,.22);

  --accent:        #d9a04a;
  --accent-soft:   #2a2114;

  --done:          #4cc27c;
  --done-soft:     #12251a;
  --weak:          #e0a63f;
  --weak-soft:     #2a2213;
  --none:          #e2715f;
  --none-soft:     #2c1917;
  --unknown:       #7b848f;
  --unknown-soft:  #23282e;

  --shadow-1:      0 1px 2px rgba(0,0,0,.3);
  --shadow-2:      0 4px 14px rgba(0,0,0,.35);
  --shadow-3:      0 16px 48px rgba(0,0,0,.55);
}

/* ---------- 2. 基础 ---------- */
*{ box-sizing: border-box; }
html,body{ height:100%; }
[hidden]{ display: none !important; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.65;
  transition: background .25s ease, color .25s ease;
}
h1,h2,h3,h4{ margin:0; font-weight:650; letter-spacing:-.01em; }
p{ margin:0; }
button{ font-family:inherit; font-size:inherit; cursor:pointer; border:0; background:none; color:inherit; }
input,textarea,select{ font-family:inherit; font-size:inherit; color:inherit; }
a{ color: var(--primary); text-decoration:none; }
::selection{ background: var(--primary-ring); }

.app{ min-height:100%; display:flex; flex-direction:column; }

/* ---------- 3. 顶栏 ---------- */
.topbar{
  position: sticky; top:0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar-row{
  max-width: var(--wrap);
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
.brand-mark{
  width:32px; height:32px; border-radius:9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-ink));
  color:#fff; font-weight:800; font-size:18px; line-height:1;
  display:grid; place-items:center;
  letter-spacing:0;
  box-shadow: 0 2px 8px var(--primary-ring);
  flex-shrink:0;
}
.brand-text{ display:flex; flex-direction:column; line-height:1.15; min-width:0; }
.brand-text strong{ font-size:13.5px; letter-spacing:.01em; white-space:nowrap; }
.brand-text em{ font-style:normal; font-size:11px; color: var(--ink-3); letter-spacing:.14em; }

.tabs{
  display:flex; gap:2px; padding:3px;
  background: var(--surface-3);
  border-radius: 11px;
  margin-left: 6px;
}
.tab{
  display:flex; align-items:center; gap:6px;
  padding: 7px 15px; border-radius: 8px;
  font-size: 13.5px; font-weight: 550; color: var(--ink-2);
  transition: all .18s ease;
  white-space: nowrap;
}
.tab-ico{ font-size:12px; opacity:.75; }
.tab:hover{ color: var(--ink); }
.tab.is-active{
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-1);
}

.top-actions{ margin-left:auto; display:flex; align-items:center; gap:8px; }

.ring-wrap{ position:relative; width:34px; height:34px; display:grid; place-items:center; }
.ring{ width:34px; height:34px; transform: rotate(-90deg); }
.ring circle{ fill:none; stroke-width:3; }
.ring-bg{ stroke: var(--line); }
.ring-fg{
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-dasharray: 97.4;
  stroke-dashoffset: 97.4;
  transition: stroke-dashoffset .7s cubic-bezier(.2,.8,.2,1);
}
.ring-txt{
  position:absolute; font-size:9px; font-weight:700; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.icon-btn{
  width:34px; height:34px; border-radius:9px;
  display:grid; place-items:center;
  color: var(--ink-2); font-size:15px;
  transition: all .16s ease;
}
.icon-btn:hover{ background: var(--surface-3); color: var(--ink); }

/* 当前登录学员身份条 */
.who-chip{
  max-width: 190px;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who-chip[hidden]{ display:none; }

/* ---------- 4. 主体 / 视图切换 ---------- */
.main{ flex:1; width:100%; }
.view{ display:none; }
.view.is-active{ display:block; animation: fadeUp .28s ease both; }
@keyframes fadeUp{
  from{ opacity:0; transform: translateY(6px); }
  to{ opacity:1; transform:none; }
}

/* ---------- 5. 知识盘点 ---------- */
.kb-wrap{
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 26px 20px 90px;
}

.overview{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  margin-bottom: 18px;
}
.ov-main{
  background: var(--surface);
  border:1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-1);
}
.ov-head h1{ font-size: 22px; letter-spacing:-.02em; }
.ov-sub{ font-size:13px; color: var(--ink-2); margin-top:5px; }
.ov-sub b{ color: var(--accent); }

.ov-metrics{
  display:grid; grid-template-columns: repeat(4,1fr);
  gap: 10px; margin: 20px 0 18px;
}
.metric{
  display:flex; flex-direction:column; gap:2px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border:1px solid var(--line);
}
.m-num{
  font-size: 26px; font-weight: 750; letter-spacing:-.03em;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  line-height:1.1;
}
.m-num.warn{ color: var(--weak); }
.m-num.danger{ color: var(--none); }
.m-label{ font-size:11.5px; color: var(--ink-3); }
.m-label i{ font-style:normal; opacity:.7; }

.ov-bar-track{
  height:8px; border-radius:99px;
  background: var(--surface-3);
  overflow:hidden;
}
.ov-bar-fill{
  height:100%; width:0%;
  border-radius:99px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--accent)));
  transition: width .7s cubic-bezier(.2,.8,.2,1);
}
.ov-bar-legend{
  display:flex; justify-content:space-between;
  margin-top:7px; font-size:11.5px; color: var(--ink-3);
}
.ov-bar-legend b{ color: var(--ink); font-variant-numeric: tabular-nums; }

.ov-side{ display:flex; flex-direction:column; gap:10px; }
.verdict{
  flex:1;
  background: var(--surface);
  border:1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-1);
}
.verdict-top{ display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.verdict-top b{ font-size:14px; }
.verdict-dot{
  width:9px; height:9px; border-radius:50%;
  background: var(--unknown); flex-shrink:0;
  box-shadow: 0 0 0 3px var(--unknown-soft);
}
.verdict p{ font-size:12.5px; color: var(--ink-2); line-height:1.6; }
.verdict-list{
  list-style:none; margin:10px 0 0; padding:0;
  display:flex; flex-direction:column; gap:5px;
}
.verdict-list li{
  font-size:12px; color: var(--ink-2);
  display:flex; gap:6px; align-items:flex-start; line-height:1.5;
}
.verdict-list li::before{
  content:"—"; color: var(--ink-3); flex-shrink:0;
}
.verdict.ok .verdict-dot{ background: var(--done); box-shadow:0 0 0 3px var(--done-soft); }
.verdict.warn .verdict-dot{ background: var(--weak); box-shadow:0 0 0 3px var(--weak-soft); }
.verdict.bad .verdict-dot{ background: var(--none); box-shadow:0 0 0 3px var(--none-soft); }

/* 工具栏 */
.toolbar{
  position: sticky; top: var(--topbar-h); z-index: 30;
  display:flex; align-items:center; gap:12px;
  flex-wrap: wrap;
  padding: 12px 0 12px;
  margin-bottom: 6px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.chips{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{
  padding: 6px 13px; border-radius:99px;
  font-size:12.5px; font-weight:550;
  color: var(--ink-2);
  background: var(--surface);
  border:1px solid var(--line);
  transition: all .16s ease;
  white-space: nowrap;
}
.chip:hover{ border-color: var(--line-2); color: var(--ink); }
.chip.is-on{
  background: var(--primary); border-color: var(--primary); color:#fff;
  box-shadow: 0 2px 8px var(--primary-ring);
}
[data-theme="dark"] .chip.is-on{ color:#0d1512; }

.toolbar-right{ margin-left:auto; display:flex; gap:8px; align-items:center; }
.search input{
  width: 220px;
  padding: 7px 13px;
  border-radius:99px;
  border:1px solid var(--line);
  background: var(--surface);
  font-size:13px;
  outline:none;
  transition: all .18s ease;
}
.search input:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.search input::placeholder{ color: var(--ink-3); }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding: 8px 15px; border-radius: 9px;
  font-size:13px; font-weight: 600;
  transition: all .16s ease;
  white-space: nowrap;
  border:1px solid transparent;
}
.btn-sm{ padding: 6px 12px; font-size:12.5px; border-radius:8px; }
.btn-primary{
  background: var(--primary); color:#fff;
  box-shadow: 0 2px 10px var(--primary-ring);
}
[data-theme="dark"] .btn-primary{ color:#0d1512; }
.btn-primary:hover{ filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost{
  background: var(--surface); color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover{ border-color: var(--line-2); color: var(--ink); }
.btn-quiet{ color: var(--ink-2); padding:6px 8px; }
.btn-quiet:hover{ background: var(--surface-3); border-radius:7px; }
.btn:disabled{ opacity:.45; cursor:not-allowed; transform:none !important; }

/* 周手风琴 */
.weeks{ display:flex; flex-direction:column; gap:10px; }
.week{
  background: var(--surface);
  border:1px solid var(--line);
  border-radius: var(--r-lg);
  overflow:hidden;
  box-shadow: var(--shadow-1);
  transition: box-shadow .2s ease;
}
.week:hover{ box-shadow: var(--shadow-2); }
.week-head{
  width:100%;
  display:flex; align-items:center; gap:12px;
  padding: 15px 18px;
  text-align:left;
  transition: background .16s ease;
}
.week-head:hover{ background: var(--surface-2); }
.week-no{
  width:34px; height:34px; flex-shrink:0;
  border-radius:10px;
  display:grid; place-items:center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight:750; font-size:14px;
  font-variant-numeric: tabular-nums;
}
.week-title{ flex:1; min-width:0; }
.week-title b{ display:block; font-size:14.5px; font-weight:600; }
.week-title span{ font-size:11.5px; color: var(--ink-3); }
.week-stat{
  display:flex; align-items:center; gap:10px;
  font-size:11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex-shrink:0;
}
.mini-bar{
  width: 76px; height:5px; border-radius:99px;
  background: var(--surface-3); overflow:hidden;
}
.mini-bar i{ display:block; height:100%; width:0%; background: var(--done); border-radius:99px; transition: width .5s ease; }
.week-caret{
  font-size:10px; color: var(--ink-3);
  transition: transform .22s ease;
  flex-shrink:0;
}
.week.is-open .week-caret{ transform: rotate(180deg); }
.week-body{ display:none; padding: 0 14px 14px; }
.week.is-open .week-body{ display:block; animation: fadeUp .22s ease both; }

/* 知识点卡片 */
.kb-item{
  border-radius: var(--r-md);
  padding: 13px 14px;
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-left: 3px solid var(--unknown);
  transition: all .18s ease;
}
.kb-item[data-status="done"]{ border-left-color: var(--done); background: color-mix(in srgb, var(--done-soft) 55%, var(--surface-2)); }
.kb-item[data-status="weak"]{ border-left-color: var(--weak); background: color-mix(in srgb, var(--weak-soft) 55%, var(--surface-2)); }
.kb-item[data-status="none"]{ border-left-color: var(--none); background: color-mix(in srgb, var(--none-soft) 55%, var(--surface-2)); }
.kb-item.is-flash{ animation: flash 1.6s ease; }
@keyframes flash{
  0%,100%{ box-shadow:none; }
  20%,60%{ box-shadow: 0 0 0 3px var(--primary-ring); }
}

.kb-top{ display:flex; align-items:flex-start; gap:8px; }
.kb-id{
  font-family: var(--mono);
  font-size:11px; font-weight:700;
  color: var(--ink-3);
  padding: 2px 6px;
  background: var(--surface-3);
  border-radius:5px;
  flex-shrink:0;
  margin-top:2px;
}
.kb-star{ color: var(--accent); font-size:11px; flex-shrink:0; margin-top:3px; }
.kb-title{
  flex:1; min-width:0;
  font-size:13.8px; font-weight:560; line-height:1.55;
}
.kb-badge{
  flex-shrink:0;
  font-size:11px; font-weight:600;
  padding: 2px 8px; border-radius:99px;
  background: var(--unknown-soft); color: var(--unknown);
  margin-top:1px;
}
.kb-item[data-status="done"] .kb-badge{ background: var(--done-soft); color: var(--done); }
.kb-item[data-status="weak"] .kb-badge{ background: var(--weak-soft); color: var(--weak); }
.kb-item[data-status="none"] .kb-badge{ background: var(--none-soft); color: var(--none); }

.kb-std{
  font-size:12.5px; color: var(--ink-2);
  margin: 7px 0 0 0;
  padding-left: 2px;
  line-height:1.6;
}
.kb-std::before{ content:"掌握标准 · "; color: var(--ink-3); font-size:11px; letter-spacing:.02em; }

.kb-actions{
  display:flex; align-items:center; gap:8px;
  margin-top: 10px; flex-wrap: wrap;
}
.seg{
  display:inline-flex; padding:2px; gap:2px;
  background: var(--surface-3);
  border-radius:8px;
}
.seg button{
  padding: 4px 10px; border-radius:6px;
  font-size:11.5px; font-weight:600;
  color: var(--ink-3);
  transition: all .15s ease;
  white-space:nowrap;
}
.seg button:hover{ color: var(--ink); }
.seg button.on[data-s="none"]{ background: var(--none-soft); color: var(--none); }
.seg button.on[data-s="weak"]{ background: var(--weak-soft); color: var(--weak); }
.seg button.on[data-s="done"]{ background: var(--done-soft); color: var(--done); }

.kb-note{
  flex:1; min-width: 160px;
  padding: 5px 10px;
  font-size:12px;
  background: var(--surface);
  border:1px solid var(--line);
  border-radius:7px;
  outline:none;
  transition: border-color .16s ease;
}
.kb-note:focus{ border-color: var(--primary); }
.kb-note::placeholder{ color: var(--ink-3); }

.link-btn{
  font-size:11.5px; font-weight:600;
  color: var(--primary);
  padding: 4px 8px; border-radius:6px;
  white-space:nowrap;
  transition: background .15s ease;
}
.link-btn:hover{ background: var(--primary-soft); }
.link-btn.muted{ color: var(--ink-3); }

.quiz-score{
  font-size:11px; font-weight:700;
  padding: 2px 7px; border-radius:99px;
  background: var(--surface-3); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.quiz-score.good{ background: var(--done-soft); color: var(--done); }
.quiz-score.bad{ background: var(--none-soft); color: var(--none); }

.empty{
  text-align:center; padding: 60px 20px;
  color: var(--ink-3); font-size:14px;
}

/* ---------- 6. 实操工坊 ---------- */
.view-ws.is-active{
  display:grid;
  grid-template-columns: 264px minmax(0,1fr);
  max-width: var(--wrap);
  margin: 0 auto;
  gap: 20px;
  padding: 22px 20px 90px;
  align-items: start;
}

.ws-side{
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  background: var(--surface);
  border:1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow:hidden;
  max-height: calc(100vh - var(--topbar-h) - 40px);
  display:flex; flex-direction:column;
}
.ws-side-head{ padding: 15px 16px 11px; border-bottom:1px solid var(--line); }
.ws-side-head h2{ font-size:14.5px; }
.ws-side-head p{ font-size:11.5px; color: var(--ink-3); margin-top:2px; }
.ws-side-body{ overflow-y:auto; padding: 10px 9px 14px; flex:1; }
.ws-side-body::-webkit-scrollbar{ width:6px; }
.ws-side-body::-webkit-scrollbar-thumb{ background: var(--line-2); border-radius:99px; }

.phase-label{
  font-size:10.5px; font-weight:700; letter-spacing:.1em;
  color: var(--ink-3);
  padding: 10px 9px 5px;
  display:flex; align-items:center; gap:6px;
}
.phase-label i{
  font-style:normal; width:16px; height:16px; border-radius:5px;
  background: var(--surface-3); color: var(--ink-2);
  display:grid; place-items:center; font-size:9px;
}
.step-btn{
  width:100%;
  display:flex; align-items:center; gap:8px;
  padding: 7px 9px; border-radius:8px;
  text-align:left;
  font-size:12.5px; color: var(--ink-2);
  transition: all .15s ease;
  margin-bottom:1px;
}
.step-btn:hover{ background: var(--surface-2); color: var(--ink); }
.step-btn.is-on{
  background: var(--primary-soft); color: var(--primary-ink);
  font-weight:600;
}
[data-theme="dark"] .step-btn.is-on{ color: var(--primary-ink); }
.step-btn .sb-no{
  font-family: var(--mono); font-size:10px; font-weight:700;
  opacity:.6; flex-shrink:0; width:14px;
}
.step-btn .sb-txt{
  flex:1; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.step-btn .sb-dot{
  width:6px; height:6px; border-radius:50%;
  background: var(--line-2); flex-shrink:0;
}
.step-btn.done .sb-dot{ background: var(--done); }
.step-btn.half .sb-dot{ background: var(--weak); }
.step-btn.is-on .sb-dot{ box-shadow: 0 0 0 3px var(--primary-ring); }

.ws-main{ min-width:0; display:flex; flex-direction:column; gap:14px; }

.card{
  background: var(--surface);
  border:1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow:hidden;
}
.card-head{
  display:flex; align-items:center; gap:10px;
  padding: 14px 18px;
  border-bottom:1px solid var(--line);
}
.card-head h3{ font-size:14px; flex:1; }
.card-body{ padding: 16px 18px; }

/* 项目卡 */
.proj-card .card-head{ background: var(--surface-2); }
.proj-tag{
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 99px;
  background: var(--surface-3); color: var(--ink-3);
  white-space: nowrap;
}
.proj-tag.on{ background: var(--primary-soft); color: var(--primary); }
.proj-grid{
  display:grid; grid-template-columns: 1fr 1fr; gap:12px;
}
.field{ display:flex; flex-direction:column; gap:4px; }
.field.full{ grid-column: 1 / -1; }
.field label{
  font-size:11.5px; font-weight:650; color: var(--ink-2);
  letter-spacing:.02em;
}
.field label em{ font-style:normal; color: var(--ink-3); font-weight:400; }
.field input, .field textarea{
  padding: 8px 11px;
  border:1px solid var(--line);
  border-radius:8px;
  background: var(--surface-2);
  font-size:13px;
  outline:none;
  transition: all .16s ease;
  resize: vertical;
  line-height:1.6;
}
.field input:focus, .field textarea:focus{
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.proj-empty{
  display:flex; align-items:center; gap:12px;
  padding: 4px 0;
}
.proj-empty p{ font-size:12.5px; color: var(--ink-3); flex:1; line-height:1.6; }

/* 步骤头 */
.step-head-card{
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}
.step-kicker{
  display:flex; align-items:center; gap:8px;
  font-size:11px; color: var(--ink-3); margin-bottom:6px;
}
.step-kicker .k-badge{
  padding: 2px 8px; border-radius:99px;
  background: var(--primary-soft); color: var(--primary);
  font-weight:700; font-size:10.5px;
}
.step-h1{ font-size: 20px; letter-spacing:-.02em; line-height:1.4; }
.step-goal{
  margin-top:12px;
  display:flex; gap:9px;
  padding: 11px 13px;
  background: var(--accent-soft);
  border-radius: var(--r-md);
  border-left:3px solid var(--accent);
}
.step-goal .g-ico{ color: var(--accent); font-size:13px; flex-shrink:0; margin-top:1px; }
.step-goal p{ font-size:12.8px; color: var(--ink-2); line-height:1.65; }
.step-goal p b{ color: var(--ink); }

/* 产出表单 */
.out-item{
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}
.out-item:last-child{ border-bottom:0; padding-bottom:0; }
.out-item:first-child{ padding-top:0; }
.out-label{
  display:flex; align-items:baseline; gap:7px; margin-bottom:3px;
}
.out-label b{ font-size:13px; }
.out-label span{ font-size:11.5px; color: var(--ink-3); }
.out-item textarea{
  width:100%; min-height: 74px;
  padding: 9px 11px;
  border:1px solid var(--line);
  border-radius:9px;
  background: var(--surface-2);
  font-size:12.8px; line-height:1.65;
  outline:none; resize: vertical;
  transition: all .16s ease;
}
.out-item textarea:focus{
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.out-meta{
  display:flex; justify-content:space-between; align-items:center;
  margin-top:5px; font-size:11px; color: var(--ink-3);
}

/* 检查清单 */
.chk{
  display:flex; align-items:flex-start; gap:9px;
  padding: 8px 10px;
  border-radius:8px;
  cursor:pointer;
  transition: background .15s ease;
  font-size:12.8px;
  line-height:1.6;
}
.chk:hover{ background: var(--surface-2); }
.chk input{ display:none; }
.chk .box{
  width:16px; height:16px; flex-shrink:0; margin-top:2px;
  border:1.5px solid var(--line-2);
  border-radius:5px;
  display:grid; place-items:center;
  transition: all .16s ease;
  color:transparent; font-size:10px; font-weight:800;
}
.chk input:checked + .box{
  background: var(--done); border-color: var(--done); color:#fff;
}
.chk input:checked ~ .txt{ color: var(--ink-3); text-decoration: line-through; }

/* AI 区 */
.ai-card .card-head{ background: var(--surface-2); }
.ai-tools{ display:flex; gap:8px; flex-wrap:wrap; }
.ai-out{
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border:1px solid var(--line);
  font-size:13px; line-height:1.75;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px; overflow-y:auto;
  display:none;
}
.ai-out.show{ display:block; }
.ai-out h1,.ai-out h2,.ai-out h3,.ai-out h4{ font-size:13.5px; margin:12px 0 5px; }
.ai-out ul,.ai-out ol{ margin:6px 0; padding-left:20px; }
.ai-out li{ margin:2px 0; }
.ai-out code{ font-family: var(--mono); font-size:12px; background: var(--surface-3); padding:1px 5px; border-radius:4px; }
.ai-out p{ margin:6px 0; }
.ai-hint{
  font-size:11.5px; color: var(--ink-3); margin-top:10px; line-height:1.6;
}
.ai-hint b{ color: var(--weak); }

.spinner{
  width:14px; height:14px; border-radius:50%;
  border:2px solid var(--primary-ring);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
  display:inline-block;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* 关联知识点 */
.kb-links{ display:flex; flex-wrap:wrap; gap:7px; }
.kb-chip{
  display:inline-flex; align-items:center; gap:6px;
  padding: 5px 11px 5px 9px;
  border-radius:99px;
  background: var(--surface-2);
  border:1px solid var(--line);
  font-size:11.8px;
  color: var(--ink-2);
  transition: all .16s ease;
  max-width: 100%;
}
.kb-chip:hover{ border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.kb-chip .d{
  width:7px; height:7px; border-radius:50%; flex-shrink:0;
  background: var(--unknown);
}
.kb-chip[data-st="done"] .d{ background: var(--done); }
.kb-chip[data-st="weak"] .d{ background: var(--weak); }
.kb-chip[data-st="none"] .d{ background: var(--none); }
.kb-chip .t{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* 正文 Markdown */
.guide-card.is-collapsed .card-body{ display:none; }
.md{ font-size:13px; line-height:1.8; color: var(--ink-2); overflow-wrap: break-word; }
.md p{ margin: 8px 0; }
.md strong{ color: var(--ink); font-weight:650; }
.md ul,.md ol{ margin: 8px 0; padding-left: 22px; }
.md li{ margin: 4px 0; }
.md li > ul,.md li > ol{ margin: 3px 0; }
.md blockquote{
  margin: 10px 0; padding: 9px 14px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
  color: var(--ink-2);
  font-size: 12.5px;
}
.md blockquote p{ margin:0; }
.md .md-tw{ overflow-x:auto; margin: 12px 0; -webkit-overflow-scrolling: touch; }
.md table{
  width:100%; border-collapse: collapse;
  margin: 0; font-size:12.2px;
  background: var(--surface-2);
  border-radius:8px; overflow:hidden;
  min-width: 100%;
}
.md th,.md td{
  border:1px solid var(--line);
  padding: 7px 10px;
  text-align:left;
  vertical-align: top;
}
.md th{ background: var(--surface-3); font-weight:650; color: var(--ink); font-size:11.8px; }
.md table th:first-child,
.md table td:first-child{ white-space: nowrap; }
.md code{
  font-family: var(--mono); font-size:11.8px;
  background: var(--surface-3); padding:1px 5px; border-radius:4px;
}

/* ---------- 7. 弹层 ---------- */
.modal{ position: fixed; inset:0; z-index: 100; display:grid; place-items:center; padding: 20px; }
.modal-mask{
  position:absolute; inset:0;
  background: rgba(15,18,20,.5);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn{ from{opacity:0;} to{opacity:1;} }
.modal-panel{
  position:relative;
  width: min(680px, 100%);
  max-height: min(86vh, 860px);
  display:flex; flex-direction:column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  overflow:hidden;
  animation: popIn .26s cubic-bezier(.2,.9,.25,1) both;
}
@keyframes popIn{
  from{ opacity:0; transform: scale(.96) translateY(10px); }
  to{ opacity:1; transform:none; }
}
.modal-head{
  display:flex; align-items:center; gap:12px;
  padding: 16px 20px;
  border-bottom:1px solid var(--line);
  flex-shrink:0;
}
.modal-head h3{ flex:1; font-size:15px; }
.modal-body{
  padding: 20px;
  overflow-y:auto;
  flex:1;
}
.modal-foot{
  display:flex; gap:9px; justify-content:flex-end;
  padding: 14px 20px;
  border-top:1px solid var(--line);
  flex-shrink:0;
  background: var(--surface-2);
}
.modal-foot:empty{ display:none; }

/* 设置表单 */
.set-group{ margin-bottom: 20px; }
.set-group > h4{
  font-size:12px; font-weight:700; letter-spacing:.06em;
  color: var(--ink-3);
  margin-bottom: 9px;
}
.set-row{ display:flex; flex-direction:column; gap:5px; margin-bottom: 12px; }
.set-row label{ font-size:12.5px; font-weight:600; }
.set-row .hint{ font-size:11px; color: var(--ink-3); line-height:1.55; }
.set-row input, .set-row select{
  padding: 9px 12px;
  border:1px solid var(--line);
  border-radius:9px;
  background: var(--surface-2);
  font-size:13px;
  outline:none;
  font-family: var(--mono);
  transition: all .16s ease;
}
.set-row input:focus{
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.preset-row{ display:flex; gap:6px; flex-wrap:wrap; margin-top:2px; }
.preset{
  font-size:11px; padding: 4px 10px; border-radius:99px;
  border:1px solid var(--line); color: var(--ink-2);
  background: var(--surface-2);
  transition: all .15s ease;
}
.preset:hover{ border-color: var(--primary); color: var(--primary); }
.test-result{
  margin-top:8px; font-size:12px; padding: 8px 11px;
  border-radius:8px; display:none; line-height:1.6;
}
.test-result.show{ display:block; }
.test-result.ok{ background: var(--done-soft); color: var(--done); }
.test-result.bad{ background: var(--none-soft); color: var(--none); }

/* 自测 */
.quiz-progress{
  display:flex; align-items:center; gap:10px;
  margin-bottom: 16px;
}
.qp-bar{ flex:1; height:5px; background: var(--surface-3); border-radius:99px; overflow:hidden; }
.qp-bar i{ display:block; height:100%; width:0; background: var(--primary); border-radius:99px; transition: width .35s ease; }
.qp-txt{ font-size:11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.q-stem{
  font-size:15px; font-weight:600; line-height:1.65;
  margin-bottom: 16px;
  color: var(--ink);
}
.q-stem .q-tag{
  display:inline-block; font-size:10.5px; font-weight:700;
  color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius:99px;
  margin-right:7px; vertical-align: 2px;
}
.q-opts{ display:flex; flex-direction:column; gap:8px; }
.q-opt{
  display:flex; align-items:flex-start; gap:10px;
  padding: 11px 14px;
  border:1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size:13.2px; line-height:1.6;
  text-align:left;
  transition: all .16s ease;
  width:100%;
}
.q-opt:hover:not(:disabled){ border-color: var(--primary); background: var(--surface); }
.q-opt .oi{
  width:20px; height:20px; flex-shrink:0;
  border-radius:50%; background: var(--surface-3);
  display:grid; place-items:center;
  font-size:11px; font-weight:700; color: var(--ink-3);
}
.q-opt.right{ border-color: var(--done); background: var(--done-soft); }
.q-opt.right .oi{ background: var(--done); color:#fff; }
.q-opt.wrong{ border-color: var(--none); background: var(--none-soft); }
.q-opt.wrong .oi{ background: var(--none); color:#fff; }
.q-opt:disabled{ cursor: default; }

.q-explain{
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  font-size:12.8px; line-height:1.7;
  color: var(--ink-2);
  display:none;
}
.q-explain.show{ display:block; animation: fadeUp .22s ease both; }
.q-explain b{ color: var(--ink); }

.q-result{ text-align:center; padding: 10px 0 4px; }
.q-result .score{
  font-size: 44px; font-weight: 800; letter-spacing:-.04em;
  color: var(--primary); font-variant-numeric: tabular-nums;
  line-height:1.1;
}
.q-result .score small{ font-size:18px; color: var(--ink-3); font-weight:600; }
.q-result p{ font-size:13px; color: var(--ink-2); margin-top:8px; }
.q-result .applied{
  margin-top:14px; padding: 10px 12px;
  background: var(--surface-2); border-radius:var(--r-md);
  font-size:12px; color: var(--ink-2); text-align:left;
  line-height:1.7;
}

/* 报告 */
.report-sec{ margin-bottom: 20px; }
.report-sec h4{
  font-size:12px; font-weight:700; color: var(--ink-3);
  letter-spacing:.06em;
  margin-bottom: 8px;
  display:flex; align-items:center; gap:8px;
}
.report-sec h4 span{
  font-size:11px; font-weight:600; color: var(--ink-3);
  background: var(--surface-3); padding:1px 7px; border-radius:99px;
  letter-spacing:0;
  text-transform:none;
}
.report-item{
  display:flex; gap:9px; align-items:flex-start;
  padding: 8px 11px;
  border-radius:8px;
  font-size:12.5px; line-height:1.6;
  background: var(--surface-2);
  margin-bottom:5px;
  transition: background .14s ease;
}
.report-item:hover{ background: var(--surface-3); cursor:pointer; }
.report-item .ri-id{
  font-family: var(--mono); font-size:10.5px; font-weight:700;
  color: var(--ink-3); flex-shrink:0; margin-top:2px;
}
.report-item .ri-t{ flex:1; }
.report-item .ri-go{ color: var(--primary); font-size:11px; flex-shrink:0; }

/* Toast */
.toast{
  position: fixed;
  left: 50%; bottom: 32px; transform: translateX(-50%) translateY(8px);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px; font-weight:550;
  box-shadow: var(--shadow-3);
  opacity:0;
  transition: all .25s cubic-bezier(.2,.9,.25,1);
  pointer-events:none;
  max-width: calc(100vw - 40px);
}
.toast.show{ opacity:1; transform: translateX(-50%) translateY(0); }

/* ---------- 8. 响应式 ---------- */
@media (max-width: 1024px){
  .overview{ grid-template-columns: 1fr; }
  .ov-side{ flex-direction:row; align-items:stretch; }
  .verdict{ flex:1; }
  .ov-side > .btn{ align-self:stretch; white-space:nowrap; }
  .view-ws.is-active{ grid-template-columns: 220px minmax(0,1fr); }
}

@media (max-width: 820px){
  :root{ --topbar-h: 0px; }
  .topbar-row{
    height:auto;
    padding: 10px 14px 0;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand{ order:1; }
  .top-actions{ order:2; }
  .who-chip{ max-width: 120px; font-size: 11px; padding: 4px 9px; }
  .tabs{
    order:3;
    width:100%;
    margin: 8px 0 0;
    display:grid; grid-template-columns: 1fr 1fr;
  }
  .tab{ justify-content:center; padding: 9px 10px; }

  .kb-wrap{ padding: 16px 13px 90px; }
  .view-ws.is-active{
    display:block;
    padding: 14px 13px 90px;
  }
  .overview{ gap:12px; }
  .ov-main{ padding: 18px 16px; border-radius: var(--r-md); }
  .ov-head h1{ font-size:19px; }
  .ov-metrics{ grid-template-columns: repeat(2,1fr); gap:8px; margin: 15px 0 15px; }
  .m-num{ font-size:22px; }
  .ov-side{ flex-direction:column; }
  .verdict{ border-radius: var(--r-md); }

  .toolbar{ top: 0; position:relative; padding: 10px 0; }
  .toolbar-right{ margin-left:0; width:100%; }
  .search{ flex:1; }
  .search input{ width:100%; }

  .week-head{ padding: 12px 13px; gap:9px; }
  .week-no{ width:28px; height:28px; font-size:12.5px; border-radius:8px; }
  .week-title b{ font-size:13.2px; }
  .week-stat .mini-bar{ display:none; }
  .kb-item{ padding: 12px; }
  .kb-title{ font-size:13.2px; }
  .kb-actions{ gap:6px; }
  .kb-note{ order:5; flex-basis:100%; }

  /* 移动端：步骤列表横向滚动 */
  .ws-side{
    position: static;
    max-height:none;
    margin-bottom: 12px;
    border-radius: var(--r-md);
  }
  .ws-side-head{ display:none; }
  .ws-side-body{
    display:flex; gap:6px; overflow-x:auto; overflow-y:hidden;
    padding: 9px;
    scrollbar-width:none;
  }
  .ws-side-body::-webkit-scrollbar{ display:none; }
  .phase-label{ display:none; }
  .step-btn{
    width:auto; white-space:nowrap; flex-shrink:0;
    padding: 7px 12px; border-radius:99px;
    background: var(--surface-2);
    font-size:12px;
    margin-bottom:0;
  }
  .step-btn .sb-txt{ max-width: 120px; }
  .card{ border-radius: var(--r-md); }
  .card-head{ padding: 12px 14px; }
  .card-body{ padding: 14px; }
  .proj-grid{ grid-template-columns: 1fr; }
  .step-h1{ font-size:17.5px; }
  .modal{ padding:0; place-items:end center; }
  .modal-panel{
    width:100%;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .modal-body{ padding: 16px; }
  .modal-foot{ padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .toast{ bottom: 24px; }
}

@media (max-width: 420px){
  .brand-text em{ display:none; }
  .tab{ font-size:12.5px; }
}

/* 打印 */
@media print{
  .topbar,.toolbar,.ws-side,.modal,.toast,.ai-card,.kb-actions{ display:none !important; }
  .week-body{ display:block !important; }
  .week,.card{ box-shadow:none; border:1px solid #ccc; page-break-inside: avoid; }
  body{ background:#fff; }

  /* 只打印报告弹层 */
  body.print-modal .app{ display:none !important; }
  body.print-modal .modal{
    display:block !important;
    position:static; padding:0;
  }
  body.print-modal .modal-mask,
  body.print-modal .modal-head .icon-btn,
  body.print-modal .modal-foot{ display:none !important; }
  body.print-modal .modal-panel{
    width:100% !important; max-height:none;
    box-shadow:none; border-radius:0; overflow:visible;
  }
  body.print-modal .modal-body{ overflow:visible; padding:0; }
  body.print-modal .modal-head{ border-bottom:2px solid #333; padding:0 0 10px; }
  body.print-modal .report-item{ background:#fff; border-bottom:1px solid #eee; border-radius:0; }
}
