:root {
  --bone: #efe9dd;
  --ash: #a8a196;
  --ink: #0a090b;
  --line: rgba(239, 233, 221, 0.18);
  --line-strong: rgba(239, 233, 221, 0.42);
  --ember: #e0705a;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --depth: 0;
  color-scheme: dark;
}

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

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--bone);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

/* The room dims as the survey goes deeper. */
.glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(130% 75% at 50% -5%, #34303a 0%, #1b191f 45%, transparent 78%);
  opacity: calc(1 - var(--depth) * 0.9);
  transition: opacity 1.4s ease;
  pointer-events: none;
}

/* ---------- top bar ---------- */

.bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 38rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 6px) 20px 8px 6px;
  font-size: 0.8125rem;
  color: var(--ash);
}

.back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--bone);
  cursor: pointer;
}

.bar-section {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-count {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.progress {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 2px;
  height: 1px;
  background: var(--line);
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bone);
  transition: width 0.5s ease;
}

/* ---------- layout ---------- */

.screen {
  max-width: 38rem;
  margin: 0 auto;
  padding: 24px 20px calc(env(safe-area-inset-bottom) + 40px);
  outline: none;
}

.stack > * + * { margin-top: 24px; }

.enter { animation: rise 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

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

/* ---------- type ---------- */

.title {
  margin: 28px 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.75rem, 14.5vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.tagline {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.375rem, 5.6vw, 1.75rem);
  line-height: 1.25;
}

.lead {
  margin: 16px 0 0;
  color: var(--ash);
}

.prose {
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.5;
}

.prose p { margin: 0; }
.prose p + p { margin-top: 14px; }
.prose .closer { font-style: italic; }

.welcome .prose,
.before-start {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.before-start-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ash);
}

.before-start p { margin: 0; }
.before-start p + p { margin-top: 10px; }

.question {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.625rem, 6.4vw, 2.125rem);
  line-height: 1.2;
  letter-spacing: -0.005em;
  outline: none;
}

.question-lead {
  margin-top: 12px !important;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.375rem;
  line-height: 1.3;
}

.note {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--ash);
}

.stack > .note { margin-top: 12px; }

.note a { color: var(--bone); }

.welcome > .note { margin-top: 24px; }

.error {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  color: var(--ember);
}

.offer {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.375rem;
  line-height: 1.3;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  outline: none;
}

/* ---------- part openers ---------- */

.part,
.done {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 8vh;
}

.part-label {
  margin: 28px 0 0;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash);
}

.part-title {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.25rem, 10vw, 3.25rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
  outline: none;
}

.part-sub {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--ash);
}

.done .part-title { margin-top: 28px; }
.part > .btn { margin-top: 40px; }
.done .prose { margin-top: 28px; }
.done .note { margin-top: 36px; }

/* ---------- mask ---------- */

.mask {
  width: 64px;
  color: var(--bone);
}

.mask svg { display: block; width: 100%; height: auto; }

.mask-fill {
  opacity: var(--veil, 1);
  transition: opacity 1s ease;
}

.mask.falls .mask-fill {
  transform-box: fill-box;
  transform-origin: 100% 20%;
  animation: falls 1.6s 0.5s cubic-bezier(0.5, 0, 0.7, 0.4) forwards;
}

@keyframes falls {
  to { opacity: 0; transform: translate(-14px, 46px) rotate(-16deg); }
}

/* ---------- controls ---------- */

button { font: inherit; }

.btn {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--bone);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.12s ease;
}

.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.28; cursor: default; }

.link {
  display: inline-block;
  min-height: 44px;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: var(--ash);
  font-size: 0.9375rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  cursor: pointer;
}

.stop { text-align: center; margin-top: 28px !important; }

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(239, 233, 221, 0.03);
  color: var(--bone);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.option[aria-pressed='true'] {
  background: var(--bone);
  border-color: var(--bone);
  color: var(--ink);
}

@media (hover: hover) {
  .option:hover { border-color: var(--line-strong); }
  .option[aria-pressed='true']:hover { border-color: var(--bone); }
}

.other { margin-top: 10px; }
.after-options { margin-top: 18px; }

input[type='text'],
input[type='search'],
textarea {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(239, 233, 221, 0.04);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.16s ease;
}

textarea {
  resize: none;
  overflow: hidden;
}

input::placeholder,
textarea::placeholder { color: var(--ash); opacity: 0.75; }

input:focus,
textarea:focus { border-color: var(--bone); }

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 3px;
}

.field-label {
  display: block;
  margin-top: 28px !important;
  font-size: 0.9375rem;
  color: var(--ash);
}

.field-label + input { margin-top: 8px !important; }

.long > * + * { margin-top: 16px; }

.prompt-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1875rem;
  line-height: 1.3;
}

/* ---------- welcome dock ---------- */

.dock {
  position: sticky;
  bottom: 0;
  margin: 28px -20px calc(0px - env(safe-area-inset-bottom) - 40px);
  padding: 28px 20px calc(env(safe-area-inset-bottom) + 14px);
  background: linear-gradient(transparent, var(--ink) 30%);
  text-align: center;
}

.meta {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--ash);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
