/*
 * 回答画面のスタイル（仕様書 3章）
 * - 本文 16px 以上。文字と背景のコントラスト比 4.5:1 以上。
 * - 文字を200%に拡大しても横スクロールが出ないよう、幅は rem と % で指定する。
 * - 外部フォントは読み込まない。
 */

:root {
  color-scheme: light;
  --text: #1a1a1a;
  --text-muted: #4a4a4a; /* 白地で 8.9:1 */
  --bg: #ffffff;
  --surface: #f3f6f9;
  --border: #6b7280; /* 白地で 4.8:1（入力欄の枠は 3:1 以上） */
  --accent: #0b5cad; /* 白地で 6.4:1 */
  --accent-dark: #084887;
  --error: #b3261e; /* 白地で 6.5:1 */
  --error-bg: #fdf1f0;
  --focus: #0b5cad;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 1.0625rem; /* 17px */
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.container {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  border-bottom: 4px solid var(--accent);
  background: var(--surface);
}

.site-org {
  margin: 0;
  padding: 0.75rem 0;
  font-weight: 700;
}

main {
  padding-bottom: 4rem;
}

h1 {
  margin: 1.5rem 0 1rem;
  font-size: 1.5rem;
  line-height: 1.5;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.5;
}

p {
  margin: 0 0 1rem;
}

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

/* ---- フォーカス表示（キーボード操作で位置が分かるように） ---- */

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

h2:focus {
  outline: none;
}

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

/* ---- 冒頭説明 ---- */

.intro {
  margin-bottom: 2rem;
}

.intro-list {
  margin: 0 0 1rem;
  padding: 1rem 1rem 1rem 2.25rem;
  background: var(--surface);
  border-radius: 0.5rem;
}

.intro-list li + li {
  margin-top: 0.25rem;
}

.required-note {
  font-weight: 700;
}

.notice {
  padding: 1rem;
  border: 2px solid var(--error);
  background: var(--error-bg);
  color: var(--error);
  font-weight: 700;
}

/* ---- 設問 ---- */

.section {
  margin: 0 0 2.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.section h2 {
  margin: 1rem 0 1.25rem;
}

.section-no {
  display: inline-block;
  margin-right: 0.75rem;
  padding: 0 0.6rem;
  border-radius: 0.25rem;
  background: var(--accent);
  color: #ffffff;
}

.question {
  margin: 0 0 1.75rem;
  padding: 0;
  border: 0;
  min-width: 0;
}

.question-prompt {
  display: block;
  margin-bottom: 0.75rem;
  padding: 0;
  font-weight: 700;
}

.answer-type {
  font-weight: 400;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.5rem;
  border-radius: 0.25rem;
  background: var(--error);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.75;
  vertical-align: 0.1em;
}

.hint {
  margin: -0.25rem 0 0.75rem;
  color: var(--text-muted);
}

.options {
  display: grid;
  gap: 0.5rem;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
}

.option:hover {
  background: var(--surface);
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: #eaf2fb;
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* キーボード操作中は選択肢の行全体を囲み、フォーカス位置を分かりやすくする */
.option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.option input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.25rem 0 0;
  accent-color: var(--accent);
}

.option label {
  flex: 1;
  cursor: pointer;
}

.other-input {
  margin: 0 0 0.25rem 2.75rem;
}

.other-input .question-prompt {
  margin-bottom: 0.25rem;
  font-weight: 400;
}

.label-note {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ---- 自由記述 ---- */

input[type="text"],
textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 0.375rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input[type="text"]:disabled,
textarea:disabled {
  border-style: dashed;
  background: #eceff3;
  color: var(--text-muted);
  cursor: not-allowed;
}

.examples {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--border);
  background: var(--surface);
}

.examples-title {
  margin: 0;
  font-weight: 700;
}

.examples ul {
  margin: 0;
  padding-left: 1.25rem;
}

.counter {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-align: right;
}

.counter.is-over {
  color: var(--error);
  font-weight: 700;
}

/* ---- エラー ---- */

.error-message {
  margin: 0 0 0.5rem;
  color: var(--error);
  font-weight: 700;
}

.error-message::before {
  content: "エラー：";
}

.has-error {
  padding-left: 0.75rem;
  border-left: 4px solid var(--error);
}

.has-error input[type="text"],
.has-error textarea {
  border-color: var(--error);
}

/* ---- ハニーポット（画面にも読み上げにも出さない） ---- */

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- 送信 ---- */

.submit-area {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-message:empty {
  display: none;
}

.form-message {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 2px solid var(--error);
  border-radius: 0.5rem;
  background: var(--error-bg);
}

.form-message p {
  margin: 0;
  font-weight: 700;
}

.form-message ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.form-message a {
  color: var(--error);
  font-weight: 700;
}

.submit-button {
  display: block;
  width: 100%;
  max-width: 20rem;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  border: 2px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.submit-button:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.submit-button:disabled {
  border-color: #6b7280;
  background: #6b7280; /* 白文字で 4.8:1 */
  cursor: wait;
}

/* ---- 完了・受付終了など ---- */

.view-message {
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.view-message h2 {
  margin-top: 0;
}

.view-message p:last-child {
  margin-bottom: 0;
}

[hidden] {
  display: none !important;
}

@media (forced-colors: active) {
  .section-no,
  .badge {
    border: 1px solid CanvasText;
  }
}
