/* =============================================================================
 * style.css — 脉动阵列错误传播模拟器（深色主题）
 * 设计基准视口：1256 × 808（左 276 / 中自适应 / 右 318），
 * 1440 与 1920 只做向上兼容（≥1600 时加宽两栏）。
 * 布局：header → 三栏 grid → 底部说明区，全程无横向溢出。
 * ========================================================================== */

:root {
  --bg:        #070b12;
  --bg-2:      #0a101a;
  --panel:     #0e1624;
  --panel-2:   #121c2d;
  --card:      #0a1322;
  --line:      #1d2a40;
  --line-soft: #16202f;
  --text:      #e8eefb;
  --muted:     #93a3bd;
  --muted-2:   #6b7d97;
  --cyan:      #38d9f5;
  --blue:      #4f8ff7;
  --amber:     #f5b942;
  --red:       #ff5a5f;
  --green:     #38e0a0;
  --purple:    #a78bfa;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #2a3b59 #0a1018;
}
body {
  margin: 0 auto;
  max-width: 2240px;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 560px at 50% -12%, rgba(24, 54, 96, .55) 0%, rgba(7, 11, 18, 0) 62%),
    radial-gradient(760px 460px at 100% 0%, rgba(10, 52, 66, .42) 0%, rgba(7, 11, 18, 0) 58%);
  background-attachment: fixed;
  overflow-x: hidden;
}
::selection { background: rgba(56, 217, 245, .28); color: #fff; }
:focus-visible { outline: 2px solid rgba(56, 217, 245, .75); outline-offset: 2px; }
code {
  font-family: var(--mono);
  font-size: 11px;
  color: #9fe8fb;
  background: rgba(56, 217, 245, .07);
  border: 1px solid rgba(56, 217, 245, .16);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 顶部 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px 10px;
  border-bottom: 1px solid rgba(29, 42, 64, .75);
  background: linear-gradient(180deg, rgba(10, 18, 30, .72), rgba(7, 11, 18, 0));
}
.brand { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.25;
  color: #eaf7ff;
  background: linear-gradient(90deg, #eaf7ff 0%, #86e2ff 52%, #b8a6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted-2);
  letter-spacing: .01em;
}
.engine-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  font-size: 11.5px;
  color: var(--muted);
  background: #0a1220;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.engine-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(56, 224, 160, .9);
}
.engine-status.loading .dot { background: var(--amber); box-shadow: 0 0 8px rgba(245, 185, 66, .9); animation: blink 1s steps(2, start) infinite; }
.engine-status.bad .dot { background: var(--red); box-shadow: 0 0 8px rgba(255, 90, 95, .9); }
@keyframes blink { 50% { opacity: .25; } }

/* ---------------------------------------------------------------- 三栏布局 */
.layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 318px;
  gap: 12px;
  padding: 12px 14px 14px;
  align-items: start;
}
.col { min-width: 0; }
.col-center { display: flex; flex-direction: column; gap: 12px; }

.panel {
  background: linear-gradient(180deg, rgba(18, 28, 45, .94), rgba(12, 19, 31, .94));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 8px 22px rgba(0, 0, 0, .26);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #cfe0f5;
  letter-spacing: .02em;
}
.panel-head h2::before {
  content: "";
  width: 3px; height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
}
.axes-note {
  margin: 0 0 8px;
  padding: 4px 8px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(56, 217, 245, .05);
  border-left: 2px solid rgba(56, 217, 245, .45);
  border-radius: 0 6px 6px 0;
}
.head-right { display: flex; align-items: center; gap: 5px; min-width: 0; }

.chip {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  background: #0a1220;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.chip.accent { color: var(--cyan); border-color: rgba(56, 217, 245, .35); }
.cap-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 400;
}
/* 矩阵坐标 C[t][c] 必须保持小写，不能被 cap-sub 的 uppercase 改写 */
#mtx-coord {
  text-transform: none;
  letter-spacing: 0;
  font-size: 10.5px;
  color: var(--cyan);
}

/* ---------------------------------------------------------------- 控制面板 */
.control-panel { padding: 4px 12px 8px; }
.sec {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(29, 42, 64, .8);
}
.sec:last-child { border-bottom: 0; padding-bottom: 2px; }
.sec-title {
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--muted-2);
  margin-bottom: 5px;
}
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
#dir-group, #mode-group { grid-template-columns: 1fr 1fr; }
.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 2px;
  font-family: var(--font);
  line-height: 1.18;
  color: var(--muted);
  background: #0b1322;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.seg-btn b { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.seg-btn span { font-size: 9.5px; color: var(--muted-2); }
