@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --primary: #fdc800;
  --secondary: #432dd7;
  --success: #16a34a;
  --danger: #dc2626;
  --surface: #fbfbf9;
  --text: #1c293c;
  --border: 2px solid #1c293c;
  --shadow: 3px 3px 0 #1c293c;
  --radius-sm: 4px;
  --radius-md: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--text);
  position: relative;
  z-index: 0;
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

[hidden] {
  display: none !important;
}

.screen {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: url("./assets/bg.webp") center / cover no-repeat var(--surface);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

@media (min-width: 431px) {
  body {
    background: var(--surface);
  }

  body::before {
    content: "";
    position: fixed;
    inset: -24px;
    background: url("./assets/bg.webp") center / cover no-repeat;
    filter: blur(18px);
    transform: scale(1.04);
    pointer-events: none;
    z-index: 0;
  }

  body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 18%);
    pointer-events: none;
    z-index: 0;
  }

  .screen {
    position: relative;
    box-shadow: 0 0 48px rgb(0 0 0 / 55%);
    z-index: 1;
  }
}

.nav-bar {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  min-height: 64px;
  padding: 12px 20px;
  border-bottom: var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}

.btn-back {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-back:hover {
  background: rgb(0 0 0 / 6%);
}

.logo {
  height: 40px;
  width: auto;
  justify-self: center;
}

.app-screen {
  flex: 1;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px;
}

.hero {
  min-height: calc(100dvh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-title {
  padding: 24px 20px 0;
}

.hero-desc {
  padding: 12px 24px 0;
}

.hero-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.hero-img {
  width: 58%;
  max-height: 340px;
  object-fit: contain;
  display: block;
  transform: rotate(-7deg);
  filter: drop-shadow(6px 6px 0 var(--text));
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn-primary {
  background: var(--primary);
  color: var(--text);
}

.btn-primary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--text);
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--text);
}

.btn-secondary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}

.btn-row {
  display: flex;
  gap: 16px;
}

.btn-row .btn {
  flex: 1;
  padding-inline: 12px;
}

.text-big-title {
  font-size: 1.6875rem;
  font-weight: 800;
  line-height: 1.15;
}

.text-title {
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.25;
}

.text-desc {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
}

.text-fine {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.45;
}

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

.page-title {
  position: relative;
  text-align: center;
  text-shadow:
    0 0 2px #fff,
    0 0 6px #fff,
    0 0 12px #fff,
    0 0 24px #fff,
    0 0 48px #fff,
    0 0 80px #fff;
}

.page-title::before {
  content: "";
  position: absolute;
  inset: -40px -20px;
  background: radial-gradient(ellipse at center, #fff 0%, rgb(255 255 255 / 90%) 40%, transparent 75%);
  z-index: -1;
}

.link-tc {
  color: var(--text);
  font-size: 0.9375rem;
  text-align: center;
  text-shadow:
    0 0 2px #fff,
    0 0 6px #fff,
    0 0 12px #fff,
    0 0 24px #fff;
}

.upload-area {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 850 / 1070;
  align-self: center;
  display: block;
  padding: 12px;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

.upload-area:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--text);
}

.upload-area__inner {
  width: 100%;
  height: 100%;
  border: 2px dashed #9ca3af;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.upload-area__icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border: var(--border);
  border-radius: 50%;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-area__sub {
  color: #6b7280;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
}

.photo-content,
.adjust-content {
  justify-content: center;
}

.adjust-card {
  width: min(100%, 320px);
  aspect-ratio: 850 / 1070;
  align-self: center;
  background: #111;
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: none;
}

.adjust-card canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.adjust-card canvas.is-dragging {
  cursor: grabbing;
}

.adjust-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 320px);
  align-self: center;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 800;
}

.adjust-control input {
  width: 100%;
  accent-color: var(--primary);
}

.camera-content {
  justify-content: center;
}

