/* RBX Cards: charcoal shell, pressed card surfaces, silver scratch foil. */

:root {
  --paper: #18191d;
  --paper-deep: #101114;
  --ink: #f4f3f0;
  --ink-soft: #b9bbc4;
  --line: #494c57;
  --red: #c93232;
  --red-deep: #812323;
  --card-back: #292b32;
  --card-back-line: #565966;
  --ok: #75c69c;
  --radius-card: 22px;
  --radius-ui: 14px;
  --font-ui: "Bricolage Grotesque", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-pin: "Spline Sans Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --press: 0 4px 0 var(--red-deep);
  --press-ink: 0 4px 0 var(--paper-deep);
  color-scheme: dark;
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- buttons */

.button {
  display: block;
  width: 100%;
  padding: 15px 20px 14px;
  border: 0;
  border-radius: var(--radius-ui);
  font: 700 17px/1 var(--font-ui);
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background 120ms ease;
}

.button.primary {
  background: var(--red);
  color: #fff;
  box-shadow: var(--press);
}

.button.primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--red-deep);
}

.button.quiet {
  background: var(--card-back);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: var(--press-ink);
}

.button.quiet:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--paper-deep);
}

.button.quiet:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: var(--press-ink);
}

/* ---------------------------------------------------------------- blocker */

.desktop-blocker {
  display: none;
}

body.desktop-blocked .desktop-blocker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  position: fixed;
  inset: 0;
  padding: 32px;
  background: var(--paper);
  text-align: center;
  z-index: 10;
}

body.desktop-blocked .app {
  display: none;
}

.blocker-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 300px;
  aspect-ratio: 1.586;
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--paper-deep);
  color: #fff;
  transform: rotate(-4deg);
}

.blocker-card strong {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
}

.blocker-card .blocker-kind {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
}

.blocker-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--red);
  font-weight: 800;
}

.blocker-kind {
  margin-top: auto;
}

.desktop-blocker h1 {
  margin: 12px 0 0;
  font-size: 26px;
  font-weight: 800;
  max-width: 22ch;
}

.desktop-blocker p {
  margin: 0;
  max-width: 34ch;
  color: var(--ink-soft);
  line-height: 1.5;
}


/* ------------------------------------------------------------------- shell */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom));
}

.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 8px;
}

