:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #17212b;
  --muted: #5c6b7a;
  --line: #dde3ea;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand-name {
  font-size: 14px;
  color: var(--muted);
}

.topbar-status {
  font-size: 13px;
  color: var(--muted);
}

.site-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--bg);
}

.site-gate[hidden] {
  display: none !important;
}

.gate-card {
  width: min(420px, 100%);
  padding: 28px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}

.gate-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.gate-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.gate-card input {
  text-align: center;
}

.gate-card .button {
  width: 100%;
  margin-top: 12px;
}

.shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.view[hidden] {
  display: none !important;
}

.intro-head {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.intro-head h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.2;
}

.intro-lead {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.panel {
  margin-top: 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.rubric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.rubric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
}

.rubric h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.rubric p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--muted);
}

.rubric strong {
  color: var(--ink);
  margin-right: 3px;
}

.muted {
  color: var(--muted);
}

.quiz-item {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.quiz-item h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.case-summary {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.6;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.radio-row label:has(input:checked) {
  border-color: var(--accent);
  background: #eef6f5;
  color: var(--accent-dark);
  font-weight: 600;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.contact-field {
  max-width: 520px;
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.28);
  border-color: var(--accent);
}

.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}

.category-chip:hover {
  border-color: var(--accent);
}

.category-chip.selected {
  border-color: var(--accent);
  background: #eef6f5;
  color: var(--accent-dark);
  font-weight: 700;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.button {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

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

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

.button.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.ghost:hover {
  background: #f2f4f6;
}

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

.error-text {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 14px;
}

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

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-label strong {
  color: var(--ink);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e7ebef;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

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

/* 任务页两栏布局：左侧内容（诉求+回复），右侧评分固定可见 */
.task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
  gap: 16px;
  align-items: start;
}

.task-main {
  min-width: 0;
}

.form-panel {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  margin-top: 0;
}

.case-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.case-card h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: #41505f;
  font-size: 12px;
  white-space: nowrap;
}

.scroll-text {
  flex: 1;
  min-height: 210px;
  max-height: 46vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.case-reply-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.text-button {
  margin-top: 8px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.text-button:hover {
  text-decoration: underline;
}

.reply-org {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
}

.form-panel {
  margin-top: 16px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.score-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.score-item h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.score-options {
  display: flex;
  gap: 8px;
}

.score-options label {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.score-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.score-options label:has(input:checked) {
  border-color: var(--accent);
  background: #eef6f5;
  color: var(--accent-dark);
  font-weight: 700;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.done-panel {
  text-align: center;
}

.done-panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.done-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.footer {
  padding: 18px 20px 34px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1000px) {
  .task-layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 16px;
  }
}

@media (max-width: 780px) {
  .shell {
    padding: 20px 12px 48px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .brand-name {
    display: none;
  }

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

  .scroll-text {
    max-height: 34vh;
    min-height: 140px;
  }

  .scroll-text.reply-expanded {
    max-height: none;
  }

  .progress-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

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