/* ═══════════════════════════════════════════════════════════════
   Mint Virtual Try-On — Public App Styles
   Mobile-first, fullscreen camera experience
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --mint: #1638E1;
  --mint-dark: #0f2ab0;
  --navy: #0A1628;
  --white: #ffffff;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'DM Serif Display', Georgia, serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ── Camera Layer ─────────────────────────────── */
.camera-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.camera-wrap video,
.camera-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mirror for selfie view — both must match */
  transform: scaleX(-1);
}

/* ── Start Overlay ────────────────────────────── */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,0.10), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(22,56,225,0.28), transparent 26%),
    radial-gradient(circle at 72% 82%, rgba(58,103,255,0.18), transparent 24%),
    linear-gradient(145deg, #08111d 0%, #0b1730 42%, #1638E1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: var(--white);
}

.start-overlay.hidden {
  display: none;
}

.start-bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.45;
  pointer-events: none;
}

.start-bg-orb--one {
  width: 180px;
  height: 180px;
  top: -40px;
  left: -54px;
  background: rgba(255,255,255,0.08);
}

.start-bg-orb--two {
  width: 220px;
  height: 220px;
  right: -70px;
  bottom: 70px;
  background: rgba(22, 56, 225, 0.24);
}

.start-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.78), rgba(0,0,0,0.24));
  pointer-events: none;
}

.start-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.start-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.start-brand-logo {
  width: min(148px, 42vw);
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.24));
}

.start-brand-tag {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
}

.start-panel {
  padding: 28px 24px 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 18px 44px rgba(0,0,0,0.22);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  text-align: left;
}

.start-kicker {
  display: inline-block;
  margin-bottom: 16px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,0.58);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start-panel h1 {
  font-family: var(--serif);
  font-size: 60px;
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  max-width: 14ch;
}

.start-panel p {
  font-size: 16px;
  color: rgba(255,255,255,0.72);
  line-height: 1.5;
  max-width: 30ch;
}

.start-btn {
  width: 100%;
  background: rgba(255,255,255,0.96);
  color: #0A1628;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 50px;
  padding: 17px 24px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,0.18);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  margin-top: 20px;
}

.start-btn:active {
  transform: scale(0.97);
  box-shadow: 0 6px 14px rgba(0,0,0,0.14);
}

.start-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.44);
  margin-top: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.start-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255,255,255,0.62);
}

.start-legal a {
  color: #dce6ff;
  font-weight: 700;
  text-decoration: none;
}

.start-legal a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .start-overlay {
    align-items: stretch;
    justify-content: flex-start;
    padding: 18px 16px 18px;
  }

  .start-shell {
    width: 100%;
    min-height: calc(100svh - 36px);
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .start-brand {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: max(env(safe-area-inset-top, 0px), 4px) 4px 0;
  }

  .start-brand-logo {
    width: 92px !important;
  }

  .start-brand-tag {
    padding: 7px 10px;
    font-size: 9px;
    letter-spacing: 0.05em;
  }

  .start-panel {
    width: 100%;
    margin-top: 64px;
    padding: 26px 20px 18px;
    border-radius: 26px;
    min-height: clamp(460px, 62svh, 580px);
    display: flex;
    flex-direction: column;
  }

  .start-kicker {
    margin-bottom: 14px;
    font-size: 9px;
  }

  .start-panel h1 {
    font-size: 50px;
    line-height: 1;
    margin-bottom: 14px;
    max-width: 13ch;
  }

  .start-panel p {
    font-size: 13px;
    line-height: 1.5;
    max-width: 30ch;
  }

  .start-btn {
    padding: 15px 18px;
    font-size: 15px;
    margin-top: auto;
  }

  .start-hint {
    font-size: 9px;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    margin-top: 10px;
    color: rgba(255,255,255,0.42);
  }

  .start-legal {
    margin-top: auto;
    padding: 10px 4px max(env(safe-area-inset-bottom, 0px), 2px);
    justify-content: space-between;
    font-size: 9px;
    gap: 8px;
    color: rgba(255,255,255,0.42);
  }
}

