:root {
  --gold: #f9d56b;
  --deep-gold: #bd8121;
  --brown: #421b0d;
  --maroon: #8b1720;
  --cream: #fff5c8;
  --white: #ffffff;
  --glass: rgba(68, 34, 8, 0.42);
  --glass-strong: rgba(73, 35, 5, 0.62);
  --border: rgba(255, 226, 133, 0.5);
  --shadow: 0 24px 80px rgba(51, 28, 4, 0.45);
  --danger: #ffe0d4;
  --success: #fff6bd;
}

* {
  box-sizing: border-box;
}

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

html {
  width: 100%;
  height: 100%;
  background-color: #cfa53b;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--cream);
  background-color: #cfa53b;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.fixed-campaign-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  background-color: #cfa53b;
  background-image: url("assets/master-delight-bg.png");
  background-size: auto 100%;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.campaign-shell {
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 36px);
}

.screen {
  width: min(100%, 470px);
  display: none;
  min-height: calc(100vh - 72px);
  min-height: calc(100lvh - 72px);
  align-items: center;
  justify-content: center;
  position: relative;
}

.active-screen {
  display: flex;
}

.brand-spacer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glass-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 237, 145, 0.16), rgba(82, 38, 4, 0.62)),
    var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: clamp(18px, 4vw, 28px);
  text-align: center;
  position: relative;
}


