:root {
  --bg: #0f1419;
  --panel: #1a222d;
  --text: #e7ecf3;
  --muted: #9aa7b8;
  --accent: #3d9cf0;
  --ok: #3ecf8e;
  --bad: #f07178;
  --line: #2a3544;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2a3d, var(--bg));
  color: var(--text);
  min-height: 100vh;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em; }
.meta { color: var(--muted); font-size: 0.9rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.hero h1 { margin: 0 0 0.5rem; font-size: 1.8rem; }
.hero p { color: var(--muted); margin: 0.35rem 0; }
.hero .path code { color: var(--accent); }
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  position: relative;
}
.panel h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.panel p { margin: 0; color: var(--muted); line-height: 1.5; }
.badge {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #243247;
  color: var(--accent);
}
.status h2 { font-size: 1.1rem; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
td code { color: #c6d4e5; font-size: 0.82rem; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
footer {
  max-width: 1100px;
  margin: 1rem auto 2rem;
  padding: 0 1.5rem;
  color: var(--muted);
}
footer a { color: var(--accent); margin-right: 0.8rem; }
@media (max-width: 720px) {
  .panels { grid-template-columns: 1fr; }
}

a.brand-link { color: inherit; text-decoration: none; }
a.badge { color: var(--accent); text-decoration: none; }
.research { max-width: 1200px; }
.controls { margin-bottom: 1rem; }
.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  margin-bottom: 0.6rem;
}
.ctrl-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.ctrl-row label.grow { flex: 1; min-width: 220px; }
.mode-switch {
  display: inline-flex;
  border: 2px solid #4a6fa0;
  border-radius: 10px;
  overflow: hidden;
  align-self: end;
  height: 2.6rem;
  box-shadow: 0 0 0 1px #1a2a3d, inset 0 0 0 1px rgba(61, 156, 240, 0.15);
  background: #0c121a;
}
.mode-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 0 1.25rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 5.2rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-btn + .mode-btn { border-left: 1px solid #2f4158; }
.mode-btn:hover:not(.active) {
  color: var(--text);
  background: #182230;
}
.mode-btn.active {
  background: linear-gradient(180deg, #3d9cf0, #2b7bc4);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}
body.mode-live .mode-btn.active {
  background: linear-gradient(180deg, #3ecf8e, #2aa86a);
}
.ctrl-inline {
  display: contents;
}
body.mode-live #controls-history,
body.mode-live #slider-row { display: none !important; }
body.mode-history #controls-live { display: none !important; }
body.mode-live #controls-live { display: contents; }
.ctrl-row .ymd {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}
.ctrl-row .ymd select { min-width: 0; }
.ctrl-row .ymd select:first-child { width: 4.6rem; }
.ctrl-row .ymd select:last-child { width: 5.6rem; }
.ctrl-row input, .ctrl-row select, .ctrl-row button {
  background: #121820;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
}
.ctrl-row button {
  background: #243247;
  color: var(--accent);
  cursor: pointer;
  height: 2.2rem;
}
.ctrl-row button:hover { border-color: var(--accent); }
.ctrl-row .mode-field { gap: 0.3rem; }
.ctrl-row .mode-switch {
  border: 2px solid #4a6fa0;
  border-radius: 10px;
  height: 2.6rem;
  box-shadow: 0 0 0 1px #1a2a3d, inset 0 0 0 1px rgba(61, 156, 240, 0.2);
  background: #0c121a;
}
.ctrl-row .mode-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  height: 100%;
  padding: 0 1.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  min-width: 5.6rem;
}
.ctrl-row .mode-btn:hover { border-color: transparent; }
.ctrl-row .mode-btn.active {
  background: linear-gradient(180deg, #3d9cf0, #2b7bc4);
  color: #fff;
  border: 0;
}
body.mode-live .ctrl-row .mode-btn.active {
  background: linear-gradient(180deg, #3ecf8e, #2aa86a);
  color: #fff;
}
.slider-row { align-items: center; }
.muted { color: var(--muted); font-size: 0.85rem; }
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.charts .wide { grid-column: 1 / -1; }
.charts h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.charts canvas { width: 100% !important; max-height: 340px; }
@media (max-width: 900px) {
  .charts { grid-template-columns: 1fr; }
  .charts .wide { grid-column: auto; }
}