/* ── Try-On Top Bar ───────────────────────────── */
.tryon-topbar {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.tryon-topbar-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tryon-logo-img {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.privacy-link {
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.28);
}

.privacy-link:hover {
  color: #ffffff;
}

.shop-btn {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 50px;
  color: var(--navy);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 8px 16px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.shop-btn:hover { background: rgba(255,255,255,0.92); }
.shop-btn:active { background: rgba(255,255,255,1); }

/* ── Frame Info Bar ───────────────────────────── */
.frame-info {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 56px);
  left: 0;
  right: 0;
  z-index: 10;
  text-align: center;
  pointer-events: none;
  padding: 8px 16px 0;
}

.info-name {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  letter-spacing: -0.01em;
}

.info-price {
  display: block;
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  margin-top: 3px;
}

/* ── Frame Selector Carousel ──────────────────── */
.selector-wrap {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 0;
  right: 0;
  z-index: 10;
  pointer-events: auto;
}

.frame-scroll {
  display: flex;
  justify-content: center;
  padding: 0 8px 8px;
  pointer-events: auto;
}

.frame-scroll::-webkit-scrollbar { display: none; }

.frame-scroll--list {
  justify-content: flex-start;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scroll-padding: 0;
  padding: 0 0 12px;
}

.frame-card {
  width: auto;
  max-width: calc(100vw - 12px);
  text-align: center;
  pointer-events: auto;
  scroll-snap-align: center;
}

.frame-scroll:not(.frame-scroll--list) .frame-card {
  width: min(calc(100vw - 20px), 680px);
  max-width: calc(100vw - 20px);
}

.frame-scroll--list .frame-card {
  width: 100vw;
  max-width: 100vw;
}

@media (max-width: 768px) {
  .frame-scroll { padding: 0; }
  .frame-scroll--list {
    gap: 0;
    padding: 0;
    scroll-padding: 0;
  }
  .frame-scroll--list .frame-card {
    width: 100vw;
    max-width: 100vw;
  }
}

.fc-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 16px 34px rgba(5, 10, 28, 0.2);
  border: 1px solid rgba(12, 20, 38, 0.06);
  margin: 0 6px;
}

.frame-scroll--list .fc-card {
  width: calc(100vw - 20px);
  max-width: calc(100vw - 20px);
  margin: 0 10px;
  padding: 22px 20px 22px;
}

.frame-scroll:not(.frame-scroll--list) .fc-card {
  width: 100%;
  margin: 0;
  padding: 24px 22px 24px;
}

.frame-card.active .fc-card {
  box-shadow:
    0 0 0 2px rgba(59,107,255,0.7),
    0 16px 34px rgba(5, 10, 28, 0.22);
}

.fc-header {
  text-align: center;
  margin-bottom: 14px;
}

.fc-title {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.fc-meta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(22, 56, 225, 0.08);
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.frame-thumb-wrap {
  width: fit-content;
  max-width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 6px 10px;
  border-radius: 16px;
  background: #f6f7fb;
  border: 1px solid rgba(12, 20, 38, 0.06);
}

.frame-scroll:not(.frame-scroll--list) .frame-thumb-wrap {
  width: 100%;
  min-height: 110px;
  padding: 14px 18px;
  border-radius: 20px;
}

.frame-scroll--list .frame-thumb-wrap {
  width: 100%;
  min-height: 94px;
  padding: 12px 16px;
}

.frame-thumb {
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.frame-thumb-crop {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.frame-thumb-cropped {
  position: absolute;
  max-width: none;
  margin: 0;
}

.frame-thumb-placeholder {
  width: 110px;
  height: 42px;
  background: rgba(10,22,40,0.08);
  border-radius: 12px;
  margin: 0 auto;
}

.fc-control + .fc-control {
  margin-top: 10px;
}

.fc-control-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(12, 20, 38, 0.45);
  text-align: center;
  margin-bottom: 6px;
}

.fc-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
  padding: 10px 2px 2px;
}

.fc-toggle-copy {
  text-align: left;
}

.fc-toggle-copy .fc-control-label {
  text-align: left;
  margin-bottom: 4px;
}

.fc-toggle-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.fc-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.fc-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fc-toggle-track {
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: rgba(12, 20, 38, 0.12);
  border: 1px solid rgba(12, 20, 38, 0.08);
  transition: background 0.18s ease, border-color 0.18s ease;
  position: relative;
  display: inline-block;
}

.fc-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(5, 10, 28, 0.18);
  transition: transform 0.18s ease;
}

