/* 段永平期权操作小样 —— 配色取自 dataviz 参考调色板（3 色位，已跑 validate_palette 双模式通过） */

/* 变量必须定义在 :root —— 定义在 .viz-root 上会让 body（其父元素）解析不到，
   导致所有继承 body color 的文字退回初始黑色（浅色下看不出，深色下全黑压黑）。 */
:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;  /* 卖 put / put 行权价 */
  --series-2: #eb6834;  /* 卖 call / call 行权价 */
  --series-3: #1baf7a;  /* 结果事件 / 净成本 */
  --warn: #fab219;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19; --plane: #0d0d0d;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19; --plane: #0d0d0d;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--plane); color: var(--text-primary);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
}
.viz-root { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }

.page-head { margin-bottom: 22px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 25px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 6px; }
.sub { margin: 0 0 14px; color: var(--text-secondary); font-size: 13.5px; }
code { background: var(--surface-1); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }

.btn-ghost {
  background: var(--surface-1); color: var(--text-secondary); cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 13px;
}
.btn-ghost:hover { color: var(--text-primary); }

.banner {
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 3px solid var(--warn); border-radius: 8px;
  padding: 11px 14px; font-size: 13.5px; color: var(--text-secondary);
}
.banner strong { color: var(--text-primary); }

/* 概览 tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin: 20px 0; }
.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.tile-v { font-size: 27px; font-weight: 600; line-height: 1.15; }
.tile-l { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.tile-note { display: block; color: var(--muted); font-size: 11.5px; }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px 20px; margin-bottom: 18px;
}
.cap { color: var(--text-secondary); font-size: 13px; margin: 0 0 12px; }
.cap em { color: var(--text-primary); font-style: normal; font-weight: 500; }
.tag-warn {
  font-size: 11.5px; font-weight: 600; color: var(--text-primary);
  background: color-mix(in oklab, var(--warn) 26%, var(--surface-1));
  border-radius: 999px; padding: 2px 9px; vertical-align: 2px; margin-left: 6px;
}

/* 图例：色块 + 文字标签（文字用 ink，不用系列色） */
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
/* 表格动作圆点：颜色放 CSS 而不是内联 style —— 内联 style 属性会被
   严格 CSP（style-src-attr）拦掉，且颜色本来就该跟色位定义在一起。 */
.pill-dot.pd-put { background: var(--series-1); }
.pill-dot.pd-call { background: var(--series-2); }
.pill-dot.pd-event { background: var(--series-3); }
.pill-dot.pd-none { background: var(--muted); }

.legend-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface-1); }

.chart-wrap { width: 100%; overflow-x: auto; }
svg { display: block; width: 100%; height: auto; }
.grid-line { stroke: var(--grid); stroke-width: 1; }
.axis-line { stroke: var(--axis); stroke-width: 1; }
.tick-txt { fill: var(--muted); font-size: 11px; }
.row-txt { fill: var(--text-secondary); font-size: 12px; }
.dot { stroke: var(--surface-1); stroke-width: 2; cursor: pointer; }
.dot:hover { stroke: var(--text-primary); }
.interp { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 4; fill: none; opacity: 0.75; }
.pt-label { fill: var(--text-primary); font-size: 11px; font-weight: 600; }

/* 控件 */
.row-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--text-secondary); }
select {
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 9px; font-size: 13px;
}
.chk { display: inline-flex; align-items: center; gap: 5px; }
.count { color: var(--muted); font-size: 12.5px; margin-left: auto; }

/* 原则卡 */
.principles { display: grid; gap: 10px; }
.principle {
  border: 1px solid var(--border); border-left: 3px solid var(--series-1);
  border-radius: 8px; padding: 11px 14px; background: var(--plane);
}
.principle p { margin: 0 0 5px; font-size: 14px; }
.principle .meta { color: var(--muted); font-size: 11.5px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; white-space: nowrap; position: sticky; top: 0; background: var(--surface-1); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.q { max-width: 380px; color: var(--text-secondary); }
.pill { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.attr-weak { color: var(--muted); }
a { color: var(--series-1); }

/* tooltip */
#tip {
  position: fixed; z-index: 50; max-width: 340px; pointer-events: none; opacity: 0;
  transition: opacity .12s; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .16); font-size: 12.5px; line-height: 1.5;
}
#tip .tip-h { font-weight: 600; margin-bottom: 3px; }
#tip .tip-q { color: var(--text-secondary); }
#tip .tip-m { color: var(--muted); font-size: 11.5px; margin-top: 5px; }

