:root {
  color-scheme: dark;
  --bg: #111412;
  --panel: #191d1a;
  --panel-2: #202620;
  --text: #edf2ed;
  --muted: #9ba69d;
  --line: #30382f;
  --green: #36c275;
  --red: #e45d57;
  --accent: #e0b84b;
  --blue: #67a7df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 56px) 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

main {
  padding: 22px clamp(18px, 4vw, 56px) 44px;
}

.controls,
.segmented,
.summary,
.chart-head {
  display: flex;
  align-items: center;
}

.controls {
  gap: 12px;
}

.segmented {
  min-height: 40px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button,
.icon-button {
  min-width: 44px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.segmented button.active,
.icon-button:hover {
  color: var(--text);
  background: var(--panel-2);
}

.compact {
  min-height: 36px;
}

.compact button {
  min-width: 42px;
  height: 28px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary > div {
  min-height: 72px;
  padding: 14px 16px;
  background: var(--panel);
}

.summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.summary strong {
  font-size: 18px;
}

.market-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.section-block {
  min-width: 0;
}

.section-block h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.cards {
  display: grid;
  gap: 10px;
}

.market-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  width: 100%;
  min-height: 96px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.market-card.active {
  border-color: var(--accent);
  background: #22251d;
}

.market-card .name {
  min-width: 0;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.market-card .meta,
.market-card .range,
.market-card .volume-text {
  color: var(--muted);
  font-size: 12px;
}

.market-card .price {
  font-size: 20px;
  font-weight: 780;
  text-align: right;
}

.market-card .change {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
}

.up {
  color: var(--green);
}

.down {
  color: var(--red);
}

html[lang="zh-CN"] .up {
  color: var(--red);
}

html[lang="zh-CN"] .down {
  color: var(--green);
}

.chart-layout {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.chart-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.chart,
.volume {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
}

.chart {
  position: relative;
  height: 430px;
  border-radius: 8px 8px 0 0;
}

.chart-only {
  border-radius: 8px;
}

.volume {
  position: relative;
  height: 120px;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.volume.hidden {
  display: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 190px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(17, 20, 18, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  font-size: 12px;
  line-height: 1.55;
  pointer-events: none;
}

.tooltip-date {
  margin-bottom: 4px;
  color: var(--accent);
  font-weight: 760;
}

.ma-legend {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  color: var(--muted);
  background: rgba(25, 29, 26, 0.74);
  border: 1px solid rgba(48, 56, 47, 0.72);
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
}

.ma-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ma-legend i {
  width: 14px;
  height: 2px;
  border-radius: 2px;
}

.volume-tooltip {
  min-width: 150px;
}

@media (max-width: 720px) {
  .topbar,
  .chart-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .controls {
    width: 100%;
    justify-content: space-between;
  }

  .chart {
    height: 340px;
  }
}
