/* Survey D. Survey C's styles (colours, radii, type and buttons from apps/survey), plus survey B's intro
   and the parts D adds: the draw nudge, the optional tag, and the plain-words note the store receives. */
:root {
  --brand-primary: #0f172a;
  --brand-accent: #3b82f6;
  --brand-accent-dark: #2563eb;
  --brand-accent-light: #dbeafe;
  --brand-success: #10b981;
  --brand-success-light: #d1fae5;
  --brand-warm: #f59e0b;
  --brand-warm-light: #fef3c7;
  --brand-surface: #f8fafc;
  --brand-card: #ffffff;
  --brand-muted: #94a3b8;
  --text-soft: #475569;
  --line: #e2e8f0;
  --radius-card: 12px;
  --radius-button: 10px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --touch: 44px;
  --mark: 42px; /* the three map buttons: 42px with 4px gaps keeps targets comfortable */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--brand-surface);
  color: var(--brand-primary);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; }

.app {
  max-width: 32rem;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(6px);
}
.top__brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top__logo { width: 24px; height: 24px; object-fit: contain; flex: none; }
.top__dealer { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; gap: 6px; flex: none; }
.dots span { width: 22px; height: 6px; border-radius: 3px; background: var(--line); transition: background 0.2s; }
.dots span.is-on { background: var(--brand-accent); }

/* ---------- body ---------- */
.screen { flex: 1; padding: 4px 20px 112px; animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: 20px; line-height: 1.25; font-weight: 600; margin: 4px 0 4px; }
.lede { font-size: 13.5px; line-height: 1.4; color: var(--text-soft); margin: 0 0 8px; }

/* ---------- the map ---------- */
.legend {
  position: sticky;
  top: 44px;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr repeat(3, var(--mark));
  column-gap: 4px;
  padding: 4px 8px 4px 0;
  background: rgba(248, 250, 252, 0.95);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  text-align: center;
}
.legend span:first-child { text-align: left; }

.group { position: relative; margin: 0; padding: 0; list-style: none; }
.group__label {
  margin: 8px 0 3px 30px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-muted);
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 1fr repeat(3, var(--mark));
  column-gap: 4px;
  align-items: center;
  margin: 0 0 5px 30px;
  padding: 4px 8px 4px 12px;
  min-height: 50px;
  background: var(--brand-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, background 0.15s;
}
.step__label { font-size: 14px; line-height: 1.3; font-weight: 500; padding-right: 4px; }

/* the rail and its nodes */
.step::before {
  content: "";
  position: absolute;
  left: -20px;
  top: -8px;
  bottom: -8px;
  width: 2px;
  background: var(--line);
}
.map > .group:first-child .step:first-of-type::before { top: 50%; }
.map > .group:last-child .step:last-of-type::before { bottom: 50%; }
.step__node {
  position: absolute;
  left: -29px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--brand-card);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  transition: background 0.15s, border-color 0.15s;
}
.step[data-state="yes"] { border-color: var(--brand-success); }
.step[data-state="yes"] .step__node { background: var(--brand-success); border-color: var(--brand-success); }
.step[data-state="no"] { border-color: var(--brand-warm); }
.step[data-state="no"] .step__node { background: var(--brand-warm); border-color: var(--brand-warm); }
.step[data-state="unsure"] .step__node { background: var(--brand-muted); border-color: var(--brand-muted); }

