/* ============================================================
   WorkBuddy 提示词工具箱 · 全文交互版
   视觉系统：苹果原生 × 低饱和手账 × 轻手绘
   ============================================================ */

:root {
  --bg: #faf7f2;
  --bg-2: #f3eee6;
  --surface: #ffffff;
  --surface-2: #f7f3ec;
  --surface-3: #efe9df;
  --ink: #221e19;
  --ink-2: #5f574c;
  --ink-3: #978d7f;
  --line: rgba(34, 30, 25, .09);
  --line-2: rgba(34, 30, 25, .18);
  --accent: #e2604f;
  --accent-ink: #fff;
  --accent-soft: #fbeee9;
  --accent-strong: #c94f41;
  --shadow-sm: 0 1px 2px rgba(34, 30, 25, .04), 0 6px 18px rgba(34, 30, 25, .06);
  --shadow-md: 0 2px 6px rgba(34, 30, 25, .06), 0 18px 44px rgba(34, 30, 25, .12);
  --shadow-lg: 0 4px 12px rgba(34, 30, 25, .08), 0 28px 70px rgba(34, 30, 25, .16);

  --c-coral: #e0705c;
  --c-coral-bg: #fbefe9;
  --c-coral-line: rgba(224, 112, 92, .35);
  --c-blue: #6f8bb2;
  --c-blue-bg: #eef2f8;
  --c-blue-line: rgba(111, 139, 178, .35);
  --c-sand: #c19b52;
  --c-sand-bg: #f8f1e0;
  --c-sand-line: rgba(193, 155, 82, .38);
  --c-green: #7da07e;
  --c-green-bg: #edf4ec;
  --c-green-line: rgba(125, 160, 126, .38);
  --c-purple: #9189b4;
  --c-purple-bg: #f1eff7;
  --c-purple-line: rgba(145, 137, 180, .38);
  --c-gray: #8f877c;
  --c-gray-bg: #f2efe9;
  --c-gray-line: rgba(143, 135, 124, .38);

  --danger: #c2453a;
  --danger-bg: #fbefec;
  --danger-line: rgba(194, 69, 58, .4);
  --warn: #a87f16;
  --warn-bg: #fbf3dd;
  --warn-line: rgba(168, 127, 22, .4);
  --ok: #3f7d54;
  --ok-bg: #eaf4ec;
  --ok-line: rgba(63, 125, 84, .35);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --content-max: 1120px;
  --sidebar-w: 268px;
  --topbar-h: 60px;
}

html[data-theme="dark"] {
  --bg: #161310;
  --bg-2: #201c17;
  --surface: #221e19;
  --surface-2: #2a251e;
  --surface-3: #332d24;
  --ink: #ece6dd;
  --ink-2: #b7aea0;
  --ink-3: #7f7669;
  --line: rgba(236, 230, 221, .10);
  --line-2: rgba(236, 230, 221, .22);
  --accent: #ef8a74;
  --accent-ink: #22120d;
  --accent-soft: #3a241e;
  --accent-strong: #ff9c85;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .3), 0 18px 44px rgba(0, 0, 0, .4);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .35), 0 28px 70px rgba(0, 0, 0, .5);

  --c-coral: #e07d68;
  --c-coral-bg: rgba(224, 125, 104, .14);
  --c-coral-line: rgba(224, 125, 104, .4);
  --c-blue: #8aa5cc;
  --c-blue-bg: rgba(138, 165, 204, .14);
  --c-blue-line: rgba(138, 165, 204, .4);
  --c-sand: #d0ac66;
  --c-sand-bg: rgba(208, 172, 102, .14);
  --c-sand-line: rgba(208, 172, 102, .4);
  --c-green: #96b897;
  --c-green-bg: rgba(150, 184, 151, .14);
  --c-green-line: rgba(150, 184, 151, .4);
  --c-purple: #a49cc6;
  --c-purple-bg: rgba(164, 156, 198, .14);
  --c-purple-line: rgba(164, 156, 198, .4);
  --c-gray: #a1988b;
  --c-gray-bg: rgba(161, 152, 139, .14);
  --c-gray-line: rgba(161, 152, 139, .4);

  --danger: #e2726a;
  --danger-bg: rgba(226, 114, 106, .14);
  --danger-line: rgba(226, 114, 106, .4);
  --warn: #d9b45e;
  --warn-bg: rgba(217, 180, 94, .14);
  --warn-line: rgba(217, 180, 94, .4);
  --ok: #7fbb90;
  --ok-bg: rgba(127, 187, 144, .14);
  --ok-line: rgba(127, 187, 144, .4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 14px); }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.72;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

