:root{
  --bg:#0b1020;
  --panel:#111831;
  --panel2:#17203f;
  --text:#e8ecf8;
  --muted:#a8b2d8;
  --accent:#7dd3fc;
  --accent2:#a78bfa;
  --ok:#86efac;
  --warn:#facc15;
  --danger:#fb7185;
  --border:#2a355f;
  --code:#090d18;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;
  background:linear-gradient(180deg,#0a0f1d 0%,#10172d 100%);
  color:var(--text);
  line-height:1.75;
}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
header{
  position:sticky;top:0;z-index:10;
  background:rgba(11,16,32,.94);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}
.nav{
  max-width:1180px;margin:auto;padding:12px 20px;
  display:flex;gap:16px;flex-wrap:wrap;align-items:center;
}
.brand{font-weight:800;margin-right:auto;color:white}
.nav a{font-size:.93rem;color:#cbd5ff}
main{max-width:1180px;margin:auto;padding:34px 20px 72px}
.hero{padding:26px;border:1px solid var(--border);border-radius:18px;background:linear-gradient(135deg,#111831,#17203f)}
.hero h1{margin:0 0 12px;font-size:clamp(2rem,4vw,3.2rem);line-height:1.2}
.hero p{color:var(--muted);max-width:900px}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px;margin-top:22px}
.card{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:20px}
.card h3{margin-top:0}.card p{color:var(--muted)}
section{margin-top:38px}
h2{margin-top:0;font-size:1.7rem}
h3{margin-top:28px}
.badge{display:inline-block;padding:3px 9px;border-radius:999px;background:#1e2a4f;color:#dbeafe;font-size:.8rem}
.callout{border-left:4px solid var(--accent);background:var(--panel);padding:16px 18px;border-radius:10px;margin:18px 0}
.callout.warn{border-left-color:var(--warn)}
.callout.ok{border-left-color:var(--ok)}
.callout.danger{border-left-color:var(--danger)}
pre,code{font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace}
pre{background:var(--code);border:1px solid var(--border);padding:16px;border-radius:12px;overflow:auto;color:#dbeafe}
code{background:#10172b;padding:.1em .35em;border-radius:5px}
table{width:100%;border-collapse:collapse;margin:16px 0;background:var(--panel);border-radius:12px;overflow:hidden}
th,td{border-bottom:1px solid var(--border);padding:12px 14px;vertical-align:top;text-align:left}
th{background:#182143}
tr:last-child td{border-bottom:none}
.small{font-size:.9rem;color:var(--muted)}
.kpi{font-size:2rem;font-weight:800;color:white}
footer{max-width:1180px;margin:auto;padding:24px 20px 48px;color:var(--muted);border-top:1px solid var(--border)}
.diagram{white-space:pre;overflow:auto;background:#0a0f1d;border:1px solid var(--border);border-radius:12px;padding:18px;color:#dbeafe}
.pill-row{display:flex;gap:8px;flex-wrap:wrap}
.pill{padding:6px 10px;border:1px solid var(--border);border-radius:999px;color:#dbeafe;background:#111831}
.toc a{display:block;padding:5px 0}
@media (max-width:720px){th,td{font-size:.9rem}.nav{gap:10px}.nav a{font-size:.84rem}}

/* インフォグラフィック上部イメージ */
.hero-image-wrap {
  margin-top: 24px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  background: var(--panel);
}
.hero-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
.hero-image-caption {
  padding: 12px 18px;
  background: rgba(17, 24, 49, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* インフォグラフィック専用スタイル */
.infographic-container {
  margin-top: 24px;
  background: linear-gradient(180deg, rgba(17, 24, 49, 0.95), rgba(11, 16, 32, 0.98));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.info-header {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.info-header h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.info-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.phase-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* フェーズブロック */
.phase-group {
  margin-top: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  padding: 20px;
  position: relative;
}
.phase-group.p1 { border-top: 3px solid #38bdf8; }
.phase-group.p2 { border-top: 3px solid #2dd4bf; }
.phase-group.p3 { border-top: 3px solid #a78bfa; }
.phase-group.p4 { border-top: 3px solid #fbbf24; }
.phase-group.p5 { border-top: 3px solid #34d399; }

.phase-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.phase-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.phase-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
}
.p1 .phase-badge { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.p2 .phase-badge { background: rgba(45, 212, 191, 0.15); color: #2dd4bf; border: 1px solid rgba(45, 212, 191, 0.3); }
.p3 .phase-badge { background: rgba(167, 139, 250, 0.15); color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.3); }
.p4 .phase-badge { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.p5 .phase-badge { background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }

.phase-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}
.phase-desc {
  font-size: 0.85rem;
  color: var(--muted);
}

/* カード */
.info-card {
  background: rgba(23, 32, 63, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.info-card:hover {
  border-color: rgba(125, 211, 252, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}
.p1 .card-icon { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.p2 .card-icon { background: rgba(45, 212, 191, 0.12); color: #2dd4bf; }
.p3 .card-icon { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.p4 .card-icon { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }
.p5 .card-icon { background: rgba(52, 211, 153, 0.12); color: #34d399; }

.step-num {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 5px;
  display: inline-block;
  margin-bottom: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}
.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.3;
}
.card-subtitle {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 400;
}
.card-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin: 8px 0;
}

/* 入出力マイクロフロー */
.io-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.76rem;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.io-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}
.io-tag strong {
  color: #f1f5f9;
  font-weight: 600;
}
.io-arrow {
  color: var(--accent);
  font-size: 0.85rem;
}

/* 並列実行グリッド */
.parallel-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}
.parallel-bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  color: #2dd4bf;
}
.parallel-badge {
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(45, 212, 191, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  margin-bottom: 6px;
}
.parallel-symbol {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

/* グリッド各種 */
.card-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* フェーズコネクタ */
.flow-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  position: relative;
}
.flow-connector-line {
  width: 2px;
  height: 16px;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.6), rgba(167, 139, 250, 0.6));
}
.flow-connector-arrow {
  color: var(--accent);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -2px;
}
.flow-connector-label {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 3px;
  background: rgba(11, 16, 32, 0.9);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* メトリクスチップ */
.metric-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.metric-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.metric-item .label {
  font-size: 0.7rem;
  color: var(--muted);
  display: block;
}
.metric-item .val {
  font-size: 0.88rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-top: 2px;
  display: block;
}

/* JSONビューア */
.json-preview {
  margin-top: 10px;
  padding: 12px;
  background: #090d18;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #93c5fd;
}
.json-preview .cm { color: #64748b; }
.json-preview .k { color: #f472b6; }
.json-preview .v { color: #fde047; }
.json-preview .n { color: #86efac; }

/* 判定項目リスト */
.decision-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.decision-row {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 10px;
}
.decision-row .key {
  font-size: 0.72rem;
  color: #fbbf24;
  font-weight: 700;
  display: block;
}
.decision-row .mean {
  font-size: 0.82rem;
  color: #e2e8f0;
}

/* ガードレールハイライト */
.guardrail-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
}
.guardrail-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.guardrail-desc {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin: 0;
}

/* レスポンシブ */
@media (max-width: 900px) {
  .card-grid-2, .card-grid-3 {
    grid-template-columns: 1fr;
  }
  .parallel-container {
    grid-template-columns: 1fr;
  }
  .parallel-bridge {
    padding: 8px 0;
  }
  .metric-mini-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .infographic-container {
    padding: 16px 12px;
  }
  .phase-group {
    padding: 14px 12px;
  }
  .decision-list {
    grid-template-columns: 1fr;
  }
}

/* ギミック＆エフェクト：スクロールプログレスバー */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #fbbf24, #34d399);
  width: 0%;
  z-index: 100;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* ナビゲーションのアクティブ表示 */
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}
.nav a.active {
  background: rgba(125, 211, 252, 0.18);
  color: #38bdf8;
  font-weight: 700;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* セクションジャンプ用マージン */
section {
  scroll-margin-top: 75px;
}

/* スクロール連動リビール（フェードイン） */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ギミック：リアルタイム検査判定シミュレーター */
.simulator-card {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(17, 24, 49, 0.95), rgba(26, 32, 64, 0.9));
  border: 1px solid rgba(125, 211, 252, 0.3);
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}
.simulator-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.06), transparent 70%);
  pointer-events: none;
}
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 18px;
}
.sim-controls {
  background: rgba(10, 15, 29, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 18px;
}
.sim-control-group {
  margin-bottom: 18px;
}
.sim-control-group:last-child {
  margin-bottom: 0;
}
.sim-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.sim-label-row span {
  color: var(--muted);
}
.sim-label-row strong {
  color: #38bdf8;
  font-family: monospace;
  font-size: 1.05rem;
}
.sim-range {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
  accent-color: #38bdf8;
  cursor: pointer;
}
.sim-display {
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sim-result-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}
.sim-result-badge.status-ok {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
}
.sim-result-badge.status-warn {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
}
.sim-result-badge.status-danger {
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.5);
  animation: pulse-border 1.5s infinite;
}
@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}
.sim-lamp {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-ok .sim-lamp { background: #34d399; box-shadow: 0 0 12px #34d399; }
.status-warn .sim-lamp { background: #fbbf24; box-shadow: 0 0 12px #fbbf24; }
.status-danger .sim-lamp { background: #f87171; box-shadow: 0 0 14px #f87171; }
.sim-status-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
}
.sim-status-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}
.sim-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.82rem;
}
.sim-meta-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.sim-meta-item span {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
}
.sim-meta-item strong {
  color: #e2e8f0;
  margin-top: 2px;
  display: block;
}

/* フローティング「トップへ戻る」ボタン */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(17, 24, 49, 0.85);
  border: 1px solid rgba(125, 211, 252, 0.4);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: #38bdf8;
  color: #0b1020;
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.35);
}

/* 各セクションのヘッダーバッジ */
.section-badge-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

@media (max-width: 800px) {
  .sim-grid {
    grid-template-columns: 1fr;
  }
}

/* データセット関連スタイル */
.media-card {
  background: rgba(17, 24, 49, 0.9);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.media-card h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.video-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  margin: 14px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.video-container video {
  width: 100%;
  max-height: 520px;
  display: block;
}
.audio-player-box {
  background: rgba(10, 15, 29, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}
.audio-player-box audio {
  width: 100%;
  margin-top: 8px;
}
.file-table {
  width: 100%;
  margin-top: 14px;
}
.file-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-video { background: rgba(244, 63, 94, 0.2); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-audio { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-image { background: rgba(52, 211, 153, 0.2); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-pdf { background: rgba(251, 191, 36, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-doc { background: rgba(167, 139, 250, 0.2); color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.3); }

.formula-box {
  background: #090d18;
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  margin: 12px 0;
  color: #93c5fd;
  overflow-x: auto;
}
.pdf-viewer-frame {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #111831;
}
