:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --gold: #f5b400;
  --gold-soft: #ffd35a;
  --green: #2ea043;
  --red: #f85149;
  --accent: #58a6ff;
  --cn-red: #d4392f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.hero {
  background: linear-gradient(135deg, #1a1f2a 0%, #2b1e0c 60%, #3a2a08 100%);
  border-bottom: 1px solid var(--border);
  padding: 28px 24px 16px;
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
  color: #1a1200;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px;
  box-shadow: 0 8px 24px rgba(245, 180, 0, 0.25);
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.price-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.price-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  min-width: 250px;
  backdrop-filter: blur(8px);
}
.price-card.cn { border-color: rgba(212,57,47,0.35); background: rgba(212,57,47,0.05); }
.price-label { color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.price-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.price-card.cn .price-value { color: var(--gold-soft); }
.price-change { font-size: 13px; margin-top: 2px; }
.price-change.up { color: var(--red); }
.price-change.down { color: var(--green); }
.price-meta {
  display: flex; gap: 12px; margin-top: 6px;
  font-size: 11px; color: var(--muted);
  flex-wrap: wrap;
}
.price-meta b { color: var(--text); font-weight: 600; margin-left: 3px; }

.updated-line {
  max-width: 1200px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap; gap: 12px;
}
.card-head h2 { margin: 0; font-size: 16px; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; }

.range-tabs, .currency-tabs, .market-toggle { display: flex; gap: 4px; }
.range-tabs button,
.currency-tabs button,
.market-toggle button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  font-family: inherit;
}
.range-tabs button:hover,
.currency-tabs button:hover,
.market-toggle button:hover { color: var(--text); border-color: var(--gold); }
.range-tabs button.active,
.currency-tabs button.active {
  background: var(--gold); color: #1a1200;
  border-color: var(--gold); font-weight: 600;
}

.market-toggle-card { padding: 14px 22px; }
.market-toggle button { padding: 7px 18px; font-size: 14px; }
.market-toggle button.active {
  background: var(--gold); color: #1a1200;
  border-color: var(--gold); font-weight: 600;
}
.market-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-wrap { position: relative; height: 380px; }
.chart-wrap.small { height: 340px; }

.history-hint {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  margin-top: 6px;
  font-style: italic;
}

/* Alerts */
.alerts-status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.alerts-status.ok {
  color: #6ddc8a;
  border-color: rgba(109,220,138,0.3);
  background: rgba(46,160,67,0.08);
}
.alerts-status.warn {
  color: #ffb86b;
  border-color: rgba(255,184,107,0.3);
  background: rgba(255,184,107,0.08);
}
.alert-form {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1fr 1.4fr 0.8fr auto auto;
  gap: 8px;
  margin-bottom: 8px;
}
.alert-form select, .alert-form input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.alert-form select:focus, .alert-form input:focus {
  outline: none; border-color: var(--gold);
}
.primary-btn, .ghost-btn {
  background: var(--gold);
  color: #1a1200;
  border: 1px solid var(--gold);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
}
.ghost-btn { background: transparent; color: var(--gold); }
.primary-btn:hover { filter: brightness(1.1); }
.ghost-btn:hover { background: rgba(245,180,0,0.1); }
.alert-hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
@media (max-width: 880px) {
  .alert-form { grid-template-columns: 1fr 1fr; }
  .primary-btn, .ghost-btn { grid-column: 1 / -1; }
}
.alerts-list { list-style: none; padding: 0; margin: 0; }
.alerts-list li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.alerts-list li:last-child { border-bottom: none; }
.alert-toggle {
  appearance: none;
  width: 36px; height: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative; cursor: pointer;
  transition: all 0.15s;
}
.alert-toggle::after {
  content: ""; position: absolute;
  top: 1px; left: 1px; width: 16px; height: 16px;
  background: var(--muted); border-radius: 50%;
  transition: all 0.15s;
}
.alert-toggle:checked { background: var(--gold); border-color: var(--gold); }
.alert-toggle:checked::after { background: #1a1200; left: 17px; }
.alert-summary { min-width: 0; }
.alert-rule { font-weight: 600; font-size: 14px; color: var(--text); }
.alert-rule .metric-tag { color: var(--gold); font-variant-numeric: tabular-nums; }
.alert-name { color: var(--muted); font-size: 12px; margin-top: 2px; }
.alert-last { color: var(--muted); font-size: 11px; white-space: nowrap; text-align: right; }
.alert-del {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--red);
  padding: 4px 10px; border-radius: 6px;
  cursor: pointer; font-size: 12px;
}
.alert-del:hover { background: rgba(248,81,73,0.1); border-color: var(--red); }