::selection { background: rgba(226, 96, 79, .22); }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Reading progress ---------- */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; pointer-events: none;
}
.reading-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--c-coral), var(--c-sand), var(--c-green));
  border-radius: 0 3px 3px 0;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 120;
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  background: rgba(250, 247, 242, .72);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--content-max); margin: 0 auto; height: var(--topbar-h);
  padding: 0 22px; display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand .brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--c-coral), var(--c-sand));
  color: #fff; font-size: 17px; box-shadow: var(--shadow-sm);
}
.brand .brand-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  height: 38px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface);
  transition: all .2s ease; white-space: nowrap;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn .kbd {
  font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--ink-3);
  font-family: var(--font-mono); border: 1px solid var(--line);
}
.nav-toggle { display: none; }
.theme-glyph { display: inline-block; width: 16px; text-align: center; }

/* ---------- Layout ---------- */
.layout { max-width: var(--content-max); margin: 0 auto; display: grid; grid-template-columns: var(--sidebar-w) 1fr; gap: 40px; padding: 30px 22px 90px; }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: calc(var(--topbar-h) + 22px); height: fit-content; max-height: calc(100vh - var(--topbar-h) - 44px); overflow-y: auto; padding-right: 6px; }
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.toc-title { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; margin: 4px 0 12px; padding: 0 12px; }
.toc-group { margin-bottom: 20px; }
.toc-link {
  display: block; padding: 7px 12px; border-radius: 11px; font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  border-left: 2px solid transparent; transition: all .18s ease; line-height: 1.45;
}
.toc-link .toc-no { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-right: 6px; }
.toc-link:hover { background: var(--surface-2); color: var(--ink); }
.toc-link.active { color: var(--accent-strong); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 700; }
.toc-link.active .toc-no { color: var(--accent); }

.sidebar-foot {
  margin-top: 8px; padding: 14px 12px; border-top: 1px dashed var(--line-2); font-size: 12px; color: var(--ink-3); line-height: 1.6;
}
.sidebar-foot b { color: var(--ink-2); }

/* ---------- Main ---------- */
.main { min-width: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 40px 6px 30px; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: -20px -40px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(420px 260px at 12% 8%, var(--c-coral-bg), transparent 70%),
    radial-gradient(460px 300px at 88% 20%, var(--c-blue-bg), transparent 70%),
    radial-gradient(420px 260px at 60% 96%, var(--c-sand-bg), transparent 70%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 600;
  border: 1px solid var(--c-coral-line); margin-bottom: 18px;
}
.hero h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; letter-spacing: -.03em; margin-bottom: 14px; }
.hero .lead { font-size: 17px; color: var(--ink-2); max-width: 720px; line-height: 1.8; }
.hero .lead b { color: var(--ink); }

.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.hero-chip em { font-style: normal; color: var(--accent-strong); font-family: var(--font-mono); font-size: 12px; }

/* ---------- Section ---------- */
section { scroll-margin-top: calc(var(--topbar-h) + 16px); padding-top: 12px; }

.part-head { display: flex; align-items: flex-start; gap: 18px; margin: 34px 0 8px; padding-top: 26px; border-top: 1px solid var(--line); }
.part-no {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font-size: 22px; font-weight: 800; font-family: var(--font-mono);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--accent-strong);
}
.part-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.part-head .part-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-top: 4px; }
.part-head .part-tag { margin-left: auto; flex: 0 0 auto; }

h3.sub { font-size: 19px; font-weight: 800; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
h3.sub::before { content: ""; width: 5px; height: 18px; border-radius: 3px; background: linear-gradient(180deg, var(--c-coral), var(--c-sand)); }
h4.mini { font-size: 15.5px; font-weight: 700; margin: 18px 0 8px; }

.lead-note { color: var(--ink-2); font-size: 15px; margin: 10px 0 6px; line-height: 1.8; }
.lead-note b { color: var(--ink); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 24px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.card.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--line-2); }

.tint { background: var(--surface-2); }

