:root {
  --bg: #0c0f17;
  --bg-soft: #121724;
  --card: #161c2b;
  --card-hover: #1b2233;
  --border: #232c40;
  --text: #e8ecf4;
  --text-dim: #8a93a8;
  --text-faint: #5b6478;
  --up: #2ecc71;
  --up-soft: rgba(46, 204, 113, 0.12);
  --down: #ff5c5c;
  --down-soft: rgba(255, 92, 92, 0.12);
  --neutral: #6f7891;
  --accent: #5b8cff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #16203a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.brand h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.2px;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.refresh-btn:hover { background: var(--card-hover); border-color: #2f3b56; }
.refresh-btn:active { transform: translateY(1px); }
.refresh-btn:disabled { opacity: 0.55; cursor: default; }

.refresh-icon { font-size: 15px; line-height: 1; }
.refresh-btn.spinning .refresh-icon {
  display: inline-block;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Sentiment banner ---- */
.sentiment-banner {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, var(--bg-soft), var(--card));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
}
.sentiment-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-faint);
}
.sentiment-value { font-size: 22px; font-weight: 700; }
.sentiment-sub { font-size: 13px; color: var(--text-dim); }

/* ---- Grid + sections ---- */
.grid { display: grid; gap: 22px; }

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-faint);
  margin: 4px 2px 12px;
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 16px;
}

/* ---- Metric card ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px 14px;
  transition: background 0.15s, border-color 0.15s, opacity 0.2s;
}
.card:hover { background: var(--card-hover); border-color: #2c3650; }

.card-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-sub { font-size: 11px; color: var(--text-faint); }

.card-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.pill.up { color: var(--up); background: var(--up-soft); }
.pill.down { color: var(--down); background: var(--down-soft); }
.pill.flat { color: var(--neutral); background: rgba(111,120,145,0.12); }

.spark { display: block; }
.spark path.line { fill: none; stroke-width: 2; }
.spark path.area { stroke: none; opacity: 0.18; }

.grid.updating .card { opacity: 0.5; }

.card.is-mock .card-sub { font-style: italic; opacity: 0.8; }

/* ---- Footer ---- */
.footer {
  margin-top: 34px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}
.footer code {
  font-family: var(--mono);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text-dim);
}

@media (max-width: 560px) {
  .card-value { font-size: 26px; }
  .brand h1 { font-size: 18px; }
}
