:root {
  color-scheme: light;
  --ink: #2b2430;
  --muted: #5d5661;
  --line: #d9d6dc;
  --soft-line: #e8e6ea;
  --tile: #eeedef;
  --tile-hover: #e6e4e8;
  --paper: #ffffff;
  --brand: #2b2430;
  --accent: #f8c84e;
  --danger: #b00020;
  --success: #1f8f4d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ink);
  font-family: "Inter", sans-serif;
  background: var(--paper);
}

button,
input {
  font: inherit;
}

.survey-shell {
  width: 100%;
  min-height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  position: relative;
}

.intro-panel {
  display: none;
  min-height: 62px;
  grid-template-columns: 42px minmax(0, 1fr) minmax(220px, 360px);
  align-items: center;
  gap: 12px;
  padding: 10px clamp(18px, 4vw, 56px);
}

.survey-shell.is-started .intro-panel {
  display: block;
  min-height: 18px;
  padding: 8px clamp(8px, 2vw, 18px) 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
}

.survey-shell.is-complete,
.survey-shell.is-complete .intro-panel,
.survey-shell.is-complete .quiz-panel {
  background: var(--accent);
}

.brand-icon {
  grid-column: 1;
  grid-row: 1 / 4;
  width: 42px;
  height: 42px;
  display: block;
  object-fit: cover;
  border-radius: 8px;
}

.eyebrow {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  grid-column: 2;
  grid-row: 2;
  margin: 0 0 2px;
  font-size: 1.02rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.intro-copy {
  grid-column: 2;
  grid-row: 3;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.progress-wrap {
  grid-column: 3;
  grid-row: 1 / 4;
  align-self: center;
  width: 100%;
}

.survey-shell.is-started .brand-icon,
.survey-shell.is-started .eyebrow,
.survey-shell.is-started h1,
.survey-shell.is-started .intro-copy,
.survey-shell.is-started .progress-meta,
.spark-list {
  display: none;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #a8a5aa;
}

.survey-shell.is-started .progress-track {
  display: none;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 300ms ease;
}

.progress-tiles {
  display: none;
}

.survey-shell.is-started .progress-wrap {
  width: 100%;
}

.survey-shell.is-started .progress-tiles {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 5px;
}

.progress-tile {
  height: 4px;
  border-radius: 999px;
  background: #d7d4da;
  transition: background 220ms ease, transform 220ms ease;
}

.progress-tile.is-complete {
  background: var(--brand);
}

.progress-tile.is-current {
  background: var(--accent);
  transform: scaleY(1.45);
}

.survey-shell.is-complete .progress-tile.is-current {
  background: #fff;
}

.quiz-panel {
  min-height: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: clamp(12px, 3vh, 28px) clamp(18px, 5vw, 64px);
}

.survey-shell:not(.is-started) .quiz-panel {
  min-height: 100dvh;
  align-items: center;
  padding-top: clamp(16px, 4vh, 36px);
  padding-bottom: clamp(16px, 4vh, 36px);
}

.survey-shell.is-started .quiz-panel {
  min-height: calc(100dvh - 14px);
  align-items: center;
  padding-top: clamp(12px, 2vh, 24px);
  padding-bottom: clamp(56px, 9vh, 84px);
}

.welcome-panel,
form,
.success-panel {
  width: min(1120px, 100%);
}

.welcome-panel,
.success-panel {
  text-align: center;
  animation: stageIn 240ms ease;
}

.welcome-panel {
  margin: auto;
}

.brand-logo {
  width: min(260px, 62vw);
  max-height: 92px;
  display: block;
  object-fit: contain;
  object-position: center;
  margin: 0 auto clamp(14px, 3vh, 22px);
  border-radius: 6px;
}

.welcome-panel h2,
.success-panel h2 {
  max-width: none;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(1.55rem, 3.2vw, 2.45rem);
  font-weight: 420;
  line-height: 1.1;
  letter-spacing: 0;
}

.welcome-panel p:not(.eyebrow),
.success-panel p:not(.eyebrow) {
  max-width: 66ch;
  margin: 0 auto 14px;
  color: var(--muted);
  font-size: clamp(0.88rem, 1.45vw, 1.05rem);
  line-height: 1.35;
}

.time-estimate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  vertical-align: middle;
  width: 100%;
}

form {
  min-height: 0;
  display: block;
  animation: stageIn 220ms ease;
}

.name-row,
.field-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.welcome-fields {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0 auto 14px;
  text-align: left;
}

.field-row {
  margin-bottom: 0;
}

.field-row-wide {
  grid-column: 1 / -1;
}

label,
.question-type {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43, 36, 48, 0.1);
}