/* ── 联系我们 / 公众号（与 power-tracker 同一形态）───────────────── */
.head-btns { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.contactbtn { text-decoration: none; display: inline-flex; align-items: center; }
.contactbtn:hover { border-color: var(--series-1); color: var(--series-1); }
/* 窄屏有吸顶的 section-nav，锚点跳过去会被盖住 → 留滚动余量 */
#contact { scroll-margin-top: 76px; }

.contactcard {
  margin: 6px 0 14px; padding: 18px 20px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
}
.contactcard .cc-text { flex: 1 1 300px; min-width: 0; }
.contactcard .cc-title {
  font-size: 13px; font-weight: 640; color: var(--text-primary); margin-bottom: 8px;
}
.contactcard .cc-line { font-size: 12.5px; line-height: 1.75; color: var(--text-secondary); }
.contactcard .cc-line b { color: var(--text-primary); }
/* min-width:0 + max-width:100% 都不能少：img 带了 width="900" 的内在尺寸，
   figure 若按内在宽度撑开，窄屏会把整个文档顶宽 */
.contactcard .cc-qr { flex: 0 1 auto; min-width: 0; max-width: 100%; text-align: center; }
.contactcard .cc-qr img {
  display: block; width: 340px; max-width: 100%; height: auto; border-radius: 8px;
}
.contactcard .cc-qr figcaption {
  margin-top: 7px; font-size: 11.5px; color: var(--text-secondary);
}
@media (max-width: 760px) {
  .contactcard { gap: 16px; padding: 16px; }
  .contactcard .cc-qr { width: 100%; }
  .contactcard .cc-qr img { width: 100%; }
}

.page-foot { color: var(--text-secondary); font-size: 12.5px; margin-top: 22px; }
.page-foot .muted { color: var(--muted); }
.page-foot em { font-style: normal; font-weight: 600; color: var(--text-primary); }

/* 覆盖度披露（借鉴 pdd-prospectus 的「共 N 项」思路：说清省略了什么） */
.coverage {
  display: flex; flex-wrap: wrap; gap: 0 22px; align-items: baseline;
  margin-top: 10px; padding: 10px 14px; font-size: 12.5px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-secondary);
}
.coverage b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.coverage .cov-bar {
  flex: 1 1 160px; min-width: 120px; height: 6px; border-radius: 999px;
  background: var(--grid); overflow: hidden;
}
.coverage .cov-bar span { display: block; height: 100%; background: var(--series-1); }
.coverage .cov-note { flex-basis: 100%; color: var(--muted); font-size: 11.5px; }

/* 分区跳转导航 */
.section-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.section-nav a {
  font-size: 12.5px; text-decoration: none; color: var(--text-secondary);
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px;
}
.section-nav a:hover { color: var(--text-primary); border-color: var(--axis); }

/* ── 左侧索引（常态收窄成刻度，hover 展开）─────────────────────── */
.rail {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%);
  z-index: 50; display: flex; flex-direction: column; gap: 6px;
  padding: 10px 8px; width: 40px;
  background: transparent; border: 1px solid transparent; border-left: none;
  border-radius: 0 12px 12px 0;
  transition: width .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.rail:hover, .rail:focus-within {
  width: 178px; background: var(--surface-1);
  border-color: var(--border); box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
}
.rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail a {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  padding: 6px 7px; border-radius: 7px; color: var(--text-secondary);
  font-size: 12.5px; line-height: 1.2; white-space: nowrap;
}
.rail a:hover { background: var(--grid); color: var(--text-primary); }
/* 刻度：收起时唯一可见的东西 */
.rail a i {
  flex: 0 0 auto; width: 16px; height: 2px; border-radius: 2px;
  background: var(--axis); transition: width .18s ease, background .18s ease;
}
.rail a span {
  opacity: 0; transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.rail:hover a span, .rail:focus-within a span { opacity: 1; transform: none; }
/* 当前所在区块 */
.rail a[aria-current="true"] { color: var(--text-primary); font-weight: 600; }
.rail a[aria-current="true"] i { width: 22px; background: var(--series-1); }
.rail-btn {
  margin-top: 4px; font-size: 12px; cursor: pointer; white-space: nowrap;
  color: var(--text-secondary); background: transparent;
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.rail:hover .rail-btn, .rail:focus-within .rail-btn { opacity: 1; pointer-events: auto; }
.rail-btn:hover { color: var(--text-primary); border-color: var(--axis); }
.rail a:focus-visible, .rail-btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }

/* 宽屏用左侧索引，窄屏退回顶部吸顶导航 —— 两者不同时出现 */
@media (min-width: 1080px) { .section-nav { display: none; } }
@media (max-width: 1079px) { .rail { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .rail, .rail a i, .rail a span, .rail-btn { transition: none; }
}

/* ── 折叠区块 ───────────────────────────────────────────────── */
details.sec { padding: 0; }
details.sec > summary {
  list-style: none; cursor: pointer; padding: 16px 20px;
  display: flex; align-items: center; gap: 8px; user-select: none;
}
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before {
  content: '▸'; color: var(--muted); font-size: 12px; transition: transform .15s;
}
details.sec[open] > summary::before { transform: rotate(90deg); }
details.sec > summary h2 { margin: 0; }
details.sec > summary:hover h2 { color: var(--series-1); }
.sec-body { padding: 0 20px 18px; }
.sec-count {
  font-size: 11.5px; font-weight: 500; color: var(--muted);
  background: var(--plane); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: 2px;
}

/* ── 吸顶分区导航 ───────────────────────────────────────────── */
.section-nav {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -20px 16px; padding: 10px 20px;
  background: color-mix(in oklab, var(--plane) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.btn-mini { padding: 3px 10px; font-size: 12px; margin-left: auto; }

/* ── 多选筛选器 ─────────────────────────────────────────────── */
.ms { display: inline-flex; align-items: center; gap: 6px; }
.ms > label { color: var(--text-secondary); }
.ms-box { position: relative; }
.ms-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 9px; font-size: 13px; min-width: 96px; justify-content: space-between;
}
.ms-btn:hover { border-color: var(--axis); }
.ms-active .ms-btn { border-color: var(--series-1); color: var(--series-1); }
.ms-caret { color: var(--muted); font-size: 10px; }
.ms-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 210px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16); overflow: hidden;
}
.ms-pop-head {
  display: flex; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--border);
}
.ms-pop-head button {
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--series-1); font-size: 12px;
}
.ms-list { max-height: 264px; overflow-y: auto; padding: 4px; }
.ms-item {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 5px 8px; border-radius: 6px; font-size: 13px;
}
.ms-item:hover { background: var(--plane); }
.ms-item span { flex: 1; }
.ms-item i { color: var(--muted); font-style: normal; font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* 搜索框 */
.txt {
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 9px; font-size: 13px; min-width: 200px;
}
