:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #57606a;
  --border: #c9d1d9;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --ok: #116329;
  --ok-bg: #dafbe1;
  --ng: #a40e26;
  --ng-bg: #ffebe9;
  --warn: #7d4e00;
  --warn-bg: #fff8c5;
  --banner-bg: #fff1d6;
  --banner-border: #bf8700;
  --good: #0b5cad;
  --bad: #8a3ffc;
  --focus: #e36209;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --text: #e6edf3;
    --muted: #9da7b3;
    --border: #3d444d;
    --accent: #4493f8;
    --accent-text: #0d1117;
    --ok: #56d364;
    --ok-bg: #12261e;
    --ng: #ff7b72;
    --ng-bg: #2d1214;
    --warn: #e3b341;
    --warn-bg: #2b2111;
    --banner-bg: #2b2111;
    --banner-border: #bb8009;
    --good: #4493f8;
    --bad: #b083f0;
    --focus: #f0883e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  z-index: 10;
}

.page-header, main, .page-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-header { padding-top: 20px; }
.site-kind { margin: 0; color: var(--muted); font-size: 0.9rem; }
h1 { margin: 0 0 12px; font-size: 1.6rem; line-height: 1.4; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }

section { margin-bottom: 20px; }

.not-submission-banner {
  background: var(--banner-bg);
  border: 3px solid var(--banner-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1.1rem;
}
.not-submission-banner p { margin: 0; }
.not-submission-banner .banner-sub { font-size: 0.95rem; margin-top: 4px; }

.config-error {
  background: var(--ng-bg);
  color: var(--ng);
  border: 2px solid var(--ng);
  border-radius: 8px;
  padding: 12px 16px;
}

.instructions, .check-section, .download-section, .draft-section, .input-notes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.instructions ol { margin: 0; padding-left: 1.6em; }
.instructions li { margin-bottom: 6px; }

.input-notes { margin-bottom: 16px; }
.input-notes-title { margin: 0; font-weight: bold; }
.input-notes ul { margin: 4px 0 8px; padding-left: 1.4em; }
.advisory-caveat { margin: 0; font-size: 0.85rem; color: var(--muted); }

.progress {
  font-weight: bold;
  margin: 8px 0;
}
.progress[data-complete="true"] { color: var(--ok); }

.draft-restored {
  background: var(--warn-bg);
  color: var(--text);
  border-left: 4px solid var(--warn);
  padding: 8px 12px;
  border-radius: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.card.cat-good { border-left-color: var(--good); }
.card.cat-bad { border-left-color: var(--bad); }

.card-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.q-number { font-weight: bold; color: var(--muted); }
.q-category {
  font-size: 0.85rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 10px;
}
.cat-good .q-category { color: var(--good); }
.cat-bad .q-category { color: var(--bad); }

.q-label {
  display: block;
  font-size: 1.1rem;
  font-weight: bold;
  margin: 4px 0 8px;
}
.q-description { margin: 0 0 8px; color: var(--muted); }

textarea {
  display: block;
  width: 100%;
  min-height: 9em;
  padding: 8px 10px;
  font: inherit;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}

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

.meter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
}
.meter .status {
  font-weight: bold;
  padding: 0 8px;
  border-radius: 4px;
}
.card[data-status="ok"] .status { color: var(--ok); background: var(--ok-bg); }
.card[data-status="short"] .status,
.card[data-status="long"] .status { color: var(--ng); background: var(--ng-bg); }
.card[data-status="empty"] .status { color: var(--muted); }
.card[data-status="ok"] textarea { border-color: var(--ok); }
.card[data-status="short"] textarea,
.card[data-status="long"] textarea { border-color: var(--ng); }

.advice {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}
.advice li {
  padding: 6px 12px;
  margin-top: 4px;
  border-radius: 4px;
  color: var(--text);
}
.advice .advice-notice { background: var(--warn-bg); }
.advice .advice-warning {
  background: var(--ng-bg);
  border-left: 4px solid var(--ng);
  font-weight: bold;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: bold;
}
.checkbox-row input {
  width: 1.4em;
  height: 1.4em;
  margin-top: 0.15em;
  flex: none;
}
.consent-description p { margin: 0 0 8px; }
.choice-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 12px 0 0;
  padding: 8px 12px 4px;
}
.choice-group legend { font-weight: bold; padding: 0 4px; }
.choice-group .checkbox-row { margin-bottom: 8px; }
.confirm-reset-note { color: var(--ng); margin: 8px 0 0; }
.confirm-reset-note:empty { display: none; }

.blockers {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.blockers p { margin: 0; }
.blockers ul { margin: 4px 0 0; padding-left: 1.4em; }

.download-button {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 14px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
.download-button:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.after-download {
  margin-top: 16px;
  border: 3px solid var(--banner-border);
  background: var(--banner-bg);
  border-radius: 8px;
  padding: 16px;
}
.after-download-main {
  margin: 0;
  font-size: 1.35rem;
  font-weight: bold;
  line-height: 1.5;
}
.after-download-sub { margin: 8px 0 0; }

.stale-notice {
  margin-top: 12px;
  background: var(--ng-bg);
  color: var(--ng);
  border: 2px solid var(--ng);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: bold;
}

.secondary-button {
  font: inherit;
  padding: 8px 16px;
  border: 2px solid var(--ng);
  color: var(--ng);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}

.small { font-size: 0.9rem; color: var(--muted); }

[hidden] { display: none !important; }

.page-footer {
  padding-bottom: 32px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  h1 { font-size: 1.35rem; }
  .after-download-main { font-size: 1.15rem; }
}