.wordmark {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wordmark em {
  font-style: normal;
  font-weight: 500;
  color: #ff9797;
}

.head-note {
  padding: 5px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.app-foot {
  padding: 22px 4px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.app-foot .foot-link {
  color: inherit;
  font-weight: 600;
}

.app-foot .foot-link:hover {
  color: var(--ink);
}

/* ----------------------------------------------------------------- screens */

.screens {
  flex: 1;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.screen.is-active {
  display: flex;
  animation: screen-in 260ms ease;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  margin: 6px 0 0;
  font-size: clamp(28px, 7.5vw, 36px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h2 {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede,
.screen-copy {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 42ch;
}

.screen .button.primary {
  margin-top: 6px;
}

/* -------------------------------------------------------------- gift cards */

.gcard {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  padding: 5.5% 6%;
  overflow: hidden;
}

.gcard.front {
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(226, 35, 26, 0.28), transparent 55%),
    var(--paper-deep);
  color: #fff;
  box-shadow: 0 2px 0 var(--paper-deep), 0 22px 40px -18px rgba(23, 23, 26, 0.55);
}

.gcard.front.stock .gcard-head,
.gcard.front.stock .gcard-foot {
  opacity: 0.45;
}

.gcard-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gcard-tile {
  display: grid;
  place-items: center;
  width: clamp(30px, 9%, 40px);
  aspect-ratio: 1;
  border-radius: 22%;
  background: var(--red);
  font-weight: 800;
  font-size: clamp(13px, 3.6vw, 16px);
}

.gcard-brand {
  font-weight: 700;
  font-size: clamp(12px, 3.4vw, 15px);
  letter-spacing: 0.01em;
}

.gcard-studs {
  display: flex;
  gap: 7px;
  margin-left: auto;
}

.gcard-studs i {
  width: clamp(7px, 2.2vw, 10px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18), inset 0 -1px 1px rgba(0, 0, 0, 0.45);
}

.gcard-amount {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  line-height: 1;
}

.gcard-amount strong,
.gcard-amount .gcard-blank {
  font-size: clamp(40px, 13.5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.gcard-amount .gcard-blank {
  color: rgba(255, 255, 255, 0.35);
}

.gcard-amount span {
  margin-top: 6px;
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.gcard-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.gcard-price {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
  font-size: clamp(12px, 3.4vw, 15px);
}

.gcard-kind {
  font-size: clamp(11px, 3vw, 13px);
  color: rgba(255, 255, 255, 0.6);
}

/* sheen sweep — plays once when the finished card arrives */
.gcard.front.live::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.14) 50%, transparent 58%);
  transform: translateX(-70%);
  animation: sheen 900ms ease 150ms forwards;
  pointer-events: none;
}

@keyframes sheen {
  to {
    transform: translateX(70%);
  }
}

/* card back */
.gcard.back {
  background: var(--card-back);
  color: var(--ink);
  border: 1px solid var(--card-back-line);
  box-shadow: 0 2px 0 var(--paper-deep), 0 22px 40px -18px rgba(23, 23, 26, 0.4);
  gap: 5.5%;
}

.gcard-stripe {
  height: 13%;
  margin: -1% -6% 0;
  background: #232327;
}

.pin-panel {
  position: relative;
  flex: 1;
  border-radius: 12px;
  background: var(--card-back);
  border: 1.5px dashed var(--card-back-line);
  overflow: hidden;
}

.pin-code {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
}

.pin-group {
  font-family: var(--font-pin);
  font-weight: 700;
  font-size: clamp(15px, 5.4vw, 24px);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

#scratch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  transition: opacity 500ms ease;
}

.pin-panel.is-revealed #scratch {
  opacity: 0;
  pointer-events: none;
}

.gcard-backfoot {
  display: flex;
  align-items: center;
  gap: 5%;
  min-height: 24%;
}

.barcode {
  width: 34%;
  height: 70%;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    transparent 2px 5px,
    var(--ink) 5px 6px,
    transparent 6px 9px,
    var(--ink) 9px 13px,
    transparent 13px 15px,
    var(--ink) 15px 16px,
    transparent 16px 21px
  );
}

.card-fineprint {
  margin: 0;
  font-size: clamp(9px, 2.6vw, 11px);
  line-height: 1.45;
  color: var(--ink-soft);
}

/* ----------------------------------------------------------- value picker */

.value-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.value-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--card-back);
  box-shadow: 0 3px 0 var(--paper-deep);
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 120ms ease, color 120ms ease;
}

.value-row strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.value-row small {
  font-size: 13px;
  color: var(--ink-soft);
}

.value-row em {
  margin-left: auto;
  font-style: normal;
  font-weight: 700;
  font-size: 15px;
}

.value-choice input:checked + .value-row {
  border-color: var(--red);
  box-shadow: 0 3px 0 var(--red-deep);
  color: #ff9797;
}

.value-choice input:checked + .value-row small {
  color: var(--ink-soft);
}

.value-choice input:checked + .value-row em {
  color: var(--ink);
}

.value-choice input:focus-visible + .value-row {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.value-row:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--paper-deep);
}

/* ---------------------------------------------------------------- printing */

.printer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 6px;
}

.printer-slot {
  position: relative;
  z-index: 1;
  height: 16px;
  border-radius: 10px;
  background: var(--paper-deep);
  overflow: hidden;
}

.printer-slot span {
  display: block;
  height: 100%;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
}

.printer-card {
  margin: -6px 6% 0;
}

