:root {
  --bg: #fbfaf7;
  --fg: #1b1b1f;
  --muted: #5d5d66;
  --line: #d9d6cf;
  --accent: #2d5bd7;
  --ok: #1f7a3d;
  --error: #b3261e;
  --card: #ffffff;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141417;
    --fg: #ececf1;
    --muted: #a3a3ad;
    --line: #34343b;
    --accent: #8fb0ff;
    --ok: #6fd393;
    --error: #ff8a80;
    --card: #1d1d22;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }

.wallets { display: grid; gap: 0.6rem; }

button.wallet {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.wallet:hover:not(:disabled) { border-color: var(--accent); }
button.wallet:disabled { opacity: 0.6; cursor: progress; }
button.wallet img { border-radius: 0.35rem; }

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

.packs { display: grid; gap: 0.5rem; border: 0; padding: 0; margin: 0; }

.pack {
  display: block;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  cursor: pointer;
}

.pack:has(input:checked) { border-color: var(--accent); }
.pack .price { float: right; font-weight: 600; }
.pack .crypto { display: block; margin-left: 1.6rem; font-size: 0.9rem; }
.choices { border: 0; padding: 0; margin: 0; }
.choices label { display: block; margin: 0.35rem 0; }
.choices .muted { display: block; margin-left: 1.6rem; font-size: 0.9rem; }
.custom select { margin-left: 0.4rem; font: inherit; padding: 0.3rem 0.4rem; }
.custom { display: block; margin-top: 0.9rem; }
.custom input { width: 7rem; margin-left: 0.4rem; font: inherit; padding: 0.3rem 0.4rem; }

#qr:not([hidden]) { display: block; margin-top: 0.5rem; background: #fff; padding: 0.5rem; border-radius: 0.5rem; }

#status:empty { display: none; }

#status {
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--card);
}

#status[data-kind="ok"] { border-color: var(--ok); }
#status[data-kind="error"] { border-color: var(--error); }

/* The checkout's payment progress: waiting, received, still settling, or an error, in place of the choices. */
.pay-panel {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0.6rem;
  background: var(--card);
  scroll-margin-top: 1rem;
}
.pay-panel:focus { outline: none; }
.pay-panel[data-state="ok"], .pay-panel[data-state="thanks"] { border-left-color: var(--ok); }
.pay-panel[data-state="error"] { border-left-color: var(--error); }
.pay-panel p { margin: 0 0 0.6rem; }
.pay-panel .headline { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; font-size: 1.15rem; font-weight: 600; }
.pay-panel[data-state="ok"] .headline, .pay-panel[data-state="thanks"] .headline { color: var(--ok); }
.pay-panel[data-state="error"] .headline, .pay-panel[data-state="info"] .headline { font-size: 1rem; font-weight: 400; }
.pay-panel[data-state="error"] .headline { color: var(--error); }
.pay-panel code, #key-reveal code { word-break: break-all; }
.pay-panel button { margin-top: 0.2rem; font: inherit; padding: 0.35rem 0.8rem; }
.pay-panel #qr:not([hidden]) { margin: 0 auto 1rem; max-width: 100%; height: auto; }
.spinner {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

footer { margin-top: 3rem; color: var(--muted); font-size: 0.9rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
pre {
  overflow-x: auto;
  padding: 0.75rem;
  border: 1px solid var(--muted);
  border-radius: 0.5rem;
  white-space: pre-wrap;
  word-break: break-all;
}
details summary { cursor: pointer; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Phone pairing: the confirmation code the user compares with the computer's screen. */
.pairing { border: 2px solid var(--accent); border-radius: 12px; padding: 1rem; margin: 1rem 0; background: var(--card); }
.pairing h2 { margin-top: 0; }
.code { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.6em; letter-spacing: 0.12em; padding: 0 0.3em; border-radius: 6px; background: var(--bg); }
#pair-error { color: var(--error); }

/* The home page: the mark next to the name. */
.brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem; }
.brand h1 { margin: 0; font-size: 2.2rem; }
.brand .logo { flex: none; }
.lead { font-size: 1.1rem; }
#key-input, #recovery-input { display: block; width: 100%; max-width: 32rem; margin: 0.3rem 0 0; }
fieldset.currency { border: 0; padding: 0; margin: 0.5rem 0 0; }
fieldset.currency legend { padding: 0; margin-bottom: 0.2rem; }

/* ── The link checker (/check): phone first ─────────────────────────────────────────────────────────────────── */
.app main { padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom)); }
.app [hidden] { display: none !important; }
.brand.small { gap: 0.6rem; margin-bottom: 1.25rem; }
.brand.small h1 { font-size: 1.5rem; }
.brand .home { display: flex; }
.small { font-size: 0.9rem; }

