:root {
  --ground: #eef3e6;
  --surface: #ffffff;
  --ink: #1a1f18;
  --muted: #5c6656;
  --faint: #8a9382;
  --hair: #e4e9dd;
  --lime: #8abd24;
  --lime-deep: #4c760f;
  --lime-wash: #eef5de;
  --lime-tint: #f5f9ec;
  --coral: #c43c22;
  --coral-wash: #fbeee9;
  --shadow: 0 1px 2px rgba(26, 31, 24, .04), 0 18px 40px -12px rgba(26, 31, 24, .12);
  --radius: 20px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(120% 60% at 50% -10%, #f7faf1 0%, var(--ground) 60%) fixed;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  justify-content: center;
  padding: 24px 18px 40px;
}
.wrap { width: 100%; max-width: 30rem; display: flex; flex-direction: column; gap: 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.topbar { padding: 2px 2px 0; }
.logo { display: block; height: 32px; width: auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow);
}

h1 { font-size: 1.7rem; line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 8px; font-weight: 800; }
.lead { color: var(--muted); font-size: 1.03rem; margin: 0 0 22px; }
h2 { font-size: 1.1rem; margin: 0 0 14px; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.fine { font-size: 0.84rem; color: var(--muted); }

/* ---------- /e interstitial (store redirect) ---------- */
#opening { text-align: center; }
#opening .muted { margin-bottom: 22px; }
#opening .btn { margin-bottom: 14px; }
#opening .fine { margin: 0; }

/* ---------- scan hero ---------- */
.scan {
  background: linear-gradient(180deg, var(--lime-wash), var(--lime-tint));
  border: 1px solid #dce8c4;
  border-radius: 16px;
  padding: 22px 22px 24px;
  text-align: center;
}
.scan-icon {
  width: 66px; height: 66px; margin: 2px auto 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #dce8c4;
  display: grid; place-items: center;
  color: var(--lime-deep);
}
.scan h2 { margin-bottom: 16px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; text-align: left; display: flex; flex-direction: column; gap: 12px; max-width: 22rem; margin-inline: auto; }
.steps li {
  position: relative;
  padding-left: 40px;
  line-height: 1.4;
  min-height: 28px;
  padding-top: 2px;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--lime);
  color: #fff;
  font-weight: 700; font-size: 0.9rem;
  display: grid; place-items: center;
}
.steps strong { font-weight: 700; }

/* ---------- divider ---------- */
.divider { display: flex; align-items: center; gap: 14px; margin: 24px 0; color: var(--faint); font-size: 0.82rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hair); }

/* ---------- manual entry ---------- */
.words {
  border: 0; margin: 0 0 16px; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px;
}
@media (min-width: 460px) { .words { grid-template-columns: repeat(3, 1fr); } }
.word { display: flex; flex-direction: column; gap: 5px; }
.wnum {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint);
}
.word input {
  width: 100%; min-height: 50px;
  padding: 10px 12px;
  border: 1.5px solid var(--hair);
  border-radius: 12px;
  font-size: 1rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.word input::placeholder { color: var(--faint); }
.word input:focus-visible {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(138, 189, 36, .22);
}
.word.valid input { border-color: var(--lime); background: var(--lime-tint); }
.word.invalid input { border-color: var(--coral); background: var(--coral-wash); }

.error { color: var(--coral); font-size: 0.9rem; margin: 0 0 14px; display: flex; gap: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%;
  padding: 15px 18px;
  border: 0; border-radius: 13px;
  background: var(--ink); color: #fff;
  font: inherit; font-weight: 650; font-size: 1.02rem;
  text-align: center; text-decoration: none;
  min-height: 52px; cursor: pointer;
  transition: opacity .15s ease, transform .05s ease, background-color .15s ease;
}
.btn:hover { opacity: .93; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
.btn:disabled { background: #e7ebe1; color: var(--faint); cursor: not-allowed; opacity: 1; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--hair); margin-top: 12px; font-weight: 600; }
.btn-ghost:hover { background: var(--lime-tint); opacity: 1; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* ---------- result ---------- */
.result { text-align: center; }
.stores { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 10px; }
#qr {
  display: block; margin: 6px auto 14px;
  width: 224px; height: 224px;
  image-rendering: pixelated;
  border: 1px solid var(--hair); border-radius: 14px; background: #fff; padding: 8px;
}

/* ---------- footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: 0.82rem; line-height: 1.5; padding: 0 6px; }
.footer p { margin: 0 0 4px; }
.footer-links { margin-top: 10px; }
.footer-links a { color: var(--lime-deep); text-decoration: none; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }
.footer-links a:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 3px; }
.footer .fine { margin-top: 10px; }
