* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #5f6b78;
  --line: #d9e0e7;
  --line-strong: #aab5c0;
  --accent: #174f7a;
  --accent-dark: #103b5d;
  --accent-soft: #e9f2f8;
  --success: #17633c;
  --success-soft: #e9f5ee;
  --danger: #a12d2d;
  --danger-soft: #fff0f0;
  --shadow: 0 18px 45px rgba(28, 42, 55, 0.08);
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(90deg, rgba(23, 79, 122, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(23, 79, 122, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  font-size: 18px;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.topbar {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.page {
  width: min(900px, calc(100% - 40px));
  margin: 32px auto 80px;
  flex: 1;
}

.page-results {
  width: min(1120px, calc(100% - 40px));
}

.intro {
  max-width: 760px;
  margin-bottom: 36px;
}

.intro.compact {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

h2 {
  margin: 0;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 710px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(19px, 2.4vw, 23px);
}

.privacy-note {
  width: fit-content;
  margin-top: 24px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #c9ded1;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 15px;
  font-weight: 700;
}

.privacy-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 13px;
}

.survey-card,
.access-card,
.success-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.survey-card {
  overflow: hidden;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question {
  padding: clamp(28px, 5vw, 48px);
  border-bottom: 1px solid var(--line);
}

.question-heading {
  margin-bottom: 26px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.question-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.question-number {
  padding-top: 5px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.required-mark {
  color: var(--danger);
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.scale-option,
.choice-option {
  position: relative;
  cursor: pointer;
}

.scale-option input,
.choice-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale-option span {
  min-height: 68px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
  font-weight: 800;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.scale-option:hover span,
.choice-option:hover .choice-content {
  border-color: var(--line-strong);
}

.scale-option input:focus-visible + span,
.choice-option input:focus-visible + .choice-content {
  outline: 3px solid rgba(23, 79, 122, 0.25);
  outline-offset: 3px;
}

.scale-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.choice-content {
  min-height: 112px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-option input:checked + .choice-content {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.choice-title {
  font-size: 21px;
  font-weight: 800;
}

.choice-description {
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
}

textarea,
input[type="password"] {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 150px;
  padding: 17px 18px;
  resize: vertical;
}

input[type="password"] {
  min-height: 56px;
  padding: 12px 15px;
}

textarea:focus,
input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 79, 122, 0.12);
}

textarea::placeholder {
  color: #7d8894;
}

.textarea-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 14px;
}

.field-error {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 15px;
  font-weight: 700;
}

.question.has-error .scale-option span,
.question.has-error .choice-content {
  border-color: #d99898;
}

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

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 3px solid rgba(23, 79, 122, 0.3);
  outline-offset: 3px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.button-primary {
  background: var(--accent);
  color: white;
}

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

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: #f9fafb;
}

.button-small {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 15px;
}

.button-wide {
  width: calc(100% - clamp(56px, 10vw, 96px));
  margin: clamp(28px, 5vw, 48px);
  min-height: 60px;
  font-size: 18px;
}

.status {
  min-height: 26px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.survey-card > .status,
.survey-card > .notice {
  margin: 24px clamp(28px, 5vw, 48px) -12px;
}

.notice {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff6dd;
  color: #6d5410;
  font-size: 15px;
}

.success-card {
  padding: clamp(34px, 6vw, 64px);
  text-align: center;
}

.success-card h2 {
  font-size: clamp(30px, 5vw, 46px);
}

.success-card > p:not(.eyebrow) {
  margin: 14px auto 28px;
  color: var(--muted);
}

.success-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 30px;
  font-weight: 900;
}

.access-card {
  padding: clamp(24px, 4vw, 36px);
  margin-bottom: 38px;
}

.access-card label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
}

.access-card .status {
  margin-top: 10px;
}

.results-toolbar {
  margin: 0 0 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-group {
  margin-bottom: 40px;
}

.group-heading {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.summary-grid {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 150px;
  padding: 23px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(28, 42, 55, 0.05);
}

.metric-label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.metric-value {
  margin-top: 12px;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric-detail {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(28, 42, 55, 0.05);
}

.table-heading {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7f9fa;
  color: #46515c;
  font-size: 13px;
  letter-spacing: 0.02em;
}

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

td {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  body {
    font-size: 17px;
  }

  .topbar,
  .page,
  .page-results,
  .footer {
    width: min(100% - 28px, 1120px);
  }

  .topbar {
    padding: 16px 0;
  }

  .page {
    margin-top: 22px;
    margin-bottom: 56px;
  }

  .topbar .button {
    padding-inline: 12px;
  }

  .privacy-note {
    align-items: flex-start;
    border-radius: 12px;
  }

  .question-heading {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }

  .scale {
    gap: 7px;
  }

  .scale-option span {
    min-height: 58px;
    border-radius: 10px;
  }

  .choice-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .choice-content {
    min-height: 94px;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  .results-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions,
  .toolbar-actions .button {
    width: 100%;
  }

  .textarea-meta {
    align-items: flex-end;
    flex-direction: column;
    gap: 3px;
  }
}

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

  * {
    transition: none !important;
  }
}