*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --bg: #070708;
  --card: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f0f0f2;
  --muted: #b0b8c8;
  --accent: #4f90ff;
  --accent-glow: rgba(79, 144, 255, 0.3);
  --success: #10b981;
  --error: #f87171;
  --radius-lg: clamp(20px, 4vw, 36px);
  --radius-md: clamp(14px, 2.5vw, 18px);
  --pad-card: clamp(24px, 5vw, 50px);
  --choice-gap: 6px;
  --choice-pad-y: 10px;
  --choice-pad-x: 14px;
  --choice-radius: 12px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
}
.bg::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(
    ellipse 70% 60% at 15% 10%,
    rgba(59, 130, 246, 0.5),
    transparent
  );
  animation: orbA 14s ease-in-out infinite alternate;
}
.bg::after {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(
      ellipse 65% 55% at 85% 80%,
      rgba(16, 185, 129, 0.35),
      transparent
    ),
    radial-gradient(
      ellipse 50% 45% at 60% 40%,
      rgba(99, 102, 241, 0.2),
      transparent
    );
  animation: orbB 18s ease-in-out infinite alternate;
}
@keyframes orbA {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(6%, 8%) scale(1.08);
  }
}
@keyframes orbB {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-5%, -6%) scale(1.1);
  }
}
.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(20px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}
@media (min-width: 640px) {
  .page {
    align-items: center;
    padding: 40px 20px;
  }
}
.card {
  width: 100%;
  max-width: 850px;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.card.is-success {
  pointer-events: none;
}
.badge {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(79, 144, 255, 0.12);
  border: 1px solid rgba(79, 144, 255, 0.3);
  color: #a8c4ff;
  font-size: clamp(11px, 2.5vw, 13px);
  margin-bottom: clamp(14px, 3vw, 20px);
  letter-spacing: 0.02em;
}
h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1.05;
  letter-spacing: clamp(-2px, -0.05em, -1px);
  margin-bottom: 12px;
  text-wrap: balance;
}
.sub {
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: var(--muted);
  max-width: 650px;
  line-height: 1.6;
  margin-bottom: clamp(28px, 5vw, 40px);
}
.progress-wrap {
  margin-bottom: clamp(20px, 4vw, 28px);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 999px;
  transition: width 0.35s var(--ease);
}
.form-body {
  counter-reset: question;
}
.q {
  counter-increment: question;
  margin: clamp(14px, 2.5vw, 20px) 0;
  padding: clamp(16px, 3vw, 22px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  opacity: 0;
  transform: translateY(8px);
  animation: fadeIn 0.45s var(--ease) forwards;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.q:focus-within {
  border-color: rgba(79, 144, 255, 0.35);
  background: rgba(79, 144, 255, 0.04);
}
.form-body .q:nth-child(1) {
  animation-delay: 0.05s;
}
.form-body .q:nth-child(2) {
  animation-delay: 0.1s;
}
.form-body .mcq:nth-of-type(1) {
  animation-delay: 0.15s;
}
.form-body .mcq:nth-of-type(2) {
  animation-delay: 0.2s;
}
.form-body .mcq:nth-of-type(3) {
  animation-delay: 0.25s;
}
.form-body .mcq:nth-of-type(4) {
  animation-delay: 0.3s;
}
.form-body .mcq:nth-of-type(5) {
  animation-delay: 0.35s;
}
.form-body .mcq:nth-of-type(6) {
  animation-delay: 0.4s;
}
.form-body .mcq:nth-of-type(7) {
  animation-delay: 0.45s;
}
.form-body .mcq:nth-of-type(8) {
  animation-delay: 0.5s;
}
.form-body .q:last-of-type {
  animation-delay: 0.55s;
}
@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
label {
  display: block;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.35;
}
.q > label::before {
  content: counter(question, decimal-leading-zero);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  opacity: 0.75;
  margin-bottom: 5px;
}
.label-hint {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}
input,
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: clamp(14px, 3vw, 18px);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
input:hover,
select:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder {
  color: #6b7a8e;
}
input.is-invalid,
select.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}
select {
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23b0b8c8' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 48px;
}
.mcq,
.msq {
  border: none;
  padding: 0;
  min-width: 0;
}
.q.mcq,
.q.msq,
.q.rating {
  position: relative;
  border: none;
  background: transparent;
  padding: clamp(12px, 2.5vw, 18px);
}
/* fieldset borders skip <legend>; paint the card behind all children */
.q.mcq::before,
.q.msq::before,
.q.rating::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.q.mcq > *,
.q.msq > *,
.q.rating > * {
  position: relative;
  z-index: 1;
}
.q.mcq:focus-within,
.q.msq:focus-within,
.q.rating:focus-within {
  border-color: transparent;
  background: transparent;
}
.q.mcq:focus-within::before,
.q.msq:focus-within::before,
.q.rating:focus-within::before {
  border-color: rgba(79, 144, 255, 0.35);
  background: rgba(79, 144, 255, 0.04);
}
.mcq legend,
.msq legend {
  display: block;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.35;
  padding: 0;
  text-wrap: balance;
}
.mcq legend::before,
.msq legend::before,
.rating legend::before {
  content: counter(question, decimal-leading-zero);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  opacity: 0.75;
  margin-bottom: 5px;
}
.legend-req {
  color: var(--error);
  margin-left: 2px;
}
.mcq-options,
.msq-options {
  display: flex;
  flex-direction: column;
  gap: var(--choice-gap);
}
.mcq-option,
.msq-option {
  display: block;
  cursor: pointer;
  position: relative;
}
.mcq-option input,
.msq-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.mcq-option span,
.msq-option span {
  display: block;
  padding: var(--choice-pad-y) var(--choice-pad-x);
  border-radius: var(--choice-radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease);
}
.mcq-option:hover span,
.msq-option:hover span {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.09);
}
.mcq-option input:focus-visible + span,
.msq-option input:focus-visible + span {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.mcq-option input:checked + span,
.msq-option input:checked + span {
  border-color: var(--accent);
  background: rgba(79, 144, 255, 0.14);
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 500;
  padding-right: 36px;
}
.mcq-option span,
.msq-option span {
  position: relative;
}
.mcq-option input:checked + span::after,
.msq-option input:checked + span::after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}
.mcq.is-invalid .mcq-options,
.msq.is-invalid .msq-options {
  outline: 1px solid rgba(248, 113, 113, 0.4);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}