/* Positioning */
.positioning-list { display: grid; gap: 16px; }
.positioning-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.positioning-item:last-child { border-bottom: none; }
.positioning-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px; gap: 12px;
}
.positioning-name { font-weight: 600; font-size: 14px; }
.positioning-net {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.positioning-net.bull { color: #6ddc8a; }
.positioning-net.bear { color: #ff8989; }
.positioning-bar {
  display: flex; height: 10px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.positioning-long  { background: linear-gradient(90deg, #2ea043 0%, #6ddc8a 100%); }
.positioning-short { background: linear-gradient(90deg, #ff8989 0%, #f85149 100%); }
.positioning-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
  flex-wrap: wrap; gap: 8px;
}
.positioning-meta .pct-row {
  display: flex; gap: 12px;
  font-variant-numeric: tabular-nums;
}
.positioning-meta a {
  color: var(--gold);
  text-decoration: none;
}
.positioning-meta a:hover { text-decoration: underline; }
.positioning-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 880px) { .grid-2 { grid-template-columns: 1fr; } }

.factor-list { list-style: none; padding: 0; margin: 0; }
.factor-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.factor-list li:last-child { border-bottom: none; }
.factor-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 4px;
}
.factor-name { font-weight: 600; }
.factor-weight {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.factor-direction {
  font-size: 11px; padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-left: 8px;
}
.factor-direction.bear { color: #ff8989; border-color: rgba(255,137,137,0.3); background: rgba(248,81,73,0.08); }
.factor-direction.bull { color: #6ddc8a; border-color: rgba(109,220,138,0.3); background: rgba(46,160,67,0.08); }
.factor-direction.neutral { color: #d2a8ff; border-color: rgba(210,168,255,0.3); background: rgba(132,87,255,0.08); }
.factor-detail { color: var(--muted); font-size: 13px; }

.analysis { display: grid; gap: 14px; }
.analysis .block {
  background: var(--surface-2);
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  border-radius: 6px;
}
.analysis .block h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.analysis .block p { margin: 0; color: var(--text); font-size: 14px; }

.footer {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 12px;
  padding: 8px 4px 24px;
  flex-wrap: wrap; gap: 8px;
}

/* News */
.news-filters { display: flex; gap: 4px; flex-wrap: wrap; max-width: 70%; }
.news-filters button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.news-filters button:hover { color: var(--text); border-color: var(--gold); }
.news-filters button.active {
  background: var(--gold); color: #1a1200;
  border-color: var(--gold); font-weight: 600;
}

.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.news-list li:last-child { border-bottom: none; }
.news-date {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.news-main { min-width: 0; }
.news-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.5;
  display: block;
  word-break: break-word;
}
.news-title:hover { color: var(--gold); text-decoration: underline; }
.news-title:hover .news-arrow { transform: translateX(2px); }
.news-arrow {
  display: inline-block;
  color: var(--muted);
  margin-left: 4px;
  transition: transform 0.15s;
}
.news-meta {
  margin-top: 4px;
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
}
.news-source {
  color: var(--muted);
  font-size: 11px;
}
.news-factor {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(245,180,0,0.1);
  color: var(--gold-soft);
  border: 1px solid rgba(245,180,0,0.25);
}
.news-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

.news-section {
  display: block !important;
  padding: 16px 0 8px !important;
  border-bottom: none !important;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.news-section:first-child { padding-top: 4px !important; }

.news-compact {
  grid-template-columns: 80px 1fr auto !important;
  padding: 8px 4px !important;
  font-size: 13px;
}
.news-compact .news-title {
  font-size: 13px;
  color: var(--muted);
}
.news-compact .news-title:hover { color: var(--gold); }
.news-compact .news-date { font-size: 11px; }
.news-compact .news-factor {
  font-size: 10px;
  padding: 1px 6px;
}

@media (max-width: 600px) {
  .news-list li { grid-template-columns: 1fr; gap: 4px; }
  .news-filters { max-width: 100%; }
}
