/* AVGO 每日追踪 — 浅色/深色自适应样式表（零依赖）
 * 默认浅色；深色通过 <html data-theme="dark"> 生效；
 * “系统配色”模式由 theme.js 在加载时按 prefers-color-scheme 解析为 light/dark。
 */
:root {
  color-scheme: light;
  --scheme: light;
  --bg: #f3f6fb;
  --bg-soft: #e9eef7;
  --card: #ffffff;
  --card-hover: #eef3fb;
  --border: #d9e2f1;
  --text: #1d2433;
  --muted: #5e6b85;
  --faint: #98a4bc;
  --green: #0a9b66;
  --red: #d3313b;
  --accent: #2f5fe0;
  --gold: #9c7400;
  --list-text: #3a4560;
  --stat-bg: rgba(47, 95, 224, 0.05);
  --tip-bg: rgba(255, 255, 255, 0.97);
  --tip-border: #c7d3e8;
  --header-bg: rgba(255, 255, 255, 0.88);
  --glow: #dbe6fa;
  --disclaimer-text: #a83a41;
  --chart-grid: #e1e8f4;
  --chart-text: #5e6b85;
  --chart-price: #2f5fe0;
  --chart-ma20: #9c7400;
  --chart-ma50: #0a9b66;
  --chart-ma200: #7a5cff;
  --chart-up: #0a9b66;
  --chart-down: #d3313b;
  --chart-last: #1d2433;
  --chart-rsi: #2f5fe0;
  --chart-rsi-hot: #d3313b;
  --chart-rsi-cool: #0a9b66;
  --chart-cross: rgba(29, 36, 51, 0.3);
  --radius: 12px;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --scheme: dark;
  --bg: #0a0e15;
  --bg-soft: #0e1420;
  --card: #121a29;
  --card-hover: #162032;
  --border: #1f2b40;
  --text: #e9eef6;
  --muted: #8b99b0;
  --faint: #5c6a82;
  --green: #16c784;
  --red: #ea3943;
  --accent: #4f7cff;
  --gold: #f0b90b;
  --list-text: #cfd8e6;
  --stat-bg: rgba(255, 255, 255, 0.03);
  --tip-bg: rgba(14, 20, 32, 0.96);
  --tip-border: #2a3a58;
  --header-bg: rgba(10, 14, 21, 0.85);
  --glow: #12203a;
  --disclaimer-text: #d8a0a3;
  --chart-grid: #1c2740;
  --chart-text: #8b99b0;
  --chart-price: #5b8cff;
  --chart-ma20: #f0b90b;
  --chart-ma50: #16c784;
  --chart-ma200: #b07cff;
  --chart-up: #16c784;
  --chart-down: #ea3943;
  --chart-last: #e9eef6;
  --chart-rsi: #5b8cff;
  --chart-rsi-hot: #ea3943;
  --chart-rsi-cool: #16c784;
  --chart-cross: rgba(233, 238, 246, 0.35);
}

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

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

body {
  background: radial-gradient(1200px 500px at 50% -10%, var(--glow) 0%, var(--bg) 55%) fixed,
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.75;
  min-height: 100vh;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 18px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 头部 ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.ticker-badge {
  font-family: var(--mono); font-weight: 800; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent), #7a5cff);
  color: #fff; border-radius: 10px; padding: 8px 12px; letter-spacing: 1px;
  box-shadow: 0 4px 18px rgba(79, 124, 255, 0.35);
  white-space: nowrap;
}
.brand h1 { font-size: 1.35rem; line-height: 1.3; letter-spacing: 2px; }
.subtitle { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.nav { display: flex; gap: 18px; font-size: 0.9rem; white-space: nowrap; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- 通用区块 ---------- */
main { padding: 26px 0 40px; }
section { margin-bottom: 36px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.section-head h2 {
  font-size: 1.15rem; letter-spacing: 3px;
  border-left: 4px solid var(--accent); padding-left: 10px;
}
.date-tag {
  font-size: 0.8rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; background: var(--bg-soft);
}

/* ---------- 最新一期卡片 ---------- */
.brief-card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px;
}
.brief-card.featured { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
.price-row { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.price { font-family: var(--mono); font-size: 2.2rem; font-weight: 800; }
.change {
  font-family: var(--mono); font-weight: 700; font-size: 1.05rem;
  padding: 3px 12px; border-radius: 8px;
}
.change.up { color: var(--green); background: rgba(22, 199, 132, 0.12); }
.change.down { color: var(--red); background: rgba(234, 57, 67, 0.12); }
.key-points { list-style: none; margin: 12px 0 18px; }
.key-points li {
  padding: 7px 0 7px 22px; position: relative;
  color: var(--list-text); font-size: 0.95rem; border-bottom: 1px dashed var(--border);
}
.key-points li:last-child { border-bottom: none; }
.key-points li::before {
  content: "▸"; position: absolute; left: 4px; color: var(--accent);
}
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 10px 22px; border-radius: 10px; font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 124, 255, 0.4); }

/* ---------- 归档 ---------- */
.filter-row { display: flex; gap: 10px; align-items: center; }
#archive-filter {
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 0.9rem;
}
#archive-clear {
  background: transparent; color: var(--muted); cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px;
  font-size: 0.9rem;
}
#archive-clear:hover { color: var(--text); border-color: var(--faint); }
.archive-list { display: grid; gap: 12px; }
.archive-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease;
}
.archive-card:hover { background: var(--card-hover); text-decoration: none;
  transform: translateY(-1px); }