.camera-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.camera-card {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 850 / 1070;
  align-self: center;
  background: #111;
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.camera-card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-card canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera-review-actions {
  width: 100%;
}

.countdown {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: #fff;
  font-size: 7rem;
  font-weight: 900;
  text-shadow: 0 8px 32px rgb(0 0 0 / 70%);
  pointer-events: none;
}

.countdown.is-active {
  display: grid;
}

.processing-wrap {
  display: flex;
  flex-direction: column;
}

.overlay {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
}

.progress-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.label-banner {
  align-self: stretch;
  background: var(--primary);
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  text-align: center;
}

.process-group {
  width: min(64%, 240px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.selfie-frame {
  position: relative;
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: #fff;
}

.selfie-frame canvas {
  width: 100%;
  aspect-ratio: 850 / 1070;
  display: block;
  object-fit: cover;
  animation: processing-pulse 2s ease-in-out infinite;
}

.selfie-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -30%;
  height: 30%;
  background: linear-gradient(to bottom, transparent, rgb(253 200 0 / 55%), transparent);
  animation: scan-sweep 2s linear infinite;
}

@keyframes processing-pulse {
  0%,
  100% {
    filter: grayscale(0.85) contrast(1.05);
  }

  50% {
    filter: grayscale(0.2) contrast(1);
  }
}

@keyframes scan-sweep {
  0% {
    top: -30%;
  }

  100% {
    top: 100%;
  }
}

.progress-bar {
  height: 12px;
  background: #e0e0e0;
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--primary);
  animation: fill-bar 3s ease-in-out infinite;
}

@keyframes fill-bar {
  0% {
    width: 0;
  }

  70% {
    width: 92%;
  }

  100% {
    width: 100%;
  }
}

.status-text {
  min-height: 1.4em;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}

.bottom-img {
  width: 100%;
  display: block;
  flex-shrink: 0;
}

.result-stage {
  position: relative;
  align-self: center;
  display: flex;
  justify-content: center;
}

.result-image {
  width: auto;
  max-width: min(100%, 340px);
  max-height: calc(100dvh - 310px);
  object-fit: contain;
  display: block;
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  background: #fff;
}

.result-image.is-revealing {
  animation: result-reveal 780ms cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: opacity, filter, transform;
}

.result-image.is-liked-glow {
  animation: result-liked-glow 920ms ease-out both;
}

@keyframes result-reveal {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(18px) scale(0.94);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

.liked-particles {
  position: absolute;
  inset: -18px;
  pointer-events: none;
}

.liked-particles span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border: 2px solid var(--text);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--text);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}

.liked-particles span:nth-child(1) {
  --particle-x: -118px;
  --particle-y: -92px;
}

.liked-particles span:nth-child(2) {
  --particle-x: 112px;
  --particle-y: -78px;
  animation-delay: 40ms;
}

.liked-particles span:nth-child(3) {
  --particle-x: -132px;
  --particle-y: 20px;
  animation-delay: 80ms;
}

.liked-particles span:nth-child(4) {
  --particle-x: 126px;
  --particle-y: 34px;
  animation-delay: 120ms;
}

.liked-particles span:nth-child(5) {
  --particle-x: -72px;
  --particle-y: 118px;
  animation-delay: 160ms;
}

.liked-particles span:nth-child(6) {
  --particle-x: 78px;
  --particle-y: 116px;
  animation-delay: 200ms;
}

.liked-particles.is-visible span {
  animation: liked-particle 880ms ease-out both;
}

.btn.is-liked-pop {
  animation: like-button-pop 260ms ease-out both;
}

.btn-row.is-entering,
.redeem-box.is-entering,
.btn.is-entering {
  animation: result-actions-enter 460ms ease-out both;
}

@keyframes result-liked-glow {
  0% {
    box-shadow: var(--shadow);
    filter: brightness(1);
  }

  42% {
    box-shadow:
      var(--shadow),
      0 0 0 6px rgb(253 200 0 / 55%),
      0 0 28px rgb(253 200 0 / 72%);
    filter: brightness(1.08);
  }

  100% {
    box-shadow: var(--shadow);
    filter: brightness(1);
  }
}

@keyframes liked-particle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35);
  }

  22% {
    opacity: 1;
    transform: translate(calc(-50% + (var(--particle-x) * 0.45)), calc(-50% + (var(--particle-y) * 0.45))) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--particle-x)), calc(-50% + var(--particle-y))) scale(0.6);
  }
}

