:root {
  --bg: #FBF7F3;
  --surface: #FFFFFF;
  --surface-2: #F5EEE8;
  --ink: #2A1E24;
  --muted: #76666D;
  --line: #EADFD8;
  --accent: #7A2E4D;
  --accent-ink: #FFFFFF;
  --error: #B42335;
  --shadow: 0 1px 2px rgba(60, 30, 40, .05), 0 8px 28px rgba(60, 30, 40, .07);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  --arch: var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17121A; --surface: #211A24; --surface-2: #2A212E; --ink: #F3ECEF; --muted: #B6A6AD;
    --line: #3A2E3D; --accent: #E08DAE; --accent-ink: #2A1220; --error: #FF8A98;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17121A; --surface: #211A24; --surface-2: #2A212E; --ink: #F3ECEF; --muted: #B6A6AD;
  --line: #3A2E3D; --accent: #E08DAE; --accent-ink: #2A1220; --error: #FF8A98;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  min-height: 100vh; display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.6rem, 8vw, 4.4rem); }
h1 em { font-style: italic; font-weight: 500; color: var(--accent); }
h2 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .85rem; }
.small { font-size: .82em; opacity: .8; font-weight: 400; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 500; color: var(--muted); margin-bottom: .8em; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { background: none; border: 0; font: italic 600 1.7rem/1 var(--serif); color: var(--accent); padding: 0; }
.topbar nav { display: flex; gap: 4px; }
.navlink { background: none; border: 0; padding: 8px 12px; border-radius: 999px; color: var(--muted); font-size: .92rem; }
.navlink:hover { color: var(--ink); background: var(--surface-2); }

main { flex: 1; width: 100%; }
.screen { display: none; padding: 32px 16px 56px; animation: rise .45s ease both; }
.screen.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.narrow { max-width: 620px; margin: 0 auto; }
.wide { max-width: 1040px; margin: 0 auto; }

/* Buttons */
.btn { border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 500; font-size: 1rem; transition: transform .15s, background .2s, box-shadow .2s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary[disabled] { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.text { background: none; padding: 10px 4px; color: var(--muted); }
.btn.text:hover { color: var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 28px 0 12px; }

/* Home */
.hero { max-width: 720px; margin: 0 auto; text-align: center; padding-top: 12px; }
.hero .cta-row { justify-content: center; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 560px; margin: 0 auto; }
.orbit { position: relative; width: 220px; height: 220px; margin: 0 auto 28px; }
.orbit .dot {
  position: absolute; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--c);
}
.orbit .dot svg { width: 24px; height: 24px; }
.orbit .center {
  position: absolute; inset: 60px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface));
  border: 1px solid var(--line); font: italic 600 2.6rem var(--serif); color: var(--accent);
}
.orbit .ring { position: absolute; inset: 0; animation: spin 80s linear infinite; }
.orbit .ring .dot { animation: spin 80s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orbit .ring, .orbit .ring .dot, .loader-ring { animation: none !important; } .screen { animation: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .orbit .dot { color: color-mix(in srgb, var(--c) 55%, white); } }
:root[data-theme="dark"] .orbit .dot { color: color-mix(in srgb, var(--c) 55%, white); }

/* Quiz */
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 28px; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }
.question { font-size: clamp(1.8rem, 5.5vw, 2.4rem); margin-bottom: 22px; }
.options { display: grid; gap: 10px; margin-bottom: 18px; }
.options.grid2 { grid-template-columns: 1fr 1fr; }
.opt {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px 18px; font-size: 1rem; transition: border-color .15s, background .15s, transform .1s;
}
.options.grid2 .opt { text-align: center; font: 600 1.35rem var(--serif); padding: 18px 10px; }
.opt:hover { border-color: var(--accent); }
.q-hint { color: var(--muted); margin: -10px 0 16px; font-size: .95rem; }
.q-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#qNext[disabled] { opacity: .45; cursor: default; box-shadow: none; }
.opt.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.opt.picked { box-shadow: inset 0 0 0 1px var(--accent); }
.options[role="group"] .opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.options[role="group"] .opt::after {
  content: ""; flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: .8rem; line-height: 1; color: var(--accent-ink);
}
.options[role="group"] .opt.picked::after { content: "\2713"; background: var(--accent); border-color: var(--accent); }