/* ---------- Prompt ---------- */
.prompt {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm); margin: 14px 0 18px;
}
.prompt-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.prompt-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.prompt-title .p-ico { font-size: 15px; }
.prompt-title .p-use { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 500; margin-top: 1px; }
.prompt-head-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; font-size: 12.5px; font-weight: 700;
  padding: 7px 12px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface);
  transition: all .18s ease;
}
.btn:hover { color: var(--ink); border-color: var(--line-2); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow-sm); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-copy { background: var(--accent-soft); border-color: var(--c-coral-line); color: var(--accent-strong); }
.btn-copy:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.prompt-body {
  padding: 16px 20px; white-space: pre-wrap; word-break: break-word;
  font-size: 13.5px; line-height: 1.78; color: var(--ink-2);
  position: relative;
}
.prompt-body[data-long] { max-height: 340px; overflow: hidden; }
.prompt-body[data-long]:not(.open)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 80px;
  background: linear-gradient(180deg, transparent, var(--surface));
  pointer-events: none;
}
.prompt-body[data-long].open { max-height: none; }
.prompt-body::-webkit-scrollbar { width: 5px; }
.prompt-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.prompt-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px dashed var(--line-2); font-size: 12px; color: var(--ink-3); }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface-2);
}
.chip.coral { background: var(--c-coral-bg); color: var(--c-coral); border-color: var(--c-coral-line); }
.chip.blue { background: var(--c-blue-bg); color: var(--c-blue); border-color: var(--c-blue-line); }
.chip.sand { background: var(--c-sand-bg); color: var(--c-sand); border-color: var(--c-sand-line); }
.chip.green { background: var(--c-green-bg); color: var(--c-green); border-color: var(--c-green-line); }
.chip.purple { background: var(--c-purple-bg); color: var(--c-purple); border-color: var(--c-purple-line); }
.chip.gray { background: var(--c-gray-bg); color: var(--c-gray); border-color: var(--c-gray-line); }

/* ---------- Copyable inline ---------- */
.copyable {
  position: relative; border: 1px dashed var(--line-2); border-radius: var(--r-md);
  padding: 12px 44px 12px 16px; margin: 10px 0; background: var(--surface-2);
  font-size: 14px; line-height: 1.7; cursor: copy; transition: border-color .2s ease, background .2s ease;
}
.copyable:hover { border-color: var(--accent); background: var(--accent-soft); }
.copyable .copy-ico {
  position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2);
}
.copyable:hover .copy-ico { color: var(--accent-strong); border-color: var(--c-coral-line); }

/* ---------- Checklists ---------- */
.check-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); margin: 14px 0 20px; overflow: hidden; }
.check-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.check-head h4 { font-size: 15px; font-weight: 800; flex: 1; }
.check-progress { font-family: var(--font-mono); font-size: 13px; color: var(--accent-strong); font-weight: 700; }
.check-bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.check-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c-coral), var(--c-sand), var(--c-green)); border-radius: 4px; transition: width .4s ease; }
.check-list { padding: 8px 8px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 12px; border-radius: 12px; cursor: pointer; transition: background .18s ease; }
.check-item:hover { background: var(--surface-2); }
.check-item input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px; border-radius: 7px; border: 2px solid var(--line-2);
  display: grid; place-items: center; transition: all .2s ease; background: var(--surface);
}
.check-item input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check-box::after { content: "✓"; font-size: 13px; color: #fff; opacity: 0; transform: scale(.4); transition: all .2s ease; font-weight: 800; }
.check-item input:checked + .check-box::after { opacity: 1; transform: scale(1); }
.check-text { font-size: 14px; line-height: 1.6; color: var(--ink); transition: color .2s ease; }
.check-item input:checked ~ .check-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }
.check-item.done .check-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-md); padding: 14px 16px; margin: 14px 0; border: 1px solid; font-size: 14px; line-height: 1.7; }
.alert .a-ico { font-size: 17px; flex: 0 0 auto; margin-top: 1px; }
.alert b { font-weight: 800; }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--ink); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--ink); }
.alert-info { background: var(--c-blue-bg); border-color: var(--c-blue-line); color: var(--ink); }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ink); }

