:root {
  --paper: #fffaf4;
  --paper-deep: #f4ecdf;
  --ink: #20211f;
  --muted: #67655f;
  --line: #d8d0c5;
  --accent: #e84f35;
  --accent-dark: #b92d18;
  --mint: #188269;
  --focus: #116dff;
  --white: #ffffff;
  --shadow: 0 22px 55px rgba(58, 46, 35, 0.14);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 12px 16px;
  transform: translateY(-150%);
  background: var(--ink);
  color: var(--white);
  border-radius: 4px;
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.site-header {
  width: min(1200px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 850;
  text-decoration: none;
}
.brand-mark { width: 40px; height: 40px; color: var(--accent); }
.quiet-link { color: var(--muted); font-size: 16px; font-weight: 700; text-underline-offset: 4px; }

.hero {
  padding: clamp(24px, 5vw, 68px) max(16px, calc((100vw - 1200px) / 2)) 84px;
  background:
    linear-gradient(rgba(216, 208, 197, .45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 208, 197, .45) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
  border-bottom: 1px solid var(--line);
}
.hero-copy { max-width: 820px; margin-bottom: 34px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1, h2 { line-height: 1.02; letter-spacing: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 900;
}
h2 { font-size: clamp(34px, 5vw, 60px); font-weight: 900; }
.hero-intro { max-width: 690px; margin-bottom: 0; color: var(--muted); font-size: clamp(19px, 2vw, 23px); }

.demo-shell {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.demo-disclaimer {
  margin: 0;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--white);
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}
.demo-disclaimer span { color: #ffcb45; }
.setup-panel { display: grid; grid-template-columns: 1fr 220px; gap: 28px 36px; padding: clamp(22px, 4vw, 42px); }
.choice-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-group legend, .rating-field legend { margin-bottom: 14px; font-size: 17px; font-weight: 850; }
.personality-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.personality-option { position: relative; min-width: 0; cursor: pointer; }
.personality-option input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.choice-copy {
  min-height: 106px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.choice-copy strong { display: block; font-size: 18px; }
.choice-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.35; }
.personality-option input:checked + .choice-copy { border-color: var(--accent); background: #fff3ef; }
.personality-option input:focus-visible + .choice-copy { outline: 3px solid var(--focus); outline-offset: 2px; }
.personality-option:active .choice-copy { transform: scale(.98); }

.compact-group { align-self: start; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented label { position: relative; min-width: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { min-height: 50px; display: grid; place-items: center; padding: 7px 9px; background: var(--white); color: var(--muted); font-size: 15px; font-weight: 800; text-align: center; border-right: 1px solid var(--line); }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--ink); color: var(--white); }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--focus); }

.setup-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button {
  min-height: 52px;
  padding: 12px 18px;
  border: 2px solid transparent;
  border-radius: 5px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}
.button:active { transform: translateY(1px); }
.button-primary { background: var(--accent); color: var(--white); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { background: var(--white); border-color: var(--ink); }
.button-secondary:hover { background: #f2f0eb; }
.voice-note { align-self: center; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

.journey-panel { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); }
.map-stage { position: relative; min-height: 520px; overflow: hidden; background: var(--paper-deep); }
#demo-map { display: block; width: 100%; height: 100%; min-height: 520px; }
.map-blocks { fill: #e7dccd; stroke: #d5c8b6; stroke-width: 2; }
.roads { fill: none; stroke: #fffaf4; stroke-width: 24; stroke-linecap: round; }
.roads path { filter: drop-shadow(0 0 1px #cabba8); }
.route-line { fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.route-muted { stroke: #cbbaaa; stroke-width: 5; stroke-dasharray: 6 12; }
.route-hidden { visibility: hidden; }
.route-terminal { fill: var(--accent); stroke: var(--white); stroke-width: 4; }
.destination-ring { fill: var(--white); stroke: var(--accent); stroke-width: 4; }
.vehicle-marker { filter: drop-shadow(0 3px 5px rgba(32, 33, 31, .25)); }
.vehicle-marker circle { fill: var(--ink); stroke: var(--white); stroke-width: 4; }
.vehicle-marker path { fill: var(--white); }
.map-label rect { fill: var(--white); stroke: #cfc2b1; }
.map-label text { fill: var(--ink); font: 700 14px system-ui, sans-serif; }
.map-badge, .recalculating { position: absolute; top: 16px; padding: 9px 12px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 4px; font-size: 14px; font-weight: 800; }
.map-badge { left: 16px; }
.recalculating { right: 16px; color: var(--accent-dark); }

.journey-readout { padding: clamp(22px, 3.4vw, 40px); border-left: 1px solid var(--line); }
.progress-row { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 14px; font-weight: 750; }
.progress-track { height: 6px; margin: 11px 0 30px; overflow: hidden; background: var(--paper-deep); border-radius: 2px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s linear; }
.message-block { min-height: 124px; padding: 18px 0; border-top: 1px solid var(--line); }
.message-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 850; text-transform: uppercase; }
.message-block p { margin: 0; font-size: clamp(21px, 2.1vw, 28px); line-height: 1.2; font-weight: 800; }
.joke-block p { color: var(--accent-dark); }
.playback-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.icon-button { min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--white); font-size: 22px; cursor: pointer; }
.icon-button:hover { background: #f5f1eb; }
.control-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.status-message { margin: 16px 0 0; padding: 12px; background: #fff5d7; border-left: 4px solid #d59c00; font-size: 14px; }

.feedback-panel { padding: clamp(26px, 5vw, 56px); animation: reveal .35s ease both; }
.feedback-panel > p:not(.eyebrow) { color: var(--muted); }
.feedback-panel form { max-width: 760px; }
.rating-field { margin: 26px 0; padding: 0; border: 0; }
.number-rating { display: grid; grid-template-columns: repeat(5, 52px); gap: 8px; }
.number-rating label { position: relative; }
.number-rating input { position: absolute; opacity: 0; }
.number-rating span { width: 52px; min-height: 52px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; font-weight: 800; cursor: pointer; }
.number-rating input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--white); }
.number-rating input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.three-way { max-width: 420px; }
.comment-field { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; font-weight: 850; }
.comment-field span { color: var(--muted); font-size: 14px; font-weight: 600; }
textarea { width: 100%; margin-top: 8px; padding: 14px; resize: vertical; border: 1px solid #938c82; border-radius: 4px; background: var(--white); color: var(--ink); }
.feedback-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.copy-fallback { max-width: 760px; margin-top: 20px; padding: 18px; background: #fff5d7; border-left: 4px solid #d59c00; }
.copy-status { min-height: 1.5em; margin: 15px 0 0; color: var(--mint); font-weight: 750; }

.about-section, .faq-section, footer { width: min(1100px, calc(100% - 32px)); margin-inline: auto; }
.about-section { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(40px, 8vw, 110px); padding: 110px 0; border-bottom: 1px solid var(--line); }
.about-section h2 { margin: 0; }
.about-copy { color: var(--muted); }
.about-copy ol { margin: 30px 0 0; padding: 0; list-style: none; counter-reset: steps; }
.about-copy li { position: relative; padding: 17px 0 17px 48px; border-top: 1px solid var(--line); counter-increment: steps; }
.about-copy li::before { content: counter(steps, decimal-leading-zero); position: absolute; left: 0; color: var(--accent-dark); font-weight: 900; }
.about-copy strong { color: var(--ink); }
.faq-section { max-width: 900px; padding: 100px 0; }
.faq-section h2 { margin-bottom: 34px; }
details { border-top: 1px solid var(--line); }
details:last-child { border-bottom: 1px solid var(--line); }
summary { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 850; cursor: pointer; }
summary::after { content: "+"; color: var(--accent); font-size: 28px; }
details[open] summary::after { content: "−"; }
details p { max-width: 720px; padding: 0 0 22px; color: var(--muted); }
footer { min-height: 130px; display: flex; align-items: center; justify-content: space-between; gap: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer-brand { font-size: 18px; }
footer p { margin: 0; }

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .setup-panel { grid-template-columns: 1fr; }
  .personality-options { grid-template-columns: 1fr; }
  .choice-copy { min-height: 82px; }
  .journey-panel { grid-template-columns: 1fr; }
  .map-stage, #demo-map { min-height: 400px; }
  .journey-readout { border-top: 1px solid var(--line); border-left: 0; }
  .about-section { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 520px) {
  body { font-size: 17px; }
  .site-header { min-height: 68px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .quiet-link { display: none; }
  .hero { padding-top: 20px; padding-bottom: 55px; }
  h1 { font-size: 48px; }
  .hero-intro { font-size: 18px; }
  .setup-panel { padding: 20px 16px 24px; }
  .setup-actions .button { width: 100%; }
  .map-stage, #demo-map { min-height: 330px; }
  .map-badge, .recalculating { top: 10px; padding: 7px 9px; font-size: 12px; }
  .map-badge { left: 10px; }
  .recalculating { right: 10px; }
  .journey-readout { padding: 22px 16px; }
  .message-block { min-height: 112px; }
  .message-block p { font-size: 22px; }
  .number-rating { grid-template-columns: repeat(5, minmax(44px, 1fr)); }
  .number-rating span { width: 100%; }
  .feedback-panel { padding: 28px 16px; }
  .about-section, .faq-section { padding: 74px 0; }
  footer { padding: 28px 0; align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
