/* ==========================================================================
   社区现场课 · 课堂版 (v7)
   视觉方向：田野手账 —— 暖纸底色、墨绿主色、插画为主角、少而准的强调色
   ========================================================================== */

:root {
  --paper: #f5efe3;
  --paper-deep: #ece3d1;
  --card: #fffcf6;
  --ink: #23302a;
  --ink-2: #4a5550;
  --muted: #7a7b70;
  --line: #e3d8c3;
  --line-strong: #cfc1a6;
  --forest: #2f6b4f;
  --forest-deep: #1f4a37;
  --accent: #2f7d5b;              /* 随案例切换 */
  --tape: #f3cf6b;
  --good: #2f7d5b;
  --good-bg: #e5f1e8;
  --warn: #b7791f;
  --warn-bg: #fbf0d9;
  --bad: #c2452d;
  --bad-bg: #f9e3dc;

  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow: 0 1px 0 rgba(80, 60, 20, .05), 0 6px 20px -8px rgba(80, 60, 20, .18);
  --shadow-lift: 0 2px 0 rgba(80, 60, 20, .06), 0 14px 30px -10px rgba(80, 60, 20, .28);
  --ease: cubic-bezier(.3, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
button:disabled { cursor: not-allowed; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, white); outline-offset: 2px; border-radius: 6px; }

html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(rgba(120, 95, 50, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
}

/* --------------------------------------------------------------------------
   顶部栏
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--forest); color: var(--paper);
}
.brand-mark svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--serif); font-size: 17px; letter-spacing: .04em; }
.brand-text small { font-size: 12px; color: var(--muted); }

.case-tabs {
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.case-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.case-tab:hover { background: var(--paper-deep); }
.case-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tab-accent); opacity: .55; }
.case-tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.case-tab.active .case-dot { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tab-accent) 22%, transparent); }

.tools { display: flex; gap: 2px; }
.tool-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-2);
}
.tool-btn:hover { background: var(--paper); color: var(--ink); }
.tool-btn .ic-off { display: none; }
.tool-btn.muted .ic-on { display: none; }
.tool-btn.muted .ic-off { display: block; }
.tool-btn.muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   舞台与通用页头
   -------------------------------------------------------------------------- */
.stage { overflow: auto; padding: 22px 24px; outline: none; }
.slide {
  max-width: 1320px;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: slide-in .35s var(--ease);
}
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.slide-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.slide-head h2 { font-family: var(--serif); font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: .02em; line-height: 1.3; }
.eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: .12em;
  color: var(--accent);
}
.counter {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 6px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; color: var(--muted);
  white-space: nowrap;
}
.counter b { font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px; font-weight: 600;
  background: var(--warn-bg); color: var(--warn);
  white-space: nowrap;
}
.tag.light { background: rgba(255, 252, 246, .92); color: var(--ink); box-shadow: var(--shadow); padding: 4px 12px; border-radius: 999px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px; font-weight: 700;
  background: var(--card);
  border: 1px solid var(--line-strong);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--forest-deep); }
.btn.primary:disabled { background: var(--line-strong); border-color: var(--line-strong); color: var(--card); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; }
.btn.ghost:hover { color: var(--bad); box-shadow: none; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 26px; font-size: 16px; border-radius: 12px; }

.empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
}
.empty-icon { font-size: 28px; filter: grayscale(.3); opacity: .8; }
.hint { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   0 · 案例速览
   -------------------------------------------------------------------------- */
.brief {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
}
.brief-visual {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  background: var(--paper-deep);
  min-height: 320px;
}
.brief-visual img { width: 100%; height: 100%; object-fit: cover; }
.brief-visual figcaption { position: absolute; left: 16px; top: 16px; }
.brief-body { display: flex; flex-direction: column; gap: 16px; justify-content: center; padding: 8px 4px; }
.brief-body h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1.1;
  letter-spacing: .04em;
}
.brief-theme { font-size: 18px; font-weight: 600; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.brief-theme em {
  font-style: normal;
  background: linear-gradient(transparent 55%, color-mix(in srgb, var(--tape) 75%, transparent) 55%);
  padding: 0 2px;
}
.brief-conflict { font-size: 15px; color: var(--ink-2); line-height: 1.8; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 2px;
}
.stat b { font-family: var(--serif); font-size: 24px; color: var(--accent); line-height: 1.2; white-space: nowrap; }
.stat span { font-size: 13px; font-weight: 600; }
.stat small { font-size: 12px; color: var(--muted); line-height: 1.4; }

.redlines {
  padding: 12px 16px;
  border-left: 3px solid var(--bad);
  background: color-mix(in srgb, var(--bad-bg) 55%, var(--card));
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.redlines-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--bad); margin-bottom: 4px; }
.redlines li { font-size: 14px; color: var(--ink-2); padding: 3px 0; }
.redlines li b { color: var(--ink); margin-right: 8px; }
.brief-body .btn.lg { align-self: flex-start; }

