:root {
  --bg: #000;
  --fg: #fff;
  --muted: #8c8c8c;
  --line: #2b2b2b;
  --panel: #141414;
  --btn-bg: #fff;
  --btn-fg: #000;
  color-scheme: dark light;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fff;
    --fg: #000;
    --muted: #6b6b6b;
    --line: #d9d9d9;
    --panel: #f2f2f2;
    --btn-bg: #000;
    --btn-fg: #fff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  line-height: 1.5;
}
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.top, .foot { padding: 1.25rem clamp(1.25rem, 4vw, 3rem); }
.top { display: flex; justify-content: space-between; align-items: center; }
.mark { font-weight: 900; letter-spacing: -0.04em; font-size: 1.25rem; text-decoration: none; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--fg); text-decoration: underline; }

main {
  display: grid;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 4vw, 3rem);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
@media (min-width: 860px) {
  main { grid-template-columns: 1.4fr 1fr; }
}

h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(3.25rem, 11vw, 8.5rem);
  line-height: 0.88;
  letter-spacing: -0.05em;
}

/* Payment sheet */
.sheet {
  width: 100%;
  max-width: 380px;
  justify-self: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 1.5rem;
}
.row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.row span { color: var(--muted); }

.status {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.25rem 0;
}
.icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  margin-bottom: 0.5rem;
  font-weight: 900; font-size: 1.25rem;
}
.status .title { margin: 0; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.status .detail { margin: 0; color: var(--muted); font-size: 0.95rem; }
.status .code { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.8rem; font-family: ui-monospace, Menlo, Consolas, monospace; }

.sheet[data-state="loading"] .icon {
  border-color: var(--line);
  border-top-color: var(--fg);
  animation: spin 0.8s linear infinite;
}
.sheet[data-state="failed"] .icon {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.sheet[data-state="failed"] .icon::before { content: "\2715"; }
.sheet[data-state="failed"] { animation: shake 0.45s; }

button {
  width: 100%;
  padding: 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.4; cursor: progress; }

.tries { margin: 1rem 0 0; text-align: center; color: var(--muted); font-size: 0.85rem; min-height: 1.3em; }

.foot { color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
.foot p { margin: 0; max-width: 70ch; }

/* Text pages (terms, 404) */
.page { display: block; max-width: 70ch; }
.page h1 { font-size: clamp(2.5rem, 8vw, 5rem); margin-bottom: 2rem; }
.page h2 { margin: 2rem 0 0.25rem; font-size: 1.15rem; letter-spacing: -0.01em; }
.page p { margin: 0 0 1rem; color: var(--muted); }
.page .home { display: inline-block; width: auto; padding: 0.9rem 1.6rem; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); font-weight: 800; text-decoration: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake {
  20% { transform: translateX(-10px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet[data-state="failed"] { animation: none; }
  .sheet[data-state="loading"] .icon { animation: none; border-top-color: var(--fg); }
}
