/* ─────────────────────────────────────────────
   二维码 LOGO 预算 · 页面样式
   配色遵循站点语义：金=结论、蓝=功能图形、红=失败、绿=通过
   ───────────────────────────────────────────── */

:root {
  --bg1: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --gold: #ffd700;
  --blue: #90caf9;
  --green: #81c784;
  --red: #ff6b6b;
  --purple: #ce93d8;
  --orange: #ffb74d;
  --line: rgba(255, 255, 255, 0.10);
  --card: rgba(255, 255, 255, 0.045);
  --ink: #e8eef6;
  --dim: #8a9bb0;
}

* { box-sizing: border-box; }
figure { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 55%, var(--bg3) 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  font: 14px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 34px 18px 72px;
}

.container { max-width: 1180px; margin: 0 auto; }

/* ── 头部 ── */
.header { margin-bottom: 26px; }
.header h1 {
  font: 700 30px/1.34 Georgia, "Songti SC", "Noto Serif SC", serif;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}
.header h1 i { color: var(--gold); font-size: 26px; vertical-align: -2px; }
.header p {
  margin: 0;
  color: var(--dim);
  font-size: 13.5px;
  max-width: 74ch;
  line-height: 1.8;
}
.header p strong { color: var(--ink); font-weight: 600; }

/* 金色 shimmer 只在标题上，别铺满整页 */
.header h1 {
  background: linear-gradient(90deg, #ffd700, #fff6c0, #ffd700);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s linear infinite;
}
.header h1 i { -webkit-text-fill-color: var(--gold); color: var(--gold); }
@keyframes shimmer { to { background-position: 220% center; } }

/* ── 错误提示 ── */
.err {
  display: none;
  margin: -8px 0 18px;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--red);
  font-size: 12.5px;
}

/* ── 区块 ── */
.section { margin-bottom: 30px; }
.round-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.round-head h2 {
  font: 600 17px/1.4 -apple-system, "PingFang SC", sans-serif;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
.round-head h2 i { color: var(--gold); font-size: 17px; }
.tag {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-fun { color: var(--purple); background: rgba(206, 147, 216, 0.14); border: 1px solid rgba(206, 147, 216, 0.3); }
.tag-easy { color: var(--green); background: rgba(129, 199, 132, 0.14); border: 1px solid rgba(129, 199, 132, 0.3); }
.tag-medium { color: var(--orange); background: rgba(255, 183, 77, 0.14); border: 1px solid rgba(255, 183, 77, 0.3); }

.section-desc {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.75;
  max-width: 88ch;
}
.section-desc strong { color: var(--ink); font-weight: 600; }
.section-desc em { font-style: normal; }
.k-blue { color: var(--blue); }
.k-red { color: var(--red); }

/* ── 卡片 ── */
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}
.card-head b { color: var(--ink); font-weight: 600; font-size: 12px; }
.card-body { padding: 13px; }

/* ── 主栅格 ── */
.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.views { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #fff;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 9px;
  font-size: 11px;
  color: var(--dim);
  line-height: 1.5;
}
.legend .sw {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.sw-blue { background: #a8cdf5; }
.sw-red { background: #ff5454; }
.sw-gold { background: var(--gold); }

.badge {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge.ok { background: rgba(129, 199, 132, 0.16); color: var(--green); border: 1px solid rgba(129, 199, 132, 0.35); }
.badge.no { background: rgba(255, 107, 107, 0.16); color: var(--red); border: 1px solid rgba(255, 107, 107, 0.35); }
.badge.idle { background: rgba(255, 255, 255, 0.07); color: var(--dim); border: 1px solid var(--line); }

/* ── 参数面板 ── */
.panel-label {
  margin: 0 0 7px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--gold);
  opacity: 0.85;
}
.panel .seg,
.panel input[type=range] { margin-bottom: 14px; }

.presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.preset {
  text-align: left;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--dim);
  cursor: pointer;
  transition: 0.16s;
  font: inherit;
  line-height: 1.4;
}
.preset b { display: block; color: var(--ink); font-size: 12px; font-weight: 600; }
.preset span { font-size: 10.5px; }
.preset:hover { border-color: rgba(255, 215, 0, 0.4); }
.preset.active {
  border-color: rgba(255, 215, 0, 0.55);
  background: rgba(255, 215, 0, 0.12);
}
.preset.active b { color: var(--gold); }

input[type=text] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
input[type=text]:focus { outline: none; border-color: rgba(255, 215, 0, 0.5); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 14px; }
.chips button {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px;
  border-radius: 7px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.chips button:hover { color: var(--gold); border-color: rgba(255, 215, 0, 0.4); }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--dim);
  font: 600 12px/1 inherit;
  cursor: pointer;
  transition: 0.15s;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: rgba(255, 215, 0, 0.14);
  color: var(--gold);
  border-color: rgba(255, 215, 0, 0.45);
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 4px;
}
.row output { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 12px; }

input[type=range] {
  width: 100%;
  height: 18px;
  margin: 0 0 6px;
  accent-color: var(--gold);
  cursor: pointer;
}

.toggles { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--dim);
  cursor: pointer;
  user-select: none;
  padding: 3px 0;
}
.toggle input { accent-color: var(--gold); width: 14px; height: 14px; margin: 0; }

/* ── 指标 ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.metric {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.metric .k { font-size: 11px; color: var(--dim); letter-spacing: 0.04em; }
.metric .v {
  font: 700 21px/1.25 Georgia, "Songti SC", serif;
  color: var(--ink);
  margin-top: 3px;
}
.metric .v small { font-size: 11px; font-weight: 400; color: var(--dim); font-family: inherit; }
.metric.hot .v { color: var(--gold); }
.metric.good .v { color: var(--green); }
.metric.bad .v { color: var(--red); }

/* ── 预算条 ── */
.budget { padding: 15px 18px; }
.budget-top {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 9px;
}
.budget-top b { color: var(--ink); font-size: 12.5px; }
.bar {
  position: relative;
  height: 12px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 7px;
  background: var(--green);
  transition: width 0.18s ease, background 0.18s ease;
}
.bar-mark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 66.66%;
  width: 2px;
  background: rgba(255, 255, 255, 0.75);
}
.bar-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 6px;
  opacity: 0.75;
}
.warn {
  margin-top: 10px;
  font-size: 12px;
  display: none;
  align-items: flex-start;
  gap: 7px;
  color: var(--red);
  line-height: 1.6;
}
.warn.on { display: flex; }
.warn i { margin-top: 2px; }
.warn span { flex: 1; }