@keyframes like-button-pop {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(0.92);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes result-actions-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.redeem-box {
  background: var(--text);
  color: var(--surface);
  border: var(--border);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--primary);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.redeem-box h2 {
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.redeem-tc {
  font-size: 0.9375rem;
  opacity: 0.45;
  text-align: center;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  color: var(--text);
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-sm);
  font-family: "Inter", sans-serif;
  font-size: 0.9375rem;
  outline: none;
  transition: box-shadow 0.12s;
}

.input-field:focus,
.otp-input:focus {
  box-shadow: 3px 3px 0 var(--primary);
}

.input-field::placeholder {
  color: #9ca3af;
}

.otp-group {
  display: flex;
  gap: 8px;
}

.otp-input {
  flex: 1;
  min-width: 0;
  height: 56px;
  color: var(--text);
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-sm);
  font-family: "Inter", sans-serif;
  font-size: 1.3125rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.page-foot {
  flex-shrink: 0;
}

.success-icon {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--primary);
  border: var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow);
  font-size: 2.2rem;
  font-weight: 900;
}

.claim-screen {
  background: url("./assets/bg.webp") center / cover no-repeat var(--surface);
}

.claim-content {
  flex: 1;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.claim-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.claim-card {
  width: 100%;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.claim-card p {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
}

.claim-card--center {
  align-items: center;
  text-align: center;
}

.claim-success-content {
  align-items: center;
  justify-content: flex-start;
  padding-top: 32px;
  padding-bottom: 140px;
  text-align: center;
}

.claim-success-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.claim-code {
  width: 100%;
  background-color: rgb(253 200 0 / 15%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0.75' y='0.75' width='100%25' height='100%25' style='width:calc(100%25 - 1.5px);height:calc(100%25 - 1.5px)' fill='none' rx='4' stroke='%231C293C' stroke-width='1.5' stroke-dasharray='6 6'/%3E%3C/svg%3E");
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 1.0625rem;
  font-weight: 800;
}

.claim-mono {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}

.claim-hint {
  font-size: 0.9375rem !important;
  font-weight: 400 !important;
}

.claim-link-button {
  border: 0;
  background: none;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.claim-link-button:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}

.claim-status-link {
  color: var(--secondary);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.claim-status-link:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}

.claim-alert {
  width: calc(100% - 40px);
  margin: 16px 20px 0;
  padding: 12px 14px;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  background: var(--danger);
  border: 2px solid #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.claim-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(0 0 0 / 55%);
}

.claim-modal {
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 20px;
  color: var(--text);
  text-align: center;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--text);
}

.claim-modal h2 {
  font-size: 1.3125rem;
  font-weight: 800;
  line-height: 1.2;
}

.claim-modal p {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.claim-page-foot-fixed {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  transform: translateX(-50%);
}

.voucher-code {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
  background-color: rgb(253 200 0 / 15%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0.75' y='0.75' width='100%25' height='100%25' style='width:calc(100%25 - 1.5px);height:calc(100%25 - 1.5px)' fill='none' rx='4' stroke='%231C293C' stroke-width='1.5' stroke-dasharray='6 6'/%3E%3C/svg%3E");
  border-radius: var(--radius-sm);
  padding: 20px 16px;
}

.voucher-code__row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.voucher-code__left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.voucher-code__value {
  min-width: 0;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.25rem, 7vw, 1.6875rem);
  font-weight: 400;
  line-height: 1;
  overflow-wrap: anywhere;
  text-align: left;
}

.voucher-copy {
  flex-shrink: 0;
  padding: 8px 14px;
  color: var(--text);
  background: var(--primary);
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 2px 2px 0 var(--text);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  transition: transform 0.08s, box-shadow 0.08s;
}

.voucher-copy:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--text);
}

.voucher-copy:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--text);
}

.voucher-copy:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.error-message {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 30;
  display: none;
  width: min(390px, calc(100% - 40px));
  padding: 14px 16px;
  color: #fff;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-align: center;
  background: rgb(28 41 60 / 96%);
  border: 2px solid #fff;
  border-radius: var(--radius-md);
  box-shadow: 3px 3px 0 var(--primary);
  transform: translateX(-50%);
}

.error-message.is-visible {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .selfie-frame canvas,
  .selfie-frame::after,
  .progress-bar__fill,
  .result-image.is-revealing,
  .result-image.is-liked-glow,
  .liked-particles.is-visible span,
  .btn.is-liked-pop,
  .btn.is-entering,
  .btn-row.is-entering,
  .redeem-box.is-entering {
    animation: none;
  }
}
