:root {
  --bg: #0b0d10;
  --surface: #14181d;
  --border: #252b33;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --accent: #ff5500;
  --win: #3ecf8e;
  --loss: #ff6b6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main, .site-header, .site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header { padding-top: 48px; padding-bottom: 24px; }
.site-header h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.tagline { margin: 4px 0 0; color: var(--muted); }

.compare-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.compare-form label span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.compare-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
/* Nickname suggestions dropdown */
.combo { position: relative; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.suggestion:hover, .suggestion[aria-selected="true"] { background: var(--border); }
.suggestion[aria-selected="true"] { outline: 1px solid var(--accent); }
.avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.suggestion-text { display: flex; flex-direction: column; min-width: 0; }
.suggestion-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-meta { color: var(--muted); font-size: 0.8rem; }

.compare-form input:focus-visible, .compare-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vs { color: var(--muted); padding-bottom: 10px; font-weight: 600; }
.compare-form button {
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.compare-form button:disabled { opacity: 0.6; cursor: progress; }

.status { min-height: 1.5em; color: var(--muted); }
.status.error { color: var(--loss); }

.players { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.player, .stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.player h2 { margin: 0; font-size: 1.4rem; word-break: break-all; }
.label { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.meta { margin: 2px 0 12px; color: var(--muted); }
.player dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.player dt { color: var(--muted); }
.player dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0 8px; }
.stat strong { display: block; font-size: 1.15rem; margin-top: 4px; }

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

.matches { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.matches th, .matches td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.matches th { color: var(--muted); font-weight: 500; }
.matches .win { color: var(--win); }
.matches .loss { color: var(--loss); }
.matches a { color: var(--accent); }

.site-footer {
  position: relative;
  margin-top: 72px;
  padding-top: 40px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 0.9rem;
}
/* Accent rule that fades out to the sides */
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--border) 60%, transparent);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-title { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  height: 28px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.footer-credit { margin: 10px 0 14px; }
.footer-credit strong { color: var(--text); font-weight: 600; }
.footer-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.pill:hover, .pill:focus-visible { border-color: var(--accent); color: var(--accent); }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-heading { margin: 0 0 4px; color: var(--text); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.footer-col a { color: var(--muted); text-decoration: none; width: fit-content; }
.footer-col a:hover, .footer-col a:focus-visible { color: var(--accent); }
.footer-fineprint { margin: 32px 0 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 0.8rem; }

.legal { max-width: 720px; }
.legal h2 { margin-top: 32px; font-size: 1.15rem; }
.legal a { color: var(--accent); }

@media (max-width: 640px) {
  .compare-form { grid-template-columns: 1fr; }
  .vs { padding: 0; text-align: center; }
  .players, .summary { grid-template-columns: 1fr; }
  .matches { display: block; overflow-x: auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

.home-link { color: inherit; text-decoration: none; }
