:root {
  color-scheme: light;
  --ink: #202522;
  --muted: #68716c;
  --line: #dfe4e1;
  --surface: #ffffff;
  --background: #f3f5f3;
  --green: #16765a;
  --amber: #b78a27;
  --danger: #bb493a;
  font-family: "IBM Plex Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--background); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--background);
  line-height: 1.5;
}
button, canvas { -webkit-tap-highlight-color: transparent; }

.topbar {
  color: #f8fbf9;
  background: #202a25;
  border-bottom: 3px solid #3e8d70;
}
.topbar__inner, .section-inner {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}
.topbar__inner {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.eyebrow, .section-kicker {
  margin: 0 0 4px;
  color: #91c6b2;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
}
.status-cluster { display: flex; align-items: center; gap: 11px; }
.status-cluster > div { display: grid; min-width: 180px; }
.status-label { font-size: 13px; font-weight: 650; }
#updated-at { color: #b8c3bd; font-size: 12px; }
.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #5bd09d;
  box-shadow: 0 0 0 4px rgba(91, 208, 157, 0.13);
}
.status-dot.offline {
  background: #e47260;
  box-shadow: 0 0 0 4px rgba(228, 114, 96, 0.13);
}
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #f8fbf9;
  background: transparent;
  border: 1px solid #59635e;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 21px;
}
.icon-button:hover { background: #303b35; border-color: #839089; }
.icon-button:focus-visible { outline: 3px solid rgba(91, 208, 157, 0.35); outline-offset: 2px; }
.icon-button.is-loading span { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.exchange-list { min-height: 480px; }
.loading-state { min-height: 420px; display: grid; place-items: center; color: var(--muted); }
.exchange-section {
  --accent: var(--green);
  padding: 52px 0 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.exchange-section:nth-child(even) { background: #f7f8f7; }
.exchange-section:last-child { border-bottom: 0; }
.exchange-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}
.exchange-name-row { display: flex; align-items: center; gap: 10px; }
.exchange-mark { width: 5px; height: 25px; background: var(--accent); border-radius: 1px; }
.exchange-name {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
}
.live-badge {
  padding: 3px 7px;
  color: #246f58;
  background: #e4f2ec;
  border: 1px solid #c4dfd4;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
}
.headline-return { display: grid; justify-items: end; }
.headline-return span { color: var(--muted); font-size: 12px; }
.headline-return strong {
  color: var(--accent);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.headline-return strong.negative { color: var(--danger); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.metric {
  min-height: 83px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 13px 14px;
  background: #f7f9f8;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.exchange-section:nth-child(even) .metric { background: #ffffff; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 630;
  font-variant-numeric: tabular-nums;
}

.chart-shell { background: #ffffff; border: 1px solid var(--line); border-radius: 6px; }
.chart-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}
.chart-title { font-size: 14px; font-weight: 650; }
.chart-legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.legend-line { width: 22px; height: 2px; margin-left: 12px; background: var(--accent); }
.legend-line:first-child { margin-left: 0; }
.legend-flow { width: 2px; height: 14px; margin-left: 12px; border-left: 2px dashed var(--amber); }
.chart-wrap { position: relative; height: 340px; }
.performance-chart { width: 100%; height: 100%; display: block; cursor: crosshair; }
.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 202px;
  padding: 11px 12px;
  color: #f8fbf9;
  background: rgba(31, 38, 34, 0.96);
  border: 1px solid #59635e;
  border-radius: 5px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(20, 25, 22, 0.18);
  font-size: 12px;
}
.chart-tooltip time { display: block; margin-bottom: 7px; color: #b8c3bd; }
.chart-tooltip div { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; }
.chart-tooltip strong { font-variant-numeric: tabular-nums; }
.chart-tooltip .flow-row { margin-top: 5px; padding-top: 6px; color: #f0c86f; border-top: 1px solid #59635e; }
.exchange-error h2 { margin-bottom: 8px; }
.exchange-error p:last-child { margin-bottom: 0; color: var(--danger); }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar__inner, .section-inner { width: min(100% - 28px, 1440px); }
  .topbar__inner { min-height: 84px; }
  h1 { font-size: 21px; }
  .status-cluster > div { display: none; }
  .exchange-section { padding: 36px 0 40px; }
  .exchange-heading { align-items: flex-start; }
  .exchange-name { font-size: 22px; }
  .headline-return strong { font-size: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-wrap { height: 290px; }
  .chart-legend { display: none; }
}
@media (max-width: 480px) {
  .exchange-heading { display: grid; gap: 16px; }
  .headline-return { justify-items: start; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 68px; }
  .chart-header { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
