:root {
  --plum: #3b1823;
  --sin: #9c1f2e;
  --sin-2: #7c1622;
  --virtue: #1d5c63;
  --virtue-2: #15464c;
  --gold: #b88a2f;
  --cream: #f7f0e1;
  --paper: #fffdf8;
  --ink: #241a17;
  --muted: #62574d;
  --line: #e6dcc8;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(59, 24, 35, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--virtue); }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; color: var(--plum); }
h1 { font-size: clamp(1.7rem, 3.8vw, 2.8rem); margin: 0.2em 0 0.35em; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); margin: 0 0 0.6em; }
h3 { font-size: 1.1rem; margin: 1.4em 0 0.6em; }
[hidden] { display: none !important; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1120px; margin: 0 auto; padding: 14px 16px;
}
.brand { font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 1.1rem; color: var(--plum); text-decoration: none; }
.brand-mark { color: var(--gold); }
.top-cta { font-weight: 600; text-decoration: none; color: var(--sin); }

.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.76rem; font-weight: 600; color: var(--sin); margin: 0; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 36em; margin: 0 0 0.6em; }
.fine { font-size: 0.85rem; color: var(--muted); margin: 0.6em 0 0; }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; border: 0; border-radius: 999px; cursor: pointer;
  padding: 12px 22px; text-decoration: none; transition: transform 0.08s ease, background 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--sin); color: #fff; }
.btn-primary:hover { background: var(--sin-2); }
.btn-ghost { background: transparent; color: var(--plum); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--virtue); }
.btn-lg { padding: 15px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.btn-row .btn { padding: 11px 8px; font-size: 0.92rem; }
.btn-mini { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--sin); background: var(--sin); color: #fff; cursor: pointer; }
.btn-mini:hover { background: var(--sin-2); border-color: var(--sin-2); }
.btn-mini-ghost { background: transparent; color: var(--plum); border-color: var(--line); }
.btn-mini-ghost:hover { background: var(--cream); border-color: var(--virtue); }
.btn-mini[disabled] { opacity: 0.45; cursor: not-allowed; }

.card-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }

/* Hero: copy on the left, the test itself on the right (stacked on phones, test still on the first screen). */
.hero {
  max-width: 1120px; margin: 0 auto; padding: 12px 16px 48px;
  display: grid; grid-template-columns: 1fr 1.05fr; gap: 20px 40px; align-items: center;
}
.vs-banner {
  grid-column: 1 / -1; background: var(--plum); color: #fff; border-radius: 14px; padding: 14px 18px;
  font-family: Fraunces, Georgia, serif; font-size: 1.12rem; line-height: 1.35;
}
.vs-banner p { margin: 0; }

.quiz { min-height: 420px; display: flex; flex-direction: column; justify-content: center; }
.quiz-top { display: flex; align-items: center; gap: 12px; }
.q-count { font-size: 0.85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.bar { flex: 1; height: 10px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--sin), var(--gold)); transition: width 0.3s ease; }
.q-text { font-family: Fraunces, Georgia, serif; font-size: clamp(1.2rem, 2.4vw, 1.5rem); line-height: 1.3; color: var(--plum); margin: 18px 0 16px; min-height: 3.9em; }
.scale { display: grid; gap: 8px; }
.opt {
  font: inherit; font-weight: 600; text-align: left; padding: 11px 16px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--cream); color: var(--ink); transition: border-color 0.15s ease, background 0.15s ease;
}
.opt:hover, .opt:focus-visible { border-color: var(--sin); outline: none; }
.opt[aria-pressed="true"] { border-color: var(--sin); background: #f6e3e2; }
.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.quiz-nav .fine { margin: 0; }
#quizDone { text-align: center; }
#quizDone h2 { margin: 6px 0 14px; }

/* Result */
.result { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; scroll-margin-top: 12px; }
.result-head { text-align: center; max-width: 760px; margin: 0 auto 22px; }
.result-head h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); margin: 6px 0 14px; }
.balance { height: 18px; border-radius: 999px; background: var(--sin); overflow: hidden; }
.balance-virtue { height: 100%; background: var(--virtue); transition: width 0.6s ease; }
.balance-labels { display: flex; justify-content: space-between; margin: 6px 0 0; font-size: 0.92rem; color: var(--muted); }
.balance-labels span:first-child strong { color: var(--virtue); }
.balance-labels span:last-child strong { color: var(--sin); }

.result-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; align-items: start; }
.tops { display: grid; gap: 16px; }
.top-card { background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--sin); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.top-card h3 { font-size: 1.6rem; margin: 4px 0 6px; }
.top-card p { margin: 0 0 8px; color: var(--muted); }
.top-card .eyebrow { color: var(--sin); }
.top-card .pct { color: var(--sin); }
.top-virtue { border-left-color: var(--virtue); }
.top-virtue .eyebrow, .top-virtue .pct { color: var(--virtue); }
.top-card a { font-weight: 600; font-size: 0.92rem; }

