:root {
  --bg: #f3f4f7;
  --card: #ffffff;
  --ink: #0e1116;
  --muted: #5c6370;
  --line: #e3e6ec;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #138a4b;
  --ok-soft: #e6f6ed;
  --err: #c2372b;
  --err-soft: #fdecea;
  --warn-soft: #fff6e0;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(14,17,22,.04), 0 12px 32px rgba(14,17,22,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12; --card: #141821; --ink: #eef0f4; --muted: #9aa2b1; --line: #252b37;
    --accent: #7c74ff; --accent-soft: #1e1f3a; --ok: #3ccf7f; --ok-soft: #10261a;
    --err: #ff6b5e; --err-soft: #2c1513; --warn-soft: #2a2312;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; padding: 24px 16px 48px;
}
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 8px 0 24px; font-weight: 700; letter-spacing: -.01em; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 15px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; max-width: 420px; margin: 0 auto 16px; }
.wide { max-width: 640px; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 4px; letter-spacing: -.01em; }
p { margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
a { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 18px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: transform .05s, opacity .15s;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn.danger { background: var(--err-soft); color: var(--err); }
.btn.inline { width: auto; padding: 8px 14px; font-size: 14px; }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-weight: 400;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input.code { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

.qr-wrap { position: relative; width: 248px; height: 248px; margin: 8px auto 16px; }
.qr-wrap img { width: 100%; height: 100%; border-radius: 16px; background: #fff; padding: 8px; display: block; transition: filter .2s, opacity .2s; }
.qr-wrap.dim img { filter: blur(6px); opacity: .4; }
.qr-wrap .overlay { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 24px; font-weight: 600; }
.qr-wrap.dim .overlay { display: grid; }
.countdown { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 0 auto 14px; width: 248px; }
.countdown > i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }

.status { min-height: 24px; font-weight: 600; text-align: center; }
.status.ok { color: var(--ok); } .status.err { color: var(--err); }
.steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; color: var(--muted); font-size: 15px; }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 700; }

.number { font-size: 56px; font-weight: 800; letter-spacing: .04em; text-align: center; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.links { display: grid; gap: 4px; }
.links button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; padding: 8px; border-radius: 10px; cursor: pointer; }
.links button:hover { background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.back { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; margin-bottom: 12px; }

.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.banner.ok { background: var(--ok-soft); } .banner.err { background: var(--err-soft); } .banner.warn { background: var(--warn-soft); } .banner.info { background: var(--accent-soft); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.row .meta { min-width: 0; }
.row .meta b { display: block; font-weight: 600; }
.row .meta span { color: var(--muted); font-size: 14px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.seg button { padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); }
.seg button b { display: block; font-size: 15px; }
.seg button span { font-size: 13px; color: var(--muted); }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; margin: 12px 0; }
.codes span { background: var(--bg); padding: 8px; border-radius: 8px; text-align: center; }
.secret { font-family: ui-monospace, Menlo, monospace; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 14px; }
@media (max-width: 480px) { .card { padding: 22px 18px; } .seg { grid-template-columns: 1fr; } }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.item { padding: 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.grow { flex: 1; min-width: 160px; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.list h3, section h3 { font-size: 14px; margin: 14px 0 4px; color: var(--muted, #9aa); }
#f-loc select, #f-loc input { flex: 1; min-width: 140px; }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.danger-zone { border-top: 1px solid rgba(255,80,80,.25); margin-top: 8px; padding-top: 8px; }
.stores { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.stores a { flex: 1; text-align: center; }