/* ---------- Quote / phenomena ---------- */
.quote { border-left: 3px solid var(--c-coral); background: var(--surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; padding: 12px 16px; margin: 12px 0; font-size: 14.5px; color: var(--ink-2); }
.quote .q-label { display: block; font-size: 11.5px; font-weight: 700; color: var(--c-coral); letter-spacing: .08em; margin-bottom: 4px; text-transform: uppercase; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Lists ---------- */
.rich-list { margin: 10px 0 6px; }
.rich-list li { position: relative; padding: 5px 0 5px 26px; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.rich-list li::before { content: ""; position: absolute; left: 6px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--c-coral); opacity: .7; }
.rich-list.li-blue li::before { background: var(--c-blue); }
.rich-list.li-sand li::before { background: var(--c-sand); }
.rich-list.li-green li::before { background: var(--c-green); }
.rich-list.li-purple li::before { background: var(--c-purple); }
.rich-list.li-gray li::before { background: var(--c-gray); }
.rich-list.li-line li::before { content: "—"; background: none; width: auto; font-family: var(--font-mono); color: var(--ink-3); left: 0; top: 5px; }
.rich-list.li-coral li::before { background: var(--c-coral); }
.rich-list.li-square li::before { content: ""; border-radius: 3px; width: 8px; height: 8px; top: 12px; left: 4px; }
.rich-list b, .rich-list strong { color: var(--ink); font-weight: 700; }
.rich-list.li-num { counter-reset: rn; }
.rich-list.li-num li { padding-left: 34px; counter-increment: rn; }
.rich-list.li-num li::before {
  content: counter(rn); width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong);
  font-size: 11.5px; font-weight: 800; font-family: var(--font-mono); display: grid; place-items: center; left: 0; top: 7px;
}

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); margin: 14px 0; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th, td { padding: 13px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td .cell-lead { font-weight: 700; color: var(--ink); }
td .cell-sub { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Stepper ---------- */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0 10px; }
.step {
  position: relative; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 14px 12px; background: var(--surface);
  cursor: pointer; transition: all .22s ease; box-shadow: var(--shadow-sm); text-align: left;
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.step .s-no { font-size: 20px; font-weight: 800; font-family: var(--font-mono); color: var(--c-coral); }
.step .s-name { font-weight: 700; font-size: 14.5px; margin-top: 4px; }
.step .s-do { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.step .s-get { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); line-height: 1.5; }
.step .s-get b { display: block; font-size: 11px; color: var(--ink-3); font-weight: 700; letter-spacing: .05em; margin-bottom: 2px; }
.step.active { border-color: var(--accent); background: var(--accent-soft); }
.step.active .s-no { color: var(--accent-strong); }

/* ---------- Flow diagram ---------- */
.flow { margin: 18px 0; }
.flow-node {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 600;
}
.flow-node .f-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: var(--surface-2); border: 1px solid var(--line); flex: 0 0 auto; }
.flow-arrow { text-align: center; font-size: 17px; color: var(--c-coral); line-height: 1.15; padding: 2px 0; }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin: 14px 0 0; }
.tab-btn { padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-2); transition: all .2s ease; }
.tab-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Badges / tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; border: 1px solid var(--line);
}
.badge.updated { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.keep { background: var(--c-green-bg); color: var(--c-green); border-color: var(--c-green-line); }
.badge.hot { background: var(--c-blue-bg); color: var(--c-blue); border-color: var(--c-blue-line); }

/* ---------- Resource cards ---------- */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin: 16px 0; }
.res-card {
  display: block; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: all .22s ease; position: relative;
}
.res-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.res-card .r-emo { font-size: 26px; }
.res-card .r-name { font-weight: 700; font-size: 14px; margin-top: 8px; }
.res-card .r-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.res-card .r-url { font-size: 11px; color: var(--c-blue); margin-top: 8px; word-break: break-all; font-family: var(--font-mono); }
.res-card .r-arrow { position: absolute; right: 12px; top: 14px; color: var(--ink-3); transition: transform .22s ease; }
.res-card:hover .r-arrow { transform: translate(2px, -2px); color: var(--accent); }

/* ---------- Quick cards ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 18px 0; }
.quick-card {
  display: block; padding: 18px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: all .22s ease; position: relative; overflow: hidden;
}
.quick-card::after { content: "→"; position: absolute; right: 16px; bottom: 14px; font-size: 18px; color: var(--ink-3); transition: all .22s ease; }
.quick-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.quick-card:hover::after { color: var(--accent); right: 13px; }
.quick-card .q-emo { font-size: 26px; }
.quick-card .q-title { font-weight: 800; font-size: 15.5px; margin-top: 10px; }
.quick-card .q-desc { font-size: 13px; color: var(--ink-2); margin-top: 5px; line-height: 1.6; }
.quick-card .q-tag { display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }

/* ---------- TOC grid ---------- */
.toc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.toc-grid a {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; transition: all .2s ease;
}
.toc-grid a:hover { border-color: var(--line-2); transform: translateX(3px); box-shadow: var(--shadow-sm); }
.toc-grid a .tg-no { font-family: var(--font-mono); color: var(--accent); font-weight: 800; }
.toc-grid a .tg-sub { display: block; font-size: 11px; color: var(--ink-3); font-weight: 500; }

