/*
 * [INPUT]: 共享theme.js设置的data-theme与原HTML/SVG语义
 * [OUTPUT]: 实时窗口日间配色、窄屏布局、输入框锚定候选及嵌入时单一页面滚动
 * [POS]: 叠加原版样式，不改曲线采样、取数或自选状态
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fa;
  --bg-soft: #f1f4f8;
  --panel: #ffffff;
  --panel-2: #f1f4f8;
  --line: #e1e6ed;
  --line-strong: #bcc8d9;
  --text: #202b3a;
  --muted: #627186;
  --blue: #245bd6;
  --cyan: #147b62;
  --red: #c33849;
  --amber: #936717;
  --shadow: 0 4px 16px rgba(23, 44, 74, 0.03);
}
body {
  background: #10151e;
}
html[data-embedded="true"],
html[data-embedded="true"] body {
  overflow-y: hidden;
}
[data-theme="light"] body {
  background: var(--bg);
}
[data-theme="light"] body::before {
  display: none;
}
[data-theme="light"] .hero,
[data-theme="light"] .card {
  background: var(--panel);
}
[data-theme="light"] .card::after {
  display: none;
}
[data-theme="light"] .badge,
[data-theme="light"] .global-status,
[data-theme="light"] .btn.secondary,
[data-theme="light"] .tab-btn,
[data-theme="light"] .chip {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--line);
}
[data-theme="light"] .btn:not(.secondary) {
  background: var(--blue);
  box-shadow: none;
}
[data-theme="light"] .tab-btn.active {
  background: #eaf0fc;
  color: var(--blue);
  border-color: #c8d8f6;
}
[data-theme="light"] .panel h3 {
  color: var(--text);
}
[data-theme="light"] .timestamp,
[data-theme="light"] .card .meta,
[data-theme="light"] .hover-box .t {
  color: var(--muted);
}
[data-theme="light"] .chart {
  background: var(--panel);
  border-color: var(--line);
}
[data-theme="light"] .hover-box {
  background: rgba(255, 255, 255, 0.97);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: 0 6px 22px #172c4a20;
}
[data-theme="light"] .blockbar input,
[data-theme="light"] #topNInput {
  background: var(--bg-soft) !important;
  color: var(--text);
}
[data-theme="light"] .chart svg text[fill="#dce8ff"] {
  fill: var(--text);
}
[data-theme="light"] .chart svg text[fill="#7e93b8"],
[data-theme="light"] .chart svg text[fill="#90a7cf"] {
  fill: var(--muted);
}
[data-theme="light"] .chart svg line {
  stroke: #dfe5ed;
}
[data-theme="light"] .chart svg line[stroke="rgba(125,154,211,0.45)"] {
  stroke: #9baabd;
}
/* 原曲线颜色偏亮：只加深系列颜色，坐标与标题仍使用主题令牌。 */
[data-theme="light"] .chart svg polyline,
[data-theme="light"] .chart svg circle,
[data-theme="light"] .chart svg text[font-size="12"],
[data-theme="light"] .hover-box .row {
  filter: brightness(0.66) saturate(1.15);
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 16px 10px 24px;
  }
  .hero {
    padding: 18px 16px;
    border-radius: 18px;
  }
  .hero-side {
    min-width: 0;
    width: 100%;
  }
  .hero h1 {
    font-size: 26px;
  }
  .hero-badge-row {
    gap: 6px;
  }
  .badge {
    padding: 6px 8px;
  }
  .panel {
    padding: 12px;
  }
}

/* 平台展示层：沿用原图形算法，统一页面密度与操作反馈。 */
.app {
  max-width: none;
  padding: 8px 0 24px;
}
.hero {
  border-radius: 14px;
  box-shadow: none;
  background: var(--panel);
}
.hero h1 {
  font-size: 30px;
}
.hero p {
  max-width: 640px;
  font-size: 14px;
}
.panel,
.card {
  border-radius: 12px;
  box-shadow: none;
}
.panel h3 {
  font-size: 16px;
}
.panel-sub,
.module-title p,
footer {
  font-size: 13px;
}
.card .value {
  font-size: 23px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 38px;
  border-radius: 8px;
}
.btn:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}
.market-kind {
  display: flex;
  gap: 8px;
  margin: 16px 0 12px;
}
.market-kind .btn {
  box-shadow: none;
  min-width: 96px;
}
.market-kind [aria-pressed="true"] {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--bg-soft);
}
.module-title h2 {
  font-size: 20px;
}
#lb td {
  padding: 9px 6px;
  font-size: 13px;
}
#lb td.x {
  width: 82px;
}
#lb td.x .b {
  min-width: 72px;
  min-height: 32px;
  padding: 4px 8px;
  opacity: 1;
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
#lb td.x .b:hover,
#lb td.x .b.selected {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--bg-soft);
}
.chip {
  border-radius: 7px;
  padding: 3px 6px 3px 10px;
}
.chip button {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  width: 28px;
  height: 28px;
}
.chip button:hover {
  color: var(--red);
}
#wlNotice:empty {
  display: none;
}
#wlNotice:not(:empty) {
  margin: 12px 0 0;
  color: var(--amber);
}
#wlChips {
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 600px) {
  .app {
    padding: 4px 0 20px;
  }
  .hero {
    padding: 18px 14px;
  }
  .hero h1 {
    font-size: 26px;
  }
  .hero p {
    font-size: 13px;
  }
  .card {
    padding: 13px 12px;
  }
  .card .value {
    font-size: 21px;
  }
  .blockbar strong {
    flex-basis: 100%;
  }
  .blockbar input {
    min-width: 0;
  }
  #lb td {
    padding: 8px 3px;
    font-size: 12px;
  }
  #lb td.x {
    width: 65px;
  }
  #lb td.x .b {
    min-width: 60px;
    padding: 4px;
    font-size: 11px;
  }
}

.mobile-chart-hint {
  display: none;
}
@media (max-width: 600px) {
  .mobile-chart-hint {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin: 8px 0;
  }
  .chart {
    overflow-x: auto;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }
  .chart svg {
    min-width: 900px;
  }
}

#wlCrosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
  pointer-events: none;
  display: none;
  z-index: 2;
}

.watch-search { position: relative; flex: 1; min-width: 0; }
.watch-search #wlInput { width: 100%; display: block; }
#wlSuggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  z-index: 20; max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-soft); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow); padding: 5px;
}
#wlSuggestions [role="option"] {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
#wlSuggestions small { color: var(--muted); }
#wlSuggestions [role="option"]:hover,
#wlSuggestions [aria-selected="true"] { background: var(--panel-2); color: var(--blue); }
#sec-whitelist > .panel:first-child { position: relative; z-index: 5; overflow: visible; }
