:root {
  color-scheme: light;
  --background-start: #eef2ff;
  --background-end: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #172033;
  --text-muted: #64748b;
  --border: #dce3ef;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef2ff;
  --success: #047857;
  --success-soft: #ecfdf5;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning-soft: #fff7ed;
  --shadow: 0 24px 70px rgb(30 41 59 / 14%);
  --radius-large: 24px;
  --radius-medium: 16px;
  --radius-small: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px 16px;
  overflow-wrap: break-word;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgb(99 102 241 / 15%), transparent 34rem),
    linear-gradient(145deg, var(--background-start), var(--background-end));
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 44px);
  background: var(--surface);
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  max-width: 820px;
  margin: 0 auto 30px;
}

.site-logo {
  display: block;
  width: clamp(70px, 10vw, 88px);
  height: auto;
  filter: drop-shadow(0 10px 18px rgb(49 46 129 / 18%));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: #20263a;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
  text-wrap: balance;
}

.hero-description {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.notice {
  margin: 0 0 24px;
  padding: 16px 18px;
  color: #7c2d12;
  background: var(--warning-soft);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-medium);
}

.user-info-card {
  margin-bottom: 28px;
  padding: 22px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
}

.user-info-card h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.user-info-card > label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

.user-info-card > label span {
  color: var(--danger);
  font-weight: 700;
}

.user-info-card input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-small);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.user-info-card input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgb(79 70 229 / 13%);
}

.user-info-card input[type="text"][aria-invalid="true"] {
  border-color: var(--danger);
}

.user-info-card input[type="text"][aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgb(185 28 28 / 13%);
}

