:root {
  color-scheme: light dark;

  --bg: #f4f5f7;
  --card: #fff;
  --text: #1d2330;
  --muted: #5b6475;
  --accent: #2f6fed;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --card: #1c2029;
    --text: #e8ebf1;
    --muted: #a0a8b8;
    --accent: #6c9bff;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px 20px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 8px 30px rgb(0 0 0 / 8%);
  text-align: center;
}

h1 {
  margin: 16px 0 8px;
  font-size: 20px;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 4px solid rgb(127 127 127 / 25%);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

[data-state="failed"] .spinner,
[data-state="paused"] .spinner {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

.progress {
  min-height: 1.5em;
  font-variant-numeric: tabular-nums;
}

.countdown {
  margin-top: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.retry {
  margin: 4px 0 12px;
  padding: 10px 24px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.retry[hidden],
.countdown[hidden],
.found-link[hidden],
.mirror-links[hidden] {
  display: none;
}

.mirror-links {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.mirror-links li {
  margin: 4px 0;
}

.mirror-links a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.found-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
}

.langs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.langs button {
  padding: 2px 10px;
  border: 1px solid rgb(127 127 127 / 40%);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.langs button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

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