.archive-date {
  font-family: var(--mono); font-size: 0.85rem; color: var(--gold);
  border: 1px solid rgba(240, 185, 11, 0.35); border-radius: 8px;
  padding: 4px 10px; white-space: nowrap; background: rgba(240, 185, 11, 0.07);
}
.archive-title { flex: 1; font-size: 0.95rem; color: var(--list-text); }
.archive-arrow { color: var(--faint); font-size: 1.2rem; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------- 日报正文页 ---------- */
.back-link { display: inline-block; margin-bottom: 16px; color: var(--muted);
  font-size: 0.9rem; }
.back-link:hover { color: var(--text); text-decoration: none; }
.brief-hero {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 22px;
}
.brief-hero h2 { font-size: 1.4rem; letter-spacing: 1px; margin-bottom: 4px; }
.brief-hero .cutoff { color: var(--muted); font-size: 0.85rem; margin-bottom: 14px; }
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin-top: 14px;
}
.stat {
  background: var(--stat-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.stat .label { font-size: 0.75rem; color: var(--muted); }
.stat .value { font-family: var(--mono); font-size: 1.05rem; font-weight: 700; }
.stat .value.up { color: var(--green); }
.stat .value.down { color: var(--red); }
.stat .value.neutral { color: var(--gold); }

.brief-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
}
.brief-section h3 {
  font-size: 1.05rem; letter-spacing: 2px; margin-bottom: 10px;
  color: var(--gold);
}
.brief-section ul { list-style: none; }
.brief-section li {
  padding: 6px 0 6px 20px; position: relative;
  color: var(--list-text); font-size: 0.94rem;
}
.brief-section li::before { content: "•"; position: absolute; left: 4px;
  color: var(--accent); font-weight: 800; }
.brief-section li .src { color: var(--faint); font-size: 0.78rem; }
.num { font-family: var(--mono); }
.tag {
  display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 6px;
  margin-left: 6px; vertical-align: middle;
}
.tag.bull { color: var(--green); background: rgba(22, 199, 132, 0.12); }
.tag.bear { color: var(--red); background: rgba(234, 57, 67, 0.12); }
.tag.flat { color: var(--gold); background: rgba(240, 185, 11, 0.1); }

.sources {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin: 22px 0 10px; font-size: 0.82rem; color: var(--muted);
}
.sources strong { color: var(--text); }
.disclaimer {
  background: rgba(234, 57, 67, 0.06); border: 1px solid rgba(234, 57, 67, 0.25);
  border-radius: var(--radius); padding: 14px 18px;
  font-size: 0.85rem; color: var(--disclaimer-text); margin-bottom: 20px;
}

/* ---------- 图表 ---------- */
.chart-block { margin: 4px 0 18px; }
.chart-title { font-size: 0.95rem; font-weight: 600; color: var(--text); margin: 16px 0 2px; }
.chart-sub { font-size: 0.75rem; color: var(--faint); margin-bottom: 4px; }
.chart-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--muted); margin: 2px 0 6px;
}
.chart-legend .lg {
  display: inline-block; width: 14px; height: 3px; border-radius: 2px;
  margin-right: 6px; vertical-align: middle;
}
.chart-wrap { position: relative; }
canvas.chart { width: 100%; height: 300px; display: block; touch-action: pan-y; cursor: crosshair; }
canvas.chart.sm { height: 170px; }
canvas.sparkline { width: 100%; height: 54px; display: block; }
.spark-wrap { margin: 2px 0 10px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--tip-bg); border: 1px solid var(--tip-border);
  border-radius: 8px; padding: 8px 11px;
  font-size: 0.75rem; line-height: 1.6; color: var(--text);
  white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.chart-tip .tt-date { color: var(--gold); font-family: var(--mono); font-size: 0.72rem; }
