:root {
  --bg: #0d1117;
  --card: #161b22;
  --line: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --blue: #58a6ff;
}

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

#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(1200px 600px at 50% -10%, #16233a 0%, #0d1117 55%, #0a0d12 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .6s ease, visibility .6s ease;
}
#splash.hide {
  opacity: 0;
  visibility: hidden;
}
.splash-inner {
  text-align: center;
  width: min(88vw, 360px);
}
.kline {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 24px rgba(88, 166, 255, .12));
}
.kline .candle {
  animation: candleIn .5s ease both;
  transform-origin: 50% 100%;
}
@keyframes candleIn {
  from { opacity: 0; transform: translateY(10px) scaleY(.6); }
  to { opacity: 1; transform: none; }
}
.kline-path {
  stroke-dasharray: 700;
  stroke-dashoffset: 700;
  animation: drawPath 2.6s ease .7s forwards;
  filter: drop-shadow(0 0 6px rgba(88, 166, 255, .55));
}
@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}
.splash-title {
  margin-top: 22px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #e6edf3;
}
.splash-quote {
  margin-top: 14px;
  min-height: 42px;
  font-size: 15px;
  line-height: 1.6;
  color: #8b949e;
  padding: 0 8px;
  transition: opacity .5s ease;
}
.splash-quote.out { opacity: 0; }
.splash-status {
  margin-top: 18px;
  font-size: 12px;
  color: #58a6ff;
  letter-spacing: 1px;
}
.splash-status .dots {
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}
.err-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(248, 81, 73, .92);
  color: #fff;
  font-size: 13px;
  padding: 8px 12px;
  text-align: center;
}

header { text-align: center; padding: 8px 0 16px; }
.title { color: var(--muted); font-size: 13px; letter-spacing: 2px; }
.price-line { font-size: 42px; font-weight: 700; margin: 4px 0; }
.price-line .unit { font-size: 16px; color: var(--muted); margin-left: 6px; }
.meta { display: flex; justify-content: center; gap: 10px; align-items: center; }
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  background: var(--card);
  border: 1px solid var(--line);
}
.badge.up { color: var(--green); border-color: var(--green); }
.badge.down { color: var(--red); border-color: var(--red); }
.badge.breakdown { color: var(--yellow); border-color: var(--yellow); }
.sub { color: var(--muted); font-size: 12px; margin-top: 6px; }

.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.level-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.level-card .lv { font-size: 18px; font-weight: 700; }
.level-card .lb { color: var(--muted); font-size: 12px; margin-top: 2px; }
.level-card .ds { font-size: 12px; margin-top: 4px; }
.level-card .ds.above { color: var(--green); }
.level-card .ds.below { color: var(--red); }
.level-card .ds.at { color: var(--yellow); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.stat-card .v { font-size: 20px; font-weight: 700; }
.stat-card .k { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat-card .v.pos { color: var(--green); }
.stat-card .v.neg { color: var(--red); }

.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}
.chart-box h2 { font-size: 14px; margin-bottom: 8px; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.chart { width: 100%; height: 300px; }
.intervals { float: right; }
.intervals button {
  padding: 2px 10px;
  font-size: 12px;
}
.intervals button.active {
  border-color: var(--blue);
  color: var(--blue);
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
@media (max-width: 700px) {
  .panels { grid-template-columns: 1fr; }
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.panel h2 { font-size: 14px; margin-bottom: 8px; }
.events { list-style: none; max-height: 320px; overflow-y: auto; }
.events li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.events .et { font-size: 11px; color: var(--muted); display: block; }
.events .ed { margin-top: 2px; }
.news-panel { margin: 12px 0; }
.event-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.event-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
}
.event-chip.active {
  color: var(--yellow);
  border-color: var(--yellow);
}
.news-list {
  list-style: none;
  max-height: 360px;
  overflow-y: auto;
}
.news-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.news-list .nmeta { font-size: 11px; color: var(--muted); }
.news-list a { color: var(--text); text-decoration: none; }
.news-list a:hover { color: var(--blue); }
.nsum {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0;
}
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 6px;
}
.tag.high { background: rgba(248, 81, 73, .15); color: var(--red); border: 1px solid var(--red); }
.tag.medium { background: rgba(210, 153, 34, .15); color: var(--yellow); border: 1px solid var(--yellow); }
.tag.low { background: rgba(139, 148, 158, .15); color: var(--muted); border: 1px solid var(--line); }
.reaction-title {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.reaction-list { max-height: 160px; overflow-y: auto; }
.reaction-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.reaction-row .rt { flex: 1; }
.reaction-row .rp { font-weight: 700; }
.reaction-row .rd { color: var(--muted); font-size: 12px; }
.table-wrap { max-height: 320px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--card); }
.pos { color: var(--green); }
.neg { color: var(--red); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 16px 0;
}
button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
}
.login-box {
  max-width: 320px;
  margin: 22vh auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
}
.login-tip { color: var(--muted); font-size: 13px; margin: 14px 0 10px; }
.login-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--blue);
  color: #0d1117;
  font-weight: 700;
  border: none;
  border-radius: 8px;
}
.login-err { color: var(--red); font-size: 12px; margin-top: 10px; min-height: 16px; }
