:root {
  --void: #0b0f0c;
  --surface: #131a15;
  --surface-2: #182019;
  --line: #223027;
  --text: #e7ece4;
  --text-dim: #7c8c7f;
  --up: #4ade80;
  --down: #f76464;
  --alert: #f2b84b;
  --score-hot: #f76464;
  --score-warm: #f2b84b;
  --score-cool: #4ade80;

  --font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-display);
}

/* ---------- header ---------- */

.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 1.75rem 1.25rem 1rem;
  max-width: 1150px;
  margin: 0 auto;
}

.header__title h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header__sub {
  margin: 0.2rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.header__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.live {
  background: var(--up);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

.status-dot.error { background: var(--down); }

/* ---------- explain ---------- */

.explain {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
}

.explain p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 70ch;
}

/* ---------- controls ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  max-width: 1150px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.control input {
  width: 90px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
}

.control input:focus-visible {
  outline: 2px solid var(--alert);
  outline-offset: 1px;
}

.control--count {
  margin-left: auto;
  font-family: var(--font-mono);
}

.control--count span { color: var(--text); }

/* ---------- board ---------- */

main {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  overflow-x: auto;
}

.board {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.83rem;
}

.board thead th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.7rem;
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.board thead th:hover { color: var(--text); }

.board th.num, .board td.num { text-align: right; font-variant-numeric: tabular-nums; }

.board tbody tr {
  border-bottom: 1px solid var(--line);
}

.board tbody tr:hover { background: var(--surface); }

.board td {
  padding: 0.55rem 0.6rem;
  white-space: nowrap;
}

.board td.pair {
  font-family: var(--font-display);
  font-weight: 500;
  text-align: left;
}

.board td.pair .quote {
  color: var(--text-dim);
  font-weight: 400;
}

.score-badge {
  display: inline-block;
  min-width: 2.4em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  text-align: center;
}

.score-badge--hot { background: rgba(247, 100, 100, 0.15); color: var(--score-hot); }
.score-badge--warm { background: rgba(242, 184, 75, 0.15); color: var(--score-warm); }
.score-badge--cool { background: rgba(74, 222, 128, 0.12); color: var(--score-cool); }

.board__empty td {
  color: var(--text-dim);
  padding: 1.5rem 0.6rem;
  font-family: var(--font-mono);
  white-space: normal;
}

/* ---------- footer ---------- */

.footer {
  max-width: 1150px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1.5;
}

.footer__links {
  display: flex;
  gap: 1rem;
}

.footer a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .board { font-size: 0.76rem; }
}