.field-hint {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.progress-container {
  scroll-margin-top: 16px;
  margin-bottom: 28px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.progress-bar {
  display: block;
  width: 100%;
  height: 11px;
  overflow: hidden;
  appearance: none;
  background: #e2e8f0;
  border: 0;
  border-radius: 999px;
}

.progress-bar::-webkit-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
}

.progress-bar::-webkit-progress-value {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
  transition: inline-size 220ms ease;
}

.progress-bar::-moz-progress-bar {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
}

.progress-count {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: right;
}

.questions-container {
  display: grid;
  gap: 16px;
  min-height: 420px;
}

.question-card {
  min-width: 0;
  margin: 0;
  padding: 20px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.question-card.answered {
  background: var(--success-soft);
  border-color: #86efac;
  transform: translateY(-1px);
}

.question-card:disabled {
  opacity: 0.76;
}

.question-text {
  width: 100%;
  margin-bottom: 16px;
  padding: 0;
  color: #1e293b;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.48;
}

.question-number {
  color: var(--primary);
  font-weight: 800;
}

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

.option {
  display: flex;
  min-width: 0;
  min-height: 46px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px 9px;
  color: #334155;
  background: var(--surface);
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.option.selected {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #818cf8;
  font-weight: 700;
}

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

.option span {
  min-width: 0;
  font-size: 0.84rem;
  text-align: center;
}

.navigation-buttons {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 720;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.button:focus-visible,
.option:has(input:focus-visible),
.brand-link:focus-visible,
.characteristics-table-wrap:focus-visible {
  outline: 3px solid rgb(79 70 229 / 30%);
  outline-offset: 3px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.button-secondary {
  color: #334155;
  background: #f1f5f9;
  border-color: #dbe3ef;
}

.button-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #fecaca;
}

#prevBtn {
  justify-self: start;
}

#nextBtn {
  justify-self: end;
}

.page-indicator {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.status-message {
  min-height: 1.5em;
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.status-message[data-tone="success"] {
  color: var(--success);
}

.status-message[data-tone="error"] {
  color: var(--danger);
}

.result-shell {
  width: min(100%, 1080px);
}

.result-page-header {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
}

.brand-link span {
  display: grid;
  line-height: 1.2;
}

.brand-link strong {
  font-size: 1.02rem;
}

.brand-link small {
  margin-top: 4px;
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.result-content {
  margin-top: 28px;
}

.result-content > h1,
.result-content > h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  text-wrap: balance;
}

.result-lead {
  margin: 12px 0 0;
  color: var(--text-muted);
}

.result-metadata {
  margin: 12px 0 0;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 650;
}

.result-section {
  margin-top: 30px;
}

.result-section h2 {
  margin: 0 0 13px;
  font-size: 1.25rem;
}

.characteristics-section .result-note {
  margin-bottom: 14px;
}

.characteristics-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
}

.characteristics-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.characteristics-table th,
.characteristics-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.characteristics-table th {
  color: #ffffff;
  background: var(--primary);
  font-size: 0.84rem;
  letter-spacing: 0.01em;
}

.characteristics-table th:first-child,
.characteristics-table td:first-child {
  width: 58px;
  text-align: center;
}

.characteristics-table th:last-child,
.characteristics-table td:last-child {
  width: 86px;
  text-align: center;
}

.characteristics-table tbody tr:nth-child(odd) {
  background: var(--surface-muted);
}

.characteristics-table tbody tr:last-child td {
  border-bottom: 0;
}

.characteristic-score {
  overflow-wrap: normal;
  color: var(--primary-dark);
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
  word-break: normal;
}

.result-list {
  display: grid;
  gap: 11px;
}

.result-item {
  padding: 16px 18px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
}

.result-item h3 {
  margin: 0 0 7px;
  font-size: 1rem;
}

.result-item p {
  margin: 0;
  color: #475569;
}

.result-score {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding: 0 7px;
  color: var(--primary-dark);
  background: #e0e7ff;
  border-radius: 999px;
  font-size: 0.8rem;
}

.result-note {
  margin: -4px 0 13px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.profession-list {
  margin: 8px 0 0;
  padding-left: 20px;
  color: #475569;
}

.profession-list li + li {
  margin-top: 6px;
}

.disclaimer {
  margin-top: 28px;
  padding: 15px 17px;
  color: #7c2d12;
  background: var(--warning-soft);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-medium);
  font-size: 0.9rem;
}

.result-start-link {
  margin-top: 22px;
}

.not-found-content {
  max-width: 640px;
  margin-right: auto;
  margin-left: auto;
  padding: clamp(34px, 8vw, 90px) 0;
  text-align: center;
}

.not-found-content .eyebrow {
  margin-bottom: 10px;
}

@media (hover: hover) {
  .question-card:hover {
    border-color: #a5b4fc;
  }

  .option:hover,
  .button:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .option:hover {
    border-color: #a5b4fc;
  }

  .button-primary:hover:not(:disabled) {
    background: var(--primary-dark);
  }

  .button-secondary:hover:not(:disabled) {
    background: #e2e8f0;
  }

  .button-danger:hover:not(:disabled) {
    background: #fee2e2;
  }
}

@media (max-width: 820px) {
  body {
    padding: 16px 10px;
  }

  .app-shell {
    padding: 26px 20px;
    border-radius: 20px;
  }

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

  .option:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .characteristics-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .characteristics-table,
  .characteristics-table tbody,
  .characteristics-table tr,
  .characteristics-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .characteristics-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .characteristics-table tbody {
    display: grid;
    gap: 12px;
  }

  .characteristics-table tbody tr,
  .characteristics-table tbody tr:nth-child(odd) {
    padding: 5px 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
  }

  .characteristics-table td,
  .characteristics-table td:first-child,
  .characteristics-table td:last-child {
    display: grid;
    grid-template-columns: minmax(118px, 42%) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .characteristics-table td:last-child {
    border-bottom: 0;
  }

  .characteristics-table td::before {
    color: var(--text-muted);
    content: attr(data-label);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }
}

@media (max-width: 560px) {
  body {
    padding: 0;
    background: var(--surface);
  }

  .app-shell {
    min-height: 100vh;
    padding: 20px 14px calc(28px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .hero {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 13px;
    align-items: start;
    margin-bottom: 22px;
  }

  .site-logo {
    width: 56px;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 0.64rem;
    letter-spacing: 0.08em;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 8vw, 2rem);
  }

  .hero-description {
    grid-column: 1 / -1;
    margin-top: 10px;
    font-size: 0.95rem;
  }

  .notice {
    padding: 14px;
    font-size: 0.9rem;
  }

  .user-info-card,
  .question-card {
    padding: 16px;
  }

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

  .option,
  .option:last-child {
    grid-column: auto;
    min-height: 50px;
    justify-content: flex-start;
    padding: 12px 14px;
  }

  .option span {
    text-align: left;
  }

  .navigation-buttons {
    position: sticky;
    z-index: 5;
    bottom: 0;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 24px -14px 0;
    padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
    background: rgb(255 255 255 / 96%);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 24px rgb(15 23 42 / 8%);
    backdrop-filter: blur(8px);
  }

  .page-indicator {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
  }

  #prevBtn {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
  }

  #nextBtn {
    grid-column: 2;
    grid-row: 2;
    justify-self: stretch;
  }

  .result-page-header {
    margin-bottom: 18px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .result-actions .button {
    width: 100%;
  }

  .result-content {
    margin-top: 24px;
  }

  .result-item {
    padding: 15px;
  }

  .characteristics-table td,
  .characteristics-table td:first-child,
  .characteristics-table td:last-child {
    grid-template-columns: 88px minmax(0, 1fr);
  }
}

@media print {
  body {
    padding: 0;
    background: #ffffff;
  }

  .app-shell {
    width: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .result-page-header,
  .result-actions,
  .status-message {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