/* ---------- Divider / note ---------- */
.divider { height: 1px; background: var(--line); margin: 22px 0; }
.note { font-size: 13px; color: var(--ink-3); line-height: 1.65; }
.note b { color: var(--ink-2); }

/* ---------- Phone demo ---------- */
.demo-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 26px; align-items: center; margin: 20px 0; }
.phone {
  width: 340px; height: 620px; border-radius: 46px; background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden; padding: 0 14px;
}
.phone-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 118px; height: 26px; background: var(--ink); border-radius: 20px; z-index: 5; }
.phone-status { display: flex; justify-content: space-between; padding: 16px 6px 4px; font-size: 11px; font-weight: 700; color: var(--ink); }
.phone-screen { height: 100%; overflow-y: auto; padding: 6px 2px 30px; scrollbar-width: none; }
.phone-screen::-webkit-scrollbar { display: none; }
.ph-hello { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.ph-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(140deg, var(--c-coral), var(--c-sand)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.ph-hello .ph-name { font-weight: 800; font-size: 15px; }
.ph-hello .ph-date { font-size: 10.5px; color: var(--ink-3); }
.ph-hello .ph-streak { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--c-sand); background: var(--c-sand-bg); padding: 4px 9px; border-radius: 999px; }
.ph-brief {
  border-radius: 18px; padding: 14px 14px 12px; background: var(--c-coral-bg); border: 1px solid var(--c-coral-line); margin-bottom: 12px;
}
.ph-brief .b-title { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--c-coral); margin-bottom: 8px; }
.ph-brief p { font-size: 11.5px; line-height: 1.65; color: var(--ink-2); }
.ph-brief p b { color: var(--ink); }
.ph-brief p + p { margin-top: 6px; }
.ph-top3 { border-radius: 18px; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.ph-top3-head { display: flex; align-items: center; margin-bottom: 8px; }
.ph-top3-head .t-title { font-size: 12.5px; font-weight: 800; flex: 1; }
.ph-ring { position: relative; width: 34px; height: 34px; }
.ph-ring svg { transform: rotate(-90deg); }
.ph-ring .ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9.5px; font-weight: 800; color: var(--accent-strong); }
.ph-top3-item { display: flex; gap: 9px; align-items: center; padding: 8px 6px; border-radius: 10px; cursor: pointer; transition: background .18s ease; }
.ph-top3-item:hover { background: var(--surface-2); }
.ph-top3-item input { position: absolute; opacity: 0; }
.ph-dot { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--line-2); display: grid; place-items: center; transition: all .2s ease; }
.ph-top3-item input:checked + .ph-dot { background: var(--accent); border-color: var(--accent); }
.ph-dot::after { content: "✓"; font-size: 10px; color: #fff; opacity: 0; transform: scale(.4); transition: all .2s ease; font-weight: 800; }
.ph-top3-item input:checked + .ph-dot::after { opacity: 1; transform: scale(1); }
.ph-top3-item .t-name { font-size: 11.5px; font-weight: 600; line-height: 1.35; flex: 1; }
.ph-top3-item .t-tag { font-size: 9.5px; color: var(--ink-3); }
.ph-top3-item.done .t-name { color: var(--ink-3); text-decoration: line-through; }
.ph-tl { border-radius: 18px; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.ph-tl-title { font-size: 12.5px; font-weight: 800; margin-bottom: 8px; }
.ph-tl-item { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 11.5px; }
.ph-tl-item .t-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); width: 34px; flex: 0 0 auto; }
.ph-tl-item .t-bar { height: 16px; border-radius: 6px; padding: 0 8px; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--ink-2); }
.ph-tabs { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; padding: 8px 8px 12px; background: rgba(255, 255, 255, .8); background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.ph-tabs .pt { text-align: center; font-size: 9px; color: var(--ink-3); font-weight: 600; }
.ph-tabs .pt i { display: block; font-size: 15px; font-style: normal; margin-bottom: 2px; }
.ph-tabs .pt.on { color: var(--accent-strong); }

.demo-note { font-size: 13.5px; color: var(--ink-2); line-height: 1.8; }
.demo-note b { color: var(--ink); }

/* ---------- Search modal ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 12, 8, .4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 300; display: grid; place-items: start center; padding-top: 12vh; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.modal-mask.show { opacity: 1; pointer-events: auto; }
.search-modal { width: min(640px, 92vw); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(-8px) scale(.98); transition: transform .2s ease; }
.modal-mask.show .search-modal { transform: none; }
.search-input { width: 100%; border: 0; outline: 0; padding: 18px 20px; font-size: 17px; background: transparent; color: var(--ink); font-family: inherit; border-bottom: 1px solid var(--line); }
.search-input::placeholder { color: var(--ink-3); }
.search-hint { padding: 10px 20px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.search-results { max-height: 46vh; overflow-y: auto; padding: 8px; }
.search-results::-webkit-scrollbar { width: 5px; }
.search-results::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.search-empty { padding: 30px; text-align: center; color: var(--ink-3); font-size: 14px; }
.search-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; font-size: 14px; transition: background .15s ease; }
.search-item:hover { background: var(--surface-2); }
.search-item .si-path { font-size: 11px; color: var(--accent-strong); font-weight: 700; margin-bottom: 3px; }
.search-item .si-text { color: var(--ink-2); line-height: 1.55; }
.search-item mark { background: var(--warn-bg); color: var(--warn); border-radius: 3px; padding: 0 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px); z-index: 400;
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .28s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .t-ico { color: var(--ok); }

/* ---------- Back to top ---------- */
#backTop {
  position: fixed; right: 26px; bottom: 26px; z-index: 150; width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-md); font-size: 18px; color: var(--ink-2);
  display: grid; place-items: center; opacity: 0; transform: translateY(12px); pointer-events: none; transition: all .25s ease;
}
#backTop.show { opacity: 1; transform: none; pointer-events: auto; }
#backTop:hover { color: var(--accent-strong); border-color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.flow-node.reveal, .flow-arrow.reveal { transition-delay: calc(var(--i, 0) * 70ms); }

