/* 計器診断（経営版）v0 — keiei.css
   デザイントークンは mock/result_screen_mock.html を踏襲。
   書類メタファーのみ「組織耐荷重試験 成績書」→「飛行前点検表」に変更。 */

:root {
  --bg: #eef0ea;
  --sheet: #f9faf5;
  --grid: #e0e6da;
  --ink: #2a332e;
  --sub: #636d66; /* WCAG AA: bg上4.68:1（旧#6b756eは4.16で未達） */
  --accent: #c43724; /* WCAG AA: sheet上5.11:1・白文字5.36:1（旧#d9432fは未達） */
  --accent-ink: #ffffff; /* accent背景の上に載せる文字色 */
  --ok: #3e7d5a;
  --line: #c8d0c6;
  --box: #fdfdf9;
  --shadow: rgba(42, 51, 46, 0.12);
  --illust-filter: none; /* イラストはクリーム紙背景のため、ダークでは減光する */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141917;
    --sheet: #1d2420;
    --grid: #28332c;
    --ink: #e8ede8;
    --sub: #93a099;
    --accent: #ff6b52;
    --accent-ink: #141917; /* WCAG AA: 6.33:1（白文字は2.81で未達のため暗色にする） */
    --ok: #5fae85;
    --line: #3a463f;
    --box: #232b26;
    --shadow: rgba(0, 0, 0, 0.4);
    --illust-filter: brightness(0.85) contrast(0.98);
  }
}

:root[data-theme="light"] {
  --bg: #eef0ea;
  --sheet: #f9faf5;
  --grid: #e0e6da;
  --ink: #2a332e;
  --sub: #636d66;
  --accent: #c43724;
  --accent-ink: #ffffff;
  --ok: #3e7d5a;
  --line: #c8d0c6;
  --box: #fdfdf9;
  --shadow: rgba(42, 51, 46, 0.12);
  --illust-filter: none;
}

:root[data-theme="dark"] {
  --bg: #141917;
  --sheet: #1d2420;
  --grid: #28332c;
  --ink: #e8ede8;
  --sub: #93a099;
  --accent: #ff6b52;
  --accent-ink: #141917;
  --ok: #5fae85;
  --line: #3a463f;
  --box: #232b26;
  --shadow: rgba(0, 0, 0, 0.4);
  --illust-filter: brightness(0.85) contrast(0.98);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}

.serif {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}

.mono {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 96px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* skip link */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--ink);
  color: var(--sheet);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 100;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 8px;
}

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

/* ---------- ヒーロー ---------- */

.hero {
  padding: 56px 16px 40px;
  text-align: center;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--sub);
  text-transform: uppercase;
}

.hero h1 {
  font-size: 28px;
  line-height: 1.5;
  margin: 12px 0 8px;
  letter-spacing: 0.03em;
  text-wrap: balance;
}

.hero .lead {
  font-size: 15px;
  color: var(--sub);
  max-width: 34em;
  margin: 0 auto 28px;
}

.hero-illust {
  display: block;
  width: min(560px, 92%);
  height: auto;
  margin: 0 auto 32px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 28px var(--shadow);
  filter: var(--illust-filter);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 語のまとまりを途中で折り返さない（「か？」「る。」だけの行の防止） */
.nb {
  display: inline-block;
}

/* ---------- つかみ3行 ---------- */

.catch {
  max-width: 480px;
  margin: 0 auto 56px;
  padding: 32px 24px;
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 28px var(--shadow);
  text-align: center;
}

.catch p {
  font-size: 17px;
  margin: 0 0 6px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}

.catch p:last-child {
  margin-bottom: 0;
  color: var(--sub);
}

/* ---------- 共通ボタン ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--sheet);
  border-radius: 6px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  font-family: inherit;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.88;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.btn.accent {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------- 設問セクション ---------- */

.survey {
  margin-bottom: 56px;
}

.progress-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 32px;
}

