:root {
  --moss: #3a6b45;
  --cream: #f4e7c8;
  --paper: #fff6df;
  --ink: #2a1a12;
  --gold: #d8b56a;
  --bark: #7a4a28;
  --ok: #1f5c45;
  --focus: #3a6b45;
  --cinnabar: #8f2d2a;
  --muted: #5c5348;
  --forest: #3a6b45;
  --forest-2: #2a4030;
  --line: #d8b56a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(227, 161, 43, 0.16), transparent 28%),
    linear-gradient(180deg, #6d8a55 0%, #2a4030 100%);
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--moss); }

.site-switch {
  display: flex;
  width: min(920px, calc(100% - 32px));
  margin: 18px auto 0;
  border: 3px solid var(--gold);
  border-radius: 18px;
  overflow: hidden;
  background: #2a4030;
}

.site-switch a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-align: center;
  padding: 10px 8px;
  color: #f7eed4;
  text-decoration: none;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 1.02rem;
}

.site-switch a.on { background: var(--moss); }

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 8px auto 0;
  width: min(920px, calc(100% - 32px));
  color: #f7eed4;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 15px;
}

.module-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(920px, calc(100% - 32px));
  margin: 10px auto 12px;
}

.pill {
  min-height: 44px;
  border: 3px solid var(--gold);
  border-radius: 18px;
  background: #2a4030;
  color: #f7eed4;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 0.95rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}

.pill.on { background: var(--moss); }

.sheet {
  width: min(920px, calc(100% - 32px));
  margin: 8px auto 40px;
  padding: 22px;
  background: var(--paper);
  border: 4px solid var(--gold);
  border-radius: 28px;
  box-shadow: 0 18px 0 rgba(31, 61, 43, 0.18);
}

.mast {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-bottom: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--bark);
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 12px;
  letter-spacing: 0.22em;
}

h1 {
  margin: 2px 0 4px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  color: var(--ink);
}

.sub, .disclosure, .mode, .progress, .stats, .colophon p {
  margin: 0;
}

.sub { font-size: 18px; }

.disclosure, .stats, .colophon, .mode {
  color: var(--muted);
  font-size: 14px;
}

.disclosure { margin-top: 8px; }

.mode {
  margin-top: 14px;
  color: var(--moss);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.field { min-width: 0; }

label, legend, button, select {
  font-family: "PingFang SC", "Hiragino Sans GB", sans-serif;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

select, button, .opt { min-height: 44px; }

select, button {
  width: 100%;
  border: 3px solid var(--gold);
  border-radius: 18px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 16px;
}

select { padding: 0 10px; }

button {
  padding: 0 12px;
  cursor: pointer;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
}

button:hover { filter: brightness(1.04); }

#submitBtn {
  background: var(--moss);
  color: #f6f1e7;
}

#submitBtn:hover { background: var(--forest-2); }

.progress { margin-top: 16px; font-size: 15px; }

.stats { margin-top: 4px; }

#question { margin-top: 14px; }

fieldset {
  margin: 0;
  padding: 12px;
  border: 3px solid var(--gold);
  border-radius: 18px;
  min-width: 0;
  background: var(--cream);
}

legend {
  padding: 0 6px;
  font-size: 18px;
  line-height: 1.45;
}

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  padding: 0 10px;
  border: 3px solid transparent;
  border-radius: 18px;
  background: var(--paper);
}

.opt:has(input:checked) {
  border-color: var(--gold);
}

.opt input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.actions, .row-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

#result {
  min-height: 1.5em;
  margin-top: 14px;
  overflow-wrap: anywhere;
}

#result p, #result li { margin: 0 0 8px; }

#result .ok { color: var(--ok); }

#result .bad { color: var(--cinnabar); }

#result ol { margin: 8px 0 0; padding-left: 1.2em; }

.colophon {
  margin-top: 22px;
  padding-top: 12px;
}

.colophon p + p { margin-top: 6px; }

dialog {
  width: min(36rem, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 4px solid var(--gold);
  border-radius: 28px;
  background: var(--paper);
  color: var(--ink);
  padding: 18px 16px 16px;
}

dialog::backdrop { background: rgba(42, 26, 18, 0.45); }

dialog h2 {
  margin: 0 0 8px;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: 26px;
}

details {
  margin: 12px 0;
  padding-top: 8px;
}

summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.roles p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 18px;
  background: var(--cream);
}

.roles p + p { margin-top: 6px; }

.roles span { color: var(--bark); }

.table-wrap { max-width: 100%; overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th, td {
  border-bottom: 1px solid var(--gold);
  text-align: left;
  padding: 8px 6px;
}

:focus-visible {
  outline: 3px solid var(--moss);
  outline-offset: 2px;
}

@media (max-width: 680px) {
  nav.site-switch {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  nav.site-switch > a {
    min-width: 0;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 15px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .module-switch { grid-template-columns: 1fr 1fr; }
  .controls, .actions, .row-actions { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .module-switch { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 641px) {
  .actions { grid-template-columns: 1fr 1fr 1fr; }
  .row-actions { grid-template-columns: 1.2fr 1fr 1fr; }
}

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

button:disabled { opacity: .6; cursor: default; }
