:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --m3-primary: #a78bfa;
  --m3-primary-dim: rgba(167, 139, 250, 0.16);
  --m3-on-primary: #1c1b2e;
  --m3-secondary: #06b6d4;
  --m3-tertiary: #f59e0b;
  --m3-background: #0a0912;
  --m3-on-surface: #fafaff;
  --m3-on-surface-variant: #a8a3c4;
  --m3-surface: rgba(24, 22, 44, 0.82);
  --m3-outline: rgba(167, 139, 250, 0.22);
  --m3-error: #ef4444;
  --m3-success: #10b981;
  --gold: #fde047;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --max-w: 480px;
  --nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--m3-background);
  color: var(--m3-on-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(91, 33, 182, 0.35), transparent 55%);
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: orbFloat 18s ease-in-out infinite alternate;
  will-change: transform;
}

.mesh-orb.o1 { width: 75vw; height: 75vw; background: #5b21b6; top: -22%; left: -18%; }
.mesh-orb.o2 { width: 58vw; height: 58vw; background: #0e7490; top: 38%; right: -22%; animation-delay: -6s; }
.mesh-orb.o3 { width: 48vw; height: 48vw; background: #7c3aed; bottom: -8%; left: 8%; animation-delay: -12s; }

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(2%, 3%) scale(1.06); }
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: var(--safe-top);
}

.glass {
  background: var(--m3-surface);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--m3-outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.brand {
  text-align: center;
  padding: 24px 20px 12px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.25rem, 4.5vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #c4b5fd 0%, var(--m3-primary) 40%, var(--m3-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand p {
  margin: 8px 0 0;
  color: var(--m3-on-surface-variant);
  font-size: 0.92rem;
  line-height: 1.45;
}

.brand strong { color: var(--m3-on-surface); font-weight: 700; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--m3-on-surface-variant);
  margin: 14px 0 7px;
  letter-spacing: 0.02em;
}

input, select, textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--m3-outline);
  background: rgba(255, 255, 255, 0.05);
  color: var(--m3-on-surface);
  font-size: 16px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a8a3c4' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #fcd34d 100%);
  color: #1a1528;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-secondary {
  background: var(--m3-primary-dim);
  color: var(--m3-on-surface);
  border: 1px solid var(--m3-outline);
}

.btn-ghost {
  background: transparent;
  color: var(--m3-primary);
  border: 1px solid var(--m3-outline);
}

.btn-sm { padding: 10px 14px; font-size: 0.85rem; width: auto; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.msg {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin: 12px 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.msg-err { background: rgba(239, 68, 68, 0.14); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.25); }
.msg-ok { background: rgba(16, 185, 129, 0.14); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.25); }

.hint { font-size: 0.82rem; color: var(--m3-on-surface-variant); margin-top: 6px; line-height: 1.4; }
.hint-warn { color: #fca5a5; }

.screen {
  padding: 0 18px calc(var(--nav-h) + var(--safe-bottom) + 20px);
}

.screen-auth {
  padding-bottom: calc(24px + var(--safe-bottom));
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.stat {
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.1), rgba(6, 182, 212, 0.06));
  border: 1px solid var(--m3-outline);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
}

.stat .n {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--m3-primary), var(--m3-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat .l {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--m3-on-surface-variant);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--m3-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 20px 0 10px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--m3-outline);
  background: rgba(255, 255, 255, 0.03);
  color: var(--m3-on-surface-variant);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chip.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.35), rgba(6, 182, 212, 0.2));
  color: var(--m3-on-surface);
  border-color: rgba(167, 139, 250, 0.45);
}

.card {
  background: var(--m3-surface);
  border: 1px solid var(--m3-outline);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  content-visibility: auto;
  contain-intrinsic-size: 120px;
}

.card:active { transform: scale(0.985); }

.card.winner {
  border-color: rgba(253, 224, 71, 0.4);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.12), rgba(24, 22, 44, 0.9));
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.12);
}

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.card-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  line-height: 1.3;
}