.seg-btn:hover { border-color: #2d4566; color: var(--text); }
.seg-btn.active {
  color: var(--cyan);
  background: linear-gradient(180deg, #10384a, #0b2634);
  border-color: rgba(56, 217, 245, .75);
  box-shadow: inset 0 0 0 1px rgba(56, 217, 245, .18);
}
.seg-btn.active span { color: #8fd8ea; }

.hint {
  margin: 5px 0 0;
  font-size: 10.5px;
  line-height: 1.42;
  color: var(--muted-2);
}
.hint b { color: #c7d8ef; font-weight: 600; }
.hint.small { font-size: 10.5px; }

.row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.row:first-child { margin-top: 0; }
.mini-label { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.value-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--cyan);
  min-width: 46px;
  text-align: right;
}

input[type="range"].range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #16324b, #2b527a);
  outline: none;
  cursor: pointer;
}
input[type="range"].range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid #05202a;
  box-shadow: 0 0 7px rgba(56, 217, 245, .65);
  cursor: pointer;
}
input[type="range"].range::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--cyan); border: 2px solid #05202a;
}

.num-input {
  width: 52px;
  flex: none;
  padding: 3px 4px;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: var(--text);
  background: #08101c;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.num-input:focus { border-color: rgba(56, 217, 245, .6); outline: none; }

.row .sel { flex: 1 1 auto; width: auto; min-width: 0; }
.readonly-chip {
  flex: none;
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  background: #0a1220;
  border: 1px dashed #2a3b59;
  border-radius: 6px;
  white-space: nowrap;
}

.warn-bar {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 9px;
  font-size: 10.5px;
  line-height: 1.45;
  color: #ffd9a0;
  background: rgba(245, 185, 66, .10);
  border: 1px solid rgba(245, 185, 66, .45);
  border-radius: 8px;
}
.warn-bar b { flex: none; color: #ffc247; }

.field-tag {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px;
  border: 1px solid;
  white-space: nowrap;
}
.field-tag.sign { color: var(--amber); border-color: rgba(245, 185, 66, .45); background: rgba(245, 185, 66, .08); }
.field-tag.exponent { color: var(--purple); border-color: rgba(167, 139, 250, .45); background: rgba(167, 139, 250, .08); }
.field-tag.mantissa { color: var(--cyan); border-color: rgba(56, 217, 245, .4); background: rgba(56, 217, 245, .07); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: 10.5px; color: var(--muted-2); }
.sel {
  width: 100%;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: #08101c;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.fault-pe { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.fault-pos {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--amber);
  background: rgba(245, 185, 66, .1);
  border: 1px solid rgba(245, 185, 66, .38);
  border-radius: 7px;
  padding: 2px 10px;
}
.hint-inline { font-size: 10.5px; color: var(--muted-2); }

.btn-row { display: flex; gap: 6px; }
.btn {
  flex: 1 1 auto;
  padding: 6px 8px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  background: #0d1524;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { background: #121f33; border-color: #33507a; }
.btn.primary {
  color: #d7f7ff;
  font-weight: 600;
  background: linear-gradient(180deg, #0e4a5c, #0a3547);
  border-color: rgba(56, 217, 245, .55);
}
.btn.primary:hover { background: linear-gradient(180deg, #11586e, #0c4054); }
.btn.primary.playing {
  color: #ffd9da;
  background: linear-gradient(180deg, #5a1220, #3a0c15);
  border-color: rgba(255, 90, 95, .6);
}
.btn.wide { width: 100%; flex: none; margin-top: 8px; }
.btn.small { flex: none; padding: 3px 10px; font-size: 11px; }

/* ---------------------------------------------------------------- 阵列动画 */
.array-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
#array-canvas {
  display: block;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 38%, rgba(30, 66, 112, .38), rgba(6, 10, 17, .95) 72%);
  box-shadow: inset 0 0 46px rgba(0, 0, 0, .55);
  cursor: crosshair;
}
.canvas-boot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(7, 11, 18, .82);
  border-radius: 10px;
}
.canvas-boot.error { color: #ffb8ba; border: 1px solid rgba(255, 90, 95, .45); }

.array-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.lg-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; }
.sw-a { background: #7dd3fc; }
.sw-w { background: #c4b5fd; }
.sw-s { background: #fda4af; }
.sw-fault { background: transparent; border: 1.5px solid var(--amber); }
.sw-dirty { background: transparent; border: 2px solid #ff6a6f; box-shadow: 0 0 5px rgba(239, 68, 68, .75); }
.sw-affected { width: 12px; height: 3px; border-radius: 1.5px; background: #ff5a5f; }
.sw-affected-box { background: transparent; border: 1.5px solid var(--cyan); }
.hover-read {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
}

.timeline-row { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.timeline {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  border-radius: 3px;
  background: #0a1322;
  border: 1px solid #16233a;
  cursor: pointer;
}
.tl-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #0e7490, #38d9f5);
  box-shadow: 0 0 8px rgba(56, 217, 245, .45);
}
.tl-knob {
  position: absolute;
  top: 50%; left: 0%;
  width: 10px; height: 10px;
  margin-left: -5px; margin-top: -5px;
  border-radius: 50%;
  background: #eafcff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 8px rgba(56, 217, 245, .8);
}
.timeline-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--cyan);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 输出矩阵 */
.matrix-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mtx-fig { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mtx-fig figcaption {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.mtx-wrap { min-width: 0; }
.mtx-wrap canvas {
  display: block;
  width: 100%;
  max-width: 236px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 8px;
  background: #080d16;
  border: 1px solid #152135;
  cursor: crosshair;
}
.heat-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.legend-cap { font-family: var(--mono); font-size: 10px; color: var(--muted-2); }
.legend-scale { display: inline-flex; align-items: center; gap: 5px; }
.legend-bar {
  display: inline-block;
  width: 88px; height: 7px;
  border-radius: 4px;
  border: 1px solid #1b2942;
  background: linear-gradient(90deg, #0a101c 0%, #143a78 24%, #2563eb 42%, #7c3aed 60%, #db2777 76%, #f97316 90%, #fde047 100%);
}
.legend-sep { width: 1px; height: 12px; background: #22314a; }
.legend-note { color: #5c6c85; }
.legend-empty {
  font-family: var(--mono);
  font-size: 10px;
  color: #9fb2cc;
  background: rgba(255, 255, 255, .035);
  border: 1px solid #22314a;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 分块重复 */
.tiling-body { display: flex; gap: 14px; align-items: flex-start; }
.tiling-wrap { flex: 0 0 auto; width: min(42%, 280px); }
.tiling-wrap canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #080d16;
  border: 1px solid #152135;
}
.tiling-body .hint { margin: 2px 0 0; flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- 指标卡 */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 5px 8px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}
.m-label {
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-val {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #dbeafe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-val.hi { color: var(--cyan); }
.m-val.warn { color: var(--amber); }
.m-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.badge.ok { color: #7ef0c0; border-color: rgba(56, 224, 160, .45); background: rgba(56, 224, 160, .08); }
.badge.warn { color: #ffd188; border-color: rgba(245, 185, 66, .45); background: rgba(245, 185, 66, .08); }
.badge.neutral { color: var(--muted); border-color: var(--line); background: #0a1220; }

/* ---------------------------------------------------------------- 底部说明 */
.notes-panel { margin: 0 14px 16px; }
.notes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.note-block h3 {
  margin: 0 0 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: #bfd2ec;
}
.note-block p {
  margin: 0;
  font-size: 11px;
  line-height: 1.62;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 浮层 */
.tooltip {
  position: fixed;
  z-index: 900;
  min-width: 156px;
  padding: 7px 10px;
  font-size: 11.5px;
  color: #dbe7f7;
  background: rgba(10, 17, 28, .97);
  border: 1px solid #2a4162;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  pointer-events: none;
}
.tt-head {
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--cyan);
}
.tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tt-row span { color: var(--muted-2); }
.tt-row b { font-family: var(--mono); font-weight: 600; color: #e8f2ff; }
.tt-row.is-affected b { color: #ff9b9e; }

.err-banner {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  font-size: 12px;
  color: #ffdcdd;
  background: linear-gradient(90deg, #5b0f16, #3a0a11 70%);
  border-bottom: 1px solid var(--red);
}
.err-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-weight: 800;
  color: #2a0508;
  background: var(--red);
}
.err-body { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.err-body b { flex: none; color: #ff9b9e; }
#err-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ffb9bb; }

.noscript {
  margin: 20px;
  padding: 12px 16px;
  color: #ffd9da;
  background: #3a0a11;
  border: 1px solid var(--red);
  border-radius: 8px;
}

/* ---------------------------------------------------------------- 响应式 */
@media (min-width: 1600px) {
  .layout { grid-template-columns: 300px minmax(0, 1fr) 344px; gap: 14px; padding: 14px 16px 16px; }
  .notes-panel { margin: 0 16px 18px; }
}

/* 窄桌面（约 1041–1210）：三栏保留但收窄，避免过早退化为单栏 */
@media (max-width: 1210px) and (min-width: 1041px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr) 300px; gap: 10px; padding: 10px 12px 12px; }
  .notes-panel { margin: 0 12px 14px; }
  .control-panel { padding: 4px 9px 8px; }
  .metric-grid { gap: 5px; }
}

@media (max-width: 1040px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-left .control-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    padding: 6px 12px 10px;
  }
  .col-left .control-panel .sec { border-bottom: 0; }
  .notes-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .mtx-wrap canvas { max-width: 100%; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .matrix-grid { grid-template-columns: minmax(0, 1fr); }
  .mtx-wrap canvas { max-width: 260px; }
  .tiling-body { flex-direction: column; }
  .tiling-wrap { width: 100%; max-width: 280px; }
  .col-left .control-panel { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================================
 * 视觉风格切换：engine（深色工程风）/ paper（论文插图风）
 * paper 参考：白底、衬线字体、细线坐标轴感、无阴影/发光、Okabe–Ito 配色、
 * 面板标号 (a)(b)(c) 与 Fig. 1 图注（Nature / LaTeX 论文图的通用做法）。
 * ======================================================================= */
.style-switch {
  display: inline-flex; align-items: center; margin-right: 10px;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .04);
}
.ss-label { font-size: 9.5px; color: var(--muted-2); padding: 0 8px; letter-spacing: .06em; }
.ss-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-size: 11px; line-height: 1; padding: 6px 11px; cursor: pointer;
  font-family: inherit;
}
.ss-btn:hover { color: var(--text); }
.ss-btn.is-on { background: var(--cyan); color: #04121a; font-weight: 600; }

.fig-caption { display: none; }
.fig-tag { display: none; }

/* ---------- 论文风 ---------- */
html.style-paper {
  --bg: #ffffff; --bg-2: #ffffff; --panel: #ffffff; --panel-2: #fbfbf9; --card: #ffffff;
  --line: #111111; --line-soft: #d6d6d2; --text: #111111; --muted: #3d3d3d; --muted-2: #666666;
  --cyan: #0072B2; --blue: #0072B2; --amber: #E69F00; --red: #D55E00;
  --green: #009E73; --purple: #CC79A7;
  --font: "Times New Roman", "Nimbus Roman", "Songti SC", "SimSun", Georgia, serif;
  --mono: "Courier New", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
  background: #ffffff;
}
html.style-paper body { background: #ffffff !important; color: #111; }
html.style-paper * { box-shadow: none !important; }

html.style-paper .topbar { background: none !important; border-bottom: 1px solid #111; }
html.style-paper .brand h1 {
  background: none !important; -webkit-text-fill-color: #111; color: #111;
  font-family: var(--font); font-weight: 700; letter-spacing: 0;
}
html.style-paper .subtitle { color: #333; font-style: italic; }
html.style-paper .engine-status {
  background: #fff !important; color: #111; border: 1px solid #111; border-radius: 0 !important;
}
html.style-paper .engine-status .dot { background: #009E73 !important; }
html.style-paper .engine-status.loading .dot { background: #E69F00 !important; }
html.style-paper .engine-status.bad .dot { background: #D55E00 !important; }

html.style-paper .style-switch { background: #fff; border: 1px solid #111; border-radius: 0; }
html.style-paper .ss-label { color: #444; }
html.style-paper .ss-btn { color: #333; border-radius: 0; }
html.style-paper .ss-btn.is-on { background: #111; color: #fff; }

html.style-paper .fig-caption {
  display: block; margin: 10px 18px 0; max-width: 1180px;
  font-family: var(--font); font-size: 13px; line-height: 1.55; color: #111;
}
html.style-paper .fig-meta { color: #444; font-style: italic; }
html.style-paper .fig-tag {
  display: inline; margin-right: 6px; color: #111;
  font-family: var(--font); font-weight: 700; font-size: 13px;
}

html.style-paper .panel {
  background: #fff !important; border: 1px solid #c9c9c4; border-radius: 0 !important;
}
html.style-paper .panel-head { border-bottom: 1px solid #111; }
html.style-paper .panel-head h2 {
  color: #111 !important; -webkit-text-fill-color: #111 !important;
  font-family: var(--font); font-weight: 700; letter-spacing: 0;
}
html.style-paper .panel-head h2 .cap-sub {
  color: #555 !important; -webkit-text-fill-color: #555 !important;
}
html.style-paper .sec-title { color: #111 !important; -webkit-text-fill-color: #111 !important; }
html.style-paper .hint { color: #333 !important; }
html.style-paper .panel-head h2::before {
  background: #111 !important; width: 2px; border-radius: 0;
}
html.style-paper .cap-sub { color: #444; font-family: var(--font); font-style: italic; }
html.style-paper .chip, html.style-paper .badge {
  background: #fff !important; border: 1px solid #111 !important; color: #111 !important;
  border-radius: 0 !important; font-family: var(--mono);
}

html.style-paper .metric {
  background: #fff !important; border: 1px solid #d6d6d2 !important; border-radius: 0 !important;
}
html.style-paper .m-val { color: #111 !important; font-family: var(--font); }
html.style-paper .m-label, html.style-paper .m-sub,
html.style-paper .hint, html.style-paper .sec-title { color: #333; }
html.style-paper .sec-title {
  font-family: var(--font); letter-spacing: 0; text-transform: none;
  border-left: 0; padding-left: 0; color: #111;
}

html.style-paper .seg { border: 1px solid #111; border-radius: 0; overflow: hidden; }
html.style-paper .seg-btn {
  background: #fff !important; color: #111 !important; border: 0;
  border-right: 1px solid #d6d6d2; border-radius: 0 !important;
}
html.style-paper .seg-btn:last-child { border-right: 0; }
html.style-paper .seg-btn span { color: #444 !important; }
html.style-paper .seg-btn.active { background: #111 !important; color: #fff !important; }
html.style-paper .seg-btn.active b, html.style-paper .seg-btn.active span { color: #fff !important; }

html.style-paper .btn {
  background: #fff !important; color: #111 !important; border: 1px solid #111 !important;
  border-radius: 0 !important;
}
html.style-paper .btn:hover { background: #f2f2f0 !important; }
html.style-paper .btn.active { background: #111 !important; color: #fff !important; }
html.style-paper .num-input, html.style-paper .mini-label { background: #fff; color: #111; }
html.style-paper .range { accent-color: #0072B2; }
html.style-paper .field-tag {
  background: #fff !important; border: 1px solid #111 !important; color: #111 !important;
  border-radius: 0 !important;
}
html.style-paper .warn-bar {
  background: #fff7e6 !important; border: 1px solid #E69F00 !important;
  color: #111 !important; border-radius: 0 !important;
}
html.style-paper .legend-inline, html.style-paper .lg-item { color: #333; font-family: var(--font); }
html.style-paper .sw-a { background: #0072B2; }
html.style-paper .sw-w { background: #009E73; }
html.style-paper .sw-s { background: #D55E00; }
html.style-paper .sw-fault { background: #fff; border: 1.5px solid #111; }
html.style-paper .sw-dirty { background: transparent; border: 2px solid #0072B2; }
html.style-paper .sw-affected { background: #D55E00; }
html.style-paper .sw-affected-box { border: 1.5px solid #D55E00; }
html.style-paper .legend-bar {
  border: 1px solid #111; border-radius: 0;
  background: linear-gradient(90deg, #440154 0%, #482878 14%, #3e4a89 28%, #31688e 42%, #26828e 56%, #1f9e89 68%, #35b779 80%, #b5de2b 92%, #fde725 100%);
}
html.style-paper .legend-sep { background: #111; }
html.style-paper .legend-note { color: #444; }
html.style-paper .legend-empty {
  background: #fff !important; color: #111 !important; border: 1px dashed #111;
  border-radius: 0 !important;
}
html.style-paper .notes-panel { border: 1px solid #c9c9c4; }
html.style-paper .notes-grid h3 { font-family: var(--font); color: #111; }
html.style-paper .notes-grid p, html.style-paper code { color: #222; }
html.style-paper .tooltip, html.style-paper .hover-read {
  background: #fff !important; color: #111 !important; border: 1px solid #111 !important;
  border-radius: 0 !important;
}
html.style-paper canvas { background: #fff; }
html.style-paper ::selection { background: #cfe3f3; }