/* Profile */
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 999px; margin: 22px 0 18px; }
.tab { flex: 1; border: 0; background: none; padding: 10px 12px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .95rem; }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.drop {
  display: grid; place-items: center; min-height: 220px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; position: relative; overflow: hidden; transition: border-color .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { max-height: 360px; max-width: 100%; object-fit: contain; display: block; }
.drop-text { display: grid; justify-items: center; gap: 4px; color: var(--muted); padding: 24px; text-align: center; }
.drop-text strong { color: var(--ink); font-weight: 500; }
.drop-text .ico { width: 30px; height: 30px; color: var(--accent); margin-bottom: 6px; }
.tips { margin: 16px 0; padding-left: 20px; color: var(--muted); font-size: .93rem; }
.tips li { margin: 3px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; margin: 12px 0 6px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.notice { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; font-size: .92rem; margin-bottom: 14px; color: var(--muted); }
.chipgroup { margin: 22px 0 8px; }
.chipgroup h4 { font: 500 .95rem var(--sans); margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 14px; text-align: left;
  display: grid; gap: 1px; font-size: .95rem;
}
.chip small { color: var(--muted); font-size: .78rem; }
.chip.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.error { color: var(--error); font-size: .95rem; }

.codebox { margin-bottom: 16px; }
.codebox label { display: block; font-weight: 500; font-size: .95rem; margin-bottom: 6px; }
.codebox input {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); letter-spacing: .04em;
}
.codebox input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
.codebox .fine { margin: 6px 0 0; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font-size: inherit; }
.prose p { font-size: 1rem; }

/* Loading */
.loader { display: grid; place-items: center; gap: 24px; padding: 80px 0; text-align: center; }
.loader-ring { width: 120px; height: 120px; border-radius: 50%; position: relative; animation: spin 6s linear infinite; }
.loader-ring span { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--c); left: 51px; top: 51px; opacity: .85; }
.loader-text { font: italic 500 1.5rem var(--serif); color: var(--muted); min-height: 2em; }

/* Results */
#resultsBody, #exploreDetail { --arch-text: var(--arch); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(#resultsBody, #exploreDetail) { --arch-text: color-mix(in srgb, var(--arch) 55%, white); } }
:root[data-theme="dark"] :is(#resultsBody, #exploreDetail) { --arch-text: color-mix(in srgb, var(--arch) 55%, white); }
.r-hero {
  text-align: center; padding: 40px 20px 34px; border-radius: 28px; max-width: 880px; margin: 0 auto 28px;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--arch) 22%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.r-emblem {
  width: 104px; height: 104px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--arch); color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--arch) 45%, transparent);
}
.r-emblem svg { width: 50px; height: 50px; stroke-width: 1.4; }
.r-hero h1 { color: var(--arch-text); margin-bottom: .15em; }
.r-tagline { font: italic 500 1.5rem var(--serif); margin-bottom: .5em; }
.r-sub { color: var(--muted); font-size: .95rem; }
.r-sub b { color: var(--ink); font-weight: 500; }
.r-why { max-width: 620px; margin: 18px auto 0; font-size: 1.02rem; }
.demo-flag { display: inline-block; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: .78rem; margin-top: 12px; }

.r-grid { max-width: 880px; margin: 0 auto; display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: var(--shadow); min-width: 0; }
.card.span2 { grid-column: 1 / -1; }
.card h3 { margin-bottom: .55em; }
.card h4 { font: 500 .78rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 16px 0 8px; }
.card h4:first-of-type { margin-top: 4px; }
.card ul { margin: 0; padding-left: 18px; }
.card li { margin: 4px 0; }
.card p:last-child { margin-bottom: 0; }

