:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --text: #e7e9ee;
  --muted: #9aa2b1;
  --accent: #6ea8fe;
  --border: #2a2f3a;
  --danger: #ff8080;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8;
    --panel: #ffffff;
    --panel-2: #f0f2f6;
    --text: #1b1e24;
    --muted: #5a6472;
    --accent: #2563eb;
    --border: #dde1e8;
    --danger: #c0392b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1rem;
  flex: 1;
}

h1 {
  margin: 0;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.25rem 0 1.5rem;
  color: var(--muted);
}

form {
  display: flex;
  gap: 0.5rem;
}

input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

button {
  padding: 0.7rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.sources {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.status {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.status.error {
  color: var(--danger);
  border-color: var(--danger);
}

.result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.headline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.metric {
  flex: 1 1 0;
  min-width: 8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* The recommendation is the answer; give it the accent border to draw the eye. */
.metric:first-child {
  border-color: var(--accent);
}

.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-value.accent {
  color: var(--accent);
}

.metric-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.deck-name {
  margin: 1rem 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.deck-name a {
  color: inherit;
  text-decoration: none;
}

.deck-name a:hover {
  text-decoration: underline;
}

.stats {
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.4rem;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border);
}

.stats dt {
  color: var(--muted);
  margin: 0;
}

.stats dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.formula {
  margin: 1rem 0 0;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--panel-2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  color: var(--muted);
  overflow-x: auto;
}

details {
  margin-top: 1rem;
}

summary {
  cursor: pointer;
  color: var(--accent);
}

#matched {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  columns: 2;
  color: var(--muted);
}

#matched a {
  color: var(--accent);
  text-decoration: none;
}

#matched a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  #matched {
    columns: 1;
  }
}

footer {
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

footer code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.fork {
  margin: 0.75rem 0 0;
}

.fork a {
  color: var(--accent);
  text-decoration: none;
}

.fork a:hover {
  text-decoration: underline;
}
