:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ede5;
  --ink: #2a2320;
  --ink-2: #5e534c;
  --muted: #8a7b70;
  --line: #e8dfd5;
  --accent: #b4536a;
  --accent-ink: #ffffff;
  --accent-soft: #f7e3e7;
  --ring: rgba(180, 83, 106, 0.35);
  --error: #b3261e;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(42, 35, 32, 0.04), 0 8px 24px rgba(42, 35, 32, 0.06);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171413;
    --surface: #221e1c;
    --surface-2: #2c2725;
    --ink: #f2ece6;
    --ink-2: #cdc2b9;
    --muted: #9d9087;
    --line: #3a3330;
    --accent: #e38aa0;
    --accent-ink: #1d1416;
    --accent-soft: #3a252b;
    --ring: rgba(227, 138, 160, 0.4);
    --error: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
h4 { margin: 0 0 6px; font-size: 0.95rem; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- Hero ---------- */
.hero { padding: 48px 0 28px; }
.brand { font-family: var(--serif); font-size: 1.1rem; color: var(--accent); letter-spacing: 0.04em; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); max-width: 14ch; }
.lede { color: var(--ink-2); font-size: 1.075rem; max-width: 56ch; margin-top: 14px; }
.hero-dots { display: flex; gap: 6px; margin-top: 22px; flex-wrap: wrap; }
.hero-dots i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }

/* ---------- Cards & steps ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.step-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.step-head h2 { font-size: 1.5rem; margin-bottom: 4px; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.optional { font: 500 0.75rem var(--sans); color: var(--muted); background: var(--surface-2); padding: 3px 8px; border-radius: 999px; vertical-align: middle; }

fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 600; margin-bottom: 10px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; margin-bottom: 20px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tab[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* ---------- Option pickers ---------- */
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.option {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 8px 10px; transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: var(--muted); }
.option[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.option .dot { flex: none; width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.option .label { font-size: 0.9rem; line-height: 1.25; }
.option small { display: block; color: var(--muted); font-size: 0.78rem; }

.notice { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; }

/* ---------- Quiz ---------- */
.quiz { margin-top: 12px; }
.quiz summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.quiz-body { margin-top: 12px; padding: 16px; border-radius: 12px; background: var(--surface-2); }
.q { margin-bottom: 14px; }
.q p { font-weight: 500; margin-bottom: 6px; }
.q label { display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 6px 0; font-size: 0.92rem; }
.q input { accent-color: var(--accent); }
.quiz-result:empty { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 500; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.large { padding: 14px 32px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.08); }
label.btn { cursor: pointer; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Selfie ---------- */
.privacy { background: var(--surface-2); padding: 10px 14px; border-radius: 12px; font-size: 0.92rem; }
.tips { color: var(--ink-2); font-size: 0.92rem; padding-left: 20px; margin: 0 0 16px; }
.upload-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.camera video { width: 100%; max-height: 60vh; border-radius: 14px; background: #000; transform: scaleX(-1); }
.camera-actions, .sampler-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.sample-instruction { font-weight: 500; }
.sample-targets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sample-targets button {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px 6px 6px; font-size: 0.9rem;
}
.sample-targets small { color: var(--muted); }
.sample-targets .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--muted); }
.sample-targets .done .dot { border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.sample-targets .active { border-color: var(--accent); background: var(--accent-soft); }
.canvas-wrap { border-radius: 14px; overflow: hidden; background: var(--surface-2); }
#photo-canvas { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; cursor: crosshair; touch-action: manipulation; }

/* ---------- Body shape ---------- */
.switch { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; margin-bottom: 18px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.2s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--ring); outline-offset: 2px; }

.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shape {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 10px;
}
.shape[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.shape .label { font-weight: 600; }
.shape small { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.body-question { margin: 22px 0 0; }
.body-question > p { margin: -4px 0 10px; }
.silhouette { width: 46px; height: 82px; fill: var(--accent); opacity: 0.85; margin-bottom: 6px; }
.silhouette.large { width: 72px; height: 128px; flex: none; }

.measure-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.measure-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 0.92rem; }
.measure-form small { color: var(--muted); font-weight: 400; }
.measure-form input { padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); }
.measure-result { margin-top: 12px; }

/* ---------- CTA ---------- */
.cta { text-align: center; margin: 28px 0 36px; }
.error { color: var(--error); margin-top: 12px; min-height: 1.5em; }

/* ---------- Results ---------- */
.results { margin-bottom: 40px; scroll-margin-top: 16px; }
.result-hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0 24px 24px; overflow: hidden; margin-bottom: 20px;
}
.stripe { display: flex; height: 14px; margin: 0 -24px 24px; }
.stripe i { flex: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.result-hero h2 { font-size: clamp(2rem, 7vw, 3rem); }
.tagline { font-family: var(--serif); font-size: 1.2rem; color: var(--ink-2); margin-top: 6px; }
.traits { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.traits span { background: var(--surface-2); padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; }

.meters { display: grid; gap: 10px; margin: 18px 0; max-width: 460px; }
.meter { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--ink-2); }
.meter span:last-child { text-align: right; }
.meter .bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); }
.meter .bar i { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px var(--surface); }
.note { background: var(--surface-2); padding: 10px 14px; border-radius: 12px; font-size: 0.95rem; }
.browse { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.92rem; color: var(--ink-2); margin-top: 12px; }
.browse select { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); }

