:root {
  --page-bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e8e8e8;
  --border-strong: #dcdfe6;
  --text: #222222;
  --choice: #707070;
  --accent: #3f85fa;
  --accent-dark: #2f73df;
  --danger: #f56c6c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
}

.review-mode-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  padding: 9px 18px;
  border-bottom: 1px solid #cfe0ff;
  color: #2f5c9f;
  background: #eef5ff;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.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;
}

.survey-shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 0 42px;
}

.is-review-mode .survey-shell {
  padding-top: 18px;
}

.progress-track {
  width: 100%;
  height: 8px;
  margin: 0 0 34px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecf5;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.answer-page {
  background: var(--surface);
  border-radius: 2px;
  padding: 18px 62px 6px;
  min-height: 360px;
}

.question-card {
  padding: 24px 0 26px;
  border-bottom: 1px solid var(--border);
}

.question-card:last-child {
  border-bottom: 0;
}

.question-card.is-invalid {
  outline: 1px solid rgba(245, 108, 108, 0.5);
  outline-offset: 8px;
}

.question-heading {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 18px;
}

.titleless-heading {
  margin-bottom: 8px;
}

.question-number {
  color: var(--text);
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.6;
}

.required-star {
  color: red;
  margin-left: 2px;
  font-weight: 700;
}

.question-title {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
}

.rich-text-container.notice-emphasis {
  margin-left: 50px;
  max-width: 820px;
  padding: 16px 20px;
  border: 1px solid #cfe0ff;
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: #f7faff;
}

.notice-emphasis .notice-body {
  color: #3f4752;
}

.notice-emphasis .notice-body p.notice-strong {
  font-weight: 700;
  color: #2f3a4a;
}

.notice-emphasis .notice-body p:last-child {
  margin-bottom: 0;
}

.notice-title {
  margin: 0 0 22px;
  text-align: center;
  font-size: 22px;
  line-height: 1.5;
  font-weight: 700;
}

.notice-body {
  font-size: 16px;
  line-height: 1.85;
  color: #555555;
}

.notice-body p {
  white-space: pre-line;
  margin: 0 0 18px;
}

.consent-confirmation {
  margin: 24px 0 0;
  padding: 16px 18px;
  border: 1px solid #cfe0ff;
  border-radius: 6px;
  background: #f7faff;
}

.consent-agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #3f4752;
  font-size: 15px;
  line-height: 1.7;
  cursor: pointer;
}

.consent-agreement input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 4px 0 0;
  accent-color: var(--accent);
}

.consent-confirmation.is-invalid {
  border-color: rgba(245, 108, 108, 0.8);
  background: #fff8f8;
}

.option-list {
  display: grid;
  gap: 12px;
  margin-left: 50px;
}

.option-line {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  gap: 10px;
  color: var(--choice);
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

.option-line input[type="radio"],
.matrix-table input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.text-input,
.date-input,
.cascade-input,
.cascade-select {
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0 12px;
  color: #606266;
  background: #ffffff;
  outline: none;
}

.text-input:focus,
.date-input:focus,
.cascade-input:focus,
.cascade-select:focus {
  border-color: var(--accent);
}

.text-input {
  width: min(520px, calc(100% - 50px));
  margin-left: 50px;
}

.long-text-input {
  display: block;
  width: min(680px, calc(100% - 50px));
  min-height: 96px;
  height: auto;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.date-input {
  width: 180px;
  margin-left: 50px;
}

.multi-text {
  display: grid;
  gap: 18px;
  margin-left: 50px;
  max-width: 580px;
}

.multi-text label {
  display: grid;
  gap: 8px;
  color: var(--choice);
  font-size: 14px;
  line-height: 1.5;
}

.multi-text .text-input {
  margin-left: 0;
  width: 100%;
}

.task-info-form {
  display: grid;
  gap: 22px;
  margin-left: 50px;
  max-width: 760px;
}

.task-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--choice);
  font-size: 14px;
  line-height: 1.5;
}

.task-field-label {
  color: #333333;
  font-size: 15px;
  font-weight: 600;
}

