:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F2F0EA;
  --ink: #0E0E0E;
  --ink-soft: #5C5C5C;
  --border: #E6E3DC;
  --accent: #FF5A1F;
  --accent-ink: #FFFFFF;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }

/* Nav */
.topbar {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.logo { font-family: 'Instrument Serif', serif; font-size: 1.5rem; letter-spacing: -0.5px; }
.logo-tag { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; }
.help-btn {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.help-btn:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Page */
.page { max-width: 480px; margin: 0 auto; padding: 0 20px 80px; }

/* Slider */
.slider {
  margin: 16px -20px 0;
  padding: 0 20px;
  max-height: 10vh;
  overflow: hidden;
}
.slider-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.slider-track::-webkit-scrollbar { display: none; }
.slider-track img {
  height: 9vh;
  width: auto;
  border-radius: 12px;
  object-fit: cover;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Hero */
.hero { padding: 36px 4px 24px; }
.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1.05;
  letter-spacing: -1.2px;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { color: var(--ink-soft); margin-top: 10px; font-size: 1rem; }

/* Upload */
.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.upload-drop {
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-drop:hover { border-color: var(--ink); background: #ECEAE3; }
.upload-emoji { font-size: 2rem; line-height: 1; }
.upload-title { font-weight: 600; font-size: 1.1rem; }
.upload-sub { color: var(--ink-soft); font-size: 0.85rem; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255,90,31,.35); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

/* Loading — skeleton */
.loading { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.loading.hidden { display: none !important; }
.skeleton-card {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.skeleton-grid {
  position: absolute;
  inset: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
}
.skeleton-cell {
  background: linear-gradient(135deg, #ECEAE3 0%, #F6F4EE 100%);
  border-radius: 10px;
}
.skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.7) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
.skeleton-caption {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Results */
.results { margin-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.results.hidden { display: none !important; }
.results-title { font-family: 'Instrument Serif', serif; font-size: 1.8rem; font-weight: 400; }

#resultsGrid { width: 100%; margin-top: 16px; }
.comparison-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
.comparison-img {
  width: 100%;
  display: block;
  filter: blur(8px);
  transform: scale(1.02);
  transition: filter 0.5s, transform 0.5s;
}
.comparison-img.unlocked { filter: none; transform: none; }
.lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.lock-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Best match / tips */
#bestMatchSection { width: 100%; margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.info-card h4 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 1.2rem;
  margin-bottom: 10px;
}
.info-card ul, .info-card ol { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; }
.info-card li { display: flex; gap: 8px; }
.info-card .num { color: var(--accent); font-weight: 600; }
.palette-row { display: flex; gap: 8px; margin-top: 4px; }
.palette-row > div { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); }

/* Unlock */
.unlock {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.unlock.hidden { display: none !important; }
.unlock-headline h3 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 1.6rem;
  margin: 12px 0 6px;
}
.lock-pill {
  display: inline-block;
  background: var(--surface-2);
  color: var(--ink-soft);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.price-original {
  text-decoration: line-through;
  color: var(--ink-soft);
  margin-right: 6px;
}
.price-current {
  color: var(--accent);
  font-weight: 700;
}

/* Support Overlay */
.support-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.support-overlay.hidden { display: none !important; }
.support-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.close-btn:hover { color: var(--ink); }
.support-modal h2 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 1.4rem;
  margin-bottom: 20px;
}
#supportForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#supportForm input,
#supportForm textarea {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
}
#supportForm input:focus,
#supportForm textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 90, 31, 0.1);
}
#supportStatus {
  margin-top: 12px;
  text-align: center;
}

/* Mobile tweaks */
@media (max-width: 380px) {
  .hero h1 { font-size: 2.2rem; }
  .upload-drop { padding: 28px 16px; }
}
