:root {
  --cream: #FFFFF2;
  --lime: #C8ED94;
  --peach: #F4B183;
  --ink: #000;
  --ink-2: #3A3A33;
  --ink-3: #55554C;
  --night: #111110;
  --night-2: #2A2A27;
  --display: Anton, Impact, sans-serif;
  font-family: Inter, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--cream); }
body.dark-bg { background: var(--night); }
body.green-bg { background: var(--lime); }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen {
  min-height: 100vh; min-height: 100dvh;
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(52px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
}
.light { background: var(--cream); color: var(--ink); }
.dark { background: var(--night); color: var(--cream); padding-left: 20px; padding-right: 20px; }
.green { background: var(--lime); color: var(--ink); }
.center { align-items: center; text-align: center; padding-top: calc(100px + env(safe-area-inset-top)); }
.grow { flex: 1; min-height: 24px; }

.brand { display: flex; align-items: center; gap: 10px; }
.wordmark { font-family: var(--display); font-size: 22px; letter-spacing: .5px; }
.pill { font-size: 13px; font-weight: 600; background: var(--lime); padding: 4px 10px; border-radius: 999px; }

.display { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1.05; text-transform: uppercase; margin: 24px 0 0; overflow-wrap: anywhere; }
#connect .display { margin-top: 56px; }
#redeemed .display { font-size: 52px; margin-top: 36px; }
.display.small { font-size: 40px; margin-top: 12px; }
.lead { margin: 12px 0 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.lead.strong { color: var(--ink); font-size: 17px; margin-top: 14px; }
#redeemed .lead.strong { font-size: 18px; }
.sub { margin: 4px 0 0; font-size: 15px; color: var(--ink-2); }

.fields { display: flex; flex-direction: column; gap: 20px; margin-top: 36px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; }
.field input {
  height: 56px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 16px;
  font: 500 18px Inter, sans-serif; background: #fff; color: var(--ink); width: 100%;
}
#access { letter-spacing: 1px; text-transform: uppercase; }
#access::placeholder { text-transform: none; letter-spacing: 0; }
.field input:focus-visible, .short input:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
.hint { font-size: 13px; color: var(--ink-3); }
.error { margin: 0; font-size: 15px; font-weight: 600; color: #8A2B00; background: #FCE3D3; border-radius: 12px; padding: 12px 14px; }

.primary {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 60px; border: 0; border-radius: 16px; background: var(--ink); color: var(--cream);
  font-size: 18px; font-weight: 600;
}
.primary:disabled { opacity: .5; cursor: progress; }
.primary:focus-visible, .outline:focus-visible, .back:focus-visible, .square:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.dark .outline:focus-visible, .dark .square:focus-visible { outline-color: var(--lime); }
.footnote { margin: 16px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); text-align: center; }
.footnote.dim { color: #A8A89E; margin-top: 12px; }
.footnote.left { text-align: left; margin: 0 0 14px; }
.note { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }

/* Scan */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.where { font-size: 13px; color: #BDBDB2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { font-family: var(--display); font-size: 26px; letter-spacing: .3px; text-transform: uppercase; }
.square { width: 48px; height: 48px; flex: none; border-radius: 14px; border: 0; background: var(--night-2); color: var(--cream); display: flex; align-items: center; justify-content: center; }
.viewfinder {
  margin-top: 28px; position: relative; height: min(420px, 52vh); border-radius: 28px; overflow: hidden;
  background: var(--night-2); display: flex; align-items: center; justify-content: center;
}
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-note {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2;
  border: 0; border-radius: 999px; padding: 10px 18px; background: var(--cream); color: var(--ink); font-size: 15px; font-weight: 600;
}
.frame { position: relative; width: min(240px, 60vw, 32vh); height: min(240px, 60vw, 32vh); }
.frame .c { position: absolute; width: 44px; height: 44px; border: 0 solid var(--lime); }
.frame .tl { left: 0; top: 0; border-left-width: 5px; border-top-width: 5px; border-top-left-radius: 18px; }
.frame .tr { right: 0; top: 0; border-right-width: 5px; border-top-width: 5px; border-top-right-radius: 18px; }
.frame .bl { left: 0; bottom: 0; border-left-width: 5px; border-bottom-width: 5px; border-bottom-left-radius: 18px; }
.frame .br { right: 0; bottom: 0; border-right-width: 5px; border-bottom-width: 5px; border-bottom-right-radius: 18px; }
.frame .line { position: absolute; left: 16px; right: 16px; top: 49%; height: 3px; border-radius: 2px; background: var(--lime); animation: sweep 2.2s ease-in-out infinite alternate; }
@keyframes sweep { from { top: 12%; } to { top: 86%; } }
@media (prefers-reduced-motion: reduce) { .frame .line { animation: none; } }
.checking { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(17,17,16,.72); font-size: 18px; font-weight: 600; z-index: 3; }
.instruction { margin: 18px 0 0; text-align: center; font-size: 16px; line-height: 1.5; color: #E4E4D8; }
.short { display: flex; gap: 10px; }
.short input {
  flex: 1; min-width: 0; height: 56px; border: 2px solid #3A3A36; border-radius: 16px; padding: 0 16px;
  background: #1C1C1A; color: var(--cream); font: 500 17px Inter, sans-serif; letter-spacing: 1px; text-transform: uppercase;
}
.short input::placeholder { text-transform: none; letter-spacing: 0; color: #8A8A80; }
.outline { height: 56px; padding: 0 20px; border-radius: 16px; border: 2px solid var(--cream); background: transparent; color: var(--cream); font-size: 16px; font-weight: 600; }
.dark-outline { height: 52px; width: 100%; border-color: var(--ink); color: var(--ink); }

/* Valid */
.back { align-self: flex-start; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); font-size: 15px; font-weight: 600; }
.status { margin-top: 16px; display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.dot { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dot.ok { background: var(--lime); }
.offer { margin-top: 20px; background: var(--lime); border-radius: 28px; padding: 28px 24px; display: flex; flex-direction: column; gap: 6px; }
.offer-campaign { font-size: 14px; font-weight: 600; }
.offer-headline { font-family: var(--display); font-size: 88px; line-height: 1; letter-spacing: -1px; overflow-wrap: anywhere; }
.offer-headline.long { font-size: 48px; letter-spacing: 0; }
.offer-conditions { font-size: 16px; line-height: 1.4; }
.facts { margin: 24px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; font-size: 15px; }
.facts div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.facts dt { font-size: 13px; color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.code { font-weight: 700; letter-spacing: 1px; }

/* Redeemed */
.big-check { width: 120px; height: 120px; border-radius: 50%; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.receipt { margin-top: 36px; width: 100%; background: var(--cream); border-radius: 20px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; }
.receipt .right { text-align: right; }
.receipt .code { font-size: 17px; }
.label { font-size: 13px; color: var(--ink-3); }
.strong { font-weight: 600; font-size: 15px; }

/* Problem */
.warn-dot { width: 80px; height: 80px; border-radius: 50%; background: var(--peach); display: flex; align-items: center; justify-content: center; }
#problem { padding-top: calc(60px + env(safe-area-inset-top)); }
.box { margin-top: 28px; background: #fff; border: 2px solid var(--ink); border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.box .row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.box .row span:first-child { color: var(--ink-3); }
.box .row span:last-child { font-weight: 700; text-align: right; }

/* Stats */
.tiles { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.tile span { font-size: 13px; }
.tile b { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; }
.tile.black { background: var(--ink); color: var(--cream); }
.tile.black span { color: #D8D8CC; }
.tile.lime { background: var(--lime); }
.outline-tile { background: #fff; border: 2px solid var(--ink); padding: 16px; }
.outline-tile span { color: var(--ink-2); }
.outline-tile b { font-size: 32px; }
.section { margin: 28px 0 8px; font-size: 16px; font-weight: 700; }
.recent { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #D9D9CC; font-size: 15px; }
.recent li span:first-child { font-weight: 600; letter-spacing: 1px; }
.recent li span:last-child { color: var(--ink-2); text-align: right; }
.empty { margin: 4px 0 0; font-size: 15px; color: var(--ink-3); }
#stats .error { margin-top: 16px; }

[tabindex="-1"]:focus { outline: none; }