/* --------------------------------------------------------------------------
   1 · 现场侦探
   -------------------------------------------------------------------------- */
.observe {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr);
  gap: 20px;
  min-height: 0;
}
.scene-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.time-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.time-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px; color: var(--ink-2);
  text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.time-tab span { display: flex; flex-direction: column; line-height: 1.3; }
.time-tab span b { font-variant-numeric: tabular-nums; color: var(--ink); }
.time-tab i { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 4px; padding: 1px 7px; background: var(--paper); border-radius: 999px; }
.time-tab.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.time-tab.active svg { color: var(--accent); }
.time-tabs.single .time-tab { cursor: default; }

.scene {
  position: relative;
  aspect-ratio: 1376 / 768;
  border-radius: var(--r-lg);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 30, 25, .12), transparent 30%, transparent 75%, rgba(20, 30, 25, .18)); pointer-events: none; }
.scene-label {
  position: absolute; right: 14px; top: 14px; z-index: 2;
  padding: 4px 12px;
  background: rgba(35, 48, 42, .78);
  color: #fff;
  font-size: 13px; font-weight: 600;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.pin {
  position: absolute; z-index: 3;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 4px;
  background: rgba(255, 252, 246, .95);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  font-size: 13px; font-weight: 700;
  white-space: nowrap;
  transition: transform .2s var(--ease);
}
.pin:hover { transform: translate(-50%, -50%) scale(1.06); }
.pin-dot {
  position: relative;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tape);
  font-size: 16px;
}
.pin:not(.got) .pin-dot::before {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--tape);
  animation: ping 1.8s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