.bars h3:first-child { margin-top: 0; }
.bar-list { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 104px 1fr auto; gap: 10px; align-items: center; font-size: 0.95rem; }
.bar-label { color: var(--ink); text-decoration: none; }
.bar-label:hover { text-decoration: underline; }
.bar-row.is-top .bar-label, .bar-row.is-top .bar-pct { font-weight: 700; }
.bar-track { position: relative; height: 12px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); overflow: hidden; }
.bar-val { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.bar-sin { background: var(--sin); }
.bar-virtue { background: var(--virtue); }
.bar-pct { font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }

/* Compare with a friend: your bar on top, theirs underneath in gold. */
.compare { margin: 0 0 20px; }
.compare h3 { margin-top: 0; font-size: 1.4rem; }
.verdict { font-family: Fraunces, Georgia, serif; font-size: 1.2rem; color: var(--plum); margin: 0 0 12px; }
.cmp-legend { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 10px; }
.dot:first-child { margin-left: 0; }
.dot-me { background: var(--plum); }
.dot-them { background: var(--gold); }
.cmp-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 28px; margin-bottom: 16px; }
.cmp-rows .bar-track { height: 18px; }
.cmp-rows .bar-val { bottom: 50%; border-radius: 999px 999px 0 0; }
.cmp-rows .bar-them { top: 50%; bottom: 0; background: var(--gold); border-radius: 0 0 999px 999px; }
.cmp-rows .bar-sin, .cmp-rows .bar-virtue { background: var(--plum); }

.share-box { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; margin: 20px 0 14px; }
.share-card canvas { width: 100%; height: auto; display: block; border-radius: 10px; box-shadow: var(--shadow); background: var(--cream); aspect-ratio: 4 / 5; }
.share-side h3 { margin-top: 0; font-size: 1.4rem; }
.link-box { margin-top: 12px; }
.link-box input { width: 100%; font: inherit; font-size: 0.9rem; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--gold); background: #fff; color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; color: var(--plum); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input {
  font: inherit; font-weight: 400; color: var(--ink); padding: 11px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; width: 100%;
}
.field input:focus { outline: none; border-color: var(--virtue); box-shadow: 0 0 0 3px rgba(29, 92, 99, 0.15); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; padding-bottom: 11px; }
.check input { width: 18px; height: 18px; accent-color: var(--sin); }
.headline-preview { margin: 16px 0 12px; color: var(--muted); }
.headline-preview strong { color: var(--plum); font-family: Fraunces, Georgia, serif; font-size: 1.1rem; }
.form-error { color: var(--sin); font-weight: 600; margin: 8px 0 12px; }