.question-card {
  min-height: 0;
  display: block;
  width: min(1120px, 100%);
  margin: 0 auto;
  animation: stageIn 220ms ease;
}

.question-card.is-changing {
  animation: stageOut 150ms ease;
}

.question-count {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border-radius: 5px;
  color: #fff;
  background: var(--brand);
  font-size: 0.76rem;
  font-weight: 850;
}

.question-type,
.question-hint {
  display: none;
}

.question-card h2 {
  max-width: min(34ch, 100%);
  margin: 0 0 clamp(12px, 2.2vh, 20px);
  color: var(--ink);
  font-size: clamp(1.45rem, 2.7vw, 2.35rem);
  font-weight: 450;
  line-height: 1.18;
  letter-spacing: 0;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.option-card {
  position: relative;
  min-height: 50px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--tile);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.option-card:hover {
  transform: translateY(-1px);
  border-color: #c8c4cc;
  background: var(--tile-hover);
}

.option-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  pointer-events: auto;
}

.option-key {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #c8c4cc;
  border-radius: 5px;
  color: var(--ink);
  background: #f8f8f9;
  font-size: 0.82rem;
  font-weight: 850;
}

.option-card:has(input:checked) {
  border-color: var(--brand);
  background: #e3e0e5;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.option-card:has(input:checked) .option-key {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.option-copy {
  display: block;
  text-transform: none;
}

.option-title,
.option-detail {
  color: #4a444d;
  font-size: clamp(0.9rem, 1.05vw, 1.08rem);
  font-weight: 400;
  line-height: 1.24;
}

.option-title {
  font-weight: 500;
}

.option-title::after {
  content: ": ";
}

.other-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f5f7;
  animation: stageIn 180ms ease;
}

.rating-scale {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 9px;
  margin-top: 4px;
}

.rating-option {
  display: grid;
  place-items: center;
  min-width: 0;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
}

.rating-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  pointer-events: auto;
}

.rating-option span {
  width: 100%;
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--tile);
  color: #4a444d;
  font-size: 1.08rem;
  font-weight: 700;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.rating-option:hover span {
  transform: translateY(-1px);
  background: var(--tile-hover);
}

.rating-option input:checked + span {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.rating-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.validation-message {
  width: min(1120px, 100%);
  min-height: 20px;
  margin: 8px auto 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 750;
}

.actions {
  width: min(1120px, 100%);
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin: 12px auto 0;
}

.primary-button,
.ghost-button {
  min-width: 78px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.primary-button {
  color: #fff;
  background: var(--brand);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.ghost-button {
  color: var(--brand);
  border: 1px solid var(--line);
  background: #fff;
}

button[hidden],
[hidden] {
  display: none;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.success-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(31, 143, 77, 0.2);
  animation: successPop 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.success-mark {
  width: 116px;
  height: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  margin: 0 auto 4px;
  pointer-events: none;
}

.success-mark span {
  --ray-tilt: 0deg;
  width: 3px;
  height: 16px;
  border-radius: 999px;
  background: rgba(43, 36, 48, 0.38);
  transform-origin: bottom center;
  animation: successRay 900ms ease-out both;
}

.success-mark span:nth-child(1) {
  --ray-tilt: -28deg;
  transform: rotate(var(--ray-tilt));
}

.success-mark span:nth-child(2) {
  height: 22px;
  animation-delay: 80ms;
}

.success-mark span:nth-child(3) {
  --ray-tilt: 28deg;
  transform: rotate(var(--ray-tilt));
  animation-delay: 140ms;
}

.success-panel h2 {
  max-width: none;
}

.success-panel {
  width: min(760px, 100%);
}

.website-link,
.site-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(43, 36, 48, 0.18);
  border-radius: 8px;
  color: var(--brand);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: none;
}

.site-button {
  color: #fff;
  background: var(--brand);
}

.web-address {
  margin: 0 auto 10px;
  color: var(--ink);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  font-weight: 850;
}

.connect-panel {
  width: min(520px, 100%);
  margin: 16px auto 18px;
}

.connect-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0;
}

.social-links a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(43, 36, 48, 0.18);
  border-radius: 8px;
  color: var(--brand);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.96rem;
  font-weight: 900;
  text-decoration: none;
}

.corner-controls {
  position: fixed;
  right: 18px;
  bottom: 16px;
  display: none;
  align-items: center;
  gap: 4px;
}

.survey-shell.is-started .corner-controls {
  display: flex;
}

.survey-shell.is-complete .corner-controls {
  display: none;
}

.corner-button,
.powered-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.78);
  background: rgba(43, 36, 48, 0.82);
  font-weight: 800;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(43, 36, 48, 0.16);
}

