:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --track: #e5e7eb;
  --accent: #3b82f6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --track: #262a33;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.card { width: 100%; max-width: 420px; text-align: center; }

/* Teks tetap ada untuk JS & pembaca layar, tapi tidak terlihat */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== Lingkaran buffering berputar ===== */
.spin {
  width: 48px; height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  border: 4px solid var(--track);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Garis berjalan di atas layar ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--track);
  overflow: hidden;
}
.topbar::before {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 35%;
  background: var(--accent);
  animation: run 1.2s ease-in-out infinite;
}
@keyframes run { from { left: -35%; } to { left: 100%; } }

/* ===== Tampilan gagal (ditampilkan oleh gateway.js) ===== */
#fail { display: none; }
#fail h1 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 600; }
#fail p  { margin: 0; color: var(--muted); }

#list { list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 8px; }
#list a {
  display: block; padding: 10px 14px;
  border: 1px solid var(--track); border-radius: 10px;
  color: var(--text); text-decoration: none;
  overflow-wrap: anywhere;
  transition: border-color .15s;
}
#list a:hover { border-color: var(--accent); }

#retry {
  padding: 10px 24px; border: 0; border-radius: 10px;
  font: inherit; font-weight: 600; color: #fff;
  background: var(--accent); cursor: pointer;
}
#retry:hover { filter: brightness(1.1); }

@media (prefers-reduced-motion: reduce) {
  .spin, .topbar::before { animation-duration: 2s; }
}