:root {
  color-scheme: light;
  --ink: #172720;
  --muted: #76837b;
  --line: #dce4dd;
  --paper: #f4f7f4;
  --white: #ffffff;
  --green: #1d7759;
  --green-dark: #15523f;
  --coral: #c65b43;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(30, 77, 55, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(30, 77, 55, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  height: 68px;
  padding: 0 max(28px, calc((100vw - 1080px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font: 500 11px "DM Mono", monospace;
}

.wordmark-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green-dark);
  font: 500 10px "DM Mono", monospace;
}

.wordmark-divider {
  padding: 0 4px;
  color: var(--coral);
}

.market-label,
.field-label,
.metric-label,
.eyebrow {
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.market-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #526259;
}

.live-dot,
.status-mark {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
}

main {
  width: min(100% - 48px, 980px);
  margin: 0 auto;
}

.intro {
  padding: 56px 0 33px;
  animation: arrive 500ms ease-out both;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--green);
}

h1 {
  margin: 0;
  font: 500 49px/1.05 "Newsreader", Georgia, serif;
  letter-spacing: 0;
}

h1 span {
  color: var(--green);
  font-style: italic;
}

.intro-copy {
  margin: 12px 0 0;
  color: #66756c;
  font-size: 14px;
}

.lab {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 16px 42px rgba(27, 52, 39, 0.055);
  animation: arrive 600ms 80ms ease-out both;
}

.controls {
  min-height: 91px;
  padding: 17px 22px;
  display: flex;
  align-items: end;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}

.field {
  display: grid;
  gap: 7px;
}

.ticker-field {
  width: min(100%, 280px);
}

.period-field {
  width: 180px;
}

.field-label {
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid #d5dfd7;
  border-radius: 4px;
  outline: none;
  color: var(--ink);
  background: white;
  font-size: 13px;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29, 119, 89, 0.12);
}

.ticker-field input {
  font: 500 13px "DM Mono", monospace;
}

.load-button {
  height: 40px;
  margin-left: auto;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--green-dark);
  border-radius: 4px;
  color: white;
  background: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 140ms ease, transform 140ms ease;
}

.load-button:hover:not(:disabled) {
  background: var(--green);
  transform: translateY(-1px);
}

.load-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.load-button span {
  color: #b6e2c9;
  font-size: 16px;
}

.status-row {
  min-height: 37px;
  padding: 0 23px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.status-mark {
  width: 6px;
  height: 6px;
  background: #9daaa1;
}

.status-row[data-state="loading"] .status-mark {
  background: #c18a2e;
  animation: pulse 900ms ease-in-out infinite alternate;
}

.status-row[data-state="success"] .status-mark {
  background: var(--green);
}

.status-row[data-state="error"] {
  color: #a33d2e;
}

.status-row[data-state="error"] .status-mark {
  background: var(--coral);
}

.chart-panel {
  padding: 9px 23px 0;
}

.chart-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 10px 0 5px;
}

.chart-heading .field-label {
  margin: 0 0 6px;
}

.chart-heading h2 {
  margin: 0;
  font: 500 23px "Newsreader", Georgia, serif;
}

.chart-period {
  margin: 0 0 3px;
  color: var(--muted);
  font: 500 10px "DM Mono", monospace;
}

.chart-wrap {
  position: relative;
  height: 310px;
  padding-top: 12px;
}

.chart-empty {
  position: absolute;
  inset: 12px 0 0;
  margin: 0;
  display: grid;
  place-items: center;
  color: #849188;
  font-size: 12px;
  pointer-events: none;
}

.chart-empty[hidden] {
  display: none;
}

.metrics {
  min-height: 86px;
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.metric {
  padding: 17px 12px 16px 0;
  display: grid;
  align-content: center;
  gap: 7px;
}

.metric + .metric {
  padding-left: 21px;
  border-left: 1px solid var(--line);
}

.metric-label {
  color: var(--muted);
  font-size: 9px;
}

.metric strong {
  font: 500 21px "Newsreader", Georgia, serif;
  font-variant-numeric: tabular-nums;
}

.page-footer {
  padding: 17px 2px 38px;
  display: flex;
  justify-content: space-between;
  color: #7d8981;
  font-size: 10px;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  to { opacity: 0.35; }
}

@media (max-width: 620px) {
  .topbar {
    height: 58px;
    padding: 0 18px;
  }

  .wordmark {
    gap: 8px;
    font-size: 9px;
  }

  .wordmark-icon {
    width: 27px;
    height: 27px;
  }

  .market-label {
    font-size: 8px;
  }

  main {
    width: calc(100% - 32px);
  }

  .intro {
    padding: 39px 0 25px;
  }

  h1 {
    font-size: 40px;
  }

  .intro-copy {
    max-width: 290px;
    line-height: 1.55;
  }

  .controls {
    padding: 15px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.8fr);
    gap: 11px;
  }

  .ticker-field,
  .period-field {
    width: 100%;
  }

  .load-button {
    width: 100%;
    justify-content: space-between;
    grid-column: 1 / -1;
  }

  .status-row {
    padding: 0 16px;
    font-size: 10px;
  }

  .chart-panel {
    padding: 8px 15px 0;
  }

  .chart-wrap {
    height: 255px;
  }

  .metrics {
    min-height: 76px;
  }

  .metric {
    padding-right: 5px;
  }

  .metric + .metric {
    padding-left: 10px;
  }

  .metric-label {
    max-width: 90px;
    font-size: 8px;
    line-height: 1.35;
  }

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

  .page-footer {
    gap: 14px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}