.task-field-prompt {
  color: #4f5661;
}

.task-text-input {
  width: min(640px, 100%);
  margin-left: 0;
}

.cascade-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-left: 50px;
  max-width: 720px;
}

.grade-row {
  grid-template-columns: minmax(150px, 190px) minmax(150px, 190px);
  max-width: 400px;
}

.text-cascade-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 520px;
}

.cascade-input,
.cascade-select {
  min-width: 0;
  width: 100%;
}

.matrix-wrap {
  overflow-x: auto;
  margin-left: 50px;
}

.matrix-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
  padding: 12px 10px;
  vertical-align: middle;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.matrix-table thead th {
  color: #555555;
  font-size: 14px;
  font-weight: 400;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  width: 34%;
  text-align: left;
  color: var(--choice);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
}

.matrix-table td:nth-child(2),
.matrix-table th:nth-child(2) {
  border-left: 1px solid var(--border);
}

.matrix-choice {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.matrix-mobile-label {
  display: none;
}

.slider-wrap {
  margin-left: 50px;
  max-width: 760px;
}

.slider-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin: 0 54px 12px 0;
  color: #555555;
  font-size: 15px;
  line-height: 1.5;
}

.slider-labels span:last-child {
  text-align: right;
}

.slider-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 40px;
  gap: 22px;
  align-items: center;
}

.slider-value {
  min-width: 36px;
  color: #7d8590;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
}

.slider-control {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 24px;
}

.slider-control.is-centered::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: #aab2bd;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

input[type="range"] {
  --slider-fill-start: 50%;
  --slider-fill-end: 50%;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #d9dee6 0%,
    #d9dee6 var(--slider-fill-start),
    var(--accent) var(--slider-fill-start),
    var(--accent) var(--slider-fill-end),
    #d9dee6 var(--slider-fill-end),
    #d9dee6 100%
  );
  box-shadow: inset 0 0 0 1px #b8c0cb;
  cursor: pointer;
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border: 0;
  background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 5px rgba(32, 84, 165, 0.25);
  cursor: grab;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border: 0;
  background: transparent;
}

input[type="range"]::-moz-range-progress {
  background: transparent;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 5px rgba(32, 84, 165, 0.25);
  cursor: grab;
}

input[type="range"]:active::-webkit-slider-thumb,
input[type="range"]:active::-moz-range-thumb {
  cursor: grabbing;
}

input[type="range"]:focus-visible {
  outline: 2px solid rgba(62, 131, 239, 0.35);
  outline-offset: 5px;
}

@media (min-width: 769px) {
  .is-action-survey-page .survey-shell {
    padding-bottom: 0;
  }

  .is-action-survey-page .progress-track {
    margin-bottom: 22px;
  }

  .answer-page.action-page {
    min-height: 0;
    padding: 14px 62px 4px;
  }

  .action-page .question-card {
    padding: 10px 0;
  }

  .action-page #card-actionIntro {
    padding: 6px 0;
  }

  .action-page .rich-text-container.notice-emphasis {
    padding: 8px 20px;
  }

  .action-page .notice-body p {
    margin-bottom: 4px;
  }

  .action-page .question-heading,
  .action-page .titleless-heading {
    margin-bottom: 3px;
  }

  .action-page .slider-labels {
    margin-bottom: 6px;
  }

  #surveyForm.is-action-page .answer-page-btn {
    min-height: 72px;
  }
}

.validation-message {
  display: none;
  margin: 14px 0 0 50px;
  color: var(--danger);
  font-size: 13px;
}

.question-card.is-invalid .validation-message {
  display: block;
}

.answer-page-btn {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

#surveyForm.is-consent-page .answer-page-btn {
  padding: 18px 16px;
}

#surveyForm.is-consent-page .form-message {
  position: static;
  flex: 0 0 100%;
  order: 3;
  margin: 0;
  text-align: center;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 112px;
  min-height: 40px;
  border-radius: 4px;
  padding: 0 26px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

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

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

.primary-button:disabled {
  cursor: not-allowed;
  background: #a9c6f5;
}

