:root {
  --ink: #111722;
  --navy: #101522;
  --muted: #97a0b0;
  --violet: #8f6bff;
  --violet-soft: #a693eb;
  --green: #1ea867;
  --line: rgba(255,255,255,.14);
  --panel: rgba(255,255,255,.06);
  --red: #f04444;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  color: #fff;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { background: #090b11; overflow-x: hidden; }

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 82% 10%, rgba(143,107,255,.30), transparent 32%),
    radial-gradient(circle at 12% 88%, rgba(181,99,49,.18), transparent 34%),
    linear-gradient(135deg, #090b11 0%, #111625 54%, #19111e 100%);
}

.quiz {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--violet);
  font-weight: 900;
  font-size: 15px;
}
.brand strong { display: block; font-size: 13px; letter-spacing: .14em; }
.brand span { display: block; color: var(--muted); font-size: 7px; letter-spacing: .16em; font-weight: 800; }

.progress-wrap { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 260px; }
.progress { flex: 1; height: 5px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--violet-soft)); transition: width .35s ease; }
#progressLabel { color: var(--muted); font-size: 11px; font-weight: 800; min-width: 32px; text-align: right; }

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 12px 24px 40px;
}

.step {
  display: none;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  animation: rise .4s ease;
}
.step.active { display: block; }

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

.kicker {
  display: inline-flex;
  padding: 7px 12px;
  margin-bottom: 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(255,255,255,.12);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}
.q-index {
  display: block;
  margin-bottom: 10px;
  color: var(--violet-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

h1 { margin: 0 0 14px; font-size: clamp(28px, 6vw, 44px); line-height: 1.08; letter-spacing: -.03em; }
h2 { margin: 0 0 10px; font-size: clamp(22px, 4.6vw, 30px); line-height: 1.15; letter-spacing: -.02em; }
.lead { margin: 0 0 22px; color: #c9cfdb; font-size: 15px; line-height: 1.6; max-width: 480px; }
.hint { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.welcome-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.welcome-tags span {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  font-size: 12px;
  color: #dde1e9;
}

.q-input, .q-textarea {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  color: #fff;
  font-size: 17px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.q-input:focus, .q-textarea:focus { border-color: var(--violet); background: rgba(255,255,255,.08); }
.q-input::placeholder, .q-textarea::placeholder { color: #757d8c; }
.q-textarea { resize: vertical; line-height: 1.5; }

.open-wrap { position: relative; }
.mic-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: var(--violet);
  cursor: pointer;
  transition: transform .15s ease, background .2s ease;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.listening { background: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,68,68,.5); }
  50% { box-shadow: 0 0 0 10px rgba(240,68,68,0); }
}
.mic-btn.unsupported { display: none; }
.mic-status { display: block; margin-top: 8px; min-height: 16px; color: var(--violet-soft); font-size: 12px; font-weight: 700; }

.options { display: grid; gap: 10px; margin-bottom: 8px; }
.option {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.option:hover { border-color: rgba(143,107,255,.5); }
.option.selected { border-color: var(--violet); background: rgba(143,107,255,.18); }

.step-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.btn-primary {
  padding: 15px 22px;
  border: none;
  border-radius: 12px;
  color: #fff;
  background: var(--violet);
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease, opacity .2s ease;
}
.btn-primary:hover { background: #7c56ff; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary.loading { color: transparent; position: relative; }
.btn-primary.loading::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.btn-ghost:hover { color: #fff; border-color: var(--muted); }

.back-btn {
  position: fixed;
  left: 20px;
  bottom: 24px;
  z-index: 2;
  width: 44px; height: 44px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #fff;
  background: rgba(20,22,32,.7);
  backdrop-filter: blur(6px);
  font-size: 18px;
  cursor: pointer;
}
.back-btn.visible { display: grid; }

.review-list { display: grid; gap: 10px; margin: 18px 0 6px; }
.review-item {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.review-item div { min-width: 0; }
.review-item b { display: block; margin-bottom: 4px; color: var(--violet-soft); font-size: 11px; letter-spacing: .04em; }
.review-item span { color: #dde1e9; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.review-item span.empty { color: #6b7280; font-style: italic; }
.review-edit {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.review-edit:hover { color: #fff; border-color: var(--violet); }

.submit-error { margin-top: 12px; color: #ff9b9b; font-size: 13px; min-height: 16px; }

.success-icon {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--green);
  font-size: 30px;
  font-weight: 900;
}

@media (max-width: 560px) {
  .quiz-top { padding: 16px 18px; }
  .stage { padding: 8px 18px 90px; }
  .progress-wrap { max-width: 140px; }
  .brand strong { letter-spacing: .1em; }
}
