:root {
  color-scheme: dark;
  --ink: #f8f5ea;
  --muted: #c9d3c7;
  --dim: #8c978e;
  --dark: #070908;
  --panel: rgba(14, 18, 17, 0.78);
  --line: rgba(248, 245, 234, 0.16);
  --mint: #d8f3c6;
  --gold: #f3dd98;
  --blue: #8fb9cd;
  --coral: #e6967a;
  --danger: #ff9b89;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--dark);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  overflow-x: hidden;
}

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

#quizCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.62;
}

.quiz-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 28px clamp(16px, 4vw, 54px);
  background:
    radial-gradient(circle at 18% 16%, rgba(216, 243, 198, 0.16), transparent 30%),
    radial-gradient(circle at 86% 84%, rgba(143, 185, 205, 0.17), transparent 34%),
    linear-gradient(135deg, rgba(7, 9, 8, 0.92), rgba(15, 19, 18, 0.76));
}

.quiz-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(248, 245, 234, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 245, 234, 0.04) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 88%, transparent);
}

.quiz-header {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 22px;
  width: min(1180px, 100%);
  margin: 0 auto 38px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 850;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.progress {
  height: 2px;
  background: rgba(248, 245, 234, 0.16);
  overflow: hidden;
}

#progressBar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--gold), var(--coral));
  transition: width 360ms ease;
}

.step-counter {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.quiz-stage {
  display: grid;
  place-items: center;
  width: min(1180px, 100%);
  min-height: calc(100vh - 134px);
  margin: 0 auto;
}

.intro-panel,
.quiz-form,
.result-panel {
  width: min(1040px, 100%);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(248, 245, 234, 0.08), rgba(248, 245, 234, 0.025)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.intro-panel,
.result-panel {
  padding: clamp(28px, 6vw, 72px);
  text-align: center;
  animation: panelIn 520ms ease both;
}

.quiz-form {
  padding: clamp(22px, 4vw, 48px);
  animation: panelIn 520ms ease both;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin-bottom: 18px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 900;
}

h1 {
  font-size: clamp(2.8rem, 3vw, 4.8rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 2.8rem);
}

p {
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.62;
}

.intro-panel p,
.result-panel p {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

.question {
  display: none;
}

.question.is-active {
  display: block;
  animation: questionIn 360ms ease both;
}

.field-grid,
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.option-grid.multi {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(248, 245, 234, 0.18);
  border-radius: 0;
  color: var(--ink);
  background: rgba(7, 9, 8, 0.58);
  outline: none;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea {
  padding: 15px 16px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(243, 221, 152, 0.82);
  box-shadow: 0 0 0 3px rgba(243, 221, 152, 0.11);
}

.option-grid label {
  position: relative;
  display: flex;
  min-height: 96px;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(248, 245, 234, 0.16);
  background: rgba(248, 245, 234, 0.052);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.option-grid label:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 243, 198, 0.38);
  background: rgba(216, 243, 198, 0.08);
}

.option-grid input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--gold);
}

.option-grid label:has(input:checked) {
  border-color: rgba(243, 221, 152, 0.82);
  background: linear-gradient(135deg, rgba(216, 243, 198, 0.16), rgba(243, 221, 152, 0.08));
}

.full-field {
  display: block;
  margin-top: 18px;
}

.consent-field {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid rgba(248, 245, 234, 0.16);
  background: rgba(248, 245, 234, 0.052);
  color: var(--muted);
  line-height: 1.45;
}

.consent-field input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--gold);
}

.quiz-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 34px;
}

.result-actions {
  justify-content: center;
}

.status-message {
  min-height: 1.6em;
  color: var(--gold);
  font-weight: 800;
}

.status-message.is-error {
  color: var(--danger);
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(248, 245, 234, 0.2);
  padding: 0 22px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
}

.primary-btn {
  border-color: transparent;
  color: var(--dark);
  background: linear-gradient(135deg, var(--mint), var(--gold));
}

.secondary-btn {
  background: rgba(248, 245, 234, 0.07);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

#hiddenResultText {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes questionIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 860px) {
  .quiz-header {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
  }

  .brand span {
    display: none;
  }

  .field-grid,
  .option-grid,
  .option-grid.multi {
    grid-template-columns: 1fr;
  }

  .quiz-actions {
    justify-content: stretch;
  }

  .quiz-actions button {
    flex: 1 1 160px;
  }
}
