/* Pre-Design Questionnaire: styles ported from the published artifact (same look). */
:root {
  color-scheme: light;
  --paper: #f1eee9; --card: #f8f6f2; --ink: #231f20; --muted: #6d6660; --line: #d3cec5;
  --wine: #632720; --wine-ink: #fbf7f2; --sel: #ebe2d8; --sand: #e5ddcf; --err: #9b2c1f;
  --olive: #2d2c25; --cover-ink: #f1eee9; --cover-muted: #b9b3a6; --cover-line: #8a4a3f;
  --display: "Kodchasan", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1f1e1a; --card: #2a2923; --ink: #ece7df; --muted: #a49d92; --line: #46433a;
    --wine: #d89c8d; --wine-ink: #231915; --sel: #3b302b; --sand: #38352d; --err: #ec9284;
    --olive: #16150f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1f1e1a; --card: #2a2923; --ink: #ece7df; --muted: #a49d92; --line: #46433a;
  --wine: #d89c8d; --wine-ink: #231915; --sel: #3b302b; --sand: #38352d; --err: #ec9284;
  --olive: #16150f; color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body.on-cover { background: var(--olive); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.wrap { max-width: 800px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
/* Headings: Kodchasan Bold for page titles, Medium for section titles. */
h1, h2 { font-family: var(--display); font-weight: 700; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h3 { font-family: var(--display); font-weight: 500; text-wrap: balance; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }
.logo { display: block; height: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 13px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; padding: 15px 26px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--wine); border-color: var(--wine); color: var(--wine-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--wine); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn-link { border: 0; background: none; padding: 6px 0; color: var(--wine); font: 600 13px var(--body); letter-spacing: .04em; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Cover */
.cover { background: var(--olive); color: var(--cover-ink); text-align: center; }
.cover .wrap { padding-block: 56px 48px; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.cover .kicker { font-family: var(--display); font-weight: 500; letter-spacing: .32em; font-size: 15px; color: var(--cover-muted); }
.cover .rule { width: 1px; height: 84px; background: linear-gradient(transparent, var(--cover-line)); }
.cover h1 { font-size: clamp(28px, 5.8vw, 48px); letter-spacing: .04em; line-height: 1.12; text-transform: uppercase; }
.cover .sub { font-size: 15px; color: var(--cover-muted); letter-spacing: .04em; }
.cover .facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; font-size: 13px; color: var(--cover-muted); max-width: 520px; }
.cover .facts span::before { content: "◦"; margin-right: 8px; color: var(--cover-line); }
.cover .actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.cover .btn { border-color: #5a574c; color: var(--cover-ink); }
.cover .btn:hover { border-color: var(--cover-ink); }
.cover .btn-start { background: var(--cover-ink); color: #2d2c25; border-color: var(--cover-ink); }
.cover .btn-start:hover { background: #fff; }
.cover .logo { width: 132px; color: var(--cover-ink); margin-top: 28px; }

/* App header */
.top { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
.top .wrap { padding-block: 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.top .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .logo { width: 62px; color: var(--ink); }
.top .count { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.secs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sec { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sec .bar { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.sec .bar i { display: block; height: 100%; background: var(--wine); transition: width .35s ease; }
.sec span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec.on span { color: var(--ink); font-weight: 700; }

/* Steps */
.step { padding-block: 34px 28px; }
.eyebrow { color: var(--wine); font-weight: 700; font-size: 14px; }
.step h2 { font-size: clamp(28px, 4.8vw, 40px); line-height: 1.15; margin-top: 8px; }
.intro { color: var(--muted); max-width: 60ch; margin-top: 10px; }
.qs { display: flex; flex-direction: column; gap: 34px; margin-top: 30px; }
.q { min-width: 0; }
.qlabel { display: block; font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.hint { display: block; color: var(--muted); font-weight: 400; font-size: 13px; margin-top: 2px; }
.req { color: var(--wine); font-weight: 400; font-size: 12px; margin-left: 6px; letter-spacing: .04em; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; text-align: left; line-height: 1.3; transition: border-color .15s, background .15s; }
.opt:hover { border-color: var(--muted); }
.opt .dot { width: 15px; height: 15px; border: 1.5px solid var(--muted); border-radius: 50%; flex: none; transition: all .15s; }
.opt.checkbox .dot { border-radius: 4px; }
.opt[aria-checked="true"] { background: var(--sel); border-color: var(--wine); }
.opt[aria-checked="true"] .dot { background: var(--wine); border-color: var(--wine); box-shadow: inset 0 0 0 2.5px var(--sel); }

/* Image cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 14px; }
.cards.four { grid-template-columns: repeat(4, 1fr); }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.two { grid-template-columns: repeat(2, minmax(0, 220px)); }
.cards.sw { grid-template-columns: repeat(4, 1fr); }
.card { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 9px; text-align: center; min-width: 0; }
.card .ph { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 5 / 4; max-width: 100%; box-shadow: 0 0 0 1px var(--line); transition: box-shadow .2s; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.card:hover img { transform: scale(1.04); }
.card[aria-checked="true"] .ph { box-shadow: 0 0 0 2.5px var(--paper), 0 0 0 4.5px var(--wine); }
.card .tick { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--wine); color: var(--wine-ink); display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: all .2s; }
.card .tick svg { width: 14px; height: 14px; }
.card[aria-checked="true"] .tick { opacity: 1; transform: none; }
.card .cap { font-size: 13.5px; }
.card[aria-checked="true"] .cap { font-weight: 700; color: var(--wine); }
.cards.sw .ph { aspect-ratio: 3 / 1; border-radius: 8px; }
.cards.sw .cap { font-size: 12.5px; }

/* Fields */
.field input, .field textarea, .other input { width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .other input:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wine) 18%, transparent); }
.other { margin-top: 10px; max-width: 420px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 16px; }
.err { color: var(--err); font-size: 13px; margin-top: 6px; }

/* Household counters */
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cnt { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 14px 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cnt .lab { font-weight: 700; font-size: 14px; }
.cnt .sub { font-size: 12px; color: var(--muted); margin-top: -6px; }
.cnt .ctl { display: flex; align-items: center; gap: 12px; }
.cnt .n { font-weight: 300; font-size: 30px; line-height: 1; min-width: 1.3em; text-align: center; font-variant-numeric: tabular-nums; }
.cnt button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 18px; line-height: 1; cursor: pointer; }
.cnt button:hover { border-color: var(--ink); }
.total { margin-top: 14px; font-size: 14px; color: var(--muted); }
.total b { color: var(--ink); }

.brandline { font-family: var(--display); font-weight: 500; text-align: center; letter-spacing: .2em; font-size: 13px; color: var(--muted); padding-block: 26px 8px; text-transform: uppercase; }
.nav { position: sticky; bottom: 0; z-index: 4; background: linear-gradient(to bottom, transparent, var(--paper) 28%); }
.nav .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 26px calc(16px + env(safe-area-inset-bottom, 0px)); }

/* Review */
.rv { margin-top: 26px; display: flex; flex-direction: column; }
.rv-g { border-top: 1px solid var(--line); padding-block: 18px; display: flex; flex-direction: column; gap: 10px; }
.rv-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rv-h h3 { font-size: 22px; }
.rv dl { margin: 0; display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 6px 18px; }
.rv dt { color: var(--muted); font-size: 13.5px; }
.rv dd { margin: 0; font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.rv dd.none { color: var(--muted); font-style: italic; }
.sign { margin-top: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.sign h3 { font-size: 24px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--wine); flex: none; }
.sig-preview { font-family: var(--display); font-weight: 500; font-size: 26px; border-bottom: 1px solid var(--line); min-height: 44px; padding-bottom: 4px; }

/* Done */
.done { padding-block: 40px 60px; display: flex; flex-direction: column; gap: 26px; }
.done h2 { font-size: clamp(32px, 5vw, 44px); }
.ref { font-weight: 700; letter-spacing: .08em; color: var(--wine); }
.status { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--sel); font-size: 14px; }
.analysis { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: clamp(20px, 4vw, 34px); display: flex; flex-direction: column; gap: 16px; }
.analysis .headline { font-size: clamp(28px, 4.6vw, 38px); line-height: 1.1; }
.analysis p { max-width: 68ch; line-height: 1.65; }
.analysis h4 { margin: 8px 0 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.analysis ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.analysis li { display: flex; gap: 10px; max-width: 68ch; }
.analysis li::before { content: "◦"; color: var(--wine); font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill { font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.done .btn { text-decoration: none; }

@media (max-width: 720px) {
  .cards.four, .cards.three, .cards.sw { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .two-col { grid-template-columns: 1fr; }
  .counts { grid-template-columns: 1fr; }
  .cnt { flex-direction: row; justify-content: space-between; padding: 12px 14px; }
  .cnt .sub { margin: 0; }
  .rv dl { grid-template-columns: 1fr; gap: 2px; }
  .rv dd { margin-bottom: 8px; }
  .secs span { font-size: 9.5px; letter-spacing: .06em; }
  .btn { padding: 14px 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
