:root {
  --bg: #ffffff;
  --ink: #141414;
  --muted: #5f5f5f;
  --faint: #8a8a8a;
  --line: #ececec;
  --fill: #f2f2f2;
  --fill-hover: #e8e8e8;
  --pad: 18px;
  --stage: min(520px, calc(100% - (var(--pad) * 2)));
  --sans: "Geist", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tap: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 2px;
  background: var(--fill);
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.4s var(--ease);
}

.chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 16;
  display: flex;
  align-items: center;
  height: 52px;
  padding: calc(8px + env(safe-area-inset-top)) var(--pad) 0;
  background: var(--bg);
}

.brand-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
}

.stage {
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(68px + env(safe-area-inset-top)) var(--pad) calc(108px + env(safe-area-inset-bottom));
}

.scene {
  width: var(--stage);
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: in 0.4s var(--ease) both;
}

.scene.is-out {
  animation: out 0.24s var(--ease) forwards;
}

.scene.is-out-back,
.scene.from-back {
  animation-name: in;
}

@keyframes in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.kicker {
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.q-title,
.welcome h1,
.review h2,
.thanks h2 {
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.helper,
.lede,
.review-lead,
.thanks p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
}

.nudge:empty {
  display: none;
}

.nudge {
  margin-top: 8px;
  color: #8a4a42;
  font-size: 0.86rem;
}

.field-wrap {
  margin-top: 16px;
}

.line-field input,
.line-field textarea {
  width: 100%;
  padding: 10px 0;
  font-size: 16px;
  outline: none;
  resize: none;
}

.line-field textarea {
  min-height: 88px;
  line-height: 1.45;
}

.line-field input::placeholder,
.line-field textarea::placeholder {
  color: #b3b3b3;
}

.line-field .rule {
  display: block;
  height: 1px;
  background: var(--line);
}

.line-field:focus-within .rule,
.line-field.has-value .rule {
  background: var(--ink);
}

.line-field + .line-field {
  margin-top: 6px;
}

.choices,
.cards,
.yesno {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.choice,
.card-opt,
.yn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  text-align: left;
  padding: 10px 12px;
  background: var(--fill);
}

.card-opt {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 11px 12px;
}

.choice:hover,
.card-opt:hover,
.yn:hover,
.skip:hover,
.back:hover {
  background: var(--fill-hover);
}

.choice.is-on,
.card-opt.is-on,
.yn.is-on {
  background: var(--ink);
  color: var(--bg);
}

.choice-label,
.card-label,
.yn .l {
  font-size: 0.95rem;
}

.card-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.card-opt.is-on .card-hint {
  color: rgba(255, 255, 255, 0.62);
}

.choices + .choice {
  margin-top: 6px;
}

.other-field {
  margin-top: 6px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.28s var(--ease), opacity 0.28s var(--ease);
}

.other-field.is-open {
  max-height: 64px;
  opacity: 1;
}

.inspire {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.inspire-block h3 {
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.welcome h1 {
  font-size: 1.5rem;
  text-align: center;
}

.for-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 1rem;
  color: var(--muted);
}

.for-line input {
  flex: 1;
  min-width: 0;
  max-width: 280px;
  border-bottom: 1px solid var(--line);
  padding: 2px 0 3px;
  text-align: center;
  outline: none;
}

.for-line input:focus {
  border-bottom-color: var(--ink);
}

.lede {
  margin-top: 16px;
  text-align: center;
}

.lede p + p {
  margin-top: 8px;
}

.notice {
  margin-top: 12px;
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
}

.review-list {
  margin-top: 10px;
  max-height: min(50vh, 380px);
  overflow: auto;
  display: grid;
  gap: 4px;
}

.review-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: var(--fill);
}

.review-item:hover {
  background: var(--fill-hover);
}

.review-item .q {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  color: var(--faint);
}

.review-item .a.is-empty {
  color: var(--faint);
}

.thanks-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.thanks-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  background: var(--fill);
  font-size: 0.88rem;
}

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.back,
.skip,
.ok {
  min-height: var(--tap);
}

.back {
  width: var(--tap);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--fill);
}

.back span {
  width: 8px;
  height: 8px;
  border-left: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(45deg) translate(2px, -1px);
}

.dock-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 0 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.92rem;
  font-weight: 500;
}

.ok.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.kbd {
  display: none;
  min-width: 40px;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.skip {
  padding: 0 12px;
  background: var(--fill);
  color: var(--ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

.skip-long {
  display: none;
}

input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 9999s;
}

@media (min-width: 720px) {
  :root {
    --pad: 28px;
  }

  .chrome {
    height: 56px;
  }

  .brand-logo {
    height: 30px;
  }

  .ok {
    flex: none;
  }

  .dock {
    justify-content: flex-end;
    background: transparent;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .dock-main {
    flex: none;
  }

  .skip-short {
    display: none;
  }

  .skip-long {
    display: inline;
  }

  .q-title,
  .welcome h1,
  .review h2,
  .thanks h2 {
    font-size: 1.55rem;
  }

  .yesno {
    grid-template-columns: 1fr 1fr;
  }

  .kbd {
    display: inline-grid;
    place-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene,
  .scene.is-out {
    animation: none;
  }
}
