:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef6f2;
  --text: #17231f;
  --muted: #66746f;
  --line: #dce5df;
  --brand: #0f766e;
  --brand-strong: #075e57;
  --accent: #d97706;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(20, 41, 34, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.13), rgba(246, 247, 244, 0) 280px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 14px 44px;
}

.survey-hero {
  padding: 22px 4px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.3;
}

.intro {
  margin-bottom: 0;
  color: #34413d;
  font-size: 16px;
}

.survey-form,
.result-panel {
  display: grid;
  gap: 14px;
}

.identity-section,
.question-card,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.identity-section,
.question-card {
  padding: 18px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.text-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.text-field input,
.open-answer {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.text-field input {
  min-height: 48px;
  padding: 10px 12px;
}

.open-answer {
  min-height: 128px;
  resize: vertical;
  padding: 12px;
}

.text-field input:focus,
.open-answer:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.text-field input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

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

.question-title {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 750;
}

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

.option-list {
  display: grid;
  gap: 10px;
}

.option-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 10px;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.option-item input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.option-item:has(input:checked) {
  border-color: rgba(15, 118, 110, 0.55);
  background: var(--surface-soft);
}

.option-item:has(input[aria-invalid="true"]) {
  border-color: rgba(180, 35, 24, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}

.course-title {
  display: block;
  font-weight: 750;
}

.course-desc {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.actions,
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-actions .primary-button:only-child,
.result-actions .secondary-button:only-child {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 750;
}

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

.primary-button:active {
  background: var(--brand-strong);
}

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

.result-panel {
  margin-top: 16px;
  padding: 18px;
}

.result-panel p {
  color: var(--muted);
}

.close-help {
  margin-bottom: 0;
  font-size: 14px;
}

#resultText {
  max-height: 320px;
  overflow: auto;
  margin: 2px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #10231f;
  color: #ecfdf5;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-message {
  margin-top: 10px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

@media (min-width: 680px) {
  .page-shell {
    padding-top: 34px;
  }

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

  .identity-section,
  .question-card,
  .result-panel {
    padding: 22px;
  }
}

@media (max-width: 430px) {
  .actions,
  .result-actions {
    grid-template-columns: 1fr;
  }

  .identity-section,
  .question-card,
  .result-panel {
    padding: 16px;
  }
}
