* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background: #F8F8FB;
  color: #000000;
  line-height: 1.7;
}

.page { max-width: 760px; margin: 0 auto; padding-bottom: 24px; }

/* ヘッダー */
.header {
  background: #0017C1;
  padding: 14px 20px;
  color: #FFFFFF;
}
.header__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header__title {
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.03em;
}
.header__subtitle {
  font-size: 11px;
  color: #C5D7FB;
  font-weight: 500;
}

/* ナビゲーション */
.nav {
  display: flex;
  background: #F8F8FB;
  border-bottom: 1px solid #CCCCCC;
}
.nav__link {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #626264;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.nav__link:hover {
  color: #0017C1;
  background: rgba(52, 96, 251, 0.05);
}
.nav__link--active {
  color: #0017C1;
  border-bottom-color: #0017C1;
}

.page-hero {
  padding: 24px 32px 16px;
}
.page-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; color: #000000; }
.page-subtitle { font-size: 14px; color: #626264; }

/* ヒーロー */
.hero {
  background: #FFFFFF;
  border-bottom: 1px solid #C5D7FB;
  padding: 28px 32px;
  text-align: center;
}
.hero__text { font-size: 16px; color: #374151; line-height: 1.9; }
.hero__text strong { color: #0017C1; }

/* セクション共通 */
.section {
  background: #FFFFFF;
  margin: 20px 24px;
  border-radius: 16px;
  padding: 28px;
  border: 1px solid #C5D7FB;
}
.section__title { font-size: 18px; font-weight: 700; color: #000000; margin-bottom: 6px; }
.section__desc { font-size: 13px; color: #626264; margin-bottom: 18px; }

/* フロー図 */
.flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.flow--query {
  margin-bottom: 0;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #C5D7FB;
}
.flow__step {
  background: #F8F8FB;
  border: 1px solid #C5D7FB;
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
  min-width: 86px;
}
.flow__step--highlight { background: #D9E6FF; border-color: #7096F8; }
.flow__step--user { background: #E6F5EC; border-color: #86efac; }
.flow__step--result { background: #fffbeb; border-color: #fcd34d; }
.flow__icon { font-size: 22px; }
.flow__label { font-size: 11px; font-weight: 700; color: #000000; margin-top: 4px; }
.flow__desc { font-size: 10px; color: #626264; margin-top: 2px; }
.flow__arrow { font-size: 18px; color: #7096F8; font-weight: 700; }

/* コードブロック */
.code-block {
  background: #000060;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}
.code-block__label {
  padding: 8px 16px;
  font-size: 11px;
  color: #7096F8;
  background: #000040;
  font-weight: 600;
}
.code-block pre {
  padding: 16px;
  font-size: 12.5px;
  color: #C5D7FB;
  font-family: 'Courier New', monospace;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.8;
}
.json-key { color: #7096F8; }
.json-str { color: #86efac; }
.json-arr { color: #fde68a; }
.json-num { color: #fb923c; }
.json-comment { color: #626264; font-style: italic; }

/* フィールドテーブル */
.field-table {
  border: 1px solid #C5D7FB;
  border-radius: 12px;
  overflow: hidden;
}
.field-row {
  display: grid;
  grid-template-columns: 130px 1fr 1.6fr;
  gap: 0;
  padding: 10px 16px;
  border-bottom: 1px solid #D9E6FF;
  align-items: center;
  font-size: 13px;
}
.field-row:last-child { border-bottom: none; }
.field-row--header {
  background: #F8F8FB;
  font-size: 11px;
  font-weight: 700;
  color: #626264;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 16px;
}
.field-row--highlight { background: #F8F8FB; }
.field-name {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #0017C1;
  font-weight: 700;
  background: #D9E6FF;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}
.field-role { color: #374151; font-weight: 500; padding: 0 12px; }
.field-use { color: #626264; font-size: 12px; }
.field-use strong { color: #0017C1; }

/* 検索ステップ */
.search-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
}
.search-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: #F8F8FB;
  border: 1px solid #C5D7FB;
  border-radius: 12px;
}
.search-step--accent {
  background: #D9E6FF;
  border-color: #7096F8;
}
.search-step__connector {
  text-align: center;
  color: #7096F8;
  font-size: 20px;
  font-weight: 700;
  padding: 2px 0;
  line-height: 1;
}
.search-step__num {
  font-size: 18px;
  font-weight: 800;
  color: #0017C1;
  flex-shrink: 0;
  width: 28px;
}
.search-step__body { flex: 1; }
.search-step__title { font-size: 14px; font-weight: 700; color: #000000; margin-bottom: 4px; }
.search-step__desc { font-size: 12px; color: #626264; line-height: 1.6; }
.search-step__badge {
  background: #D9E6FF;
  color: #0017C1;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
}
.search-step__badge--purple {
  background: #D9E6FF;
  color: #0017C1;
}

/* 類似度バー */
.similarity-example {
  background: #F8F8FB;
  border: 1px solid #C5D7FB;
  border-radius: 12px;
  padding: 16px;
}
.similarity-example__title {
  font-size: 12px;
  color: #626264;
  font-weight: 600;
  margin-bottom: 12px;
}
.similarity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.similarity-item:last-child { margin-bottom: 0; }
.similarity-item--dim { opacity: 0.5; }
.similarity-label { font-size: 12px; color: #374151; width: 200px; flex-shrink: 0; }
.similarity-bar-wrap { flex: 1; height: 8px; background: #C5D7FB; border-radius: 4px; overflow: hidden; }
.similarity-bar { height: 100%; background: #3460FB; border-radius: 4px; display: block; }
.similarity-bar--dim { background: #C5D7FB; }
.similarity-score { font-size: 12px; font-weight: 700; color: #0017C1; width: 38px; flex-shrink: 0; text-align: right; }
.similarity-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #F1F1F4;
  color: #626264;
  flex-shrink: 0;
}
.similarity-tag--selected {
  background: #E6F5EC;
  color: #197A4B;
  font-weight: 700;
}

/* カテゴリグリッド */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.category-card {
  border: 1px solid #C5D7FB;
  border-radius: 12px;
  overflow: hidden;
}
.category-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #F8F8FB;
  border-bottom: 1px solid #C5D7FB;
}
.category-card__icon { font-size: 16px; }
.category-card__name { font-size: 13px; font-weight: 700; color: #000000; flex: 1; }
.category-card__count {
  font-size: 11px;
  color: #3460FB;
  background: #D9E6FF;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.category-card__chunks {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.chunk-pill {
  font-size: 11px;
  color: #4b5563;
  background: #FFFFFF;
  border: 1px solid #CCCCCC;
  padding: 4px 10px;
  border-radius: 6px;
  display: block;
}

/* 技術スタック */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tech-card {
  background: #F8F8FB;
  border: 1px solid #C5D7FB;
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
}
.tech-card__icon { font-size: 28px; margin-bottom: 8px; }
.tech-card__name { font-size: 13px; font-weight: 700; color: #000000; margin-bottom: 6px; }
.tech-card__desc { font-size: 11px; color: #626264; line-height: 1.5; }

/* 全体フロー2フェーズレイアウト */
.flow-phases {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: center;
  margin-top: 4px;
}

.flow-phase {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid;
}

.flow-phase--prep {
  border-color: #7096F8;
}

.flow-phase--query {
  border-color: #6ee7b7;
}

.flow-phase__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
}

.flow-phase--prep .flow-phase__header {
  background: #D9E6FF;
  color: #0017C1;
}

.flow-phase--query .flow-phase__header {
  background: #d1fae5;
  color: #065f46;
}

.flow-phase__badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.flow-phase--prep .flow-phase__badge {
  background: #7096F8;
  color: #000060;
}

.flow-phase--query .flow-phase__badge {
  background: #6ee7b7;
  color: #064e3b;
}

.flow-phase__steps {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fafafa;
}

.flow-phase-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #CCCCCC;
}

.flow-phase-step--db {
  background: #D9E6FF;
  border-color: #7096F8;
  border-width: 2px;
}

.flow-phase-step--result {
  background: #E6F5EC;
  border-color: #6ee7b7;
  border-width: 2px;
}

.flow-phase-step__icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.flow-phase-step__body { flex: 1; }

.flow-phase-step__title {
  font-size: 12px;
  font-weight: 700;
  color: #000000;
  line-height: 1.3;
}

.flow-phase-step__desc {
  font-size: 10px;
  color: #626264;
  margin-top: 2px;
  line-height: 1.4;
}

.flow-phase-connector {
  text-align: center;
  color: #626264;
  font-size: 16px;
  padding: 3px 0;
  line-height: 1;
}

/* フェーズ間ブリッジ */
.flow-phases-bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  gap: 4px;
}

.flow-phases-bridge__arrow {
  font-size: 22px;
  color: #3460FB;
  font-weight: 700;
  line-height: 1;
}

.flow-phases-bridge__label {
  font-size: 10px;
  font-weight: 700;
  color: #3460FB;
  background: #D9E6FF;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.flow-phases-bridge__line {
  width: 2px;
  height: 20px;
  background: #C5D7FB;
  border-radius: 2px;
}

/* スマホ対応：フェーズを縦積み */
@media (max-width: 640px) {
  .flow-phases {
    grid-template-columns: 1fr;
  }
  .flow-phases-bridge {
    flex-direction: row;
    padding: 8px 0;
  }
  .flow-phases-bridge__line {
    width: 20px;
    height: 2px;
  }
  .flow-phases-bridge__arrow {
    transform: rotate(90deg);
  }
}

/* CTA */
.cta { text-align: center; margin-top: 32px; }
.cta__btn {
  background: #0017C1;
  color: #FFFFFF;
  text-decoration: none;
  padding: 14px 36px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  display: inline-block;
  transition: opacity 0.2s;
}
.cta__btn:hover { opacity: 0.85; }

/* ユーティリティ */
.text-accent-blue { color: #0017C1; }
.text-accent-green { color: #197A4B; }

/* スマホ対応 */
@media (max-width: 600px) {
  .header { padding: 20px 16px; }
  .section { margin: 12px 12px; padding: 20px 16px; }
  .hero { padding: 20px 16px; }
  .flow { gap: 4px; }
  .flow__step { min-width: 70px; padding: 8px 8px; }
  .flow__label { font-size: 10px; }
  .flow__arrow { font-size: 14px; }
  .field-row { grid-template-columns: 100px 1fr; }
  .field-row .field-use { display: none; }
  .field-row--header span:last-child { display: none; }
  .similarity-label { width: 130px; font-size: 11px; }
  .category-grid { grid-template-columns: 1fr; }
}
