:root {
  --cream: #f5ede3;
  --cream-dark: #ede5da;
  --charcoal: #3c3c32;
  --body: #5c5c4d;
  --muted: #8a8a7a;
  --gold: #c5b9a8;
  --olive: #6b6b5a;
  --olive-dark: #4a4a3e;
  --olive-banner: #777b6d;
  --line: #d5cdbf;
  --white: #fffaf3;
  --danger: #8f4a3f;
  --shadow: rgba(74, 74, 62, 0.12);
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  font-family: "DM Sans", sans-serif;
  color: var(--charcoal);
  background: var(--cream);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2rem, 3vw, 3.15rem);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.08;
}

h2 {
  max-width: 22ch;
  font-size: clamp(1.85rem, 2.5vw, 2.75rem);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.12;
}

h3 {
  color: var(--charcoal);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.site-header {
  width: min(70rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.15rem 0;
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(213, 205, 191, 0.74);
}

.wordmark {
  color: var(--charcoal);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.experience {
  width: min(72rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 4.8rem);
  display: grid;
  grid-template-columns: minmax(18rem, 0.78fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: stretch;
}

.step-gate .experience {
  width: min(72rem, calc(100% - 3rem));
  min-height: calc(100vh - 6rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 4.8rem);
  display: grid;
  grid-template-columns: minmax(18rem, 0.78fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2rem);
  align-content: center;
  background: transparent;
}

.step-gate .intro {
  position: static;
  max-width: none;
  padding: clamp(2rem, 4vw, 3.25rem);
  text-align: left;
}

.step-gate .intro h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.15rem);
  line-height: 1.08;
  color: var(--white);
}

.step-gate .side-copy {
  max-width: 31ch;
  margin: 0;
  color: rgba(255, 250, 243, 0.88);
  font-size: 0.95rem;
  line-height: 1.75;
}

.step-gate .framework,
.step-gate .topline {
  display: none;
}

.step-gate .workspace {
  width: 100%;
  margin: 0 auto;
}

.step-gate .panel {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid rgba(213, 205, 191, 0.88);
  background: rgba(255, 252, 246, 0.7);
}

.step-gate .panel-header {
  width: auto;
  margin: 0;
  padding-top: 0;
  border-top: 0;
  text-align: left;
}

.step-gate h2 {
  max-width: 22ch;
  font-size: clamp(1.85rem, 2.5vw, 2.75rem);
}

.step-gate .two {
  grid-template-columns: 1fr;
}

.step-gate .actions {
  justify-content: flex-start;
  padding-top: 0.15rem;
}

.step-gate label {
  text-align: left;
}

.step-gate input {
  min-height: 48px;
  background: rgba(255, 250, 243, 0.86);
}

.intro {
  position: sticky;
  top: 1.5rem;
  display: grid;
  min-height: min(43rem, calc(100vh - 8rem));
  gap: 1.15rem;
  align-content: center;
  padding: clamp(2rem, 4vw, 3.25rem);
  border: 1px solid rgba(74, 74, 62, 0.08);
  border-radius: 10px;
  background: var(--olive-banner);
  color: var(--white);
}

.eyebrow {
  color: rgba(255, 250, 243, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.side-copy {
  max-width: 31ch;
  color: rgba(255, 250, 243, 0.84);
  font-size: 0.98rem;
  line-height: 1.82;
}

.framework {
  display: grid;
  gap: 0.68rem;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.framework span {
  display: grid;
  grid-template-columns: 5.8rem 1fr;
  gap: 0.85rem;
  align-items: baseline;
  color: rgba(92, 92, 77, 0.86);
  font-size: 0.86rem;
}

.framework strong {
  color: var(--olive);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main {
  min-width: 0;
}

.workspace {
  width: 100%;
  display: grid;
  gap: 1rem;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.progress {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.dot {
  width: clamp(1.3rem, 3vw, 2rem);
  height: 0.12rem;
  border-radius: 999px;
  background: var(--line);
}

.dot.active {
  background: var(--olive);
}

.panel {
  position: relative;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  display: grid;
  gap: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(213, 205, 191, 0.88);
  border-radius: 10px;
  background: rgba(255, 252, 246, 0.62);
  box-shadow: none;
}

.consultation-panel,
.conversation-panel {
  min-height: min(43rem, calc(100vh - 8rem));
  align-content: center;
}

.question-block {
  display: grid;
  gap: 0.72rem;
}

.speaker {
  color: var(--olive);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel::before {
  content: none;
}

.panel-header {
  display: grid;
  gap: 0.8rem;
}

.lead {
  max-width: 45ch;
  color: var(--body);
  font-size: 0.96rem;
  line-height: 1.7;
}

.form-grid {
  display: grid;
  gap: 1.05rem;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-field,
.form-actions,
.return-link {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.42rem;
  color: var(--charcoal);
  font-size: 0.86rem;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 0.95rem;
  border: 1px solid #c9beae;
  border-radius: 4px;
  outline: none;
  background: rgba(255, 250, 243, 0.72);
  color: var(--charcoal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 7.5rem;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: rgba(138, 138, 122, 0.78);
}

input:focus,
textarea:focus {
  border-color: var(--olive);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(107, 107, 90, 0.22);
}

.actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

.form-actions {
  justify-content: center;
  margin-top: 0.25rem;
}

.btn {
  min-height: 48px;
  min-width: 200px;
  padding: 0 1.75rem;
  border: 1px solid var(--olive);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--olive);
  color: var(--cream);
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  min-height: 48px;
  min-width: 200px;
  padding: 0 28px;
  border-radius: 4px;
  background: #666756;
  color: #fffaf2;
  font-weight: 700;
}

.btn:hover {
  transform: translateY(-1px);
  background: #555747;
  border-color: #555747;
  box-shadow: 0 0.75rem 1.75rem rgba(74, 74, 62, 0.16);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible,
.route:focus-visible,
.chip:focus-visible,
.history-item:focus-visible,
.return-link:focus-visible {
  outline: 3px solid rgba(107, 107, 90, 0.24);
  outline-offset: 3px;
}

.field-note {
  max-width: 38rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
}

.return-link {
  width: fit-content;
  margin: 0.15rem auto 0;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: var(--body);
  cursor: pointer;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: rgba(92, 92, 77, 0.34);
  text-underline-offset: 0.22rem;
}

.return-link:hover,
.text-button:hover {
  color: var(--olive-dark);
  text-decoration-color: currentColor;
}

.text-button {
  width: fit-content;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: var(--body);
  cursor: pointer;
  font-weight: 650;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(92, 92, 77, 0.34);
  text-underline-offset: 0.22rem;
}

.btn.secondary {
  background: transparent;
  color: var(--olive-dark);
}

.btn.secondary:hover {
  background: var(--cream-dark);
  border-color: var(--olive);
  box-shadow: none;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--body);
}

.btn.ghost:hover {
  background: rgba(237, 229, 218, 0.78);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.route,
.history-item {
  min-height: 8.75rem;
  padding: 1rem;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.88);
  color: var(--body);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.route:hover,
.history-item:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 1rem 2.2rem rgba(74, 74, 62, 0.09);
}

.route.selected,
.chip.selected {
  border-color: var(--olive);
  background: linear-gradient(180deg, #f1eadf, #ece2d5);
}

.route strong,
.history-item strong {
  color: var(--charcoal);
  font-size: 1.14rem;
  line-height: 1.25;
}

.route span,
.history-item span {
  line-height: 1.58;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--space-2);
}

.custom-value {
  display: grid;
  gap: var(--space-2);
  align-items: start;
}

.custom-value > .chip {
  width: fit-content;
}

.custom-value-field {
  max-width: 28rem;
}

.chip {
  min-height: 3rem;
  padding: 0.25rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.9);
  color: var(--charcoal);
  line-height: 1.25;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.trigger-list {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.conversation-panel {
  align-content: center;
}

.phase-card,
.stuck-panel {
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.45rem;
  border: 1px solid rgba(213, 205, 191, 0.86);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.72);
}

.phase-card span {
  color: var(--olive);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase-card p,
.stuck-panel p {
  color: var(--body);
  font-size: 0.92rem;
  line-height: 1.55;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.helper-chip {
  min-height: 2.5rem;
}

.conversation {
  max-height: min(50vh, 29rem);
  padding: 0;
  display: grid;
  gap: 0.75rem;
  overflow: auto;
  border: 0;
  background: transparent;
}

.message {
  width: min(42rem, 96%);
  padding: 1rem;
  display: grid;
  gap: var(--space-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.message.quiet {
  opacity: 0.66;
}

.message.current {
  padding: clamp(1.15rem, 3vw, 1.7rem);
  border-color: rgba(107, 107, 90, 0.42);
}

.message.current p {
  color: var(--charcoal);
  font-size: clamp(1.08rem, 1.8vw, 1.28rem);
  line-height: 1.55;
}

.message.user {
  justify-self: end;
  border-color: rgba(107, 107, 90, 0.34);
  background: #ece2d5;
}

.message.thinking p::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  animation: ellipsis 1.2s steps(4, end) infinite;
}

@keyframes ellipsis {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

.message span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.message p {
  color: var(--body);
  line-height: 1.65;
}

.report {
  gap: var(--space-4);
}

.report-section {
  padding-top: var(--space-3);
  display: grid;
  gap: var(--space-1);
  border-top: 1px solid var(--line);
}

.report-section p {
  max-width: 74ch;
  color: var(--body);
  line-height: 1.74;
}

.notice,
.error {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  line-height: 1.48;
}

.notice {
  border: 1px solid var(--line);
  background: var(--cream-dark);
  color: var(--body);
}

.error {
  border: 1px solid rgba(143, 74, 63, 0.22);
  background: #f7e2dc;
  color: var(--danger);
}

.history-list {
  display: grid;
  gap: var(--space-2);
}

.history-item {
  min-height: 0;
}

.history-item:disabled {
  cursor: default;
  opacity: 0.82;
  transform: none;
}

.history-item:disabled:hover {
  border-color: var(--line);
  box-shadow: none;
}

.small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 980px) {
  .experience,
  .step-gate .experience {
    grid-template-columns: 1fr;
    position: static;
    padding: clamp(1.75rem, 6vw, 3rem) 0;
    gap: var(--space-5);
  }

  .intro {
    position: static;
    order: 2;
    min-height: auto;
  }

  .main {
    order: 1;
  }

  .framework {
    display: none;
  }

  h1 {
    max-width: 18ch;
  }
}

@media (max-width: 720px) {
  .topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .two,
  .route-grid {
    grid-template-columns: 1fr;
  }

  .route {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(1.9rem, 9vw, 2.55rem);
  }

  h2 {
    font-size: clamp(1.65rem, 8vw, 2.2rem);
  }

  .panel {
    padding: 1.25rem;
  }

  .actions {
    display: grid;
  }

  .consultation-panel,
  .conversation-panel {
    min-height: auto;
  }

  .btn {
    width: 100%;
  }
}