/* ── 损耗控制台 ── */
.loss-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0 18px;
  padding: 14px 18px 16px;
}

.sweep-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid rgba(255, 215, 0, 0.4);
  background: rgba(255, 215, 0, 0.12);
  color: var(--gold);
  font: 600 12.5px/1 inherit;
  cursor: pointer;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: rgba(255, 215, 0, 0.2); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
}
.btn-ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

.sweep-out {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--dim);
  line-height: 1.8;
  min-height: 3.4em;
}
.sweep-out b { color: var(--gold); }
.sweep-out .dim { opacity: 0.55; }

/* ── 解读 ── */
.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.note {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 14px 16px;
}
.note h3 {
  margin: 0 0 8px;
  font: 600 13.5px/1.4 -apple-system, "PingFang SC", sans-serif;
  color: var(--gold);
}
.note p { margin: 0; font-size: 12.5px; color: var(--dim); line-height: 1.85; }
.note p strong { color: var(--ink); font-weight: 600; }

/* ── 工具引导 ── */
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 22px;
  padding: 16px 18px;
  border-color: rgba(144, 202, 249, 0.26);
  background: rgba(144, 202, 249, 0.06);
}
.cta-copy { flex: 1 1 380px; min-width: 0; }
.cta-copy h3 {
  margin: 0 0 6px;
  font: 600 14px/1.4 -apple-system, "PingFang SC", sans-serif;
  color: var(--blue);
}
.cta-copy h3 i { margin-right: 4px; }
.cta-copy p { margin: 0; font-size: 12.5px; color: var(--dim); line-height: 1.8; }
.cta-btn { flex: 0 0 auto; text-decoration: none; white-space: nowrap; }

/* ── 脚注 ── */
.foot {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--dim);
  line-height: 1.9;
}
.foot code {
  background: rgba(144, 202, 249, 0.1);
  color: var(--blue);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}
.foot a { color: var(--blue); text-decoration: none; border-bottom: 1px dotted rgba(144, 202, 249, 0.4); }
.foot a:hover { color: var(--gold); border-color: rgba(255, 215, 0, 0.5); }

/* ── 响应式 ── */
@media (max-width: 980px) {
  .grid-main { grid-template-columns: 1fr; }
  .loss-grid { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
  .presets { grid-template-columns: repeat(2, 1fr); }
  .notes { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { padding: 24px 14px 56px; }
  .header h1 { font-size: 23px; }
  .views { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .budget-top { flex-direction: column; align-items: flex-start; }
  .loss-grid { grid-template-columns: 1fr; }
  .sweep-row .btn { flex: 1; justify-content: center; }
  .presets { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cta-btn { flex: 1 1 100%; justify-content: center; }
}
