:root {
  --ink: #161310;
  --ink-soft: #3c362f;
  --muted: #6f675e;
  --faint: #8a8175;
  --paper: #f3eee6;
  --paper-2: #fffdfb;
  --line: rgba(22, 19, 16, 0.12);
  --rail: #141210;
  --cream: #f7f2eb;
  --sand: #e4c59a;
  --terra: #b5523a;
  --danger: #9c2f2f;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--sand);
  color: var(--ink);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  min-height: 100dvh;
}

.rail {
  background: var(--rail);
  color: var(--cream);
  padding: 2rem 1.75rem 1.4rem;
}

.mark {
  margin: 0 0 1.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sand);
}

.rail h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.7rem, 4vw, 3.5rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  color: var(--cream);
}

.rail h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--sand);
}

.deck {
  margin: 1.1rem 0 0;
  max-width: 22rem;
  color: rgba(247, 242, 235, 0.74);
  font-weight: 300;
  font-size: 1.02rem;
  line-height: 1.55;
}

.steps {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.steps button,
.steps-link {
  position: relative;
  width: 100%;
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: rgba(247, 242, 235, 0.42);
  padding: 0.42rem 0;
  cursor: pointer;
  text-decoration: none;
}

.steps-link {
  color: rgba(247, 242, 235, 0.78);
}

.steps button:hover,
.steps-link:hover {
  color: rgba(247, 242, 235, 0.82);
}

.steps button.is-done {
  color: rgba(247, 242, 235, 0.78);
}

.steps button.is-current {
  color: var(--cream);
  border-bottom-color: var(--sand);
}

.steps .idx {
  width: 1.7rem;
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--sand);
}

.steps .label {
  font-size: 0.98rem;
}

.rail-foot {
  margin: 1.4rem 0 0;
  color: rgba(247, 242, 235, 0.45);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rail-foot a {
  color: inherit;
  text-decoration: none;
}

.rail-foot a:hover {
  color: var(--sand);
}

main {
  background: var(--paper);
  border-left: 3px solid var(--sand);
  min-width: 0;
}

.progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem var(--gutter) 0;
}

.progress-count {
  margin: 0;
  min-width: 4.5rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.track {
  flex: 1;
  height: 2px;
  background: rgba(22, 19, 16, 0.1);
}

.track > span {
  display: block;
  height: 100%;
  width: 12.5%;
  background: var(--terra);
  transition: width 0.4s ease;
}

.stage {
  padding: 1.6rem var(--gutter) 2.2rem;
}

.step {
  display: none;
  position: relative;
}

.step.is-active {
  display: block;
  animation: rise 0.45s ease both;
}

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

.watermark {
  position: absolute;
  z-index: 0;
  top: -0.4rem;
  right: 0;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(6rem, 12vw, 9.5rem);
  line-height: 0.8;
  color: rgba(22, 19, 16, 0.055);
  pointer-events: none;
  user-select: none;
}

.step-body {
  position: relative;
  z-index: 1;
  max-width: 40rem;
}

.kicker {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terra);
}

h2 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 3.15rem);
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.prompt p,
.success-copy,
.draft-note {
  margin: 0 0 0.9rem;
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.draft-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.identity {
  display: flex;
  flex-direction: column;
  gap: 1.55rem;
  margin-top: 1.8rem;
}

.identity label,
.answer,
.other label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.identity label span,
.why > span,
.other label span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.name-input,
.email-input,
.other input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(22, 19, 16, 0.22);
  border-radius: 0;
  padding: 0.4rem 0 0.5rem;
}

.name-input {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.email-input,
.other input {
  font-size: 1.15rem;
}

.name-input:focus,
.email-input:focus,
.other input:focus,
textarea:focus {
  outline: none;
  border-color: var(--terra);
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid rgba(22, 19, 16, 0.14);
  background: var(--paper-2);
  border-radius: 18px;
  padding: 1.05rem 1.1rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

.answer {
  margin-top: 1.35rem;
}

.count {
  align-self: flex-end;
  min-height: 1em;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

.count.is-short {
  color: var(--danger);
}

::placeholder {
  color: #a3988c;
}

.roles {
  border: 0;
  margin: 1.35rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.role {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  min-height: 6.6rem;
  padding: 0.95rem 1rem 1rem;
  background: var(--paper-2);
  border: 1px solid rgba(22, 19, 16, 0.14);
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.role:hover {
  border-color: var(--ink);
}

.role input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.role:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.role:has(input:checked) {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.role-index {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.role:has(input:checked) .role-index {
  color: var(--sand);
}

.role-name {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.other {
  margin-top: 1.15rem;
}

.why {
  margin-top: 1.4rem;
}

.review-item {
  padding: 1.05rem 0;
  border-top: 1px solid var(--line);
}

.review-item h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.review-item p {
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.45;
}

.review-item button {
  margin-top: 0.4rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--terra);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.review-item button:hover {
  color: var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem var(--gutter) 1.15rem;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.hint {
  flex: 1;
  margin: 0;
  min-height: 1.3em;
  color: var(--danger);
  font-size: 0.92rem;
  line-height: 1.4;
}

.nav-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.btn {
  border: 0;
  border-radius: 999px;
  min-width: 11.5rem;
  padding: 0.85rem 1.3rem;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover {
  background: var(--terra);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn.ghost {
  min-width: 6.5rem;
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover {
  background: rgba(22, 19, 16, 0.06);
}

.btn:focus-visible,
.steps button:focus-visible,
.review-item button:focus-visible {
  outline: 2px solid var(--sand);
  outline-offset: 3px;
}

.success {
  padding: 2.2rem var(--gutter) 3rem;
}

.success .btn {
  min-width: 0;
  margin-top: 0.6rem;
}

.noscript {
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--ink);
  color: var(--cream);
}

.record {
  max-width: 44rem;
  padding-bottom: 2.4rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--line);
}

.record:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.record .email-line {
  margin: -0.2rem 0 1.2rem;
  color: var(--muted);
}

.empty-note {
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.65;
}

@media (min-width: 961px) {
  .shell {
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  }

  .rail,
  main {
    height: 100dvh;
    min-height: 0;
  }

  .rail {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }

  .steps {
    margin-top: auto;
    padding-top: 1.5rem;
  }

  main {
    display: flex;
    flex-direction: column;
  }

  .stage {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 960px) {
  .shell {
    display: block;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.85rem 1rem 0.65rem;
  }

  .rail h1,
  .deck {
    display: none;
  }

  .mark {
    margin-bottom: 0.55rem;
  }

  .steps {
    display: flex;
    gap: 0.15rem;
    margin: 0;
    overflow-x: auto;
  }

  .steps li {
    flex: 0 0 auto;
  }

  .steps button,
  .steps-link {
    width: auto;
    padding: 0.3rem 0.45rem 0.4rem;
  }

  .steps .label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .rail-foot {
    display: none;
  }

  main {
    border-left: 0;
    border-top: 3px solid var(--sand);
  }

  .nav {
    position: sticky;
    bottom: 0;
  }

  .watermark {
    display: none;
  }
}

@media (max-width: 640px) {
  .roles {
    grid-template-columns: 1fr;
  }

  .nav {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions .btn {
    flex: 1;
  }

  textarea {
    min-height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
