:root {
  color-scheme: light;
  --ink: #1c342d;
  --muted: #4e6259;
  --accent: #216953;
  --accent-hover: #16513e;
  --paper: #fff;
  --background: #f1f6f4;
  --line: #d8e4dd;
  --hint: #edf6f1;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.55;
}

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

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-size: 1rem;
}

main {
  width: min(100% - 32px, 760px);
  margin-inline: auto;
  padding-block: clamp(18px, 5vw, 56px) 48px;
}

h1, h2, p { margin: 0; }

.intro {
  padding: clamp(22px, 5vw, 40px);
  background: #e0f0e8;
  border: 1px solid #cfe3d8;
  border-radius: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: .875rem;
  margin-bottom: 10px;
}

h1 {
  font-size: clamp(1.8rem, 5.5vw, 2.7rem);
  line-height: 1.22;
  letter-spacing: -.018em;
  margin-bottom: 14px;
}

.intro p + p { margin-top: 10px; }
.note, .hint { color: var(--muted); font-size: .875rem; }

.progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
  font-size: .875rem;
}

progress, meter {
  accent-color: var(--accent);
  width: 100%;
}

progress { flex: 1 1 80px; height: .85rem; }
meter { height: .62rem; display: block; margin-top: 5px; }

fieldset {
  min-width: 0;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  padding: 0 clamp(14px, 3vw, 24px) 18px;
}

legend {
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 100%;
  padding: 18px 0 12px;
  width: 100%;
  float: left;
  font-size: 1.0625rem;
  line-height: 1.45;
  font-weight: 700;
}

.number {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  align-self: flex-start;
  min-width: 26px;
  height: 26px;
  color: var(--accent);
  background: var(--hint);
  border-radius: 7px;
  font-size: .875rem;
}

.options {
  clear: both;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hint { clear: both; margin-bottom: 8px; }

.option {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.option:hover, .option:has(input:checked) {
  background: var(--hint);
  border-color: #71a58d;
}

.option input {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
}

@media (min-width: 660px) {
  .scales { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .scales .option { justify-content: center; }
}

@media (max-width: 430px) {
  .options:not(.scales) { grid-template-columns: 1fr; }
}

.form-end { padding-top: 6px; }

button, .actions a {
  display: inline-flex;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 11px 18px;
}

button { cursor: pointer; width: 100%; }
button:disabled { cursor: wait; opacity: .65; }
button:not(:disabled):hover, .actions a:hover { background: var(--accent-hover); }
:focus-visible { outline: 3px solid #a46a24; outline-offset: 3px; }
#form-status { margin-top: 10px; color: #91372e; }
.message { margin-top: 8px; }

.overview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.overview > div {
  background: var(--paper);
  border: 1px solid #cfe3d8;
  border-radius: 12px;
  padding: 12px;
}

.overview strong { display: block; font-size: 1.6rem; }
.overview small { color: var(--muted); font-size: .8125rem; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions a:last-child { background: var(--paper); color: var(--accent-hover); }
.actions a:last-child:hover { background: #f1f8f4; }

.result-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 12px;
  padding: 16px clamp(14px, 3vw, 24px);
}

.result-card h2 { display: flex; align-items: baseline; gap: 10px; font-size: 1.0625rem; }
.result-card .hint { margin: 8px 0 0 36px; }
.result-card ul { list-style: none; padding: 0; margin-bottom: 0; }
.result-card li + li { margin-top: 11px; }
.metric { display: flex; justify-content: space-between; gap: 8px; }
.metric span:last-child { flex-shrink: 0; color: var(--muted); font-size: .875rem; }

main:has(.dashboard:not([hidden])) {
  width: min(100% - 32px, 1060px);
}

.dashboard-intro { padding: clamp(18px, 4vw, 34px); }
.dashboard .overview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard .overview > div { padding: 12px 14px; }
.dashboard .overview > div > span { font-size: .875rem; font-weight: 600; }
.dashboard .overview strong {
  margin-top: 2px;
  font-size: clamp(1.45rem, 3.8vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.dashboard .overview small { display: block; margin-top: 6px; }
.dashboard .overview small:empty { display: none; }
.dashboard-note { margin: 0 0 14px; color: var(--muted); }

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chart {
  --agree: #256a54;
  --neutral: #aebdb6;
  --disagree: #bc6956;
  padding: clamp(15px, 3vw, 22px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: 0;
}

.chart--wide { grid-column: 1 / -1; }
.chart h2 { font-size: 1.075rem; }
.chart p { margin-top: 5px; }
.chart-note { color: var(--muted); font-size: .875rem; }

.chart-list, .chart-legend {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.chart-stack, .chart-track {
  display: flex;
  width: 100%;
  height: 11px;
  margin-top: 6px;
  border-radius: 6px;
  overflow: hidden;
  background: #e7eee9;
}

.chart-stack { height: 15px; }
.chart-fill { background: var(--agree); }
.chart-fill--barrier { background: #a6523e; }
.chart-fill--scenario { background: #386889; }

.chart-segment--agree, .chart-swatch--agree { background: var(--agree); }
.chart-segment--neutral, .chart-swatch--neutral { background: var(--neutral); }
.chart-segment--disagree, .chart-swatch--disagree { background: var(--disagree); }

.chart-legend, .chart-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--muted);
  font-size: .875rem;
}

.chart-key { display: flex; gap: 6px; align-items: center; }
.chart-swatch { width: 10px; height: 10px; border-radius: 2px; }
.chart-item + .chart-item { margin-top: 13px; }
.chart-item .metric { font-weight: 550; }
.chart-item .metric span:last-child { font-variant-numeric: tabular-nums; }
.chart-values { margin-top: 5px; }

.dashboard-detail {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.dashboard-detail summary { padding: 5px 8px; font-weight: 700; cursor: pointer; }
.dashboard-detail[open] summary { margin-bottom: 10px; }
.dashboard-detail .result-card:last-child { margin-bottom: 0; }

@media (max-width: 710px) {
  .dashboard .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-charts { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
  .dashboard .overview > div { padding-inline: 8px; }
  .chart-item .metric { flex-wrap: wrap; }
}
