:root {
  color-scheme: light;
  --ink: #1f2925;
  --muted: #65706b;
  --line: #d9e0dc;
  --surface: #ffffff;
  --soft: #f3f6f4;
  --page: #edf2ef;
  --accent: #087f6e;
  --accent-dark: #056356;
  --accent-soft: #dff2ed;
  --gold: #a66705;
  --gold-soft: #fff4d7;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 8px 26px rgba(28, 42, 35, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--ink); font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif; line-height: 1.55; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
h1, h2, h3, p { margin-top: 0; }
fieldset { min-width: 0; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, main { width: min(calc(100% - 32px), 1000px); margin: 0 auto; }
.header-inner { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.header-inner h1 { margin-bottom: 3px; font-size: 23px; line-height: 1.3; }
.header-inner p { margin: 0; color: var(--muted); font-size: 14px; }
.time-hint { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #b9ded6; border-radius: 6px; background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; }
main { padding: 24px 0 128px; }
.is-hidden { display: none !important; }

.intro { margin-bottom: 18px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.intro h2 { margin-bottom: 5px; font-size: 18px; }
.intro p { margin: 0; color: var(--muted); }
#assessmentForm { overflow: visible; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.form-section { padding: 28px 26px; border-bottom: 1px solid var(--line); }
.section-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading > span { color: var(--accent-dark); font-size: 12px; font-weight: 700; }
.section-heading h2 { margin: 3px 0 4px; font-size: 20px; line-height: 1.35; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; margin-top: 20px; }
.field { display: grid; gap: 7px; color: #3f4944; font-size: 14px; font-weight: 600; }
.field b { color: var(--danger); }
.field input, .field select, .question textarea, .other-input, .note-input, .admin-field input, .admin-field textarea {
  width: 100%; border: 1px solid #c8d1cc; border-radius: 6px; background: #fff; color: var(--ink); padding: 11px 12px; outline: 0; font-weight: 400;
}
.field input:focus, .field select:focus, .question textarea:focus, .other-input:focus, .note-input:focus, .admin-field input:focus, .admin-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 127, 110, .14); }
.question textarea, .admin-field textarea { min-height: 92px; resize: vertical; }
.inline-field { margin: 0; padding: 0; border: 0; }
.inline-field legend { margin-bottom: 7px; color: #3f4944; font-size: 14px; font-weight: 600; }
.compact-options { display: flex; gap: 8px; }
.compact-options label { flex: 1; }
.compact-options input { position: absolute; opacity: 0; }
.compact-options span { min-height: 43px; display: flex; align-items: center; justify-content: center; border: 1px solid #c8d1cc; border-radius: 6px; cursor: pointer; }
.compact-options input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--accent); }

.question-list { display: grid; }
.question { margin: 0; padding: 22px 0; border: 0; border-bottom: 1px solid #e7ebe9; }
.question:last-child { padding-bottom: 0; border-bottom: 0; }
.question legend { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 9px; align-items: start; margin-bottom: 14px; font-weight: 650; }
.question-id { display: inline-flex; width: 42px; height: 28px; align-items: center; justify-content: center; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 12px; }
.required-mark { margin-top: 2px; padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; }
.question.needs-answer { margin-inline: -12px; padding-inline: 12px; border-radius: 6px; background: var(--danger-soft); }
.option-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-left: 57px; }
.option-list-compact { display: flex; flex-wrap: wrap; }
.option-list-compact .option { flex: 1 1 180px; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option > span { min-height: 46px; display: flex; align-items: center; border: 1px solid #c8d1cc; border-radius: 6px; padding: 9px 12px; background: #fff; color: #3e4944; cursor: pointer; font-size: 14px; }
.option input:focus-visible + span { outline: 3px solid rgba(8, 127, 110, .2); outline-offset: 2px; }
.option input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--accent); }
.other-input, .note-input, .question textarea { width: calc(100% - 57px); margin: 11px 0 0 57px; }
.scale-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-left: 57px; }
.scale-list .option > span { justify-content: center; flex-direction: column; gap: 2px; text-align: center; }
.scale-list b { font-size: 16px; }
.scale-list small { color: var(--muted); }

.submit-bar { position: sticky; bottom: 12px; z-index: 20; margin: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.98); box-shadow: 0 12px 34px rgba(25,35,31,.16); }
.progress-line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.progress-track { height: 5px; margin: 8px 0 12px; overflow: hidden; border-radius: 5px; background: #e7ece9; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; padding: 9px 15px; text-decoration: none; cursor: pointer; font-weight: 700; font-size: 14px; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { border-color: #c8d1cc; background: #fff; color: #34403b; }
.button-secondary:hover { background: var(--soft); }
.button-danger { border-color: #e5aaa4; background: #fff; color: var(--danger); }
.button:disabled { opacity: .6; cursor: not-allowed; }
.submit-bar .button { width: 100%; }

.result-view { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.result-header { position: relative; padding: 32px; border-bottom: 1px solid var(--line); }
.result-header > span { color: var(--accent-dark); font-size: 13px; font-weight: 700; }
.result-header h2 { margin: 4px 120px 5px 0; font-size: 28px; }
.result-header p { max-width: 620px; margin: 0; color: var(--muted); }
.score-total { position: absolute; right: 32px; top: 30px; display: flex; align-items: baseline; gap: 4px; }
.score-total strong { color: var(--accent-dark); font-size: 46px; line-height: 1; }
.score-total span { color: var(--muted); }
.dimension-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.dimension { padding: 24px; border-right: 1px solid var(--line); }
.dimension:last-child { border-right: 0; }
.dimension > span { color: var(--muted); font-size: 13px; }
.dimension h3 { margin: 3px 0 7px; font-size: 20px; }
.dimension p { min-height: 67px; margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.dimension b { color: var(--accent-dark); }
.result-section { padding: 25px 30px; border-bottom: 1px solid var(--line); }
.result-section h3 { margin-bottom: 13px; font-size: 17px; }
.result-section p { margin: 0; color: #45514b; }
.result-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.result-columns ul { margin: 0; padding-left: 20px; }
.result-columns li + li { margin-top: 7px; }
.score-bars { display: grid; gap: 13px; }
.score-row > div { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 14px; }
.score-row progress { display: block; width: 100%; height: 9px; border: 0; border-radius: 6px; overflow: hidden; appearance: none; }
.score-row progress::-webkit-progress-bar { background: #e7ece9; }
.score-row progress::-webkit-progress-value { background: var(--accent); }
.score-row progress::-moz-progress-bar { background: var(--accent); }
.result-note { margin: 0; padding: 17px 30px; background: var(--soft); color: var(--muted); font-size: 13px; }
.result-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 30px; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; max-width: min(380px, calc(100% - 36px)); padding: 12px 15px; border-radius: 6px; background: #25312c; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: var(--danger); }

@media (max-width: 720px) {
  .header-inner, main { width: min(calc(100% - 24px), 1000px); }
  .header-inner { min-height: 80px; }
  .header-inner h1 { font-size: 19px; }
  .header-inner p { font-size: 12px; }
  .time-hint { max-width: 102px; text-align: center; }
  main { padding-top: 14px; }
  .intro { padding: 17px 16px; }
  .form-section { padding: 23px 16px; }
  .field-grid, .dimension-grid, .result-columns { grid-template-columns: 1fr; }
  .dimension { border-right: 0; border-bottom: 1px solid var(--line); }
  .dimension:last-child { border-bottom: 0; }
  .dimension p { min-height: 0; }
  .question legend { grid-template-columns: 46px minmax(0, 1fr); }
  .required-mark { display: none; }
  .option-list, .scale-list { margin-left: 0; }
  .other-input, .note-input, .question textarea { width: 100%; margin-left: 0; }
  .scale-list { grid-template-columns: repeat(2, 1fr); }
  .submit-bar { bottom: 8px; margin: 12px; padding: 12px; }
  .result-header { padding: 24px 20px 82px; }
  .result-header h2 { margin-right: 0; font-size: 24px; }
  .score-total { right: auto; left: 20px; top: auto; bottom: 22px; }
  .score-total strong { font-size: 38px; }
  .result-section { padding: 22px 20px; }
  .result-actions { padding: 18px 20px; }
  .result-actions .button { flex: 1; }
}

@media (max-width: 430px) {
  .option-list { grid-template-columns: 1fr; }
  .progress-line { gap: 8px; }
  #draftStatus { text-align: right; }
}

@media print {
  body { background: #fff; }
  .site-header, .submit-bar, .result-actions, .toast, #assessmentView { display: none !important; }
  main { width: 100%; padding: 0; }
  .result-view { box-shadow: none; border: 0; }
}