.card-sub {
  color: var(--m3-on-surface-variant);
  font-size: 0.85rem;
  margin-top: 6px;
  line-height: 1.4;
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.18);
  color: var(--m3-on-surface);
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-won { background: rgba(253, 224, 71, 0.2); color: var(--gold); }
.badge-ok { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge-pending { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

/* ── Bottom navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 14px calc(10px + var(--safe-bottom));
  pointer-events: none;
}

.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 6px 6px;
  background: rgba(14, 12, 26, 0.88);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 24px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  pointer-events: auto;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--m3-on-surface-variant);
  font-size: 0.65rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 18px;
  transition: color 0.2s;
  touch-action: manipulation;
}

.nav-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 32px;
  border-radius: 16px;
  transition: background 0.22s, transform 0.15s;
}

.nav-btn .material-symbols-rounded {
  font-size: 24px;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  transition: font-variation-settings 0.2s, color 0.2s;
}

.nav-label {
  line-height: 1.1;
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn.active {
  color: #e9d5ff;
}

.nav-btn.active .nav-icon-wrap {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.45), rgba(6, 182, 212, 0.25));
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
}

.nav-btn.active .material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
  color: #f3e8ff;
}

.nav-btn:active .nav-icon-wrap { transform: scale(0.94); }

.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--m3-on-surface-variant);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--m3-outline);
  border-radius: var(--radius-lg);
}

.empty b {
  display: block;
  color: var(--m3-on-surface);
  margin-bottom: 8px;
  font-size: 1rem;
}

.row-btns { display: flex; gap: 10px; margin-top: 12px; }
.row-btns .btn { flex: 1; margin-top: 0; }

.photo-preview {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(52vh, 440px);
  object-fit: contain;
  display: block;
  border-radius: var(--radius-md);
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transform-origin: center center;
}

.receipt-viewer {
  width: 100%;
  max-height: min(52vh, 440px);
  min-height: 180px;
  margin-top: 12px;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--m3-outline);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-touch-callout: none;
}

.scan-preview-viewer {
  max-height: min(55vh, 480px);
}

.scan-preview-viewer--active {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.12),
    0 8px 28px rgba(88, 28, 135, 0.28);
  animation: scan-viewer-glow 2.4s ease-in-out infinite;
}

.scan-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 180px;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: calc(var(--radius-md) - 1px);
  overflow: hidden;
}

.scan-frame {
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(192, 132, 252, 0.35),
    inset 0 0 24px rgba(124, 58, 237, 0.12);
  animation: scan-frame-pulse 2.4s ease-in-out infinite;
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(192, 132, 252, 0.85);
  opacity: 0.9;
}

.scan-frame::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 6px;
}

.scan-frame::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 6px;
}

.scan-overlay::before,
.scan-overlay::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(192, 132, 252, 0.85);
  opacity: 0.9;
}

.scan-overlay::before {
  top: 9px;
  right: 9px;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 6px;
}

.scan-overlay::after {
  bottom: 9px;
  left: 9px;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 6px;
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(167, 139, 250, 0.15) 15%,
    rgba(216, 180, 254, 1) 50%,
    rgba(167, 139, 250, 0.15) 85%,
    transparent 100%
  );
  box-shadow:
    0 0 10px rgba(192, 132, 252, 0.95),
    0 0 22px rgba(124, 58, 237, 0.55),
    0 0 40px rgba(124, 58, 237, 0.25);
  animation: scan-beam-sweep 2.4s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.scan-beam-trail {
  position: absolute;
  left: 0;
  right: 0;
  height: 56px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(124, 58, 237, 0.06) 40%,
    rgba(192, 132, 252, 0.18) 100%
  );
  opacity: 0.7;
  animation: scan-beam-sweep 2.4s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes scan-beam-sweep {
  0% {
    top: 6%;
    opacity: 0.35;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    top: 94%;
    opacity: 0.35;
  }
}

@keyframes scan-frame-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@keyframes scan-viewer-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(167, 139, 250, 0.1),
      0 8px 28px rgba(88, 28, 135, 0.22);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(167, 139, 250, 0.28),
      0 8px 32px rgba(124, 58, 237, 0.38);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-preview-viewer--active,
  .scan-frame,
  .scan-beam,
  .scan-beam-trail {
    animation: none;
  }
}

.scan-progress-panel {
  text-align: center;
  padding: 18px 16px;
  margin-top: 14px;
}

.scan-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  border: 3px solid rgba(167, 139, 250, 0.2);
  border-top-color: var(--m3-primary);
  border-radius: 50%;
  animation: scan-spin 0.85s linear infinite;
}

@keyframes scan-spin {
  to {
    transform: rotate(360deg);
  }
}

.scan-progress-screen {
  overscroll-behavior: none;
}

.scan-progress-screen .brand p {
  color: var(--m3-on-surface-variant);
}

.receipt-viewer-hint {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--m3-on-surface-variant);
  text-align: center;
}

.scan-hint-warn {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: #fcd34d;
  line-height: 1.4;
}

.field-tag-req {
  color: #fca5a5;
}

.field-group.has-error select {
  border-color: var(--m3-error) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: flex-start;
  padding: calc(8px + var(--safe-top) * 0.2) 4px 0;
}

.topbar button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--m3-outline);
  color: var(--m3-on-surface-variant);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
}

.otp-input {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-weight: 700;
  padding-left: 0.4em;
}

input[type="file"] {
  padding: 12px;
  font-size: 0.88rem;
}

.scan-upload { text-align: center; }
.scan-upload-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.scan-upload-actions .scan-file-btn {
  width: 100%;
  justify-content: center;
}
.scan-icon { font-size: 3rem; color: var(--m3-primary); margin: 8px 0 16px; }
.scan-icon .material-symbols-rounded { font-size: 56px; }
.scan-file-btn { position: relative; cursor: pointer; }
.scan-file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Photo guide — compact bad (left) vs good (right) */
.scan-guide-screen .brand--compact { margin-bottom: 10px; }
.scan-guide-screen .brand--compact h1 { font-size: 1.12rem; margin-bottom: 0; }
.photo-guide-sheet {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.photo-guide-row { margin: 0; }
.photo-guide-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--m3-on-surface);
}
.photo-guide-tip .material-symbols-rounded { font-size: 17px; color: var(--m3-primary); }
.photo-guide-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.photo-guide-side {
  margin: 0;
  position: relative;
}
.photo-guide-side::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 800;
  pointer-events: none;
}
.photo-guide-side--bad::before {
  content: "✕";
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.photo-guide-side--good::before {
  content: "✓";
  background: rgba(34, 197, 94, 0.92);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.photo-guide-side--bad .photo-guide-mock {
  border: 1.5px solid rgba(239, 68, 68, 0.45);
}
.photo-guide-side--good .photo-guide-mock {
  border: 1.5px solid rgba(34, 197, 94, 0.45);
}
.photo-guide-mock {
  aspect-ratio: 5 / 3.2;
  max-height: 72px;
  border-radius: 8px;
  background: #141320;
  overflow: hidden;
  position: relative;
}
.photo-guide-mock--blur .mock-receipt { filter: blur(2.5px) brightness(0.65); }
.photo-guide-mock--crop { overflow: hidden; }
.photo-guide-mock--crop .mock-receipt--partial {
  inset: 10% 10% 10% -42%;
  transform: scale(1.15);
}
.mock-receipt {
  position: absolute;
  inset: 14% 12%;
  background: linear-gradient(180deg, #f4f0ea 0%, #e8e2d8 100%);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.mock-receipt::before,
.mock-receipt::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  background: #bbb;
  border-radius: 1px;
}
.mock-receipt::before { top: 20%; box-shadow: 0 6px 0 #ccc, 0 12px 0 #ccc, 0 18px 0 #ccc; }
.mock-receipt::after { bottom: 24%; left: 22%; right: 22%; height: 4px; background: #333; }
.mock-receipt--blur { opacity: 0.9; }
.mock-receipt--sharp::before { background: #222; box-shadow: 0 5px 0 #444, 0 10px 0 #444, 0 15px 0 #888; }
.photo-guide-mock--photo {
  aspect-ratio: 2 / 3;
  max-height: 132px;
  margin: 0 auto;
}
.guide-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.guide-photo--cropped {
  transform: scale(1.9);
  transform-origin: 42% 28%;
}
.guide-photo--blur { filter: blur(2.5px) brightness(0.8); }
.photo-guide-side figcaption {
  margin-top: 4px;
  font-size: 0.65rem;
  line-height: 1.2;
  text-align: center;
  color: var(--m3-on-surface-variant);
}
.photo-guide-side--bad figcaption { color: #f0a0a0; }
.photo-guide-side--good figcaption { color: #8fd4a8; }
.scan-guide-actions { margin-top: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  margin: 0 0 12px;
  font-size: 0.92rem;
  line-height: 1.35;
  font-weight: 600;
}
.warning-banner .material-symbols-rounded { font-size: 22px; flex-shrink: 0; }
.warning-banner--prize {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1a1200;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.55), 0 8px 24px rgba(245, 158, 11, 0.35);
}
.warning-banner--truth {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.45), 0 8px 24px rgba(185, 28, 28, 0.35);
}
.warning-banner--photo {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #041018;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45), 0 8px 24px rgba(2, 132, 199, 0.3);
}

.error-hero { text-align: center; padding: 28px 20px 12px; }
.error-icon-wrap {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.35);
}
.error-icon-wrap .material-symbols-rounded { font-size: 36px; color: #fca5a5; }
.error-hero h2 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.error-hero p { margin: 8px 0 0; color: var(--m3-on-surface-variant); font-size: 0.92rem; }

.mall-list { margin: 0; padding: 0 0 0 18px; color: var(--m3-on-surface-variant); font-size: 0.88rem; line-height: 1.6; }

.field-locked {
  background: rgba(167, 139, 250, 0.08) !important;
  border-color: rgba(167, 139, 250, 0.25) !important;
  color: var(--m3-on-surface) !important;
  opacity: 1 !important;
}
.field-tag {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  color: #6ee7b7; letter-spacing: 0.06em;
}

@media (min-width: 480px) {
  .bottom-nav { padding-left: max(14px, calc(50% - var(--max-w) / 2)); padding-right: max(14px, calc(50% - var(--max-w) / 2)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Light theme ── */
body.theme-light {
  --m3-background: #f4f2fa;
  --m3-on-surface: #1c1b2e;
  --m3-on-surface-variant: #5c5678;
  --m3-surface: rgba(255, 255, 255, 0.92);
  --m3-outline: rgba(91, 33, 182, 0.14);
}

body.theme-light .mesh-bg {
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(167, 139, 250, 0.25), transparent 55%);
}

body.theme-light .mesh-orb { opacity: 0.25; }

body.theme-light .bottom-nav-inner {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(91, 33, 182, 0.12);
}

body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  background: rgba(0, 0, 0, 0.03);
}

body.theme-light .msg-err { color: #991b1b; background: rgba(239, 68, 68, 0.1); }
body.theme-light .msg-ok { color: #065f46; background: rgba(16, 185, 129, 0.1); }

/* ── Status bar ── */
.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 18px 10px;
  pointer-events: none;
}

.status-bar > * { pointer-events: auto; }

.status-profile {
  display: flex;
  align-items: center;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.status-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--m3-primary-dim);
  border: 1px solid var(--m3-outline);
}

.status-avatar .material-symbols-rounded {
  font-size: 28px;
  color: var(--m3-primary);
}

.status-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--m3-surface);
  border: 1px solid var(--m3-outline);
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.status-coins .material-symbols-rounded {
  font-size: 20px;
  color: var(--m3-tertiary);
}

.status-coins-n {
  min-width: 1ch;
  font-variant-numeric: tabular-nums;
}

.screen-with-status {
  padding-top: 56px;
}

/* ── Receipt disclaimer ── */
.receipt-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: var(--m3-on-surface-variant);
  font-size: 0.82rem;
  line-height: 1.45;
}

.receipt-disclaimer .material-symbols-rounded {
  font-size: 18px;
  color: var(--m3-tertiary);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Field validation ── */
.field-group { margin-bottom: 2px; }

.field-group.has-error input:not(.field-locked) {
  border-color: var(--m3-error) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.field-error {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #fca5a5;
  line-height: 1.35;
}

body.theme-light .field-error { color: var(--m3-error); }

.badge-ocr {
  display: inline-block;
  margin-top: 10px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

body.theme-light .badge-ocr { color: #b45309; }

.ticket-estimate {
  margin: 8px 0 4px;
  font-size: 0.85rem;
  color: var(--m3-on-surface-variant);
}

.ticket-estimate strong { color: var(--m3-on-surface); }

.confirm-form.form-closing {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

/* ── Success overlay ── */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 9, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.success-overlay.visible { opacity: 1; }

.success-overlay-inner {
  text-align: center;
  max-width: 340px;
  animation: successPop 0.45s ease forwards;
}

@keyframes successPop {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.success-icon .material-symbols-rounded {
  font-size: 72px;
  color: var(--m3-success);
}

.success-text {
  margin: 20px 0 24px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--m3-on-surface);
}

/* ── Entries intro & win cards ── */
.entries-intro {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--m3-on-surface-variant);
  line-height: 1.5;
}

.win-cards { margin-bottom: 8px; }

.win-card {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.win-card-icon .material-symbols-rounded {
  font-size: 36px;
  color: var(--gold);
}

.win-code { color: var(--gold) !important; }

/* ── Draw cards ── */
.draw-card { padding: 0; overflow: hidden; cursor: pointer; }

.draw-card-banner {
  padding: 18px 18px 14px;
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.22), rgba(6, 182, 212, 0.12));
}

.draw-type {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--m3-secondary);
}

.draw-title {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.25;
}

.draw-banner-text {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--m3-on-surface-variant);
  line-height: 1.4;
}

.draw-mall {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--m3-on-surface-variant);
}

.draw-mall .material-symbols-rounded { font-size: 18px; }

.draw-timing {
  margin: 10px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.draw-timing.draw-future { color: #6ee7b7; }
.draw-timing.draw-past { color: var(--m3-on-surface-variant); }

.draw-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--m3-outline);
}

.draw-tickets {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

.draw-tickets .material-symbols-rounded {
  font-size: 20px;
  color: var(--m3-tertiary);
}

.draw-tap-hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--m3-on-surface-variant);
}

.draw-tap-hint .material-symbols-rounded { font-size: 18px; }

/* ── Bottom sheets ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet-backdrop.visible { opacity: 1; }

.sheet-backdrop.terms-backdrop {
  align-items: stretch;
  pointer-events: auto;
}

.sheet {
  width: 100%;
  max-width: var(--max-w);
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--m3-surface);
  border: 1px solid var(--m3-outline);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(24px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.sheet-backdrop.visible .sheet { transform: translateY(0); }

.terms-backdrop .terms-sheet {
  margin-top: auto;
  max-height: 88dvh;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--m3-outline);
  margin: 0 auto 16px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--m3-outline);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--m3-on-surface-variant);
  cursor: pointer;
}

.terms-content {
  max-height: 50vh;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--m3-on-surface-variant);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

/* ── Receipt detail sheet ── */
.receipt-photo-zoom { margin-bottom: 16px; }

.receipt-photo-wrap {
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--m3-outline);
  background: rgba(0, 0, 0, 0.2);
  max-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-photo-wrap img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  transition: transform 0.2s ease;
  transform-origin: center center;
}

.zoom-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.zoom-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--m3-outline);
  background: var(--m3-primary-dim);
  color: var(--m3-on-surface);
  cursor: pointer;
}

.detail-rows { margin-bottom: 8px; }

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--m3-outline);
  font-size: 0.9rem;
}

.detail-row span:first-child { color: var(--m3-on-surface-variant); }

.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--m3-outline);
}

.ticket-code {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.88rem;
}

.ticket-won .ticket-code { color: var(--gold); }

/* ── Profile ── */
.profile-avatar-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.profile-avatar-img,
.profile-avatar-placeholder {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--m3-outline);
}

.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--m3-primary-dim);
}

.profile-avatar-placeholder .material-symbols-rounded {
  font-size: 52px;
  color: var(--m3-primary);
}

.avatar-upload-btn { position: relative; cursor: pointer; }
.avatar-upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.login-banner {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(var(--max-w) - 36px);
  width: calc(100% - 36px);
  margin: 0;
}

@media (min-width: 480px) {
  .status-bar {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
  }
}

/* ── Mobile performance mode: less GPU work on phones ── */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .mesh-orb {
    display: none;
    animation: none;
  }

  .glass,
  .bottom-nav-inner,
  .sheet,
  .success-overlay,
  .terms-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .glass {
    background: rgba(24, 22, 44, 0.96);
  }

  .bottom-nav-inner {
    background: rgba(14, 12, 26, 0.96);
  }

  .card {
    transition: none;
  }

  .card:active {
    transform: none;
    opacity: 0.92;
  }
}