/* ---------- Flash highlight (search / step jump) ---------- */
.flash { animation: flashRing 1.5s ease; }
@keyframes flashRing {
  0% { box-shadow: 0 0 0 0 rgba(226, 96, 79, .5); }
  70% { box-shadow: 0 0 0 16px rgba(226, 96, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 96, 79, 0); }
}

/* ---------- Code block ---------- */
.codeblock { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: var(--ink-2); overflow-x: auto; margin: 12px 0; white-space: pre; }
.codeblock b { color: var(--ink); }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 30px 0 40px; text-align: center; color: var(--ink-3); font-size: 13px; line-height: 1.8; }
.site-foot b { color: var(--ink-2); }

/* ---------- Keycap / inline em ---------- */
em.k { font-style: normal; font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }

/* ---------- Accordion for part2 issues ---------- */
.issue { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); margin: 12px 0; overflow: hidden; }
.issue-head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 16px 18px; font-size: 15px; font-weight: 700; transition: background .2s ease; }
.issue-head:hover { background: var(--surface-2); }
.issue-head .i-no { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 800; flex: 0 0 auto; }
.issue-head .i-title { flex: 1; }
.issue-head .i-chev { flex: 0 0 auto; color: var(--ink-3); transition: transform .25s ease; font-size: 13px; }
.issue.open .i-chev { transform: rotate(180deg); }
.issue-body { display: none; padding: 6px 20px 20px; }
.issue.open .issue-body { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 20px 18px 90px; }
  .sidebar { display: none; }
  .nav-toggle { display: inline-flex; }
  .two-col { grid-template-columns: 1fr; }
  .demo-wrap { grid-template-columns: 1fr; justify-items: center; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .toc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .brand-sub { display: none; }
  .brand { font-size: 13.5px; }
  .srch-text, .tog-text, .kbd { display: none; }
  #searchBtn { padding: 0 12px; }
  .topbar-inner { gap: 8px; }
  .hero { padding-top: 26px; }
  .part-head { gap: 12px; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .topbar-inner { padding: 0 14px; }
  .hero h1 { font-size: 28px; }
  .part-head h2 { font-size: 20px; }
  .part-no { width: 44px; height: 44px; font-size: 18px; }
  .card, .issue-head { padding-left: 16px; padding-right: 16px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .phone { width: 300px; height: 560px; border-radius: 40px; }
  #backTop { right: 16px; bottom: 16px; }
}

/* ---------- Sidebar drawer (mobile) ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(15,12,8,.4); backdrop-filter: blur(4px); z-index: 180; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 84vw); background: var(--bg); z-index: 190;
  transform: translateX(-100%); transition: transform .28s ease; box-shadow: var(--shadow-lg); overflow-y: auto; padding: 20px 14px 40px;
}
.drawer.show { transform: none; }
.drawer .toc-title { margin-top: 8px; }