.app button, .app .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.app button.primary, .app .button.primary {
  border-color: #1f8a70;
  background: #1f8a70;
  color: #fff;
  font-weight: 600;
}
.app button:disabled { opacity: 0.55; cursor: default; }
.app button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}
.app button.wallet { justify-content: flex-start; }
.buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.check-form { display: grid; gap: 0.5rem; }
.check-form label { font-weight: 600; }
.field-row { display: flex; gap: 0.5rem; }
.app input[type="url"], .app input[type="password"], .app textarea {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  color: inherit;
  font: inherit;
  font-size: max(1rem, 16px); /* 16px or more: iOS doesn't zoom in on focus */
}
.check-form button.primary { width: 100%; font-size: 1.1rem; min-height: 3.1rem; }
.error-text { margin: 0; color: var(--error); }

.account { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1rem; margin-bottom: 1rem; }
.account p { margin: 0; }
.checks { font-weight: 600; white-space: nowrap; }

.panel {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--card);
}
.panel h2:first-child { margin-top: 0; }
.notice { border-left: 4px solid #b35900; }
.choice { border-top: 1px solid var(--line); padding: 0.75rem 0; }
.choice summary { font-weight: 600; min-height: 2rem; }
.choice input { margin: 0.3rem 0 0.5rem; }
.choice-link { border-top: 1px solid var(--line); padding-top: 0.75rem; margin-bottom: 0; }

.steps { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.steps li { display: flex; gap: 0.6rem; align-items: center; padding: 0.2rem 0; color: var(--muted); }
.steps li.done { color: var(--fg); }
.steps .tick {
  display: inline-flex;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.8rem;
  line-height: 1.2rem;
}
.steps li.done .tick { border-color: var(--ok); color: var(--ok); }

/* The verdict: a word and a symbol, never colour alone. */
.verdict {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--line);
  border-radius: 0.8rem;
  background: var(--card);
}
.verdict .symbol {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
}
.verdict .label { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.25; }
.verdict.reliable { border-color: #1f7a3d; }
.verdict.reliable .symbol { background: #1f7a3d; }
.verdict.concerns { border-color: #8a6d00; }
.verdict.concerns .symbol { background: #8a6d00; }
.verdict.careful { border-color: #b35900; }
.verdict.careful .symbol { background: #b35900; }
.verdict.junk_or_scam, .verdict.warning { border-color: #b3261e; }
.verdict.junk_or_scam .symbol, .verdict.warning .symbol { background: #b3261e; }
.headline { font-size: 1.05rem; margin: 0.75rem 0 0; }
.source-note { margin-top: 0.75rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.card {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 0.6rem;
  background: var(--card);
}
.card.high { border-left-color: #b3261e; }
.card.medium { border-left-color: #b35900; }
.card.low { border-left-color: #8a6d00; }
.card.good { border-left-color: #1f7a3d; }
.card .title { display: block; font-weight: 600; }
.card details { margin-top: 0.35rem; }
.card summary { color: var(--accent); font-size: 0.95rem; }
.card details p { margin: 0.35rem 0 0; }
.thumbs { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.thumbs img { border-radius: 0.35rem; object-fit: cover; }
.details ul { padding-left: 1.2rem; }
#again-row { margin-top: 1.5rem; }
#again { width: 100%; }

/* "Spotted recently" and a showcase case's page (/showcase/{id}). */
.spotted { margin-top: 2rem; }
.spotted-list { margin-top: 0.5rem; }
.spotted-item p { margin: 0.2rem 0 0; }
.spotted-band { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; font-weight: 600; }
.spotted-band .symbol {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 0.85rem;
}
.spotted-band.reliable .symbol { background: #1f7a3d; }
.spotted-band.concerns .symbol { background: #8a6d00; }
.spotted-band.careful .symbol { background: #b35900; }
.spotted-band.warning .symbol { background: #b3261e; }
.spotted-title { display: block; margin-top: 0.35rem; font-weight: 600; overflow-wrap: anywhere; }
.kicker { margin: 0; font-weight: 600; color: var(--muted); }
.case-title { font-size: 1.35rem; overflow-wrap: anywhere; }
.case-meta { margin: 0 0 0.2rem; overflow-wrap: anywhere; }
.case-meta .host { font-weight: 600; }
.shot { margin: 1rem 0 0; }
.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 0.6rem; }
.shot figcaption { margin-top: 0.3rem; }
.case + .buttons { margin-top: 1.5rem; }

/* "Share this result" on /check, and a shared result's page (/r/{id}). */
#share-area { margin-top: 1rem; }
.share-preview .case-title { font-size: 1.15rem; margin: 0 0 0.3rem; }
.share-link, #share-code { overflow-wrap: anywhere; }
.case .choice textarea, .case .choice input { margin: 0.3rem 0 0.5rem; }

@media (min-width: 40rem) {
  .app main { padding-top: 2.5rem; }
  .check-form button.primary, #again { width: auto; min-width: 12rem; justify-self: start; }
}

/* Invites: the codes a pack comes with (shown once), and the "Have an invite?" fields. */
.invites { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.invites li { margin: 0.3rem 0; }
.invites code { word-break: break-all; }
.pack .gift { display: block; margin-left: 1.6rem; font-size: 0.9rem; }
details.invite { margin-top: 1rem; }
details.invite summary { cursor: pointer; }
details.invite input { width: 100%; max-width: 24rem; margin: 0.3rem 0; font: inherit; padding: 0.3rem 0.4rem; box-sizing: border-box; }
