@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f2f2f4;
  --card-bg: #ffffff;
  --text: #1a1a1e;
  --text-muted: #6b6b73;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --border: #e2e2e6;
  --focus-ring: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --card-bg: #232327;
    --text: #f2f2f4;
    --text-muted: #9a9aa2;
    --accent: #5b8def;
    --accent-contrast: #0b1220;
    --border: #333338;
    --focus-ring: #5b8def;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Figtree", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
}

button {
  font-family: inherit;
}

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.site-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

.site-header p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.progress {
  text-align: center;
  margin-bottom: 18px;
}

.progress .round-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.progress .match-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar-fill {
    transition: none;
  }
}

.matchup {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  flex: 1;
}

@media (min-width: 720px) {
  .matchup {
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
  }
}

.vs-divider {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
}

@media (min-width: 720px) {
  .vs-divider {
    display: flex;
  }
}

.card-btn {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card-btn:hover {
  transform: translateY(-2px);
}

.card-btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .card-btn {
    transition: none;
  }
  .card-btn:hover {
    transform: none;
  }
}

.card-btn .frame {
  aspect-ratio: 4 / 3;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-btn .caption {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.95rem;
}

.card-btn .key-hint {
  padding: 0 14px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.hint-line {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 10px;
}

/* Finish screen */

.finish {
  text-align: center;
}

.finish .champion-frame {
  max-width: 420px;
  margin: 0 auto 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.finish .champion-frame img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--border);
}

.finish h2 {
  margin: 6px 0 0;
  font-size: 1.6rem;
}

.finish .eyebrow {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 700;
}

.finish .runner-up {
  margin: 22px auto 0;
  max-width: 260px;
  color: var(--text-muted);
}

.finish .runner-up img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  aspect-ratio: 4/3;
  object-fit: contain;
  background: var(--card-bg);
  margin-bottom: 6px;
}

.finish-order {
  margin: 32px auto 0;
  max-width: 560px;
  text-align: left;
}

.finish-order h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.finish-order .tier {
  margin-bottom: 14px;
}

.finish-order .tier-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.finish-order ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.finish-order li {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.85rem;
}

.finish .play-again {
  margin-top: 28px;
}

.empty-state {
  text-align: center;
  margin-top: 60px;
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
