:root {
  color-scheme: light;
  --page-top: #fbf5ef;
  --page-bottom: #ead9cd;
  --frame-bg: #f5ede6;
  --text: #241714;
  --muted: rgba(36, 23, 20, 0.72);
  --muted-soft: rgba(77, 49, 43, 0.75);
  --white: #fffaf7;
  --accent: #1d120f;
  --accent-soft: #4d312b;
  --border: rgba(255, 255, 255, 0.35);
  --card-border: rgba(110, 78, 68, 0.14);
  --card-bg: rgba(255, 252, 249, 0.84);
  --sheet-bg: rgba(255, 249, 245, 0.68);
  --shadow-soft: 0 18px 40px rgba(25, 13, 9, 0.16);
  --shadow-strong: 0 24px 80px rgba(73, 38, 26, 0.2);
  --shared-card-height: min(540px, 68dvh);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 237, 222, 0.85), transparent 30%),
    radial-gradient(circle at bottom right, rgba(232, 197, 180, 0.9), transparent 34%),
    linear-gradient(180deg, var(--page-top) 0%, var(--page-bottom) 100%);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.device-frame {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  overflow: hidden;
  background: var(--frame-bg);
}

#app,
.screen {
  width: 100%;
  height: 100%;
}

.screen {
  position: relative;
}

.screen.enter {
  animation: screen-enter 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.screen.exit {
  animation: screen-exit 220ms ease forwards;
}

.welcome-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 20px calc(28px + var(--safe-bottom));
}

.hero-image,
.hero-overlay,
.question-hero-image,
.question-hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-image {
  /* Placeholder image for welcome screen. */
  background:
    linear-gradient(180deg, rgba(26, 16, 13, 0.12) 0%, rgba(26, 16, 13, 0.58) 100%),
    url('https://images.unsplash.com/photo-1515886657613-9f3515b0c78f?auto=format&fit=crop&w=1200&q=80')
      center center / cover no-repeat;
  transform: scale(1.02);
}

.hero-overlay {
  background:
    radial-gradient(circle at top center, rgba(255, 240, 231, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(13, 8, 7, 0.08) 0%, rgba(13, 8, 7, 0.2) 45%, rgba(13, 8, 7, 0.48) 100%);
}

.brand-lockup {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--white);
}

.welcome-screen .brand-lockup {
  margin-bottom: auto;
  padding-top: calc(14px + var(--safe-top));
}

.brand-lockup.compact {
  color: var(--text);
}

.brand-name {
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0.84;
}

.product-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.glass-card,
.bottom-sheet {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: min(
    var(--shared-card-height),
    calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom))
  );
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.glass-card {
  padding: 22px 18px 18px;
  background: rgba(255, 249, 245, 0.16);
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 250, 247, 0.86);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.glass-card h1,
.sheet-header h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.9rem, 7vw, 2.45rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.glass-card h1 {
  color: var(--white);
}

.description {
  margin: 12px 0 16px;
  color: rgba(255, 250, 247, 0.9);
  line-height: 1.5;
  font-size: 0.92rem;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff7f1 0%, #f2dfd2 100%);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(39, 21, 16, 0.15);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease,
    filter 180ms ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(39, 21, 16, 0.18);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: saturate(0.7);
}

.secondary-button {
  min-height: 48px;
  border: 1px solid rgba(77, 49, 43, 0.16);
  border-radius: 999px;
  background: rgba(255, 252, 249, 0.85);
  color: var(--accent-soft);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.secondary-button.full-width {
  width: 100%;
}

.question-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(255, 251, 248, 0.98) 0%, rgba(244, 232, 224, 0.98) 100%);
}

.question-hero {
  position: relative;
  position: absolute;
  inset: 0;
  padding: calc(18px + var(--safe-top)) 20px 0;
}

.question-hero-image {
  transform: scale(1.02);
}

.question-hero-overlay {
  background:
    linear-gradient(180deg, rgba(28, 17, 13, 0.14) 0%, rgba(28, 17, 13, 0.42) 100%),
    radial-gradient(circle at top center, rgba(255, 242, 233, 0.22), transparent 36%);
}

.gender-image {
  /* Placeholder image for gender selection screen. */
  background:
    linear-gradient(180deg, rgba(24, 16, 13, 0.1) 0%, rgba(24, 16, 13, 0.34) 100%),
    url('https://images.unsplash.com/photo-1524504388940-b1c1722653e1?auto=format&fit=crop&w=1200&q=80')
      center center / cover no-repeat;
}

