/* ── Tokens ──────────────────────────────────────────────────────────────
   Anchor: a steady, desaturated signal-blue — calm and technical without
   reading as "hacker neon". Warm near-white/near-charcoal neutrals, never
   pure #fff/#000. One warm coral accent reserved for the single action that
   matters (get connected) so it never has to compete with itself. */

:root {
  --bg: #f6f4f0;
  --bg-raised: #ffffff;
  --ink: #1c2321;
  --ink-soft: #4a5652;
  --ink-faint: #7c8884;
  --line: #dfdad2;
  --signal: #1f5f6b;
  --signal-soft: #e6eef0;
  --accent: #e8703a;
  --accent-ink: #fffaf6;
  --good: #2f7d5c;
  --warn: #c8862b;
  --bad: #c14545;
  --shadow: 0 1px 2px rgba(28, 35, 33, 0.06), 0 8px 24px rgba(28, 35, 33, 0.08);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --bg-raised: #1c2225;
    --ink: #eef1ef;
    --ink-soft: #b6c0bc;
    --ink-faint: #7c8884;
    --line: #2b3336;
    --signal: #5fb0bd;
    --signal-soft: #1c2f33;
    --accent: #f2895a;
    --accent-ink: #201007;
    --good: #59b98c;
    --warn: #e0a94f;
    --bad: #e57272;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #14181a;
  --bg-raised: #1c2225;
  --ink: #eef1ef;
  --ink-soft: #b6c0bc;
  --ink-faint: #7c8884;
  --line: #2b3336;
  --signal: #5fb0bd;
  --signal-soft: #1c2f33;
  --accent: #f2895a;
  --accent-ink: #201007;
  --good: #59b98c;
  --warn: #e0a94f;
  --bad: #e57272;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #f6f4f0;
  --bg-raised: #ffffff;
  --ink: #1c2321;
  --ink-soft: #4a5652;
  --ink-faint: #7c8884;
  --line: #dfdad2;
  --signal: #1f5f6b;
  --signal-soft: #e6eef0;
  --accent: #e8703a;
  --accent-ink: #fffaf6;
  --good: #2f7d5c;
  --warn: #c8862b;
  --bad: #c14545;
  --shadow: 0 1px 2px rgba(28, 35, 33, 0.06), 0 8px 24px rgba(28, 35, 33, 0.08);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }

/* Must outrank .stack/.row's own `display` — otherwise an element that is
   both `hidden` and `class="stack"` (every view section in this app) stays
   visible, since an author class rule of equal specificity beats the UA
   stylesheet's [hidden] rule once it comes later in the cascade. */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Layout ────────────────────────────────────────────────────────────── */

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }

/* ── Type ──────────────────────────────────────────────────────────────── */

h1 {
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 12px;
  text-wrap: balance;
}
h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
p { margin: 0; color: var(--ink-soft); }
.lede { font-size: 17px; color: var(--ink-soft); }
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-faint); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ── Header ────────────────────────────────────────────────────────────── */

.topbar {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-soft);
}

/* ── Card ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: transform 0.12s ease, opacity 0.12s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--signal-soft); color: var(--signal); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }

/* ── Inputs ────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 16px;
  width: 100%;
  transition: border-color 0.12s ease;
}
.input:focus { outline: none; border-color: var(--signal); }
.input:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.error-text { color: var(--bad); font-size: 13px; min-height: 1.2em; }

/* ── Badges / pills ────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.pill-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill-bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pill-neutral { background: var(--signal-soft); color: var(--signal); }

/* ── Spinner ───────────────────────────────────────────────────────────── */

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Plan list ─────────────────────────────────────────────────────────── */

.plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-raised);
  text-align: left;
  width: 100%;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.plan:hover { border-color: var(--signal); }
.plan[aria-pressed="true"] {
  border-color: var(--signal);
  background: var(--signal-soft);
}
.plan-name { font-weight: 700; font-size: 15px; }
.plan-meta { color: var(--ink-faint); font-size: 13px; margin-top: 2px; }
.plan-price { font-weight: 800; font-size: 16px; white-space: nowrap; }

/* ── QR / config block ─────────────────────────────────────────────────── */

.qr-frame {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin: 0 auto;
}
.qr-frame img, .qr-frame canvas { width: 200px; height: 200px; }

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
}
.link-box code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
}
.copy-btn {
  border: none;
  background: var(--signal-soft);
  color: var(--signal);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

footer {
  margin-top: auto;
  padding: 24px 20px 32px;
  text-align: center;
}