.gcard.front.mini .gcard-amount strong {
  font-size: clamp(30px, 9vw, 44px);
}

.gcard.front.mini .gcard-amount span,
.gcard.front.mini .gcard-kind {
  font-size: 11px;
}

.print-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.print-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
}

.print-steps .marker {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card-back);
}

.print-steps li.doing {
  color: var(--ink);
}

.print-steps li.doing .marker {
  border-color: var(--red);
  background: radial-gradient(circle, var(--red) 0 40%, var(--card-back) 45%);
}

.print-steps li.done {
  color: var(--ink);
}

.print-steps li.done .marker {
  border-color: var(--ok);
  background: var(--ok);
}

.print-percent {
  margin: 6px 0 0;
  font-family: var(--font-pin);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ result */

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ------------------------------------------------------------------ tablet */

@media (min-width: 700px) {
  .app {
    max-width: 560px;
    padding: 0 32px calc(28px + env(safe-area-inset-bottom));
  }

  .app-head {
    padding-top: 26px;
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 30px;
  }

  .gcard-amount strong {
    font-size: 72px;
  }

  .pin-group {
    font-size: 27px;
  }
}

@media (min-width: 1024px) {
  .app {
    max-width: 640px;
  }

  .gcard-amount strong {
    font-size: 84px;
  }
}

/* --------------------------------------------------------- short landscape */

@media (max-height: 620px) and (orientation: landscape) {
  .app {
    max-width: 520px;
    padding-bottom: 12px;
  }

  .gcard,
  .value-picker {
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }

  .value-choice {
    max-width: 300px;
    margin: 0 auto;
    width: 100%;
  }

  h1 {
    font-size: 24px;
  }

  .lede {
    font-size: 14px;
  }
}

[hidden] { display: none !important; }
/* Printing: a single paced card-feed animation follows the actual progress. */
.wordmark { font-size: clamp(17px, 4.8vw, 20px); white-space: nowrap; }
.wordmark span { color: #ff9797; font-weight: 500; }
.app-head { gap: 10px; flex-wrap: wrap; }
#printing { --print-progress: 0; padding-top: 24px; }
.printer { position: relative; padding: 0; }
.printer-housing {
  position: relative; z-index: 3; display: flex; justify-content: space-between;
  align-items: center; padding: 22px 24px 26px; border: 1px solid #494c57;
  border-radius: 22px 22px 8px 8px; background: linear-gradient(#373941, #24262c);
  box-shadow: inset 0 1px 0 #626571, 0 12px 24px #0005;
  font-size: 14px; font-weight: 700; color: #c9cbd3;
}
.printer-light { width: 8px; height: 8px; border-radius: 50%; background: #75c69c; box-shadow: 0 0 10px #75c69c66; }
.printer-slot { margin: -12px 16px 0; height: 14px; z-index: 4; border: 3px solid #494c57; background: #08090b; box-shadow: 0 2px 0 #ffffff0d; }
.printer-output { overflow: hidden; padding: 0 10px 24px; }
.printer-card { margin: -3px 5% 0; transform: translateY(calc(-85% + var(--print-progress) * 85%)); will-change: transform; }
.printer-card .gcard { border: 1px solid #494c57; box-shadow: 0 12px 18px #0005; }
#printing h2 { margin-top: 0; }
#print-status { min-height: 1.55em; }
.print-progress { height: 6px; border-radius: 6px; overflow: hidden; background: #34363e; }
.print-progress span { display: block; height: 100%; background: #ff9797; transform: scaleX(0); transform-origin: left; border-radius: inherit; }
.print-steps { gap: 0; margin-top: 4px; }
.print-steps li { padding: 12px 0; border-bottom: 1px solid #ffffff0b; transition: color 200ms; }
.print-steps .marker { width: 20px; height: 20px; position: relative; }
.print-steps li.doing .marker { border-color: #ff9797; background: transparent; }
.print-steps li.doing .marker::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #ff9797; animation: print-pulse 1.4s ease-in-out infinite; }
.print-steps li.done .marker::after { content: ''; position: absolute; width: 5px; height: 9px; left: 5px; top: 2px; border: solid #18261e; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.print-percent { align-self: flex-end; margin-top: -4px; font-family: var(--font-ui); font-size: 18px; color: var(--ink); }
@keyframes print-pulse { 50% { opacity: .35; transform: scale(.75); } }
/* Non-modal gate (see app.js): UA modal centring doesn't apply, so fix and
   centre it ourselves. The whole stack deliberately sits BELOW the partner
   panel's natural inline z-index 11000, so its popup always wins the layer
   fight even if our re-styler never finds it: page < backdrop 8000 <
   big text ≈ dialog 8100 < partner panel 11000+ < conversion toasts. */
#offer-dialog { position: fixed; inset: 0; margin: auto; z-index: 8100; width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 26px; border: 1px solid #565966; border-radius: 24px; background: #24262c; color: var(--ink); box-shadow: 0 30px 90px #0009; }
#offer-backdrop { position: fixed; inset: 0; z-index: 8000; background: #000b; backdrop-filter: blur(5px); animation: backdrop-in 420ms ease-out; }
#offer-backdrop[hidden] { display: none; }
#offer-dialog[open] { animation: gate-in 560ms cubic-bezier(.2, 1.06, .3, 1) both; }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes gate-in { 0% { opacity: 0; transform: translateY(76px) scale(.94); } 100% { opacity: 1; transform: translateY(0) scale(1); } }

/* Beat 1 — the big headline pops in over the dim before the box appears. */
.offer-bigtext {
  position: fixed;
  inset: 0;
  z-index: 8100; /* same layer as the dialog; it leaves before the box enters */
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 24px;
  font-size: clamp(38px, 10.5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-align: center;
  text-wrap: balance;
  color: var(--ink);
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.offer-bigtext span { color: #ff9797; }
.offer-bigtext:not([hidden]) { animation: bigtext-pop 640ms cubic-bezier(.3, 1.45, .45, 1) both; }
.offer-bigtext.is-leaving { animation: bigtext-out 380ms cubic-bezier(.4, 0, .7, .2) both; }
@keyframes bigtext-pop {
  0% { opacity: 0; transform: scale(.5) translateY(24px); }
  62% { opacity: 1; transform: scale(1.07) translateY(0); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes bigtext-out {
  to { opacity: 0; transform: scale(.9) translateY(-34px); filter: blur(7px); }
}
#offer-dialog .dialog-head { display: flex; align-items: center; justify-content: space-between; }
#offer-dialog h2 { font-size: 26px; margin: 14px 0 10px; }
#offer-dialog p { font-size: 16px; line-height: 1.55; color: var(--ink-soft); }
#offer-dialog .offer-note { font-size: 14px; }
#offer-dialog .button { margin-top: 14px; line-height: 1.3; }
#offer-dialog .captcha-mount { margin-top: 18px; display: flex; justify-content: center; }
#offer-dialog .captcha-mount > div { width: 100%; }
#offer-dialog .captcha-note { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: 14px 0 2px; }
#offer-dialog .offer-close { margin-top: 10px; }
/* Anticipation: spinner + rotating status first, captcha rises in after. */
#offer-dialog .verify-connecting { display: none; justify-items: center; gap: 14px; padding: 24px 0 12px; }
#offer-dialog.is-connecting .verify-connecting { display: grid; }
#offer-dialog.is-connecting .verify-ready { display: none; }
#offer-dialog .verify-ready { animation: rise-in 420ms cubic-bezier(.22, 1, .36, 1) both; }
#offer-dialog .verify-spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: verify-spin .8s linear infinite; }
#offer-dialog .verify-status { margin: 0; font-size: 14px; color: var(--ink-soft); }
@keyframes verify-spin { to { transform: rotate(1turn); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
