:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --surface: #ffffff;
  --soft: #f0f4f8;
  --blue: #1769aa;
  --blue-dark: #0b4f83;
  --gold: #8a6500;
  --danger: #9b2c2c;
  --shadow: 0 18px 48px rgba(16, 42, 67, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(23, 105, 170, 0.12), transparent 32rem),
    linear-gradient(180deg, #f7fafc, #edf2f7);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.65;
}

button, input, textarea, select { font: inherit; }

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  color: var(--muted);
}

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .04em;
}

.topbar-note { font-size: .9rem; }
.page-shell { width: min(1120px, calc(100% - 32px)); margin: 18px auto 64px; }

.access-card {
  width: min(760px, 100%);
  margin: 7vh auto 0;
  padding: clamp(28px, 6vw, 64px);
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.eyebrow { color: var(--blue); font-weight: 800; letter-spacing: .08em; }
h1 { margin: 4px 0 12px; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.14; }
.lead { color: var(--muted); font-size: 1.05rem; }

.privacy-box {
  margin: 24px 0;
  padding: 16px 18px;
  border-left: 4px solid #d69e2e;
  border-radius: 10px;
  background: #fffaf0;
}
.privacy-box p { margin: 4px 0 0; }

.access-form label { display: block; margin-bottom: 8px; font-weight: 700; }
.inline-field { display: flex; gap: 10px; }

input[type="password"], textarea, select {
  width: 100%;
  border: 1px solid #bcccdc;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  background: white;
}

.button {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
}
.button.primary { color: white; background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { color: var(--ink); background: #d9e2ec; }
.button.danger { color: white; background: var(--danger); }
.button.quiet { width: 100%; color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button:disabled { cursor: not-allowed; opacity: .48; }

:focus-visible { outline: 3px solid rgba(23, 105, 170, .35); outline-offset: 3px; }
.status { min-height: 1.5em; color: var(--danger); }

.survey-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 26px; }
.section-panel, .question-stage {
  min-width: 0;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}
.section-panel { position: sticky; top: 18px; align-self: start; padding: 18px; }
.question-stage { padding: clamp(22px, 4vw, 46px); min-height: 680px; }
.survey-controls { min-inline-size: 0; margin: 0; padding: 0; border: 0; }

.progress-block { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-bottom: 18px; }
progress { width: 100%; accent-color: var(--blue); }
.draft-budget { margin: -8px 0 14px; color: var(--muted); font-size: .82rem; }
.draft-budget.over-budget { color: var(--danger); font-weight: 700; }

.section-nav { display: grid; gap: 6px; margin-bottom: 18px; }
.section-link {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.section-link.active { color: white; background: var(--blue); }

.question-meta { color: var(--muted); font-size: .92rem; }
.question-card h2 { margin: 10px 0 18px; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.4; }
.question-options { display: grid; gap: 10px; }
.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.option:hover { border-color: #9fb3c8; background: #f8fbff; }
.option input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--blue); }
textarea { min-height: 190px; resize: vertical; }

.matrix { width: 100%; border-collapse: collapse; overflow-x: auto; display: block; }
.matrix th, .matrix td { padding: 9px; border: 1px solid var(--line); text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; white-space: normal; min-width: 220px; }
.matrix th { background: var(--soft); }

.missing-control { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.missing-control label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .92rem; }
.priority-control { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.priority-control label { display: block; margin-bottom: 8px; font-weight: 700; }
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.actions #next, .actions #submit-survey { margin-left: auto; }

@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .page-shell { width: min(100% - 20px, 680px); margin-top: 8px; }
  .access-card { margin-top: 2vh; padding: 24px 20px; border-radius: 18px; }
  .inline-field { flex-direction: column; }
  .survey-layout { grid-template-columns: minmax(0, 1fr); }
  .section-panel { position: static; }
  .section-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-stage { min-height: 620px; padding: 22px 18px; }
  .actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