.secondary-button {
  color: var(--accent-dark);
  background: white;
  border-color: var(--border-strong);
}

.secondary-button:disabled {
  cursor: not-allowed;
  color: #9aa4b2;
  background: #f5f7fa;
  border-color: #d9dee7;
}

.form-message {
  position: absolute;
  margin-top: 68px;
  min-height: 20px;
  color: #6f7785;
  font-size: 13px;
}

.form-message.is-status {
  color: #667085;
}

.form-message.is-error {
  color: var(--danger);
}

.result-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 30, 45, 0.32);
}

.result-dialog {
  width: min(520px, 100%);
  border-radius: 6px;
  background: white;
  padding: 32px;
  box-shadow: 0 18px 45px rgba(20, 30, 45, 0.22);
}

.result-dialog h2 {
  margin: 0 0 12px;
  font-size: 24px;
}

.result-dialog p {
  margin: 0 0 24px;
  line-height: 1.6;
  color: #555555;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .survey-shell {
    width: min(100% - 20px, 680px);
    padding-bottom: 32px;
  }

  .progress-track {
    margin-bottom: 18px;
  }

  .answer-page {
    padding: 8px 18px 0;
  }

  #declineConsentButton:not([hidden]),
  #declineConsentButton:not([hidden]) ~ #nextPageButton {
    width: calc(50% - 8px);
    min-width: 0;
    min-height: 46px;
    padding: 6px 12px;
    line-height: 1.4;
  }

  .question-heading {
    grid-template-columns: 42px 1fr;
  }

  .rich-text-container.notice-emphasis {
    margin-left: 0;
  }

  .option-list,
  .text-input,
  .date-input,
  .multi-text,
  .task-info-form,
  .cascade-row,
  .matrix-wrap,
  .slider-wrap,
  .validation-message {
    margin-left: 42px;
  }

  .text-input {
    width: calc(100% - 42px);
  }

  .task-text-input {
    width: 100%;
    margin-left: 0;
  }

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

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

  .matrix-wrap {
    margin-left: 0;
    overflow-x: visible;
  }

  .matrix-table {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    table-layout: auto;
  }

  .matrix-table thead {
    display: none;
  }

  .matrix-table tbody {
    display: grid;
    width: 100%;
  }

  .matrix-table tbody tr {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    padding: 18px 0 16px;
    border-bottom: 1px solid var(--border);
  }

  .matrix-table tbody tr:first-child {
    padding-top: 4px;
  }

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

  .matrix-table tbody th,
  .matrix-table tbody td {
    display: block;
    width: auto;
    padding: 0 2px;
    border: 0;
  }

  .matrix-table tbody th:first-child {
    grid-column: 1 / -1;
    width: auto;
    padding: 0 0 12px;
    color: var(--choice);
    text-align: left;
    font-size: 14px;
    line-height: 1.65;
    font-weight: 400;
  }

  .matrix-table tbody td:nth-child(2) {
    border-left: 0;
  }

  .matrix-choice {
    display: grid;
    grid-template-rows: 28px 34px;
    justify-items: center;
    align-items: start;
    width: 100%;
    min-width: 0;
    min-height: 62px;
    padding: 4px 0 0;
  }

  .matrix-choice input[type="radio"] {
    width: 18px;
    height: 18px;
  }

  .matrix-mobile-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    color: #666666;
    text-align: center;
    font-size: 12px;
    line-height: 1.35;
  }

  .matrix-choice:has(input:checked) .matrix-mobile-label {
    color: var(--accent-dark);
    font-weight: 600;
  }

  .slider-labels {
    gap: 20px;
    margin-right: 0;
    font-size: 14px;
  }

  .slider-line {
    grid-template-columns: 1fr 38px;
  }

  .answer-page-btn {
    min-height: 84px;
  }
}

@media (max-width: 420px) {
  #surveyForm.is-consent-page #declineConsentButton:not([hidden]),
  #surveyForm.is-consent-page #declineConsentButton:not([hidden]) ~ #nextPageButton {
    width: 100%;
  }
}