/* the three choices */
.choice {
  width: var(--mark);
  height: var(--mark);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: #fff;
  color: var(--brand-muted);
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.choice svg { width: 20px; height: 20px; }
.choice:active { transform: scale(0.94); }
.choice[aria-checked="true"][data-value="yes"] { background: var(--brand-success-light); border: 2px solid var(--brand-success); color: #047857; }
.choice[aria-checked="true"][data-value="no"] { background: var(--brand-warm-light); border: 2px solid var(--brand-warm); color: #b45309; }
.choice[aria-checked="true"][data-value="unsure"] { background: #f1f5f9; border: 2px solid var(--brand-muted); color: var(--text-soft); }

/* ---------- outcome screen ---------- */
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  background: var(--brand-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.option:active { transform: scale(0.985); }
.option__radio { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--brand-muted); display: grid; place-items: center; }
.option[aria-checked="true"] { border: 2px solid var(--brand-accent); background: var(--brand-accent-light); padding: 11px 15px; }
.option[aria-checked="true"] .option__radio { border-color: var(--brand-accent); }
.option[aria-checked="true"] .option__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-accent); }

.block { margin-top: 22px; scroll-margin-top: 56px; animation: rise 0.2s ease-out; }
.block h2 { font-size: 16px; line-height: 1.3; font-weight: 600; margin: 0 0 4px; }
.hint { font-size: 12px; line-height: 1.4; color: var(--text-soft); margin: 4px 0 10px; }
.block .pills + .hint { margin: 8px 0 0; }
.text {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
  line-height: 1.4;
  color: var(--brand-primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  resize: vertical;
}
.text:focus { outline: 2px solid var(--brand-accent); outline-offset: 0; border-color: transparent; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-height: var(--touch);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pill:disabled { opacity: 0.45; cursor: not-allowed; }
.pill[aria-checked="true"] { border: 2px solid var(--brand-accent); background: var(--brand-accent-light); color: var(--brand-primary); padding: 9px 15px; }

/* ---------- bottom bar ---------- */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  background: #fff;
  border-top: 1px solid #f1f5f9;
  padding: 10px 20px max(14px, env(safe-area-inset-bottom, 14px));
}
.nav__inner { max-width: 32rem; margin: 0 auto; }
.nav__count { font-size: 12px; color: var(--text-soft); text-align: center; margin: 0 0 6px; }
.nav__row { display: flex; gap: 12px; }
.btn {
  min-height: 48px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn--primary { flex: 1; background: var(--brand-accent); color: #fff; }
.btn--primary:hover { background: var(--brand-accent-dark); }
.btn--primary:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--text-soft); font-size: 14px; font-weight: 500; }

/* ---------- finished ---------- */
.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; animation: rise 0.3s ease-out; }
.done__tick { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-success-light); color: #047857; display: grid; place-items: center; margin-bottom: 20px; }
.done__tick svg { width: 32px; height: 32px; }
.done h1 { font-size: 26px; font-weight: 700; }
.done p { font-size: 15px; line-height: 1.5; color: var(--text-soft); max-width: 22rem; margin: 6px 0; }
.receipt { width: 100%; margin-top: 24px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); padding: 12px 14px; }
.receipt summary { font-size: 13px; font-weight: 600; cursor: pointer; }
.receipt pre { font-size: 11px; line-height: 1.45; overflow-x: auto; margin: 10px 0 0; color: var(--text-soft); }
.linkish { margin-top: 18px; background: none; border: 0; color: var(--brand-accent); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: underline; }

.foot { font-size: 11px; line-height: 1.45; color: var(--brand-muted); text-align: center; margin: 16px 0 0; }

:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

@media (max-width: 359px) {
  :root { --touch: 40px; --mark: 38px; }
  .screen, .top, .nav { padding-left: 14px; padding-right: 14px; }
  .step__label { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* One-line note under 'When is a good time?' */
.text--line{min-height:0;height:46px;margin-top:10px;resize:none}

/* ---------- intro (survey B's front door) ---------- */
.intro { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; animation: rise 0.3s ease-out; }
.intro__logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 18px; }
.intro__dealer { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-muted); margin: 0 0 8px; }
.intro h1 { font-size: 30px; line-height: 1.15; font-weight: 700; margin: 0 0 10px; }
.intro__lede { font-size: 16px; line-height: 1.5; color: var(--text-soft); max-width: 22rem; margin: 0 0 16px; }
.intro__draw { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #92400e; background: var(--brand-warm-light); border: 1px solid #fde68a; border-radius: 999px; padding: 9px 16px; margin: 0 0 24px; max-width: 24rem; }
.btn--wide { flex: none; width: 100%; max-width: 24rem; }
.intro .foot { max-width: 22rem; margin-top: 18px; }

/* ---------- small additions ---------- */
.opt { font-size: 12px; font-weight: 500; color: var(--brand-muted); margin-left: 4px; }
#sub-block { margin-top: 18px; scroll-margin-bottom: 120px; }

/* The chosen answer's card opens downward to hold the optional "where" question. */
.option.is-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; padding-bottom: 12px; box-shadow: none; }
.option__more {
  position: relative;
  margin-top: -11px; /* close the gap between options and overlap by a pixel, so the two read as one card with no seam */
  padding: 3px 15px 14px 47px; /* the words line up with the answer's words above */
  background: var(--brand-accent-light);
  border: 2px solid var(--brand-accent);
  border-top: 0;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  scroll-margin-bottom: 120px;
  animation: open 0.2s ease-out;
}
@keyframes open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.option__ask { display: block; font-size: 14px; font-weight: 600; color: var(--brand-primary); margin: 0 0 8px; }
.option__more .text--line { margin-top: 0; background: #fff; border-color: #bfdbfe; }
.nav__nudge { color: #92400e; font-weight: 600; animation: rise 0.3s ease-out; }

/* ---------- thank-you additions ---------- */
.done__draw { font-weight: 600; color: #92400e !important; }
.receipt__label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--brand-muted); margin: 0 0 8px; }
.note { margin: 0; font-size: 13.5px; line-height: 1.45; }
.note__head { font-size: 13px; font-weight: 600; color: var(--brand-primary); margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.note__row { display: grid; grid-template-columns: 9.5rem 1fr; gap: 10px; padding: 5px 0; }
.note__row dt { font-weight: 600; color: var(--text-soft); }
.note__row dd { margin: 0; color: var(--brand-primary); }
.note__row.is-hot { background: #fee2e2; border-radius: 8px; padding: 6px 8px; margin: 2px -8px 4px; }
.note__row.is-hot dt, .note__row.is-hot dd { color: #991b1b; font-weight: 600; }
.note__row.is-warn dd { color: #b45309; font-weight: 600; }
.raw { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.raw summary { font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer; }
.raw pre { font-size: 11px; line-height: 1.45; overflow-x: auto; margin: 10px 0 0; color: var(--text-soft); }
@media (max-width: 420px) { .note__row { grid-template-columns: 1fr; gap: 0; } }

/* ---------- even choices (replaces the wrap-to-fit chips) ---------- */
/* Grid: two equal cards to a row, every card the same height in its group. */
.pills--grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; }
.pills--grid .pill {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 10px 14px;
  text-align: left;
  line-height: 1.3;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.pills--grid .pill:active { transform: scale(0.985); }
.pills--grid .pill[aria-checked="true"] { padding: 9px 13px; }
/* Cards with a picture are taller, and keep their words clear of it. */
.pills--grid .pill.has-mark { min-height: 76px; align-items: flex-start; padding-right: 40px; }
.pills--grid .pill.has-mark[aria-checked="true"] { padding: 9px 39px 9px 13px; }
.pill__label { position: relative; z-index: 1; }
.pill__mark {
  position: absolute;
  right: -6px;
  bottom: -8px;
  width: 52px;
  height: 52px;
  color: var(--brand-primary);
  opacity: 0.1;
  transform: rotate(-8deg);
  pointer-events: none;
  transition: opacity 0.15s, color 0.15s;
}
.pill__mark svg { width: 100%; height: 100%; }
.pill[aria-checked="true"] .pill__mark { color: var(--brand-accent); opacity: 0.32; }

/* Rows: full width with a radio dot, like the first screen's answers. */
.pills--rows { display: flex; flex-direction: column; gap: 8px; }
.pills--rows .pill {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  text-align: left;
  line-height: 1.3;
  border-radius: var(--radius-card);
}
.pills--rows .pill[aria-checked="true"] { padding: 9px 13px; }
.pill__radio { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand-muted); display: grid; place-items: center; }
.pill[aria-checked="true"] .pill__radio { border-color: var(--brand-accent); }
.pill[aria-checked="true"] .pill__radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-accent); }

@media (max-width: 359px) {
  .pills--grid .pill { font-size: 13px; }
  .pills--grid .pill.has-mark { padding-right: 32px; }
}
.note__row.is-quiet dt, .note__row.is-quiet dd { color: var(--brand-muted); }
/* The reason-based hint under the open question: easy to read, still clearly a hint. */
#comment-hint { font-size: 13.5px; color: #334155; }