.pin.got { background: rgba(255, 252, 246, .82); color: var(--ink-2); }
.pin.got .pin-dot { background: var(--good); color: #fff; }
.pin.got .pin-dot svg { width: 16px; height: 16px; stroke-width: 3; }

.notebook {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}
.notebook-head { display: flex; flex-direction: column; gap: 8px; }
.notebook h3, .deals h3, .reflect h3 { font-family: var(--serif); font-size: 18px; }
.meter { height: 6px; background: var(--paper-deep); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease); }
.evidence { display: flex; flex-direction: column; gap: 10px; overflow: auto; padding-right: 4px; counter-reset: ev; }
.evidence-item {
  position: relative;
  padding: 12px 14px 12px 42px;
  background: var(--paper);
  border-radius: var(--r-md);
  animation: slide-in .35s var(--ease);
  counter-increment: ev;
}
.evidence-item::before {
  content: counter(ev);
  position: absolute; left: 12px; top: 12px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
}
.evidence-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 4px; }
.evidence-title { font-weight: 700; font-size: 14px; }
.fact, .insight { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.fact b, .insight b { font-size: 11px; font-weight: 700; margin-right: 6px; padding: 0 5px; border-radius: 3px; background: var(--paper-deep); color: var(--muted); }
.insight { margin-top: 3px; }
.insight b { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* --------------------------------------------------------------------------
   2 · 角色读心
   -------------------------------------------------------------------------- */
.interview {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  min-height: 0;
}
.roster { display: flex; flex-direction: column; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-align: left;
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.person:hover { transform: translateX(2px); }
.person.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.person-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.person-text b { font-size: 15px; }
.person-text small { font-size: 12px; color: var(--muted); }
.person-state { font-size: 12px; font-weight: 700; color: var(--muted); }
.person.full .person-state { color: var(--good); }

.avatar {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #f6efe2;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
  display: grid; place-items: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
.avatar-emoji { font-size: 24px; }
.avatar.sm { width: 44px; height: 44px; }
.avatar.lg { width: 96px; height: 96px; border-width: 3px; }
.avatar.lg .avatar-emoji { font-size: 44px; }

.talk {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  min-height: 0;
}
.talk-person { display: flex; gap: 16px; align-items: center; }
.talk-person h3 { font-family: var(--serif); font-size: 22px; line-height: 1.2; }
.talk-person p { font-size: 13px; color: var(--muted); }
.stance { display: inline-flex; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.stance b { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: var(--warn-bg); color: var(--warn); white-space: nowrap; align-self: flex-start; margin-top: 2px; }

.thread {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  background: var(--paper);
  border-radius: var(--r-md);
  overflow: auto;
  min-height: 140px;
  max-height: 46vh;
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.65;
  border-radius: 14px;
  animation: slide-in .3s var(--ease);
}
.bubble.them { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-top-left-radius: 4px; font-family: var(--serif); }
.bubble.them.reveal { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.bubble.me { align-self: flex-end; background: var(--forest); color: #fff; border-top-right-radius: 4px; font-size: 14px; }
.bubble-tag { display: block; font-size: 11px; font-weight: 700; opacity: .75; margin-bottom: 2px; letter-spacing: .05em; }
.insight-note { align-self: flex-start; max-width: 78%; font-size: 13px; color: var(--accent); padding-left: 14px; border-left: 2px solid var(--accent); }
.insight-note b { margin-right: 6px; }

.probes-title { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.probe-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.probe {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: 0 3px 0 var(--line-strong);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.probe:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 var(--line-strong); border-color: var(--accent); }
.probe:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line-strong); }
.probe b { font-size: 14px; }
.probe span { font-size: 13px; color: var(--ink-2); }
.probe.used { box-shadow: none; background: var(--paper); border-style: dashed; opacity: .75; }
.probe i { display: flex; align-items: center; gap: 4px; font-style: normal; font-size: 12px; font-weight: 700; color: var(--good); }

/* --------------------------------------------------------------------------
   3 · 关系连连看
   -------------------------------------------------------------------------- */
.match {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 20px;
}
.board {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: clamp(60px, 12%, 140px);
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  align-content: center;
}
.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wires path { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 8 6; fill: none; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
.col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
.col-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.col-title i, .brick-head i, .sheet-row-head i {
  font-style: normal;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 12px;
}
.node {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.node:hover { border-color: var(--accent); }
.node-icon { font-size: 26px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--paper); border-radius: 12px; flex-shrink: 0; }
.node-text { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.node-text b { font-size: 15px; }
.node-text small { font-size: 12px; color: var(--muted); }
.node-port {
  position: absolute; top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line-strong);
}
.col:not(.right) .node-port { right: -8px; }
.col.right .node-port { left: -8px; }
.node.selected { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); transform: translateX(4px); }
.node.selected .node-port { border-color: var(--accent); background: var(--accent); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); } }
.node.matched { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.node.matched .node-port { background: var(--accent); border-color: var(--accent); }
.node.shake { animation: shake .4s; border-color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.deals {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.deal {
  position: relative;
  padding: 14px 16px;
  background: var(--paper);
  border-radius: var(--r-md);
  animation: slide-in .35s var(--ease);
}
.deal::before { content: ""; position: absolute; left: 16px; top: -5px; width: 46px; height: 12px; background: color-mix(in srgb, var(--tape) 80%, transparent); transform: rotate(-3deg); border-radius: 2px; }
.deal b { display: block; font-size: 15px; margin-bottom: 2px; }
.deal p { font-size: 13px; color: var(--ink-2); }
.soft-note { font-size: 12px; color: var(--muted); padding: 8px 10px; background: var(--paper); border-radius: var(--r-sm); }

/* --------------------------------------------------------------------------
   4 · 方案积木
   -------------------------------------------------------------------------- */
.plan {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 20px;
  align-items: start;
}
.bricks-area { display: flex; flex-direction: column; gap: 16px; }
.brick-group { padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.brick-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.brick-head b { font-family: var(--serif); font-size: 17px; }
.brick-head span { font-size: 13px; color: var(--muted); }
.bricks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.brick {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px;
  text-align: left;
  font-size: 14px; font-weight: 600; line-height: 1.5;
  background: var(--paper);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  transition: border-color .2s, background .2s, transform .15s var(--ease);
}
.brick:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.brick small { font-size: 12px; font-weight: 600; color: var(--muted); }
.brick.on { background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.brick.on small { color: var(--accent); }

.sandbox {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px;
  background: #22302a;
  color: #eef0e8;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.sandbox-head { display: flex; justify-content: space-between; align-items: baseline; }
.sandbox-head h3 { font-family: var(--serif); font-size: 20px; }
.sandbox-head span { font-size: 12px; color: #a9b3a8; letter-spacing: .06em; }
.formula { display: flex; flex-direction: column; gap: 6px; }
.slot {
  display: flex; gap: 10px; align-items: baseline;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, .2);
  font-size: 13px; color: #8f998f;
}
.slot i { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .08em; flex-shrink: 0; }
.slot.filled { border-style: solid; border-color: rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #eef0e8; }
.slot.filled i { color: var(--tape); }

.checks { display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: rgba(255, 255, 255, .05); border-radius: 10px; }
.checks b { display: flex; justify-content: space-between; font-size: 14px; }
.checks b em { font-style: normal; font-variant-numeric: tabular-nums; opacity: .8; }
.checks p { font-size: 13px; color: #b9c2b8; line-height: 1.55; }
.checks > li > div { flex: 1; }
.check-icon {
  flex-shrink: 0;
  min-width: 26px; height: 26px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, .1); color: #cfd6cd;
}
.checks .ok .check-icon { background: #3f9a6e; color: #fff; }
.checks .no .check-icon { background: #d9644a; color: #fff; }
.checks .no b { color: #ffd2c4; }

.result { display: flex; gap: 16px; align-items: center; padding: 6px 0; animation: slide-in .4s var(--ease); }
.score-ring {
  --c: #6cc497;
  position: relative;
  flex-shrink: 0;
  width: 86px; height: 86px;
  border-radius: 50%;
  display: grid; place-items: center; align-content: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0);
}
.score-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #22302a; }
.score-ring b, .score-ring small { position: relative; line-height: 1; }
.score-ring b { font-family: var(--serif); font-size: 30px; }
.score-ring small { font-size: 11px; color: #a9b3a8; margin-top: 2px; }
.v-revise .score-ring { --c: var(--tape); }
.v-fail .score-ring { --c: #e07a5f; }
.verdict { display: flex; flex-direction: column; gap: 4px; }
.verdict b { font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.verdict span { font-size: 13px; color: #b9c2b8; }
.v-pass .verdict b { color: #9be0bb; }
.v-revise .verdict b { color: var(--tape); }
.v-fail .verdict b { color: #ffab94; }

.sandbox .btn.primary { background: var(--tape); border-color: var(--tape); color: #2a2412; }
.sandbox .btn.primary:hover:not(:disabled) { background: #f7da87; }
.sandbox .btn.primary:disabled { background: rgba(255, 255, 255, .1); border-color: transparent; color: #8f998f; }

.sandbox.scanning::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 36%;
  background: linear-gradient(180deg, transparent, rgba(243, 207, 107, .22), transparent);
  animation: scan 1.1s linear infinite;
  pointer-events: none;
}
@keyframes scan { from { transform: translateY(-100%); } to { transform: translateY(300%); } }

/* --------------------------------------------------------------------------
   5 · 成果归档
   -------------------------------------------------------------------------- */
.dossier {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}
.sheet {
  position: relative;
  padding: 28px 30px 28px 56px;
  background:
    linear-gradient(90deg, transparent 38px, rgba(194, 69, 45, .35) 38px, rgba(194, 69, 45, .35) 39px, transparent 39px),
    var(--card);
  border: 1px solid var(--line);
  border-radius: 6px var(--r-lg) var(--r-lg) 6px;
  box-shadow: var(--shadow-lift);
}
.sheet-title { margin-bottom: 16px; }
.sheet-title h3 { font-family: var(--serif); font-size: 26px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sheet-title small { font-size: 14px; color: var(--muted); font-family: var(--sans); font-weight: 500; }
.sheet-row { padding: 12px 0; border-top: 1px dashed var(--line-strong); }
.sheet-row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sheet-row-head i { width: auto; padding: 0 7px; border-radius: 5px; }
.sheet-row-head b { font-family: var(--serif); font-size: 17px; flex: 1; }
.sheet-row-head span { font-size: 13px; font-weight: 700; color: var(--warn); }
.sheet-row-head span.full { color: var(--good); }
.sheet-row li { font-size: 14px; color: var(--ink-2); padding: 3px 0 3px 14px; position: relative; }
.sheet-row li::before { content: ""; position: absolute; left: 0; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.sheet-row li b { color: var(--ink); margin-right: 8px; }
.plan-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.plan-dl dt { font-weight: 700; color: var(--muted); }
.plan-dl dd small { margin-left: 8px; color: var(--muted); }
.plan-dl b.pass { color: var(--good); }
.plan-dl b.revise { color: var(--warn); }
.plan-dl b.fail { color: var(--bad); }

.reflect {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.reflect-sub { font-size: 13px; color: var(--muted); }
.reflect ol { counter-reset: q; display: flex; flex-direction: column; gap: 10px; }
.reflect li { counter-increment: q; position: relative; padding: 10px 12px 10px 40px; background: var(--paper); border-radius: var(--r-md); font-size: 14px; line-height: 1.6; }
.reflect li::before { content: counter(q); position: absolute; left: 12px; top: 10px; font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--accent); line-height: 1.4; }
.reflect-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* --------------------------------------------------------------------------
   底部导航
   -------------------------------------------------------------------------- */
.navbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px; font-weight: 700;
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.nav-btn:hover:not(:disabled) { background: var(--paper); }
.nav-btn:disabled { opacity: .35; }
.nav-btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.nav-btn.primary:hover { background: var(--forest-deep); }
.steps { flex: 1; display: flex; justify-content: center; align-items: center; gap: 0; }
.steps li { display: flex; align-items: center; }
.steps li + li::before { content: ""; width: clamp(8px, 3vw, 40px); height: 2px; background: var(--line); margin: 0 4px; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 999px; }
.step:hover { background: var(--paper); }
.step-num {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--card);
}
.step-num svg { width: 14px; height: 14px; stroke-width: 3; }
.step-label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.step.done .step-num { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.step.active .step-num { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.step.active .step-label { color: var(--ink); }

/* --------------------------------------------------------------------------
   弹窗与提示
   -------------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(35, 48, 42, .45);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px 26px;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4);
  transform: translateY(10px);
  transition: transform .25s var(--ease);
}
.modal.open .modal-card { transform: none; }
.modal-card.wide { width: min(680px, 100%); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h3, .quest-done h3 { font-family: var(--serif); font-size: 22px; line-height: 1.3; }
.icon-close { font-size: 26px; line-height: 1; color: var(--muted); width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.icon-close:hover { background: var(--paper); color: var(--ink); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-foot.center { justify-content: center; }

.guide-list { counter-reset: g; display: flex; flex-direction: column; gap: 10px; }
.guide-list li { counter-increment: g; position: relative; padding-left: 36px; font-size: 14px; color: var(--ink-2); }
.guide-list li::before { content: counter(g); position: absolute; left: 0; top: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
.guide-list b { color: var(--ink); margin-right: 8px; }
.guide-tip { margin-top: 14px; padding: 10px 12px; background: var(--paper); border-radius: var(--r-sm); font-size: 13px; color: var(--muted); }
kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--card); font-family: var(--sans); font-size: 12px; color: var(--ink); }

.quest-progress { display: flex; gap: 6px; margin-bottom: 14px; }
.quest-progress i { flex: 1; height: 5px; border-radius: 999px; background: var(--paper-deep); }
.quest-progress i.done { background: var(--good); }
.quest-progress i.now { background: var(--tape); }
.rule-card { padding: 10px 14px; background: var(--paper); border-left: 3px solid var(--forest); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 14px; color: var(--ink-2); margin-bottom: 14px; }
.quest-q { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.quest-opts { display: flex; flex-direction: column; gap: 8px; }
.quest-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; text-align: left; font-size: 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-md); transition: border-color .2s; }
.quest-opt:hover:not(:disabled) { border-color: var(--accent); }
.quest-opt i { font-style: normal; font-weight: 700; color: var(--muted); }
.quest-opt.right { border-color: var(--good); background: var(--good-bg); }
.quest-opt.wrong { border-color: var(--bad); background: var(--bad-bg); opacity: .8; }
.quest-feedback { min-height: 24px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.quest-feedback.good { color: var(--good); }
.quest-feedback.bad { color: var(--bad); }
.quest-done { text-align: center; padding: 10px 0; }
.quest-done p { margin-top: 8px; color: var(--ink-2); }

.toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  padding: 9px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .35);
  animation: toast-in .3s var(--ease);
  transition: opacity .3s, transform .3s;
}
.toast.good { background: var(--forest); }
.toast.warn { background: #8a5a14; }
.toast.bad { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* --------------------------------------------------------------------------
   响应式：平板 / 手机 / 超星窄 iframe
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .brand-text small { display: none; }
  .tool-btn span { display: none; }
  .step-label { display: none; }
  .step.active .step-label { display: inline; }
  .interview { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .case-tabs { order: 3; width: 100%; min-width: 0; margin: 0; overflow-x: auto; }
  .case-tab { flex: 1; justify-content: center; padding: 7px 10px; }
  .tools { margin-left: auto; }
  .stage { padding: 16px; }
  .brief, .observe, .interview, .match, .plan, .dossier { grid-template-columns: 1fr; }
  .brief-visual { min-height: 0; aspect-ratio: 16 / 9; }
  .roster { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .person { flex: 0 0 auto; }
  .person-text small { display: none; }
  .thread { max-height: none; }
  .sandbox, .reflect { position: static; }
  .slide-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .navbar { padding: 8px 12px; gap: 8px; }
  .nav-btn span { display: none; }
  .nav-btn { padding: 9px 11px; }
}

@media (max-width: 560px) {
  .brand-text strong { font-size: 15px; }
  .stats { grid-template-columns: 1fr; }
  .time-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
  .time-tab { flex: 0 0 auto; padding: 6px 10px; }
  .stat { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .stat small { width: 100%; }
  .board { grid-template-columns: 1fr; row-gap: 18px; padding: 16px; }
  .node-port { display: none; }
  .pin { padding: 3px; }
  .pin-label { display: none; }
  .pin-dot { width: 32px; height: 32px; }
  .bubble, .insight-note { max-width: 92%; }
  .sheet { padding: 22px 18px 22px 40px; background: var(--card); }
  .sheet::before { content: ""; position: absolute; left: 24px; top: 0; bottom: 0; width: 1px; background: rgba(194, 69, 45, .35); }
  .steps li + li::before { width: 6px; margin: 0 2px; }
  .step { padding: 4px; }
  .step.active .step-label { display: none; }
}

@media (max-width: 374px) {
  .navbar { padding-inline: 8px; gap: 6px; }
  .nav-btn { flex: 0 0 auto; }
  .steps { min-width: 0; }
  .steps li { flex-shrink: 0; }
  .steps li + li::before { width: 2px; margin: 0 1px; }
  .step { padding: 4px 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------------------------------------
   打印：只打印学习单
   -------------------------------------------------------------------------- */
@media print {
  body { background: #fff; }
  .topbar, .navbar, .reflect-actions, .toasts, .modal { display: none !important; }
  .app { display: block; height: auto; }
  .stage { overflow: visible; padding: 0; }
  .dossier { display: block; }
  .sheet { box-shadow: none; border: 1px solid #ccc; margin-bottom: 16px; }
  .reflect { box-shadow: none; border: 1px solid #ccc; position: static; }
}
