:root {
  --bg: #f5f1ea;
  --surface: #fbfaf7;
  --ink: #1f1d1a;
  --muted: #6d675e;
  --line: #ddd6ca;
  --accent: #3f7a5f;
  --accent-ink: #ffffff;
  --accent-soft: #e3ede6;
  --a: #b4572f;
  --b: #34668a;
  --error: #a33a2a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --surface: #201f1c; --ink: #ece7de; --muted: #a29b90; --line: #36332e;
    --accent: #7cb898; --accent-ink: #10201a; --accent-soft: #23312a;
    --a: #e08a62; --b: #79aed3; --error: #e78a7a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- survey ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: transparent; z-index: 10; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }

.survey {
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 20px 0;
  display: flex; flex-direction: column;
}
.loading { margin-top: 30vh; text-align: center; }
.screen { display: flex; flex-direction: column; flex: 1; animation: in .28s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } .progress span { transition: none; } }

h1 { font: 600 28px/1.2 var(--serif); letter-spacing: -.01em; margin: 12px 0 16px; text-wrap: balance; }
h1.question { font-size: 24px; line-height: 1.28; margin-top: 4px; }
.eyebrow { margin: 8px 0 0; font-size: 13px; letter-spacing: .02em; color: var(--muted); }
.qno { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lead { margin: 0 0 14px; }
.hint { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.note { margin: 10px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.error { color: var(--error); font-size: 15px; min-height: 1px; margin: 12px 0 0; }

.product { margin: 0 0 8px; padding: 20px 12px 8px; text-align: center; }
.product img { width: 100%; max-width: 280px; height: auto; }
@media (prefers-color-scheme: dark) { .product img { filter: invert(.9) hue-rotate(180deg); } }
.specs { list-style: none; padding: 0; margin: 0 0 8px; border-top: 1px solid var(--line); }
.specs li { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 16px; }

.highlight { margin: 4px 0 20px; font: 600 44px/1.1 var(--serif); font-variant-numeric: lining-nums; }
.highlight .label { display: block; font: 13px/1.4 var(--sans); color: var(--muted); margin-bottom: 6px; }

.footer {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 20px 0 max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 22%);
}
.primary {
  width: 100%; min-height: 54px; border: 0; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 17px;
  cursor: pointer; transition: opacity .15s, transform .1s;
}
.primary:active:not(:disabled) { transform: scale(.985); }
.primary:disabled { opacity: .35; cursor: default; }
.screen > .footer:first-child { margin-top: 0; }

/* options */
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.options.row { flex-direction: row; }
.options.row .option { flex: 1; justify-content: center; text-align: center; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px;
  padding: 13px 16px; text-align: left; line-height: 1.35;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px;
  cursor: pointer; transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.option.radio::before, .option.check::before {
  content: ""; flex: none; width: 20px; height: 20px; border: 1.5px solid var(--muted); border-radius: 50%;
  transition: all .15s;
}
.option.check::before { border-radius: 6px; }
.options.row .option::before { display: none; }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option[aria-pressed="true"]::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3.5px var(--accent-soft); }
.option.check[aria-pressed="true"]::before { box-shadow: none; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }
@media (hover: hover) { .option:hover { border-color: var(--muted); } }

.other-input, .price input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; outline: none;
}
.other-input { min-height: 52px; padding: 12px 16px; }
.other-input:focus, .price:focus-within { border-color: var(--accent); }

/* price */
.price-wrap { margin-top: 16px; }
.price {
  display: flex; align-items: baseline; gap: 8px; padding: 10px 18px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; cursor: text;
}
.price input {
  border: 0; padding: 0; background: transparent; min-width: 0; flex: 1;
  font: 600 40px/1.25 var(--serif); font-variant-numeric: lining-nums tabular-nums;
}
.price input::placeholder { color: var(--line); }
.price .cur { font: 500 28px var(--serif); color: var(--muted); }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; font-size: 14px; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* scale */
.scale { margin-top: 18px; }
.scale-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale-btn {
  aspect-ratio: 1; max-height: 64px; width: 100%; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); font: 600 20px var(--serif); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: all .15s;
}
.scale-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.scale-ends { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.scale-ends span:last-child { text-align: right; }

.done { padding-top: 12vh; }
.debrief { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.debrief h2 { font: 600 19px var(--serif); margin: 0 0 8px; }
.debrief p { margin: 0 0 12px; }

/* ---------- stats ---------- */
.stats main { max-width: 860px; margin: 0 auto; padding: 32px 16px 64px; }
.stats h1 { font-size: 30px; margin: 0 0 6px; }
.stats h2 { font: 600 21px/1.3 var(--serif); margin: 0 0 8px; }
.stats h3 { font-size: 15px; font-weight: 600; margin: 22px 0 8px; }
.stats section { padding: 28px 0; border-top: 1px solid var(--line); }
.stats-head { padding-bottom: 20px; }
.links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 15px; }
.links a, .stats a { color: var(--accent); }
table.num { width: 100%; border-collapse: collapse; font-size: 15px; margin: 10px 0; font-variant-numeric: tabular-nums; }
table.num th, table.num td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.num thead th { font-size: 13px; color: var(--muted); font-weight: 500; }
table.num tbody th { font-weight: 500; width: 40%; }
table.compact tbody th { width: 34%; }
.verdict { padding: 12px 14px; border-radius: 10px; margin: 14px 0; font-size: 15px; }
.verdict.yes { background: var(--accent-soft); }
.verdict.no { background: var(--surface); border: 1px solid var(--line); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.a { background: var(--a); } .dot.b { background: var(--b); }
.legend { display: flex; gap: 18px; font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.chart { width: 100%; height: auto; margin-top: 12px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ref { stroke: var(--muted); stroke-dasharray: 3 4; }
.chart .tick { font: 11px var(--sans); fill: var(--muted); }
.chart .lbl { font: 600 13px var(--sans); fill: var(--ink); }
.chart .pt.A { fill: var(--a); } .chart .pt.B { fill: var(--b); }
.chart .pt { fill-opacity: .75; }
.chart .box.A { fill: var(--a); } .chart .box.B { fill: var(--b); }
.chart .box { fill-opacity: .14; }
.chart .med.A { stroke: var(--a); } .chart .med.B { stroke: var(--b); }
.chart .med { stroke-width: 2.5; }
.chart .line { fill: none; stroke-width: 2.5; }
.chart .line.A { stroke: var(--a); } .chart .line.B { stroke: var(--b); }
.grid2 { display: grid; gap: 0 32px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
details { margin: 6px 0 0; font-size: 14px; } summary { cursor: pointer; color: var(--accent); }
@media (max-width: 520px) { table.num { font-size: 14px; } table.num tbody th { width: auto; } }
