/* Browser Use 交互图解站 · 唯一设计系统（见 DESIGN.md） */
:root {
  --paper: #f5f4ef;
  --surface: #ffffff;
  --ink: #1c2333;
  --muted: #5a6474;
  --accent: #3b5bff;
  --accent-soft: #e8edff;
  --orange: #e8622c;
  --orange-soft: #fdeee5;
  --good: #0e9f6e;
  --good-soft: #e2f6ee;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --bad: #d33f2e;
  --bad-soft: #fdeae7;
  --border: #e3e0d8;
  --panel: #161b26;
  --panel-ink: #d7dee9;
  --panel-dim: #8b95a7;
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.75 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.5rem; margin: 2.2em 0 0.7em; padding-top: 0.6em; border-top: 2px solid var(--border); }
h3 { font-size: 1.12rem; margin: 1.6em 0 0.5em; }
p { margin: 0.7em 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.88em; background: #efece3; padding: 0.1em 0.35em; border-radius: 5px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 22px 90px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 244, 239, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.brand { font-weight: 800; color: var(--ink); margin-right: 12px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--orange); }
.topbar a.nav { color: var(--muted); font-size: 0.85rem; padding: 4px 9px; border-radius: 8px; white-space: nowrap; }
.topbar a.nav:hover { color: var(--ink); background: #eceade; text-decoration: none; }
.topbar a.nav.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.progress-pill { margin-left: auto; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 章头 ---------- */
.kicker { color: var(--orange); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }
.lede { font-size: 1.08rem; color: var(--muted); }

/* ---------- callout ---------- */
.note {
  border-radius: var(--radius); padding: 14px 18px; margin: 1.2em 0;
  border: 1px solid var(--border); background: var(--surface); font-size: 0.95rem;
}
.note .tag { font-weight: 800; margin-right: 6px; }
.note.intuition { background: var(--accent-soft); border-color: #c9d5ff; }
.note.intuition .tag { color: var(--accent); }
.note.trap { background: var(--warn-soft); border-color: #f0dcbb; }
.note.trap .tag { color: var(--warn); }
.note.math { background: #efedf6; border-color: #ddd6ec; }
.note.math .tag { color: #6b4fbb; }
.note.sum { background: var(--good-soft); border-color: #bfe8d6; }
.note.sum .tag { color: var(--good); }
.note p:first-child { margin-top: 0; } .note p:last-child { margin-bottom: 0; }

.formula {
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin: 1.2em 0; font-size: 1.05rem; overflow-x: auto;
}

/* ---------- 浏览器窗口卡片 ---------- */
.win {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 10px 30px rgba(28, 35, 51, 0.07);
}
.win-bar {
  display: flex; align-items: center; gap: 10px;
  background: #eceade; border-bottom: 1px solid var(--border); padding: 8px 12px;
}
.win-dots { display: flex; gap: 6px; }
.win-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.win-dots i:nth-child(1) { background: #f06a5e; }
.win-dots i:nth-child(2) { background: #f5bf4f; }
.win-dots i:nth-child(3) { background: #3dc06c; }
.win-url {
  flex: 1; font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-body { padding: 18px; }

/* ---------- 演示 ---------- */
.demo { margin: 1.6em 0 2.2em; }
.demo-title { font-weight: 800; font-size: 1.05rem; margin: 0 0 2px; }
.demo-sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }
.ctl { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin: 14px 0 10px; }
.ctl label { font-size: 0.88rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ctl output { font-family: var(--mono); font-weight: 700; color: var(--ink); min-width: 3.5em; }
input[type=range] { accent-color: var(--accent); width: 150px; }
.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.btn-group button {
  border: 0; background: transparent; padding: 7px 14px; font-size: 0.85rem; cursor: pointer;
  color: var(--muted); font-family: inherit;
}
.btn-group button + button { border-left: 1px solid var(--border); }
.btn-group button.on { background: var(--accent); color: #fff; font-weight: 600; }
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 7px 16px; font-size: 0.88rem; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.preset { border: 1px dashed var(--border); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; color: var(--muted); cursor: pointer; font-family: inherit; }
.preset:hover { border-color: var(--orange); color: var(--orange); }
.readouts { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.readout {
  font-family: var(--mono); font-size: 0.85rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px;
}
.readout.good { color: var(--good); border-color: #bfe8d6; background: var(--good-soft); }
.readout.warn { color: var(--warn); border-color: #f0dcbb; background: var(--warn-soft); }
.readout.bad { color: var(--bad); border-color: #f2c7c0; background: var(--bad-soft); }
.demo-note { font-size: 0.9rem; color: var(--muted); border-left: 3px solid var(--orange); padding-left: 12px; margin: 12px 0 0; }
.demo-note b { color: var(--orange); }

/* 深色面板（agent 视角 / 终端 / 代码） */
.panel {
  background: var(--panel); color: var(--panel-ink); border-radius: 10px;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.65;
  padding: 14px 16px; overflow-x: auto; white-space: pre;
}
.panel .dim { color: var(--panel-dim); }
.panel .hl { color: #ffd479; }
.panel .ok { color: #5fd6a2; }
.panel .err { color: #ff8a7a; }
.panel .bl { color: #8fb4ff; }

/* 表格 */
table.cmp { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 1.2em 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
table.cmp th, table.cmp td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
table.cmp th { background: #eceade; font-size: 0.85rem; }

/* ---------- 章末 ---------- */
.done-row { display: flex; align-items: center; gap: 14px; margin: 2.5em 0 1em; }
.mark-done { font-size: 0.95rem; padding: 10px 22px; }
.mark-done.done { background: var(--good); border-color: var(--good); color: #fff; }
.chap-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 1.5em; }
.chap-nav a {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 14px 18px; color: var(--ink);
}
.chap-nav a:hover { border-color: var(--accent); text-decoration: none; }
.chap-nav .dir { font-size: 0.78rem; color: var(--muted); }
.chap-nav .t { font-weight: 700; }
.chap-nav a.next { text-align: right; }
.chap-nav a:only-child { grid-column: 2; }
.chap-nav a:first-child:nth-last-child(2) { grid-column: auto; }

/* ---------- 首页 ---------- */
.hero { padding: 64px 0 30px; }
.hero h1 { font-size: 2.6rem; max-width: 18em; }
.hero .lede { max-width: 40em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 2em 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
}
.stat .v { font-family: var(--mono); font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat .v.warm { color: var(--orange); }
.stat .k { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.chap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 1.5em 0; }
.chap-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; color: var(--ink); position: relative; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.chap-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(28, 35, 51, 0.1); border-color: var(--accent); }
.chap-card .no { font-family: var(--mono); color: var(--orange); font-size: 0.8rem; font-weight: 700; }
.chap-card .t { font-weight: 800; font-size: 1.05rem; margin: 4px 0 6px; }
.chap-card .d { font-size: 0.87rem; color: var(--muted); }
.chap-card .tick { position: absolute; top: 14px; right: 16px; color: var(--good); font-weight: 800; display: none; }
.chap-card.read .tick { display: block; }
.chap-card.read { border-color: #bfe8d6; }

@media (max-width: 640px) {
  .chap-nav { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  input[type=range] { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