.section-title { max-width: 880px; margin: 40px auto 16px; display: flex; align-items: baseline; gap: 12px; }
.section-title h2 { margin: 0; }
.section-title span { color: var(--muted); font-size: .9rem; }

.blend { display: grid; gap: 9px; }
.blend-row { display: grid; grid-template-columns: 112px 1fr 42px; align-items: center; gap: 10px; font-size: .92rem; }
.blend-row .track { height: 9px; background: var(--surface-2); border-radius: 9px; overflow: hidden; }
.blend-row .fill { height: 100%; border-radius: 9px; background: var(--c); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.blend-row .pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.blend-row.lead { font-weight: 600; }

.tagrow { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { background: var(--surface-2); border-radius: 999px; padding: 5px 12px; font-size: .88rem; }
.tag.arch { background: color-mix(in srgb, var(--arch) 14%, var(--surface)); color: var(--arch-text); }
a.tag { color: inherit; text-decoration: none; }
a.tag:hover { background: color-mix(in srgb, var(--arch) 22%, var(--surface)); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.sw { display: grid; gap: 6px; font-size: .8rem; color: var(--muted); text-align: center; }
.sw i { display: block; height: 58px; border-radius: 12px; border: 1px solid rgba(0,0,0,.08); }

.outfits { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.outfit { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; }
.outfit b { display: block; font: 600 1.15rem var(--serif); color: var(--arch-text); margin-bottom: 4px; }
.outfit p { margin: 0; font-size: .93rem; }

.tiplist { display: grid; gap: 12px; }
.tip b { display: block; font-weight: 500; }
.tip span { color: var(--muted); font-size: .94rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fact { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.fact small { display: block; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; }
.fact span { font-weight: 500; text-transform: capitalize; }

.r-actions { max-width: 880px; margin: 32px auto 0; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.rate-card { border-color: color-mix(in srgb, var(--arch) 35%, var(--line)); }
.rate-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 6px 0 12px; }
.rate-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 4px;
  display: grid; gap: 2px; justify-items: center; transition: border-color .15s, background .15s;
}
.rate-btn b { font: 600 1.4rem var(--serif); line-height: 1; }
.rate-btn small { font-size: .72rem; color: var(--muted); text-align: center; }
.rate-btn:hover { border-color: var(--arch); }
.rate-btn.picked { border-color: var(--arch); background: color-mix(in srgb, var(--arch) 14%, var(--surface)); }
.rate-card textarea {
  width: 100%; font: inherit; font-size: .95rem; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); resize: vertical;
}
.rate-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* Explore */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 42vw), 1fr)); gap: 12px; margin-top: 26px; }
.acard {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s; display: grid; gap: 6px; align-content: start;
}
.acard:hover { transform: translateY(-2px); border-color: var(--c); }
.acard .em { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; margin-bottom: 6px; }
.acard .em svg { width: 24px; height: 24px; }
.acard b { font: 600 1.45rem var(--serif); }
.acard span { color: var(--muted); font-size: .92rem; }
#exploreDetail:not(:empty) { margin-top: 36px; scroll-margin-top: 80px; }

.foot { text-align: center; padding: 20px 16px 32px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }

@media (max-width: 680px) {
  body { font-size: 16px; }
  .r-grid { grid-template-columns: 1fr; }
  .options.grid2 { grid-template-columns: 1fr 1fr; }
  .blend-row { grid-template-columns: 96px 1fr 38px; }
  .r-hero { padding: 30px 16px 26px; border-radius: 22px; }
  .card { padding: 18px 16px 14px; }
}

@media print {
  .topbar, .foot, .r-actions { display: none !important; }
  .screen { display: none !important; }
  #results { display: block !important; padding: 0; }
  .card, .r-hero { box-shadow: none; break-inside: avoid; }
}