.chart-tip b { font-family: var(--mono); }
.chart-tip .t-up { color: var(--green); font-family: var(--mono); }
.chart-tip .t-down { color: var(--red); font-family: var(--mono); }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border); padding: 22px 0 30px;
  color: var(--faint); font-size: 0.8rem; text-align: center;
}
.site-footer p { margin: 4px 0; }

/* ---------- 配色开关（OpenRin Rin 按钮风格：胶囊形；选中=主题粉，未选中=中性灰） ---------- */
:root {
  --rin-pink: #fc466b;         /* Rin 主按钮 252 70 107 */
  --rin-pink-hover: #b13049;   /* 177 48 73 */
  --rin-pink-active: #972038;  /* 151 32 56 */
  --rin-btn-bg: #f5f5f5;       /* Rin 次按钮底色（浅色） */
  --rin-btn-hover: #e5e5e5;
  --rin-btn-active: #d4d4d4;
}
:root[data-theme="dark"] {
  --rin-btn-bg: #404040;       /* Rin 次按钮底色（深色） */
  --rin-btn-hover: #525252;
  --rin-btn-active: #737373;
}
.theme-switch {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.theme-label { color: var(--faint); font-size: 0.78rem; margin-right: 2px; }
.theme-btn {
  font-family: inherit; font-size: 0.8rem; white-space: nowrap;
  background: var(--rin-btn-bg); color: var(--text);
  border: none; border-radius: 999px;
  padding: 8px 16px; cursor: pointer;
  transition: background-color 0.15s ease;
}
.theme-btn:hover { background: var(--rin-btn-hover); }
.theme-btn:active { background: var(--rin-btn-active); }
.theme-btn:focus-visible { outline: 2px solid var(--rin-pink); outline-offset: 2px; }
.theme-btn.active {
  background: var(--rin-pink); color: #fff; font-weight: 600;
}
.theme-btn.active:hover { background: var(--rin-pink-hover); }
.theme-btn.active:active { background: var(--rin-pink-active); }
/* 图标版按钮：圆形胶囊，图标随按钮文字颜色（currentColor） */
.theme-btn-icon { padding: 9px; line-height: 0; }
.theme-btn-icon svg { width: 17px; height: 17px; display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .brand h1 { font-size: 1.1rem; }
  .subtitle { font-size: 0.75rem; }
  .nav { gap: 12px; font-size: 0.85rem; }
  .price { font-size: 1.8rem; }
  .brief-card, .brief-section, .brief-hero { padding: 16px; }
  .archive-card { flex-wrap: wrap; }
  .archive-arrow { display: none; }
  .section-head h2 { font-size: 1rem; }
  canvas.chart { height: 240px; }
  canvas.chart.sm { height: 150px; }
}

/* ═══ 深度文章页：数据表格 ═══ */
.data-table-wrap { overflow-x: auto; margin: 0.9em 0 1.2em; border: 1px solid var(--border); border-radius: 10px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; background: var(--card); }
.data-table caption { text-align: left; font-weight: 700; padding: 0.7em 0.9em; border-bottom: 1px solid var(--border); }
.data-table th, .data-table td { padding: 0.55em 0.8em; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { background: var(--card-hover); font-weight: 700; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: none; }
.data-table .src-note { font-size: 0.78rem; opacity: 0.75; }

/* 内联数据图表（迁移自原文 SVG） */
.chart-figure { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 0.9em 0 1.2em; background: var(--card); }
.chart-figure .fig-title { font-size: 14px; font-weight: 700; }
.chart-figure .fig-sub { font-size: 12px; opacity: 0.7; margin: 2px 0 8px; }
.chart-figure .fig-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; opacity: 0.85; margin-bottom: 8px; }
.chart-figure .fig-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.chart-figure svg { width: 100%; height: auto; display: block; }
.chart-figure.narrow svg { max-width: 340px; margin: 0 auto; }
.article-meta { color: var(--muted, #8a94a6); font-size: 0.85rem; margin-top: 0.4em; }
.article-meta a { color: inherit; }
.qa { border-left: 3px solid var(--border); padding: 0.2em 0 0.2em 1em; margin: 1em 0; }
.qa .q { font-weight: 700; }
.qa .a { margin-top: 0.3em; }
.tag-warn { display: inline-block; background: #fff3cd; color: #8a6d1a; border-radius: 6px; padding: 0 0.5em; font-size: 0.82em; font-weight: 700; }
:root[data-theme="dark"] .tag-warn { background: #4a3d12; color: #ffd97a; }