.skin-image {
  /* Placeholder image for skin type screen. */
  background:
    linear-gradient(180deg, rgba(24, 16, 13, 0.1) 0%, rgba(24, 16, 13, 0.34) 100%),
    url('https://images.unsplash.com/photo-1498843053639-170ff2122f35?auto=format&fit=crop&w=1200&q=80')
      center center / cover no-repeat;
}

.concern-image {
  /* Placeholder image for personal skin concerns screen. */
  background:
    linear-gradient(180deg, rgba(24, 16, 13, 0.1) 0%, rgba(24, 16, 13, 0.34) 100%),
    url('https://images.unsplash.com/photo-1522335789203-aabd1fc54bc9?auto=format&fit=crop&w=1200&q=80')
      center center / cover no-repeat;
}

.location-image {
  /* Placeholder image for location screen. */
  background:
    linear-gradient(180deg, rgba(24, 16, 13, 0.1) 0%, rgba(24, 16, 13, 0.34) 100%),
    url('https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1200&q=80')
      center center / cover no-repeat;
}

.selfie-image {
  /* Placeholder image for selfie guidance screen. */
  background:
    linear-gradient(180deg, rgba(24, 16, 13, 0.1) 0%, rgba(24, 16, 13, 0.34) 100%),
    url('https://images.unsplash.com/photo-1515377905703-c4788e51af15?auto=format&fit=crop&w=1200&q=80')
      center center / cover no-repeat;
}

.camera-screen {
  display: flex;
  flex-direction: column;
  background: #140f0d;
}

.camera-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: calc(18px + var(--safe-top)) 20px 0;
}

.camera-topbar {
  position: relative;
  z-index: 3;
}

.camera-preview-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.camera-preview-video,
.camera-preview-image,
.camera-preview-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-preview-video,
.camera-preview-image {
  object-fit: cover;
}

.camera-preview-overlay {
  background:
    linear-gradient(180deg, rgba(20, 15, 13, 0.18) 0%, rgba(20, 15, 13, 0.06) 18%, rgba(20, 15, 13, 0.06) 82%, rgba(20, 15, 13, 0.2) 100%);
}

.camera-face-guide {
  position: absolute;
  top: 54%;
  left: 50%;
  z-index: 2;
  width: min(64vw, 280px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 250, 247, 0.95);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 9999px rgba(20, 15, 13, 0.78),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.camera-countdown-badge {
  position: absolute;
  top: calc(22px + var(--safe-top));
  right: 20px;
  z-index: 3;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 247, 0.18);
  color: var(--white);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 0.78rem;
  font-weight: 700;
}

.question-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.back-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.brand-lockup.compact .brand-subtitle {
  opacity: 0.72;
}

.bottom-sheet {
  width: 100%;
  margin: 0;
  padding: 20px 16px 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sheet-bg);
}

.bottom-sheet::-webkit-scrollbar {
  display: none;
}

.sheet-header .eyebrow {
  color: var(--muted-soft);
}

.sheet-header h2 {
  color: var(--text);
  font-size: clamp(1.7rem, 6vw, 2.1rem);
}

.supporting-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.42;
  font-size: 0.8rem;
}

.option-list {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  gap: 7px;
  margin-top: 12px;
  align-content: start;
}

.option-list.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-list.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 54px;
  padding: 12px 13px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(119, 80, 67, 0.08);
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.option-card:hover {
  transform: translateY(-1px);
}

.option-card.selected {
  border-color: rgba(77, 49, 43, 0.45);
  background: rgba(255, 250, 247, 0.95);
  box-shadow: var(--shadow-strong);
  transform: translateY(-2px) scale(1.01);
}

.option-label {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}

.option-list.two-column .option-card {
  min-height: 48px;
  padding: 10px 10px;
}

.option-list.two-column .option-label {
  font-size: 0.78rem;
}

.skin-type-grid {
  gap: 8px;
}

.skin-type-grid .option-card {
  min-height: 56px;
  padding: 10px 12px;
}

.skin-type-grid .option-label {
  font-size: 0.82rem;
  line-height: 1.18;
}

.concern-grid .option-card {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 18px;
}

.concern-grid .option-label {
  font-size: 0.7rem;
  line-height: 1.15;
}

.location-sheet {
  gap: 10px;
}