.rating {
  border: none;
  padding: 0;
  min-width: 0;
}
.rating legend {
  display: block;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.35;
  padding: 0;
  text-wrap: balance;
}
.rating-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.35;
}
.rating-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--choice-gap);
}
.rating-option {
  cursor: pointer;
  position: relative;
}
.rating-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.rating-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--choice-pad-y) 10px;
  border-radius: var(--choice-radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease);
}
.rating-option:hover span {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.09);
}
.rating-option input:focus-visible + span {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.rating-option input:checked + span {
  border-color: var(--accent);
  background: rgba(79, 144, 255, 0.14);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.rating.is-invalid .rating-options {
  outline: 1px solid rgba(248, 113, 113, 0.4);
  outline-offset: 4px;
  border-radius: var(--choice-radius);
}
.field-error,
.submit-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.25s var(--ease),
    opacity 0.2s;
}
.field-error.is-visible,
.submit-error.is-visible {
  max-height: 48px;
  opacity: 1;
  min-height: 1.2em;
}
button[type="submit"] {
  width: 100%;
  margin-top: clamp(16px, 3vw, 25px);
  padding: clamp(16px, 3vw, 20px);
  border: none;
  border-radius: clamp(16px, 3vw, 20px);
  font-size: clamp(1rem, 3vw, 1.125rem);
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #fff 0%, #e8f0ff 100%);
  color: #0a0a14;
  font-family: inherit;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.2s,
    opacity 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}
button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 12px 40px rgba(79, 144, 255, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.3);
}
button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
button[type="submit"].is-loading {
  color: transparent;
}
button[type="submit"].is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.footer {
  margin-top: clamp(18px, 3vw, 24px);
  text-align: center;
  color: #8b8b8b;
  font-size: clamp(12px, 2.5vw, 14px);
  line-height: 1.5;
}
.success-panel {
  display: none;
  text-align: center;
  padding: clamp(24px, 5vw, 40px) 0;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeIn 0.5s var(--ease) forwards;
}
.success-panel.is-visible {
  display: block;
}
.success-panel .icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.success-panel h2 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  margin-bottom: 12px;
}
.success-panel p {
  color: var(--muted);
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  line-height: 1.6;
}
.form-body.is-hidden {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
