:root {
  --blue: #1a3a5c;
  --blue-900: #102842;
  --blue-700: #245078;
  --green: #1f8f5f;
  --yellow: #b98512;
  --red: #c93b3b;
  --text: #17202a;
  --muted: #647182;
  --line: #d9e1ea;
  --card: #f4f6f8;
  --bg: #eef2f6;
  --white: #ffffff;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(26, 58, 92, 0.12), transparent 280px),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 5vw, 64px);
  background: var(--blue);
  color: var(--white);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.home-link,
.reset-button,
.primary-button,
.choice-button {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.home-link {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--white);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.tool-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(34px, 6vw, 72px) 0;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 900;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  color: var(--blue-900);
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05;
}

.hero p:last-child {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.checklist-panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 70px rgba(16, 40, 66, 0.12);
}

.checklist-panel {
  padding: clamp(20px, 4vw, 34px);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.panel-heading h2 {
  margin-bottom: 0;
  color: var(--blue-900);
  font-size: clamp(24px, 3vw, 34px);
}

.reset-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
}

.progress-card {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid rgba(26, 58, 92, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(26, 58, 92, 0.08), rgba(255, 255, 255, 0.9));
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-label strong {
  color: var(--blue-900);
  font-size: 18px;
}

.progress-label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #2b78a0);
  transition: width 0.24s ease;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--card);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.question-card.answered {
  border-color: var(--blue);
  background: #f8fafc;
}

.question-card h3 {
  margin: 0 0 14px;
  color: var(--blue-900);
  font-size: 18px;
  line-height: 1.5;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.choice-button .mark {
  color: var(--muted);
  font-size: 18px;
}

.choice-button.selected {
  border-color: var(--blue);
  background: rgba(26, 58, 92, 0.08);
  color: var(--blue);
}

.choice-button.selected .mark {
  color: var(--blue);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  background: var(--blue);
  color: #fff;
}

.form-warning {
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

.result-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
  padding: clamp(20px, 4vw, 30px);
  background:
    linear-gradient(135deg, rgba(26, 58, 92, 0.08), rgba(255, 255, 255, 0.96)),
    #fff;
}

.result-card[hidden] {
  display: none;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-bottom: 12px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.result-card.low .result-badge {
  background: var(--result-color, var(--green));
}

.result-card.medium .result-badge {
  background: var(--result-color, var(--yellow));
}

.result-card.high .result-badge {
  background: var(--result-color, var(--red));
}

.risk-gauge {
  --score: 0;
  --gauge-color: var(--green);
  display: grid;
  place-items: center;
  width: 164px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 56%),
    conic-gradient(var(--gauge-color) calc(var(--score) * 1%), #d8e1ea 0);
  box-shadow:
    inset 0 0 0 1px rgba(26, 58, 92, 0.08),
    0 16px 42px rgba(16, 40, 66, 0.16);
}

.gauge-core {
  display: grid;
  place-items: center;
  width: 104px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(26, 58, 92, 0.1);
}

.gauge-core span {
  color: var(--blue-900);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.gauge-core small {
  color: var(--muted);
  font-size: 12px;
}

.result-card h2 {
  margin-bottom: 8px;
  color: var(--blue-900);
}

.result-card p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.result-card small {
  color: var(--muted);
  font-weight: 800;
}

body.night-mode {
  background: #1a1a1a;
  color: #cccccc;
}

body.night-mode .topbar {
  background: #1a1a1a;
}

body.night-mode .checklist-panel,
body.night-mode .result-card,
body.night-mode .question-card,
body.night-mode .progress-card,
body.night-mode .choice-button {
  background: #242424;
  color: #cccccc;
}

body.night-mode h1,
body.night-mode h2,
body.night-mode h3,
body.night-mode .brand strong {
  color: #f0f0f0;
}

body.night-mode p,
body.night-mode .hero p:last-child,
body.night-mode .progress-label span,
body.night-mode .result-card p,
body.night-mode .result-card small {
  color: #cccccc;
}

body.night-mode *,
body.night-mode *::before,
body.night-mode *::after {
  transition: background-color 0.3s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

@media (max-width: 720px) {
  .topbar,
  .panel-heading,
  .action-row,
  .result-card {
    display: grid;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .risk-gauge {
    width: 150px;
  }

  .progress-label {
    display: grid;
  }

  .home-link,
  .reset-button,
  .primary-button {
    width: 100%;
    text-align: center;
  }

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