:root {
  --main-bg: #2a3447;
  --soft-bg: #384256;
  --dark-bg: #222b3c;
  --main-color: #ffffff;
  --soft-color: #c6cfdf;
  --button-bg: #384256;
  --button-color: #ffffff;
  --button-border: #4a5877;
  --button-hover-bg: #222b3c;
  --accent: #6f8cff;
  --accent-2: #8a5dff;
  --danger: #ff7f96;
  --warning: #ffcf6a;
}

[data-theme="light"] {
  --main-bg: #edf6fb;
  --soft-bg: #d8e9f7;
  --dark-bg: #ffffff;
  --main-color: #172033;
  --soft-color: #526275;
  --button-bg: #e5f3ff;
  --button-color: #172033;
  --button-border: #b9d4ec;
  --button-hover-bg: #cce9ff;
  --accent: #506dff;
  --accent-2: #7c4dff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--main-color);
  background:
    radial-gradient(circle at top, rgba(111, 140, 255, 0.16), transparent 30%),
    linear-gradient(180deg, var(--main-bg), var(--dark-bg));
  transition: background 180ms ease, color 180ms ease;
}

body {
  min-height: 100vh;
}

html.theme-transitioning body,
html.theme-transitioning .card,
html.theme-transitioning .input,
html.theme-transitioning .textarea,
html.theme-transitioning .theme-toggle,
html.theme-transitioning .primary,
html.theme-transitioning .secondary,
html.theme-transitioning .chip,
html.theme-transitioning .track,
html.theme-transitioning .fill {
  transition:
    background-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

.page {
  min-height: 100vh;
  padding: 24px 16px 40px;
}

.shell {
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.card {
  background: rgba(18, 24, 39, 0.9);
  border: 1px solid rgba(130, 150, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 38px rgba(59, 89, 145, 0.1);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.title {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2.25rem);
}

.subtitle,
.intro-copy,
.question-helper,
.section-description,
.footer-status,
.meta,
.completion-copy {
  color: var(--soft-color);
}

.theme-toggle {
  background: linear-gradient(180deg, rgba(109, 141, 255, 0.18), rgba(109, 141, 255, 0.08));
  color: var(--main-color);
  border: 1px solid rgba(109, 141, 255, 0.3);
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}

.intro-card,
.progress-card,
.step-card,
.notice-card {
  padding: 22px 24px;
}

.sticky-progress {
  position: sticky;
  top: 12px;
  z-index: 20;
}

.intro-copy {
  display: grid;
  gap: 8px;
  line-height: 1.6;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
}

.track {
  width: 100%;
  height: 10px;
  background: rgba(127, 144, 190, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chip {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(127, 144, 190, 0.12);
  color: var(--soft-color);
  font-size: 13px;
}

.chip.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
}

.chip.complete {
  background: rgba(111, 140, 255, 0.2);
  color: var(--main-color);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.step-card {
  will-change: transform, opacity;
}

.step-card--next {
  animation: step-next 170ms ease-out;
}

.step-card--prev {
  animation: step-prev 170ms ease-out;
}

.section-intro {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(127, 144, 190, 0.09);
  margin-bottom: 18px;
  display: grid;
  gap: 8px;
}

.questions {
  display: grid;
  gap: 18px;
}

.question {
  padding-top: 16px;
  border-top: 1px solid rgba(127, 144, 190, 0.14);
}

.question:first-child {
  border-top: 0;
  padding-top: 0;
}

.label {
  display: block;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 10px;
}

.required {
  color: var(--danger);
  margin-left: 6px;
}

.input, .textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(127, 144, 190, 0.22);
  background: rgba(15, 20, 33, 0.75);
  color: var(--main-color);
  padding: 14px 16px;
  outline: none;
}

[data-theme="light"] .input,
[data-theme="light"] .textarea {
  background: rgba(255, 255, 255, 0.95);
}

.input:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 140, 255, 0.15);
}

.radio-group {
  display: grid;
  gap: 10px;
}

.radio-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(127, 144, 190, 0.14);
  background: rgba(127, 144, 190, 0.07);
}

.radio-option input {
  margin-top: 3px;
}

.error {
  font-size: 0.92rem;
  color: var(--danger);
  margin-top: 10px;
}

.notice-card {
  border-color: rgba(255, 128, 151, 0.3);
  color: #ffb5c3;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.btn-group {
  display: flex;
  gap: 12px;
}

.primary,
.secondary {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

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

.primary {
  min-width: 128px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
}

.secondary {
  background: transparent;
  color: var(--main-color);
  border-color: rgba(127, 144, 190, 0.28);
}

.primary:disabled,
.secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.loading,
.success {
  display: grid;
  place-items: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
}

.spinner,
.check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.spinner {
  border: 6px solid rgba(133, 154, 255, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.check {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: pop 0.4s ease-out;
  box-shadow: 0 16px 42px rgba(111, 140, 255, 0.25);
}

.check span {
  font-size: 2rem;
  font-weight: 800;
  color: white;
}

.success-shell {
  padding: 40px 24px;
}

.success-shell h2 {
  margin: 0;
}

.meta {
  font-size: 0.95rem;
}

.warning {
  color: var(--warning);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pop {
  0% { transform: scale(0.7); opacity: 0.2; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes step-next {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes step-prev {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .page {
    padding: 18px 12px 30px;
  }

  .header,
  .intro-card,
  .progress-card,
  .step-card,
  .notice-card {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .header {
    flex-direction: column;
  }

  .footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-group {
    width: 100%;
  }

  .primary,
  .secondary {
    width: 100%;
  }

  .meta {
    text-align: left;
    order: 3;
  }
}
