:root {
  --brand: #0a5ff0;
  --brand-deep: #0847c2;
  --brand-soft: #e3edff;
  --bg: #f2f5fa;
  --surface: #ffffff;
  --text: #0f1b2d;
  --muted: #5a6a80;
  --border: #dce4f0;
  --on: #16a34a;
  --err: #c62828;
  --shadow: 0 12px 32px rgb(10 50 120 / 0.12);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3b82ff;
    --brand-deep: #0a3fa8;
    --brand-soft: #16264a;
    --bg: #0a111d;
    --surface: #121c2c;
    --text: #e8eef7;
    --muted: #93a3b8;
    --border: #22314a;
    --on: #4ade80;
    --err: #ff8a80;
    --shadow: 0 12px 32px rgb(0 0 0 / 0.4);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Hero: solid brand band, the card below overlaps its bottom edge. */
.hero {
  background: var(--brand-deep);
  background-image: linear-gradient(160deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  padding: 24px 0 88px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 36px;
}

.brand img {
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.25));
}

h1 {
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  text-wrap: balance;
}

.lead {
  font-size: 18px;
  margin: 0;
  color: rgb(255 255 255 / 0.85);
  text-wrap: pretty;
}

.card {
  position: relative;
  margin-top: -56px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card p {
  margin: 0 0 12px;
}

.card p:last-child {
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  border-color: var(--brand);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.btn.wide {
  width: 100%;
  min-height: 56px;
  font-size: 17px;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 20px;
}

.actions .btn {
  flex: 1 1 200px;
}

.status {
  font-size: 18px;
  font-weight: 700;
}

.card .status + .hint {
  margin-top: -8px;
}

.status.on::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 9px;
  vertical-align: 2px;
  border-radius: 50%;
  background: var(--on);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--on) 22%, transparent);
}

.status.err {
  color: var(--err);
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  font-size: 14px;
}

.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--brand-soft);
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.2s;
}

.qr-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.qr {
  flex: none;
  width: 132px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #000;
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

details {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-bottom: 14px;
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
}

.fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 12px 0 0;
}

.fields dt {
  color: var(--muted);
}

.fields dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  user-select: all;
}

.howto {
  padding: 36px 4px 56px;
}

h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}

.howto ol {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}

.howto li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 16px;
  min-height: 28px;
}

.howto li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
  line-height: 28px;
  text-align: center;
}

@media (max-width: 420px) {
  .card {
    padding: 20px 18px;
  }

  .qr-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
