/* BTC / ETH / SOL 每日研究 — public static site
   Dark theme: black background, gold numbers, green/red accents.
   Fixed left sidebar TOC on desktop; hamburger drawer on mobile.
*/
:root {
  --bg: #070708;
  --bg-elev: #101012;
  --bg-card: #161618;
  --bg-hover: #1e1e22;
  --line: #2a2a2e;
  --line-soft: #1c1c20;
  --text: #eceae6;
  --muted: #9a958c;
  --dim: #6f6b64;
  --gold: #e0b84d;
  --gold-2: #f3d27a;
  --gold-dim: rgba(224, 184, 77, 0.16);
  --green: #3dcf8a;
  --green-dim: rgba(61, 207, 138, 0.14);
  --red: #ef5b5b;
  --red-dim: rgba(239, 91, 91, 0.14);
  --cyan: #5ec8d8;
  --cyan-dim: rgba(94, 200, 216, 0.14);
  --blue: #8aa4ff;
  --warn: #f0c14b;
  --sidebar-w: 280px;
  --header-h: 0px;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --font: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100%;
}
body {
  overflow: hidden;
  height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select { font-family: inherit; }

/* ---------- layout ---------- */
.nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--gold);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #0c0c0e;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.brand {
  padding: 22px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.brand h1 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.35;
}
.brand p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}
.picker {
  padding: 14px 16px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line-soft);
}
.picker-label {
  display: block;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
  margin: 0 0 6px;
}
.coin-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.coin-switch button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 0;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.coin-switch button:hover { border-color: var(--gold); color: var(--text); }
.coin-switch button.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-2);
}
.date-select {
  width: 100%;
  appearance: none;
  background: var(--bg-elev) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239a958c' d='M1 1l5 5 5-5'/></svg>") no-repeat right 10px center;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 28px 8px 10px;
  font-size: 13px;
  cursor: pointer;
}
.date-select:focus { outline: 1px solid var(--gold); }

.toc {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  line-height: 1.4;
}
.toc a:hover { color: var(--text); background: var(--bg-hover); }
.toc a.active {
  color: var(--gold-2);
  background: var(--gold-dim);
  border-left-color: var(--gold);
  font-weight: 650;
}

.sidebar-foot {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--dim);
  line-height: 1.45;
}

.main {
  margin-left: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 36px 80px;
  scroll-behavior: smooth;
}
.wrap {
  max-width: 1080px;
  margin: 0 auto;
}

/* ---------- typography / sections ---------- */
.disclaimer {
  background: linear-gradient(180deg, rgba(240, 193, 75, 0.1), rgba(240, 193, 75, 0.04));
  border: 1px solid rgba(240, 193, 75, 0.28);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 22px;
}
.disclaimer strong { color: var(--warn); }
.meta-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 24px;
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--muted);
}
.meta-row dt { color: var(--dim); font-size: 11px; letter-spacing: 0.04em; }
.meta-row dd { margin: 2px 0 0; color: var(--text); }

section.block {
  margin: 0 0 36px;
  scroll-margin-top: 24px;
}
section.block > h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.caption { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.lede { margin: 0 0 8px; color: var(--text); }
.sub { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }

/* ---------- metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.metric {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.metric .k { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.metric .v {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.metric .v.danger { color: var(--red); }
.metric .v.success { color: var(--green); }
.metric .d { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 10px 0 14px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 480px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
th {
  color: var(--dim);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
td { color: var(--text); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.now, .tone-warning { color: var(--gold-2); font-weight: 650; }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: var(--bg-hover);
  color: var(--text);
}
.badge.up, .badge.偏多, .badge.观察多 { background: var(--green-dim); color: var(--green); }
.badge.down, .badge.偏空, .badge.观察空 { background: var(--red-dim); color: var(--red); }
.badge.中性, .badge.震荡, .badge.结构 { background: var(--cyan-dim); color: var(--cyan); }

/* ---------- charts ---------- */
.chart {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 8px 8px 4px;
  margin: 10px 0 12px;
}
.chart svg { display: block; width: 100%; height: auto; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 8px 4px;
}
.chart-legend i {
  display: inline-block;
  width: 16px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: currentColor;
}
.bars { display: grid; gap: 8px; margin: 12px 0; }
.bar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lab { color: var(--muted); }
.bar-row .track { height: 8px; background: var(--bg-elev); border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--gold); border-radius: 99px; }
.bar-row .val { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---------- cards / lists ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card .role { color: var(--gold); font-size: 12px; margin: 0 0 8px; }
.card ul, .bullets { margin: 0; padding-left: 18px; }
.card li, .bullets li { margin: 0 0 6px; }
.turns { list-style: none; margin: 0 0 16px; padding: 0; }
.turns li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.turns .t { color: var(--gold); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 650; }
.turns .title { font-weight: 650; }
.turns .sub { color: var(--muted); font-size: 13px; }

.callout {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px;
  margin: 10px 0 14px;
}
.callout.info { border-left-color: var(--cyan); }
.callout.warn { border-left-color: var(--warn); background: rgba(240, 193, 75, 0.05); }
.callout .lead { font-weight: 700; color: var(--gold-2); margin: 0 0 6px; font-size: 13px; }
.callout p { margin: 0 0 6px; }
.callout p:last-child { margin: 0; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.links a {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
}
.links a:hover { border-color: var(--gold); color: var(--gold-2); }

.hist-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 0 8px 8px 0;
  cursor: pointer;
  font-size: 13px;
}
.hist-btn.active, .hist-btn:hover {
  border-color: var(--gold);
  color: var(--gold-2);
  background: var(--gold-dim);
}

.backtop {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--gold);
  cursor: pointer;
  box-shadow: var(--shadow);
  display: none;
}
.backtop.show { display: inline-flex; align-items: center; justify-content: center; }

.footer-note {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 13px;
}

/* ---------- mobile drawer ---------- */
@media (max-width: 900px) {
  body { overflow: auto; height: auto; }
  .nav-toggle { display: inline-flex; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    width: min(88vw, 320px);
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display: block; }
  .main {
    margin-left: 0;
    height: auto;
    overflow: visible;
    padding: 64px 16px 72px;
  }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .meta-row { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .turns li { grid-template-columns: 1fr; gap: 2px; }
  table { min-width: 360px; }
}

@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric .v { font-size: 18px; }
  section.block > h2 { font-size: 18px; }
}