.corner-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.corner-button:hover {
  background: rgba(43, 36, 48, 0.92);
  transform: translateY(-1px);
}

.corner-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  transform: none;
}

.corner-icon {
  width: 10px;
  height: 10px;
  display: block;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.corner-icon-up {
  transform: translateY(2px) rotate(45deg);
}

.corner-icon-down {
  transform: translateY(-2px) rotate(225deg);
}

.powered-badge {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

@keyframes stageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stageOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0.45;
    transform: translateY(8px);
  }
}

@keyframes successPop {
  from {
    opacity: 0;
    transform: scale(0.76) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes successRay {
  0% {
    opacity: 0;
    transform: rotate(var(--ray-tilt)) scaleY(0.1);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0.72;
    transform: rotate(var(--ray-tilt)) scaleY(1);
  }
}

@media (max-width: 760px) {
  .intro-panel {
    min-height: 0;
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 10px 14px;
  }

  .survey-shell.is-started .intro-panel {
    min-height: 14px;
    padding: 6px 8px 0;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
  }

  .progress-wrap {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .quiz-panel {
    align-items: stretch;
    padding: 8px 14px 52px;
  }

  .brand-logo {
    width: min(190px, 58vw);
    max-height: 66px;
    margin-bottom: 10px;
  }

  .welcome-panel h2,
  .success-panel h2 {
    max-width: none;
    margin-bottom: 6px;
    font-size: clamp(1.18rem, 5.5vw, 1.65rem);
  }

  .welcome-panel p:not(.eyebrow),
  .success-panel p:not(.eyebrow) {
    margin-bottom: 8px;
    font-size: 0.76rem;
    line-height: 1.24;
  }

  .time-estimate {
    min-height: 24px;
    margin-top: 6px;
    font-size: 0.8rem;
  }

  .survey-shell.is-started .progress-tiles {
    gap: 3px;
  }

  .progress-tile {
    height: 3px;
  }

  .name-row,
  .field-row {
    gap: 4px;
    margin-bottom: 8px;
  }

  .welcome-fields {
    grid-template-columns: 1fr;
    gap: 5px;
    margin-bottom: 8px;
  }

  input[type="text"],
  input[type="email"] {
    min-height: 32px;
    font-size: 0.82rem;
  }

  .question-card h2 {
    max-width: none;
    margin-bottom: 12px;
    font-size: clamp(1.06rem, 5vw, 1.48rem);
    line-height: 1.15;
  }

  .question-count {
    width: 21px;
    height: 21px;
    margin-right: 7px;
    font-size: 0.68rem;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .option-card {
    min-height: 48px;
    padding: 9px 10px;
    gap: 9px;
  }

  .option-key {
    width: 24px;
    height: 24px;
    font-size: 0.74rem;
  }

  .option-title,
  .option-detail {
    font-size: clamp(0.82rem, 3.5vw, 0.96rem);
    line-height: 1.2;
  }

  .rating-scale {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
  }

  .rating-option span {
    min-height: 36px;
    font-size: 0.88rem;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .corner-controls {
    right: 10px;
    bottom: 10px;
  }

  .powered-badge {
    min-height: 32px;
    padding: 0 8px;
    font-size: 0.6rem;
    opacity: 0.55;
  }

  .corner-button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .corner-icon {
    width: 9px;
    height: 9px;
  }

  .connect-panel {
    margin-top: 12px;
    margin-bottom: 14px;
  }

  .website-link {
    min-height: 34px;
    font-size: 0.78rem;
  }
}

@media (max-height: 720px) {
  .question-card h2 {
    margin-bottom: 12px;
    font-size: clamp(1.4rem, 3vw, 2.25rem);
  }

  .option-card {
    min-height: 44px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .option-title,
  .option-detail {
    font-size: clamp(0.92rem, 1.35vw, 1.14rem);
  }
}
