: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;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--cream);
  background: #c99d2b;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.campaign-shell {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 36px);
}

.campaign-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background-color: #cfa53b;
  background-image: url("assets/master-delight-bg.png");
  background-size: 100% 100%;
  background-position: top center;
  background-repeat: no-repeat;
}

.campaign-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 235, 144, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(72, 32, 3, 0.08) 0%, rgba(72, 32, 3, 0.18) 48%, rgba(35, 14, 2, 0.46) 100%);
}

.gold-glow {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.28;
  pointer-events: none;
}

.gold-glow-one {
  top: 20%;
  left: -110px;
  background: #fff2a0;
}

.gold-glow-two {
  right: -120px;
  bottom: 7%;
  background: #b05c13;
}

.screen {
  width: min(100%, 520px);
  display: none;
  min-height: calc(100vh - 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(22px, 5vw, 34px);
  text-align: center;
}

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

.scanner-card,
.reward-card {
  margin-top: 72px;
  background:
    linear-gradient(145deg, rgba(255, 237, 145, 0.18), rgba(65, 27, 2, 0.72)),
    var(--glass-strong);
}

.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: 24px;
  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.45rem;
  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 {
  max-width: 560px;
}

.success-ring {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #4f1a02;
  background: linear-gradient(135deg, #fff6b1, #edbb42);
  font-size: 2rem;
  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: 22px auto 20px;
  width: min(100%, 310px);
  border-radius: 28px;
  padding: 20px;
  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(2.2rem, 10vw, 4.1rem);
  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: 22px;
}

.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: rgba(23, 9, 0, 0.62);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(100%, 430px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  text-align: center;
  color: var(--cream);
  background:
    linear-gradient(145deg, rgba(255, 237, 145, 0.18), rgba(70, 28, 2, 0.82)),
    rgba(42, 15, 0, 0.86);
  box-shadow: var(--shadow);
  animation: modalPop 0.22s ease both;
}

@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) {
  .campaign-shell {
    align-items: start;
  }

  .campaign-shell::before {
    background-size: auto 100vh;
    background-size: auto 100dvh;
    background-position: top center;
    background-color: #cfa53b;
  }

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

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

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

@media (max-width: 560px) {
  .campaign-shell {
    padding: 14px;
    place-items: start center;
  }

  .campaign-shell::before {
    background-size: 100% 100%;
    background-position: top center;
    background-color: #d1a838;
  }

  .campaign-shell::after {
    background:
      linear-gradient(180deg, rgba(83, 38, 5, 0.03) 0%, rgba(74, 29, 2, 0.1) 38%, rgba(38, 15, 1, 0.5) 100%);
  }

  .screen {
    width: 100%;
    min-height: calc(100vh - 28px);
  }

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

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

  .glass-card {
    border-radius: 24px;
  }

  .top-bar {
    top: 12px;
  }

  .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 {
    padding: 26px 20px;
  }
}

@media (max-width: 390px) {
  .login-card {
    margin-top: 0;
  }

  .glass-card {
    padding: 20px 16px;
  }

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

  .input-wrap {
    min-height: 50px;
    border-radius: 16px;
  }

  .primary-btn,
  .secondary-btn {
    min-height: 50px;
  }
}

@media (max-height: 720px) and (orientation: landscape) {
  .campaign-shell::before {
    background-size: 100% 100%;
  }

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

@media (min-width: 800px) {
  .campaign-shell::before {
    background-size: auto 100vh;
    background-size: auto 100dvh;
  }
}