/* Portrait maker */
.maker {
  max-width: 1120px; margin: 0 auto; padding: 0 16px 56px; scroll-margin-top: 12px;
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: start;
}
.maker h2 { margin: 6px 0 8px; }
.portrait-lead { color: var(--muted); margin: 0; }
.quick-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.looks { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.look {
  position: relative; border: 2px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden;
  background: var(--cream); cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.look img { aspect-ratio: 2 / 3; object-fit: cover; width: 100%; }
.look span { display: block; padding: 5px 6px; font-size: 0.72rem; font-weight: 600; line-height: 1.2; }
.look[aria-checked="true"] { border-color: var(--sin); box-shadow: 0 0 0 3px rgba(156, 31, 46, 0.18); }
.look-virtue[aria-checked="true"] { border-color: var(--virtue); box-shadow: 0 0 0 3px rgba(29, 92, 99, 0.18); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-box { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.photo-pick { display: grid; place-items: center; aspect-ratio: 1; border: 2px dashed var(--gold); border-radius: 14px; background: var(--cream); cursor: pointer; text-align: center; overflow: hidden; color: var(--muted); font-size: 0.82rem; line-height: 1.35; padding: 10px; }
.photo-pick:hover, #photoInput:focus-visible + .photo-pick { border-color: var(--sin); }
.photo-pick strong { display: block; color: var(--sin); font-size: 1rem; margin-bottom: 4px; }
.photo-pick.has-photo { border-style: solid; border-color: var(--virtue); padding: 0; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-side .fine:first-child { margin-top: 0; }
.photo-side .btn-mini { margin-top: 10px; }

.maker-result { position: sticky; top: 16px; text-align: center; }
.sample-pair { position: relative; width: 74%; margin: 4px auto 8px; }
.empty-sample { width: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.before { position: absolute; left: -14%; bottom: -4px; width: 40%; margin: 0; padding: 5px 5px 0; background: var(--paper); border-radius: 10px; box-shadow: var(--shadow); transform: rotate(-5deg); }
.before img { border-radius: 6px; aspect-ratio: 1; object-fit: cover; width: 100%; }
.before figcaption { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-align: center; padding: 3px 0 5px; }
.spark { font-size: 2.6rem; color: var(--gold); animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#progressBox .bar { margin: 14px 0 6px; }
#progressBox .bar-fill { width: 2%; transition: width 0.8s ease; }
#previewImg { width: 100%; height: auto; border-radius: 10px; margin-bottom: 12px; background: var(--cream); }
.actions { margin-top: 4px; }
.paid-note { font-weight: 600; color: var(--virtue); margin: 0 0 4px; }

/* Text sections */
.intro, .gallery, .faq, .style-links { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }
.intro p { max-width: 46em; color: var(--muted); }
.gallery-lead { color: var(--muted); max-width: 46em; margin-top: -0.3em; }
.gallery-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.gallery-grid a { display: block; text-decoration: none; color: var(--plum); font-weight: 600; font-size: 0.9rem; text-align: center; }
.gallery-grid img { width: 100%; border-radius: 10px; box-shadow: var(--shadow); aspect-ratio: 2 / 3; object-fit: cover; margin-bottom: 6px; }
#galleryNote { margin-top: 12px; }
.style-links h2 { font-size: 1.2rem; margin: 1.2em 0 0.5em; }
.style-links h2:first-child { margin-top: 0; }
.style-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.style-links a, .style-links span[aria-current] { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--plum); text-decoration: none; font-size: 0.9rem; background: var(--paper); }
.style-links a:hover { border-color: var(--virtue); }
.style-links span[aria-current] { background: var(--plum); color: #fff; border-color: var(--plum); }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--plum); }
.faq p { margin: 10px 0 2px; color: var(--muted); }

.foot { text-align: center; padding: 28px 16px 40px; border-top: 1px solid var(--line); color: var(--muted); }
.foot a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; max-width: min(92vw, 520px);
  background: var(--plum); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; text-align: center;
  overflow-wrap: anywhere;
}

/* Turnstile widget: invisible unless Cloudflare asks for a click. */
.human-check:empty { display: none; }
.human-check { display: flex; justify-content: center; margin: 0 0 0.8em; }

/* Trait pages (/sins/<id>, /virtues/<id>) */
.trait { max-width: 1000px; margin: 0 auto; padding: 4px 16px 40px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin: 4px 0 10px; }
.crumbs a { color: var(--muted); }
.trait .lead { max-width: 44em; }
.trait-cta { margin: 14px 0 26px; }
.trait-grid { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: start; margin-bottom: 36px; }
.trait-art { margin: 0; position: sticky; top: 16px; }
.trait-art img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
.trait-art figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 8px; text-align: center; }
.trait-text h2 { margin-top: 1.3em; }
.trait-text h2:first-child { margin-top: 0; }
.trait-text p, .trait-text li { color: #3d332d; }
.trait-text ul { padding-left: 1.2em; }
.trait-text li { margin-bottom: 6px; }
.trait-virtue .eyebrow { color: var(--virtue); }
.trait .style-links { padding: 0; }

/* Share page (/s/<id>) and 404 */
.share, .notfound { max-width: 560px; margin: 0 auto; padding: 8px 16px 48px; text-align: center; }
.share h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 6px 0 16px; }
.share-img { width: 100%; max-width: 420px; margin: 0 auto 18px; border-radius: 12px; box-shadow: var(--shadow); background: var(--paper); }
.share .lead { margin: 0 auto 16px; }

.legal { max-width: 760px; margin: 0 auto; padding: 8px 16px 56px; }
.legal h1 { font-size: 2rem; }
.legal h2 { font-size: 1.2rem; margin-top: 1.6em; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 12px; padding-bottom: 36px; }
  .hero-fine { display: none; }
  .lead { font-size: 1rem; }
  .quiz { min-height: 0; }
  .q-text { min-height: 3.9em; margin: 14px 0 12px; }
  .result-grid, .maker, .share-box { grid-template-columns: 1fr; }
  .share-card { max-width: 320px; margin: 0 auto; }
  .maker-result { position: static; }
  .maker-result.is-empty { display: none; }
  .cmp-rows { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
  .trait-grid { grid-template-columns: 1fr; gap: 20px; }
  .trait-art { position: static; max-width: 300px; margin: 0 auto; }
}
@media (max-width: 520px) {
  .top { padding: 10px 16px; }
  h1 { font-size: 1.55rem; }
  .card-panel { padding: 16px; }
  .opt { padding: 10px 14px; }
  .looks { grid-template-columns: repeat(4, 1fr); }
  .fields { grid-template-columns: 1fr; }
  .check { padding-bottom: 0; }
  .photo-box { grid-template-columns: 118px 1fr; gap: 12px; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .bar-row { grid-template-columns: 92px 1fr auto; }
  .btn-row .btn { font-size: 0.85rem; padding: 10px 4px; }
  .top-cta { font-size: 0.92rem; }
}