.fc-toggle input:checked + .fc-toggle-track {
  background: rgba(22, 56, 225, 0.18);
  border-color: rgba(22, 56, 225, 0.36);
}

.fc-toggle input:checked + .fc-toggle-track::after {
  transform: translateX(22px);
}

.fc-variants {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  max-width: min(100vw - 32px, 420px);
  margin-left: auto;
  margin-right: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.frame-scroll:not(.frame-scroll--list) .fc-variants {
  max-width: 100%;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding: 0 2px;
}

.frame-scroll--list .fc-variants {
  max-width: 100%;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
  padding: 0 2px;
}

.fc-variants::-webkit-scrollbar { display: none; }

.variant-pill {
  appearance: none;
  border: 1px solid rgba(12, 20, 38, 0.08);
  background: rgba(255,255,255,0.6);
  color: var(--navy);
  border-radius: 999px;
  padding: 8px 18px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s, opacity 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.variant-pill:active {
  transform: scale(0.97);
}

.variant-pill.active {
  background: rgba(22, 56, 225, 0.10);
  color: var(--navy);
  border-color: rgba(22, 56, 225, 0.42);
  box-shadow: none;
}

.fc-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.frame-scroll:not(.frame-scroll--list) .fc-actions {
  width: 100%;
  gap: 12px;
  margin-top: 16px;
}

.frame-scroll--list .fc-actions {
  width: 100%;
  gap: 12px;
}

.fc-btn {
  flex: 1;
  border-radius: 999px;
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(12, 20, 38, 0.08);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.frame-scroll:not(.frame-scroll--list) .fc-btn {
  min-height: 56px;
  font-size: 14px;
}

.fc-btn:active { transform: scale(0.98); }

.fc-btn-save {
  background: #ffffff;
  color: var(--navy);
}

.fc-btn-buy {
  background: linear-gradient(135deg, #1638E1 0%, #0f2ab0 100%);
  color: #ffffff;
  border-color: rgba(22, 56, 225, 0.24);
  box-shadow: 0 12px 24px rgba(22, 56, 225, 0.22);
}

/* ── Actions Bar ──────────────────────────────── */
.actions-bar {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 0;
  right: 0;
  z-index: 10;
  display: none !important;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px 24px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.actions-bar.visible {
  opacity: 1;
  pointer-events: all;
}

/* Capture / shutter button */
.capture-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 4px solid rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.capture-btn:active { transform: scale(0.93); }

.capture-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid rgba(0,0,0,0.08);
}

/* Secondary action buttons (Share, Buy) */
.action-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.action-icon-btn:active {
  background: rgba(255,255,255,0.32);
  transform: scale(0.92);
}

.action-icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Snapshot Modal ───────────────────────────── */
.snapshot-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
}

.snapshot-modal.visible {
  display: flex;
}

.snapshot-inner {
  background: var(--white);
  border-radius: 24px 24px 16px 16px;
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 -8px 60px rgba(0,0,0,0.4);
  animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

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

.snapshot-img {
  width: 100%;
  display: block;
  max-height: 55vh;
  object-fit: cover;
}

.snapshot-actions {
  padding: 16px;
  display: flex;
  gap: 8px;
}

.snap-btn {
  flex: 1;
  padding: 14px 12px;
  border-radius: 12px;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.snap-btn:active { transform: scale(0.97); }

.snap-btn.primary {
  background: var(--mint);
  color: var(--white);
}

.snap-btn.secondary {
  background: #f0f0f8;
  color: var(--navy);
}

.snap-btn.ghost {
  background: transparent;
  color: #999;
  font-weight: 500;
  font-size: 12px;
  flex: 0 0 auto;
  padding: 14px 10px;
}

/* ── Color Variant Swatches ───────────────────── */
/* ── No Frames State ──────────────────────────── */
.no-frames {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}