.progress-lamps {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.lamp {
  width: 14px;
  height: 14px;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: var(--box);
  transition: background 0.25s, border-color 0.25s;
}

.lamp.lit {
  background: var(--accent);
  border-color: var(--accent);
}

.progress-text {
  font-size: 12px;
  color: var(--sub);
}

.q-block {
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  scroll-margin-top: 88px;
}

.q-block legend {
  /* legend標準の「枠線またぎ」描画を無効化し、カード内に流し込む */
  float: left;
  padding: 0;
  width: 100%;
}

.q-num {
  display: block;
  font-size: 12px;
  color: var(--sub);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.q-text {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.6;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  clear: both;
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--box);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option:hover {
  border-color: var(--sub);
}

.option input[type="radio"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--accent);
}

.option-label {
  font-size: 14px;
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--box);
}

.option:has(input:checked) .option-label {
  font-weight: 700;
}

.submit-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  scroll-margin-top: 88px;
}

.validation-msg {
  font-size: 13px;
  color: var(--accent);
  min-height: 1.4em;
  text-align: center;
}

/* ---------- 結果：飛行前点検表 ---------- */

#result {
  scroll-margin-top: 24px;
}

.sheet {
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 28px var(--shadow);
  overflow: hidden;
  background-image: repeating-linear-gradient(0deg, var(--grid) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, var(--grid) 0 1px, transparent 1px 24px);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 14px 20px;
  border-bottom: 1.5px solid var(--line);
  background: var(--sheet);
  font-size: 12px;
  color: var(--sub);
}

.sheet-head b {
  color: var(--ink);
  font-weight: 600;
}

.sheet-title {
  text-align: center;
  padding: 22px 20px 4px;
  font-size: 21px;
  letter-spacing: 0.28em;
  font-weight: 700;
}

.sheet-sub {
  text-align: center;
  font-size: 12px;
  color: var(--sub);
  padding-bottom: 16px;
}

/* 計器盤（4連ゲージ） */

.gauge-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 8px 24px 20px;
}

@media (max-width: 480px) {
  .gauge-board {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 8px 12px 16px;
  }
}

.gauge {
  text-align: center;
}

.gauge svg {
  width: 100%;
  max-width: 150px;
}

.gauge-needle {
  transition: transform 1s cubic-bezier(0.34, 1.5, 0.44, 1);
  transform-origin: 100px 100px;
}

.gauge-label {
  font-size: 11px;
  color: var(--sub);
  margin-top: 4px;
}

.gauge-value {
  font-size: 13px;
  font-weight: 700;
}

.gauge.dim .gauge-value {
  color: var(--sub);
  opacity: 0.7;
}

/* キラーナンバー */

.readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 20px 24px;
  border-top: 1.5px dashed var(--line);
  margin-top: 8px;
  text-align: center;
}

.readout .cap {
  font-size: 12px;
  color: var(--sub);
}

