:root {
  color-scheme: light;
  --bg: #f3f4f5;
  --panel: #ffffff;
  --panel-strong: #fff5f5;
  --text: #25272b;
  --muted: #60646c;
  --line: #d9dce0;
  --accent: #bc2639;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  border-top: 4px solid var(--accent);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 3.5rem;
  line-height: 0.92;
}

h2 {
  margin-bottom: 0.85rem;
  font-size: 1.4rem;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto 4rem;
}

.status {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  color: var(--muted);
  text-align: right;
}

.status strong {
  color: var(--accent);
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric {
  min-height: 9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span,
.metric small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.metric strong {
  font-size: 1.8rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.history { margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.history h2 { font-size: 1.4rem; margin: 0; }
.history select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); padding: 0.6rem; max-width: 100%; }
#historyStatus { color: var(--muted); font-size: 0.85rem; margin: 0.8rem 0; }
#priceStatus { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.8rem; }
.chart { height: 280px; position: relative; width: 100%; min-width: 0; }
.chart-heading { display: flex; gap: 0.5rem 1rem; flex-wrap: wrap; align-items: baseline; justify-content: space-between; margin: 1.2rem 0 0.5rem; }
.chart-heading h3 { font-size: 1rem; margin: 0; }
.chart-heading span { font-size: 0.8rem; color: var(--muted); }
.chart-controls { display: flex; gap: 0.4rem; }
.chart-controls button { min-width: 40px; height: 40px; padding: 0 0.75rem; font: inherit; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--text); cursor: pointer; }
.chart-controls button:hover { border-color: var(--accent); color: var(--accent); }
.chart-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart canvas { touch-action: pan-y; cursor: grab; }
.chart canvas:active { cursor: grabbing; }

.metric.live {
  background: var(--panel-strong);
  border-color: var(--accent);
}

.forecast {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  gap: 1.5rem;
  margin-top: 1.4rem;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  border-left: 4px solid var(--accent);
}

.forecast p {
  color: var(--muted);
}

.forecast ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
}

.forecast li + li {
  margin-top: 0.6rem;
}

@media (max-width: 900px) {
  .overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .status {
    justify-items: start;
    text-align: left;
  }

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