.login-card,
.scanner-card,
.reward-card {
  margin-top: 0;
  background: rgba(42, 15, 0, 0.14);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.login-card {
  width: min(100%, 390px);
  padding: 16px 18px;
  overflow: hidden;
}

.login-card .campaign-form {
  margin-top: 0;
}

.login-card .campaign-form label {
  margin: 0 0 7px 4px;
  color: #fff2b8;
  font-size: 0.9rem;
  font-weight: 700;
}

.login-card .input-wrap {
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  padding: 0 18px;
  gap: 14px;
  background: rgba(91, 54, 12, 0.78);
  box-shadow:
    inset 0 1px 2px rgba(255, 246, 190, 0.18),
    0 8px 20px rgba(92, 53, 5, 0.15);
}

.login-card .input-wrap span {
  color: #ffe47b;
  font-size: 1.08rem;
}

.login-card .input-wrap input {
  color: #fff7d6;
  font-size: 1rem;
}

.login-card .input-wrap input::placeholder {
  color: rgba(255, 246, 216, 0.58);
}

.login-card .field-error {
  margin: 4px 8px 0;
  min-height: 28px;
  color: #7e1017;
}

.login-card .primary-btn {
  min-height: 46px;
  margin: 0;
  border-radius: 999px;
  color: #3f2106;
  font-size: 1.08rem;
  background: linear-gradient(105deg, #fff5ae 0%, #ffd55e 45%, #e58d17 100%);
  box-shadow:
    0 14px 26px rgba(119, 68, 5, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.login-card h1 {
  margin: 6px -26px -3px;
  font-size: clamp(3.5rem, 13vw, 5.25rem);
  line-height: 0.95;
  white-space: nowrap;
  color: #bd1822;
  letter-spacing: 0.015em;
  transform: scaleX(1.26);
}

body.otp-open .login-card {
  visibility: hidden;
}

.scanner-card,
.reward-card {
  margin-top: 36px;
}

.scanner-card {
  width: min(100%, 390px);
  padding: 18px 20px;
}

.scanner-card h2 {
  font-size: clamp(1.45rem, 5vw, 2.1rem);
}

.scanner-card .campaign-form {
  margin-top: 14px;
}

.scanner-card .input-wrap {
  min-height: 48px;
  border-radius: 15px;
}

.scanner-card .primary-btn {
  min-height: 46px;
}

.scanner-card .field-error {
  min-height: 16px;
  margin-top: 5px;
}

.scanner-card .hint-text {
  margin-top: 9px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.73rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  color: #fff7cf;
  letter-spacing: 0.02em;
  text-shadow: 0 3px 18px rgba(64, 25, 2, 0.6);
}

h1 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(3rem, 12vw, 5.5rem);
  line-height: 1;
  color: #b51f27;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

h2 {
  font-size: clamp(1.75rem, 6vw, 2.7rem);
  line-height: 1.1;
}

.campaign-line {
  margin: 12px auto 0;
  max-width: 420px;
  color: rgba(255, 248, 207, 0.94);
  line-height: 1.55;
  font-size: 0.98rem;
}

.campaign-line strong,
.hint-text strong {
  color: var(--gold);
}

.campaign-form {
  margin-top: 18px;
  text-align: left;
}

.campaign-form label {
  display: block;
  margin-bottom: 9px;
  color: #fff2b8;
  font-size: 0.9rem;
  font-weight: 700;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border: 1px solid rgba(255, 224, 124, 0.52);
  border-radius: 18px;
  background: rgba(43, 18, 2, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 28px rgba(47, 18, 1, 0.18);
  padding: 0 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-wrap:focus-within {
  border-color: rgba(255, 239, 151, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 216, 98, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  background: rgba(36, 14, 1, 0.66);
}

.input-wrap span {
  color: var(--gold);
  font-weight: 800;
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #fff9d6;
  background: transparent;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.input-wrap input::placeholder {
  color: rgba(255, 247, 204, 0.54);
  font-weight: 500;
}

.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:hover,
.input-wrap input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff9d6;
  caret-color: #fff9d6;
  box-shadow: 0 0 0 1000px rgba(43, 18, 2, 0.92) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.otp-wrap input {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 0.32em;
}

.code-input-wrap input {
  text-transform: uppercase;
}

.field-error {
  min-height: 19px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.center-error {
  text-align: center;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.tab-btn,
.link-btn {
  border: 0;
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.primary-btn {
  margin-top: 4px;
  color: #451602;
  background: linear-gradient(135deg, #fff4ac, #f5c04d 42%, #b86713 100%);
  box-shadow: 0 18px 38px rgba(90, 39, 2, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.secondary-btn {
  color: #fff2b5;
  background: rgba(48, 18, 0, 0.55);
  border: 1px solid rgba(255, 224, 124, 0.42);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.tab-btn:hover,
.link-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.tab-btn:active,
.link-btn:active {
  transform: translateY(1px) scale(0.99);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.link-btn {
  display: block;
  margin: 14px auto 0;
  background: transparent;
  color: var(--gold);
  font-weight: 800;
  text-decoration: underline;
}

.hint-text {
  margin: 14px 0 0;
  color: rgba(255, 248, 214, 0.76);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.top-bar {
  position: fixed;
  top: 18px;
  left: 50%;
  width: min(calc(100% - 28px), 720px);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.ghost-btn,
.user-pill {
  border: 1px solid rgba(255, 224, 124, 0.42);
  background: rgba(52, 22, 3, 0.58);
  color: #fff2b8;
  box-shadow: 0 14px 32px rgba(48, 18, 0, 0.24);
  backdrop-filter: blur(14px);
}

.ghost-btn {
  padding: 10px 16px;
  font-weight: 800;
}

.small-btn {
  min-height: 40px;
}

.user-pill {
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.85rem;
}

.user-pill strong {
  color: var(--gold);
}

.mega-strip {
  margin: 18px 0 0;
  padding: 11px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 234, 138, 0.36);
  background: linear-gradient(135deg, rgba(255, 229, 107, 0.16), rgba(117, 33, 6, 0.18));
  color: #fff3b8;
  font-size: 0.88rem;
  font-weight: 800;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(49, 18, 1, 0.44);
  border: 1px solid rgba(255, 224, 124, 0.22);
}

.tab-btn {
  min-height: 42px;
  color: rgba(255, 246, 198, 0.76);
  background: transparent;
  font-weight: 900;
}

.active-tab {
  color: #471a03;
  background: linear-gradient(135deg, #fff5b2, #e7b23b);
  box-shadow: 0 10px 24px rgba(59, 23, 2, 0.24);
}

.mode-panel {
  display: none;
}

.active-panel {
  display: block;
}

.scanner-frame {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 222, 97, 0.15), transparent 52%),
    rgba(29, 12, 1, 0.66);
  border: 1px solid rgba(255, 224, 124, 0.46);
  box-shadow: inset 0 0 44px rgba(255, 217, 96, 0.15), 0 20px 38px rgba(41, 15, 1, 0.32);
}

.scanner-frame::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 178, 0.9), transparent);
  box-shadow: 0 0 18px rgba(255, 227, 92, 0.8);
  animation: scanLine 2.25s ease-in-out infinite;
}

@keyframes scanLine {
  0%, 100% { transform: translateY(-110px); opacity: 0.35; }
  50% { transform: translateY(110px); opacity: 1; }
}

#qrVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.scanner-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 24px;
  color: rgba(255, 246, 203, 0.78);
  text-align: center;
}

.scan-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 22px;
  border: 2px solid rgba(255, 223, 100, 0.74);
  position: relative;
}

.scan-icon::before,
.scan-icon::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 12px;
  border: 2px dashed rgba(255, 245, 176, 0.52);
}

.scan-icon::after {
  inset: 30px;
  border-radius: 50%;
  border-style: solid;
}

.scan-corner {
  position: absolute;
  width: 44px;
  height: 44px;
  border-color: #fff4a8;
  filter: drop-shadow(0 0 9px rgba(255, 230, 99, 0.75));
}

.top-left {
  top: 18px;
  left: 18px;
  border-top: 4px solid;
  border-left: 4px solid;
  border-radius: 10px 0 0 0;
}

.top-right {
  top: 18px;
  right: 18px;
  border-top: 4px solid;
  border-right: 4px solid;
  border-radius: 0 10px 0 0;
}

.bottom-left {
  bottom: 18px;
  left: 18px;
  border-bottom: 4px solid;
  border-left: 4px solid;
  border-radius: 0 0 0 10px;
}

.bottom-right {
  bottom: 18px;
  right: 18px;
  border-bottom: 4px solid;
  border-right: 4px solid;
  border-radius: 0 0 10px 0;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.button-row .primary-btn,
.button-row .secondary-btn {
  margin-top: 0;
}

.reward-card {
  width: min(100%, 390px);
  max-width: 390px;
  padding: 18px 20px;
}

.reward-card h2 {
  font-size: clamp(1.35rem, 4.8vw, 2rem);
}

.success-ring {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 9px;
  border-radius: 50%;
  color: #4f1a02;
  background: linear-gradient(135deg, #fff6b1, #edbb42);
  font-size: 1.55rem;
  font-weight: 1000;
  box-shadow: 0 14px 34px rgba(50, 18, 1, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.reward-badge {
  margin: 15px auto 13px;
  width: min(100%, 270px);
  border-radius: 22px;
  padding: 15px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.28), transparent 35%),
    linear-gradient(135deg, #fff6b8, #f1bf45 48%, #a4540d 100%);
  color: #4a1702;
  box-shadow: 0 18px 42px rgba(48, 18, 0, 0.3);
}

.reward-badge span {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 900;
}

.reward-badge strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  line-height: 1;
  font-family: "Bebas Neue", Impact, sans-serif;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: left;
}

.details-grid div {
  min-width: 0;
  border: 1px solid rgba(255, 224, 124, 0.26);
  border-radius: 18px;
  background: rgba(43, 16, 1, 0.42);
  padding: 13px;
}

.details-grid span {
  display: block;
  color: rgba(255, 245, 195, 0.66);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.details-grid strong {
  display: block;
  margin-top: 6px;
  color: #fff7d1;
  word-break: break-word;
  font-size: 0.92rem;
}

.full-width {
  grid-column: 1 / -1;
}

.reward-actions {
  margin-top: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 20px;
}

.modal.show-modal {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 16px 18px;
  text-align: center;
  color: var(--cream);
  background: rgba(42, 15, 0, 0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: var(--shadow);
  animation: modalPop 0.22s ease both;
}

.modal-card h2 {
  font-size: clamp(1.45rem, 5vw, 2.1rem);
}

.modal-card .campaign-line {
  margin-top: 8px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.modal-card .campaign-form {
  margin-top: 14px;
}

.modal-card .input-wrap {
  min-height: 48px;
  border-radius: 15px;
}

.modal-card .primary-btn {
  min-height: 46px;
}

.modal-card .field-error {
  min-height: 16px;
  margin-top: 5px;
}

.modal-card .link-btn,
.modal-card .hint-text {
  margin-top: 9px;
}

@keyframes modalPop {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 224, 124, 0.34);
  border-radius: 50%;
  background: rgba(39, 15, 0, 0.42);
  color: #fff3bd;
  font-size: 1.35rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  width: min(calc(100% - 32px), 420px);
  transform: translate(-50%, 110px);
  opacity: 0;
  border: 1px solid rgba(255, 224, 124, 0.38);
  border-radius: 18px;
  padding: 13px 16px;
  color: #fff7cf;
  background: rgba(47, 17, 0, 0.86);
  box-shadow: 0 16px 42px rgba(24, 9, 0, 0.32);
  text-align: center;
  font-weight: 800;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show-toast {
  opacity: 1;
  transform: translate(-50%, 0);
}

.reveal-up {
  animation: revealUp 0.48s ease both;
}

.reveal-down {
  animation: revealDown 0.4s ease both;
}

@keyframes revealUp {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes revealDown {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 800px) and (hover: hover) and (pointer: fine) {
  .campaign-shell {
    align-items: start;
  }

  .screen {
    min-height: calc(100vh - 72px);
    min-height: calc(100lvh - 72px);
  }

  .login-card {
    margin-top: -36px;
  }

  .scanner-card,
  .reward-card {
    margin-top: 48px;
  }
}

@media (max-width: 799px), (hover: none) and (pointer: coarse) {
  :root {
    --mobile-campaign-height: max(100dvh, calc(100vw * 1500 / 689));
    --mobile-card-width: min(calc(100vw - clamp(52px, 16vw, 84px)), 340px);
    --mobile-card-padding: clamp(11px, 3.2vw, 15px);
    --mobile-control-height: clamp(40px, 6dvh, 44px);
    --mobile-content-top: clamp(150px, 36vw, 220px);
  }

  html {
    height: auto;
    min-height: var(--mobile-campaign-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
  }

  body {
    position: relative;
    height: var(--mobile-campaign-height);
    min-height: var(--mobile-campaign-height);
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior-y: none;
  }

  .campaign-shell {
    position: relative;
    width: 100%;
    height: var(--mobile-campaign-height);
    min-height: var(--mobile-campaign-height);
    padding: 14px;
    place-items: start center;
    overflow: hidden;
  }

  .fixed-campaign-background {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: var(--mobile-campaign-height);
    background-size: 100% auto;
    background-position: top center;
    background-repeat: no-repeat;
  }

  .screen {
    width: 100%;
    height: 100%;
    min-height: 0;
    align-items: flex-start;
    padding-top: var(--mobile-content-top);
    padding-bottom: clamp(32px, 10dvh, 72px);
  }

  .active-screen {
    display: flex;
  }

  .login-card {
    margin-top: clamp(-28px, -4vw, -12px);
    width: var(--mobile-card-width);
    border: 1px solid rgba(255, 231, 141, 0.36);
    border-radius: 26px;
    padding: var(--mobile-card-padding);
    background:
      linear-gradient(180deg, rgba(122, 79, 20, 0.3), rgba(181, 128, 43, 0.5)),
      rgba(155, 103, 30, 0.34);
    box-shadow:
      inset 0 1px 0 rgba(255, 247, 197, 0.2),
      0 16px 34px rgba(105, 63, 9, 0.14);
  }

  .scanner-card,
  .reward-card {
    width: var(--mobile-card-width);
    margin-top: 0;
  }

  .scanner-card {
    padding: var(--mobile-card-padding);
  }

  .reward-card {
    padding: var(--mobile-card-padding);
    margin-top: clamp(-48px, -8vw, -20px);
  }

  #scanScreen {
    padding-top: clamp(112px, 20dvh, 166px);
  }

  #scanScreen .scanner-card {
    margin-top: 0;
  }

  #thankYouScreen {
    padding-top: clamp(130px, 30vw, 190px);
  }

  .glass-card {
    border-radius: clamp(18px, 5vw, 22px);
  }

  .login-card h1 {
    font-size: clamp(2.65rem, 10.5vw, 4rem);
  }

  .scanner-card h2,
  .modal-card h2 {
    font-size: clamp(1.25rem, 4.5vw, 1.75rem);
  }

  .reward-card h2 {
    font-size: clamp(1.2rem, 4.2vw, 1.6rem);
  }

  .campaign-form,
  .scanner-card .campaign-form,
  .modal-card .campaign-form {
    margin-top: 10px;
  }

  .input-wrap,
  .login-card .input-wrap {
    border-radius: 13px;
    padding-right: 13px;
    padding-left: 13px;
  }

  .login-card .input-wrap input,
  .input-wrap input {
    font-size: 0.9rem;
  }

  .otp-wrap input {
    font-size: 1.35rem;
  }

  .primary-btn,
  .secondary-btn {
    padding: 9px 16px;
    font-size: 0.9rem;
  }

  .login-card .input-wrap,
  .login-card .primary-btn,
  .scanner-card .input-wrap,
  .scanner-card .primary-btn,
  .modal-card .input-wrap,
  .modal-card .primary-btn {
    min-height: var(--mobile-control-height);
  }

  .top-bar {
    top: max(10px, env(safe-area-inset-top));
    width: min(calc(100% - 24px), 720px);
  }

  .user-pill,
  .ghost-btn {
    font-size: 0.76rem;
    padding: 9px 12px;
  }

  .button-row,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    border-radius: 20px;
  }

  .tab-btn {
    border-radius: 16px;
  }

  .scanner-frame {
    border-radius: 22px;
  }

  .modal-card {
    width: var(--mobile-card-width);
    padding: var(--mobile-card-padding);
    margin-top: 0;
  }

  .modal-card .campaign-line {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .modal-close {
    top: 9px;
    right: 9px;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  .field-error,
  .login-card .field-error {
    min-height: 16px;
    margin-top: 4px;
    font-size: 0.72rem;
  }

  .link-btn,
  .modal-card .link-btn {
    margin-top: 7px;
    font-size: 0.82rem;
  }

  .success-ring {
    width: 48px;
    height: 48px;
    margin-bottom: 7px;
    font-size: 1.25rem;
  }

  .reward-badge {
    width: min(100%, 235px);
    margin: 10px auto 9px;
    padding: 11px;
    border-radius: 18px;
  }

  .reward-badge strong {
    font-size: clamp(1.25rem, 5vw, 1.85rem);
  }

  .mega-strip {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    font-size: 0.76rem;
  }

  .modal {
    place-items: start center;
    padding:
      clamp(90px, 18dvh, 180px)
      max(14px, env(safe-area-inset-right))
      max(20px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    overflow-y: auto;
  }
}

@media (max-width: 390px) {
  .login-card {
    margin-top: clamp(-14px, -3vw, -6px);
  }

  .glass-card {
    padding: var(--mobile-card-padding, 16px);
  }

  .login-card {
    padding: var(--mobile-card-padding, 16px);
  }

  .campaign-line {
    font-size: 0.9rem;
  }

  .input-wrap {
    min-height: var(--mobile-control-height, 44px);
    border-radius: 16px;
  }

  .login-card .input-wrap,
  .login-card .primary-btn {
    min-height: var(--mobile-control-height, 44px);
  }

  .login-card h1 {
    font-size: 12vw;
  }

  .primary-btn,
  .secondary-btn {
    min-height: var(--mobile-control-height, 44px);
  }
}

@media (max-width: 799px) and (max-height: 700px) {
  :root {
    --mobile-card-width: min(calc(100vw - 64px), 320px);
    --mobile-card-padding: clamp(10px, 3vw, 13px);
    --mobile-control-height: 40px;
    --mobile-content-top: clamp(112px, 30vw, 160px);
  }

  .login-card h1 {
    font-size: clamp(2.35rem, 9.5vw, 3.25rem);
  }

  .login-card .field-error {
    min-height: 16px;
  }

  #scanScreen {
    padding-top: clamp(92px, 15dvh, 120px);
  }

  #thankYouScreen {
    padding-top: clamp(105px, 24vw, 145px);
  }

  .reward-card {
    margin-top: -20px;
  }

  .modal {
    padding-top: clamp(52px, 10dvh, 80px);
  }

  .modal-card .campaign-line,
  .modal-card .campaign-form {
    margin-top: 6px;
  }

  .scanner-card h2,
  .modal-card h2,
  .reward-card h2 {
    font-size: clamp(1.1rem, 4vw, 1.4rem);
  }

  .success-ring {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .reward-badge {
    width: min(100%, 215px);
    padding: 9px;
  }

  .mega-strip {
    margin-top: 8px;
    padding: 7px 9px;
  }
}

@media (max-width: 360px) {
  :root {
    --mobile-card-width: min(calc(100vw - 48px), 292px);
    --mobile-card-padding: 10px;
    --mobile-control-height: 38px;
    --mobile-content-top: clamp(105px, 29vw, 140px);
  }

  .login-card h1 {
    font-size: clamp(2.15rem, 9.5vw, 2.8rem);
  }

  .login-card .input-wrap,
  .input-wrap {
    padding-right: 10px;
    padding-left: 10px;
    gap: 8px;
  }

  .login-card .input-wrap input,
  .input-wrap input,
  .primary-btn,
  .secondary-btn {
    font-size: 0.82rem;
  }

  .campaign-line {
    font-size: 0.76rem;
  }

  #scanScreen {
    padding-top: clamp(82px, 14dvh, 105px);
  }

  #thankYouScreen {
    padding-top: clamp(92px, 22vw, 120px);
  }

  .modal {
    padding-top: clamp(42px, 8dvh, 64px);
  }

  .otp-wrap input {
    font-size: 1.3rem;
  }
}

@media (max-width: 340px), (max-width: 799px) and (max-height: 600px) {
  :root {
    --mobile-card-width: min(calc(100vw - 40px), 275px);
    --mobile-card-padding: 8px;
    --mobile-control-height: 36px;
  }

  .login-card h1 {
    font-size: clamp(1.95rem, 9vw, 2.45rem);
  }

  .scanner-card h2,
  .modal-card h2,
  .reward-card h2 {
    font-size: 1.05rem;
  }

  .field-error,
  .login-card .field-error {
    min-height: 13px;
    font-size: 0.65rem;
  }

  .success-ring {
    width: 36px;
    height: 36px;
    margin-bottom: 5px;
    font-size: 0.95rem;
  }

  .reward-badge {
    width: min(100%, 195px);
    margin: 7px auto;
    padding: 7px;
  }

  .reward-badge strong {
    font-size: 1.15rem;
  }

  .mega-strip {
    margin-top: 6px;
    padding: 6px 8px;
    font-size: 0.68rem;
  }
}

@media (min-width: 800px) and (max-height: 720px) and (orientation: landscape) {
  .fixed-campaign-background {
    background-size: 100% auto;
  }

  .scanner-card,
  .reward-card {
    margin-top: 56px;
  }
}

@media (min-width: 800px) and (hover: hover) and (pointer: fine) {
  .fixed-campaign-background {
    background-size: auto 100vh;
    background-size: auto 100dvh;
  }
}

/* ------------------------------------------------------------------
   Final mobile layout fix
   - Keeps the campaign background scrollable up to the artwork height.
   - Places login, OTP, code and reward cards at the same vertical level.
   - Gives all campaign cards the same width and minimum height.
------------------------------------------------------------------- */
@media (max-width: 799px), (hover: none) and (pointer: coarse) {
  :root {
    --mobile-artwork-height: calc(100vw * 1500 / 689);
    --mobile-campaign-height: var(--mobile-artwork-height);
    /* Clear artwork band: below the logo (about y=240) and above the Bullet (about y=625). */
    --mobile-section-top: calc(100vw * 260 / 689);
    --mobile-card-width: min(calc(100vw - clamp(52px, 16vw, 84px)), 340px);
    --mobile-card-padding: clamp(9px, 2.6vw, 12px);
    --mobile-control-height: clamp(38px, 10vw, 42px);
  }

  html {
    height: auto;
    min-height: 0;
    max-height: var(--mobile-artwork-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body {
    position: relative;
    height: var(--mobile-artwork-height);
    min-height: var(--mobile-campaign-height);
    max-height: var(--mobile-artwork-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    background-color: #cfa53b;
  }

  .fixed-campaign-background {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: var(--mobile-campaign-height);
    min-height: var(--mobile-campaign-height);
    background-size: 100% auto;
    background-position: top center;
    background-repeat: no-repeat;
  }

  .campaign-shell {
    display: block;
    width: 100%;
    height: var(--mobile-campaign-height);
    min-height: var(--mobile-campaign-height);
    max-height: var(--mobile-artwork-height);
    padding: 0 14px;
    overflow: hidden;
  }

  .screen {
    width: 100%;
    min-height: var(--mobile-campaign-height);
    height: auto;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: var(--mobile-section-top) !important;
    padding-bottom: 64px;
  }

  .active-screen {
    display: flex;
  }

  .login-card,
  .scanner-card,
  .reward-card,
  .modal-card {
    width: var(--mobile-card-width);
    max-width: var(--mobile-card-width);
    min-height: 0;
    height: auto;
    margin-top: 0 !important;
    padding: var(--mobile-card-padding);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .login-card .campaign-form,
  .scanner-card .campaign-form,
  .reward-card .campaign-form,
  .modal-card .campaign-form {
    width: 100%;
  }

  #scanScreen,
  #thankYouScreen {
    padding-top: var(--mobile-section-top) !important;
  }

  .modal {
    place-items: start center;
    padding:
      var(--mobile-section-top)
      max(14px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left)) !important;
    overflow-y: auto;
  }

  .modal-card {
    margin-top: 0 !important;
  }

  .login-card .input-wrap,
  .login-card .primary-btn,
  .scanner-card .input-wrap,
  .scanner-card .primary-btn,
  .modal-card .input-wrap,
  .modal-card .primary-btn {
    min-height: var(--mobile-control-height);
  }

  .login-card h1 {
    margin-top: 3px;
    font-size: clamp(2.55rem, 11vw, 3.6rem);
  }

  .scanner-card .campaign-form,
  .modal-card .campaign-form {
    margin-top: 6px;
  }

  .modal-card .eyebrow {
    margin-bottom: 3px;
    font-size: 0.62rem;
  }

  .modal-card .campaign-line {
    margin-top: 3px;
    line-height: 1.2;
  }

  .modal-card .campaign-form > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .modal-card .field-error,
  .scanner-card .field-error {
    min-height: 13px;
    margin-top: 2px;
  }

  .modal-card .link-btn {
    margin-top: 4px;
  }

  .reward-card .success-ring {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    font-size: 1.05rem;
  }

  .reward-card .reward-badge {
    margin: 7px auto 6px;
    padding: 8px;
  }

  .reward-card .mega-strip {
    margin-top: 6px;
    padding: 6px 8px;
  }
}

@media (max-width: 360px) {
  :root {
    --mobile-section-top: calc(100vw * 252 / 689);
  }
}