.location-sheet .sheet-header h2,
.selfie-sheet .sheet-header h2 {
  font-size: clamp(1.5rem, 5.5vw, 1.9rem);
}

.city-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.city-label {
  color: var(--accent-soft);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.city-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(110, 78, 68, 0.16);
  border-radius: 18px;
  padding: 0 14px;
  background: rgba(255, 252, 249, 0.88);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.city-input::placeholder {
  color: rgba(77, 49, 43, 0.5);
}

.city-input:focus {
  border-color: rgba(77, 49, 43, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 3px rgba(242, 223, 210, 0.7);
}

.city-status {
  min-height: 30px;
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(255, 252, 249, 0.55);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.city-status.matched {
  color: var(--accent-soft);
  background: rgba(250, 240, 232, 0.9);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 78px;
  padding: 10px 8px;
  border: 1px solid rgba(110, 78, 68, 0.12);
  border-radius: 18px;
  background: rgba(255, 252, 249, 0.7);
  box-shadow: 0 12px 28px rgba(119, 80, 67, 0.07);
}

.metric-card.active {
  background: rgba(255, 250, 247, 0.92);
  border-color: rgba(77, 49, 43, 0.18);
}

.metric-icon {
  font-size: 1rem;
  line-height: 1;
}

.metric-label {
  color: var(--muted-soft);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.2;
}

.selfie-sheet {
  gap: 10px;
}

.camera-sheet {
  gap: 10px;
  height: min(280px, 34dvh);
}

.camera-sheet .sheet-header h2 {
  font-size: clamp(1.35rem, 5vw, 1.7rem);
}

.selfie-tips-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.selfie-tip-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 74px;
  padding: 10px 9px;
  border: 1px solid rgba(110, 78, 68, 0.12);
  border-radius: 18px;
  background: rgba(255, 252, 249, 0.75);
  box-shadow: 0 12px 28px rgba(119, 80, 67, 0.07);
}

.selfie-tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: rgba(250, 240, 232, 0.95);
  color: var(--accent-soft);
}

.selfie-tip-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.selfie-tip-text {
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
}

.consent-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(110, 78, 68, 0.14);
  border-radius: 18px;
  background: rgba(255, 252, 249, 0.82);
  cursor: pointer;
}

.consent-checkbox {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #4d312b;
  flex-shrink: 0;
}

.consent-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
  font-size: 0.69rem;
  line-height: 1.28;
}

.consent-copy strong {
  font-size: 0.7rem;
}

.consent-copy span {
  color: var(--muted);
}

.camera-alert {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 241, 238, 0.9);
  color: #8a3d32;
  font-size: 0.76rem;
  line-height: 1.3;
}

.camera-alert.subtle {
  background: rgba(255, 252, 249, 0.55);
  color: var(--muted);
}

.camera-actions {
  gap: 0;
}

.camera-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.selection-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.6px solid rgba(77, 49, 43, 0.26);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  transition:
    border-color 220ms ease,
    transform 220ms ease;
}

.selection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0.7);
  transition:
    transform 220ms ease,
    background 220ms ease;
}

.option-card.selected .selection-indicator {
  border-color: rgba(77, 49, 43, 0.55);
  transform: scale(1.06);
}

.option-card.selected .selection-dot {
  background: var(--accent-soft);
  transform: scale(1);
}

.skin-type-grid .selection-indicator,
.concern-grid .selection-indicator {
  width: 18px;
  height: 18px;
}

.skin-type-grid .selection-dot,
.concern-grid .selection-dot {
  width: 8px;
  height: 8px;
}

.footer-actions {
  margin-top: auto;
  padding-top: 8px;
}

.location-sheet .footer-actions,
.selfie-sheet .footer-actions {
  padding-top: 6px;
}

.location-sheet .state-message,
.selfie-sheet .state-message {
  min-height: 14px;
  margin-top: 6px;
  font-size: 0.68rem;
}

.state-message {
  min-height: 18px;
  margin: 8px 0 0;
  color: transparent;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.25;
  transition: color 180ms ease;
}

.state-message.visible {
  color: rgba(77, 49, 43, 0.86);
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

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

@keyframes screen-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.99);
  }
}

@media (min-width: 431px) {
  .app-shell {
    padding: 12px 0;
  }

  .device-frame {
    height: calc(100dvh - 24px);
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 28px 80px rgba(86, 53, 43, 0.22);
  }
}