.covnum-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.covnum {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.covnum.ok {
  color: var(--ok);
}

.covnum.warn {
  color: var(--accent);
}

.covnum-unit {
  font-size: 22px;
  font-weight: 600;
}

/* 判定スタンプ */

.verdict {
  padding: 6px 24px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.stamp {
  display: inline-block;
  border: 3px solid var(--accent);
  color: var(--accent);
  padding: 8px 20px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.12em;
  transform: rotate(-4deg);
  border-radius: 4px;
  opacity: 0;
}

.stamp.ok {
  border-color: var(--ok);
  color: var(--ok);
}

.stamp.in {
  animation: stampin 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

@keyframes stampin {
  0% {
    opacity: 0;
    transform: rotate(-4deg) scale(2.2);
  }
  100% {
    opacity: 1;
    transform: rotate(-4deg) scale(1);
  }
}

.stamp .lab {
  display: block;
  font-size: 10px;
  letter-spacing: 0.4em;
  opacity: 0.8;
}

.stage-judge {
  font-size: 14px;
  color: var(--ink);
  max-width: 34em;
  margin-inline: auto;
  opacity: 0;
  transition: opacity 0.6s;
}

.stage-judge.in {
  opacity: 1;
}

/* タイプカードの前置き（2026-09-09 追加）。
   タイプは4領域のうち相対的に最も見えていない領域を指す。
   絶対評価と誤読されないよう、カードの直前に置く。 */
.tlead {
  font-size: 13.5px;
  color: var(--sub);
  margin: 22px 0 8px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s;
}
.tlead.in { opacity: 1; }

.typecard {
  border: 1.5px solid var(--line);
  background: var(--box);
  border-radius: 8px;
  padding: 18px 20px 20px;
  /* 2026-09-09 480px→560px。絵を主役にするため（B案・SHINDAN-TYPE-CONTRADICT） */
  max-width: 560px;
  width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s, transform 0.5s;
  text-align: left;
}

.typecard.in {
  opacity: 1;
  transform: none;
}

.typecard .timg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  filter: var(--illust-filter);
}

/* 2026-09-09 改訂（SHINDAN-TYPE-CONTRADICT／B案）。
   旧＝タイプ名19px・一言コピー14px太字が上に来て、段階を汲んだ判定文13pxが最下部にあった。
   新の順序と重み：何の絵か（小）→ 次に付ける計器（主見出し）→ 段階別の判定文（本文）
   → 解説（小）→ タイプ名（最小）。tcopy は出さないので定義も置かない。 */

.typecard .tcaption {
  font-size: 12.5px;
  color: var(--sub);
  text-align: center;
  margin: 0 0 16px;
  line-height: 1.7;
}

.typecard .tnext {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.02em;
  text-align: center;
  margin: 0 0 14px;
  text-wrap: balance;
}

.typecard .tjudge {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink);
  /* 中央揃えは行末が不揃いだと1語だけ取り残されるため、行数を均す */
  margin: 0 auto;
  max-width: 30em;
  text-align: center;
  text-wrap: balance;
}

.typecard .tdesc {
  font-size: 12.5px;
  color: var(--sub);
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1.5px dashed var(--line);
}

.typecard .tname {
  font-size: 11.5px;
  color: var(--sub);
  letter-spacing: 0.08em;
  text-align: center;
  margin: 10px 0 0;
}

@media (max-width: 480px) {
  .typecard .tnext { font-size: 18px; }
}

/* 満点時の賛辞文（タイプカードの代替） */

.perfect-note {
  border: 1.5px dashed var(--ok);
  background: var(--box);
  border-radius: 8px;
  padding: 18px 20px;
  max-width: 480px;
  width: 100%;
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s, transform 0.5s;
}

.perfect-note.in {
  opacity: 1;
  transform: none;
}

/* 推定コスト */

.cost-row {
  border-top: 1.5px solid var(--line);
  padding: 16px 24px;
  text-align: center;
  font-size: 13px;
}

.cost-row .cost-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.cost-row .cost-note {
  display: block;
  font-size: 11px;
  color: var(--sub);
  margin-top: 4px;
}

/* CTA 2段 */

.cta-block {
  border-top: 1.5px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cta-primary,
.cta-secondary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.cta-primary p,
.cta-secondary p {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.cta-hint {
  font-size: 11px;
  color: var(--sub);
}

/* シェア */

.share {
  border-top: 1.5px solid var(--line);
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.sharetext {
  font-size: 13px;
  background: var(--box);
  border: 1.5px dashed var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  max-width: 100%;
  color: var(--ink);
  text-align: center;
}

.replay-row {
  text-align: center;
  margin-top: 24px;
}

footer.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--sub);
  padding: 24px 16px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--sheet);
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 90%;
  text-align: center;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}

/* ---------- モバイル微調整（各要素の基本ルールより後に置き、上書きを効かせる） ---------- */

@media (max-width: 480px) {
  .hero h1 {
    font-size: 24px;
  }
  .catch p {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