.results > .tab-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.results h3 { font-size: 1.25rem; margin: 22px 0 12px; }
.results h3:first-child { margin-top: 0; }
.results h3 small { font: 400 0.85rem var(--sans); color: var(--muted); margin-left: 6px; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.swatches.large { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.swatch { border: 0; background: none; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.swatch .chip { display: block; height: 64px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); margin-bottom: 6px; transition: transform 0.15s; }
.swatches.large .chip { height: 92px; }
.swatch:hover .chip { transform: translateY(-2px); }
.swatch .name { font-size: 0.85rem; font-weight: 500; line-height: 1.25; }
.swatch .hex { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.swatches.round { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.swatches.round .swatch { align-items: center; text-align: center; }
.swatches.round .chip { width: 58px; height: 58px; border-radius: 50%; }
.swatches.round.large .chip { width: 76px; height: 76px; }
.swatches.avoid .chip { position: relative; opacity: 0.85; }
.swatches.avoid .chip::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), rgba(255, 255, 255, 0.9) calc(50% - 1.5px), rgba(255, 255, 255, 0.9) calc(50% + 1.5px), transparent calc(50% + 1.5px));
}

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 24px; }
.info { background: var(--surface-2); border-radius: 14px; padding: 16px; font-size: 0.93rem; color: var(--ink-2); }
.info h4 { color: var(--ink); }
.info ul { margin: 0; padding-left: 18px; }
.info p:last-child { margin-bottom: 0; }
.info.accent { background: var(--accent-soft); }
.info.wide { grid-column: 1 / -1; }
.tip { margin-top: 18px; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.inline-swatch { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.inline-swatch i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }

.body-result { display: flex; gap: 20px; align-items: center; }
.body-result h3 { margin: 0 0 4px; }
.goal { margin-top: 8px; }
.empty { text-align: center; padding: 20px 0; color: var(--ink-2); }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }

.footer { padding-bottom: 40px; text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .card, .results > .tab-panel { padding: 18px; }
  .result-hero { padding: 0 18px 18px; }
  .stripe { margin: 0 -18px 20px; }
  .options { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 7px 11px; font-size: 0.88rem; }
  .body-result { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Real-life examples ---------- */
.celebs { margin: 18px 0 6px; }
.celeb-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 8px 0 8px; max-width: 460px; }
.celeb { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--ink); text-decoration: none; }
.celeb:hover .celeb-name { text-decoration: underline; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-weight: 600; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.celeb-name { font-size: 0.8rem; line-height: 1.25; }

.examples { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.examples > .muted { margin: -4px 0 12px; }
.chip-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.chip-row .pill { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.chip-row .pill i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.pill { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.pill:hover { border-color: var(--muted); }
.pill[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.photo { position: relative; display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--surface-2); }
.photo-grid.square .photo { aspect-ratio: 1; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s; }
.photo:hover img { transform: scale(1.03); }
.photo .credit {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 0.7rem; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo.skeleton { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .photo.skeleton { animation: none; } .photo img { transition: none; } }
.credit-line, .gallery-msg, .key-form { grid-column: 1 / -1; }
.credit-line { margin-top: 4px; }
.credit-line a { color: inherit; }

.key-form { background: var(--surface-2); border-radius: 14px; padding: 16px; }
.key-form p { margin: 0 0 10px; }
.key-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.key-row input { flex: 1 1 220px; min-width: 0; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); }
.key-form a { color: var(--accent); font-weight: 600; }

@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .avatar { width: 60px; height: 60px; }
}
