/* =========================================
   重点戦略予算（Budget Priority UI） - slides only版
   画像を一次情報として表示（個別施策テキスト非掲載）
   ========================================= */

:root {
  --bp-bg: #f8f9fc;
  --bp-card: #ffffff;
  --bp-line: #e7eaf2;
  --bp-text: #131722;
  --bp-muted: #6b7280;
  --bp-accent: #fa5252;
  --bp-accent-soft: #fff1f1;
  --bp-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --bp-radius-xl: 20px;
  --bp-radius-lg: 16px;
  --bp-radius-md: 12px;
}

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

.budget-priority-section {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius-xl);
  background: var(--bp-bg);
  min-width: 0;
}

/* ===== Header ===== */
.bp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.bp-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.bp-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--bp-muted);
  line-height: 1.5;
}

.bp-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--bp-muted);
  line-height: 1.55;
}

.bp-header-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.bp-reload-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--bp-line);
  background: #fff;
  color: var(--bp-text);
  cursor: pointer;
  white-space: nowrap;
}
.bp-reload-btn:hover { background: #f6f7fb; }

/* ===== Status ===== */
.bp-status {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--bp-line);
  background: #fff;
  color: var(--bp-muted);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.bp-status.is-loading {
  color: #1d4ed8;
  border-color: #c7d2fe;
  background: #eef2ff;
}
.bp-status.is-error {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff1f2;
}
.bp-status.is-ok {
  color: #166534;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

/* ===== Overview card ===== */
.bp-overview-card {
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius-lg);
  background: var(--bp-card);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--bp-shadow);
  min-width: 0;
}

.bp-overview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.bp-area {
  font-weight: 800;
  font-size: 18px;
  color: var(--bp-text);
  line-height: 1.2;
  word-break: break-word;
}

.bp-fiscal-year {
  margin-top: 3px;
  font-size: 13px;
  color: var(--bp-muted);
  line-height: 1.4;
}

.bp-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--bp-line);
  background: #fff;
  color: var(--bp-text);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: auto;
}
.bp-source-link:hover { background: #f6f7fb; }

.bp-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* 今のHTMLは2項目なので2列固定 */
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.bp-summary-item {
  border: 1px solid var(--bp-line);
  border-radius: 12px;
  background: #fafbff;
  padding: 10px;
  min-width: 0;
}

.bp-summary-label {
  font-size: 11px;
  color: var(--bp-muted);
  margin-bottom: 4px;
  line-height: 1.3;
}

.bp-summary-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--bp-text);
  line-height: 1.25;
  word-break: break-word;
}

/* ===== Analysis points ===== */
.bp-analysis-head {
  margin: 6px 2px 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.bp-analysis-points {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.bp-analysis-item {
  border: 1px solid #ffe0e0;
  background: var(--bp-accent-soft);
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}

.bp-analysis-point {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
  color: #991b1b;
  line-height: 1.4;
  word-break: break-word;
}

.bp-analysis-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #4b5563;
  word-break: break-word;
}

/* ★新：参照ページ（evidence） */
.bp-analysis-evidence {
  margin: 6px 0 0;
  font-size: 11px;
  color: #7c2d12;
  font-weight: 700;
  line-height: 1.4;
}

/* ★新：overview footnote */
.bp-overview-footnote {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bp-footnote-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--bp-line);
  background: #fff;
  font-size: 12px;
  color: var(--bp-muted);
}

/* ===== Main layout ===== */
.bp-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}
.bp-main > * { min-width: 0; }

.bp-slider-panel,
.bp-detail-panel {
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius-lg);
  background: var(--bp-card);
  box-shadow: var(--bp-shadow);
  min-width: 0;
  overflow: hidden;
  height: 100%;
}

/* ===== Slider ===== */
.bp-slider-panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.bp-slider-frame {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.bp-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--bp-line);
  background: #fff;
  color: var(--bp-text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bp-nav-btn:hover { background: #f6f7fb; }
.bp-nav-btn:disabled { opacity: .45; cursor: not-allowed; }

/* stage: HTML側で tabindex/role を付けたのでfocus style追加 */
.bp-slide-stage {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--bp-line);
  background: #f7f8fb;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  max-height: min(72vh, 640px);
  overflow: hidden;
  display: grid;
  place-items: center;
  outline: none;
}
.bp-slide-stage:focus-visible {
  box-shadow: 0 0 0 3px rgba(250, 82, 82, 0.18);
  border-color: rgba(250, 82, 82, 0.55);
}
.bp-slide-stage:hover { border-color: rgba(250, 82, 82, 0.35); }

.bp-slide-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.bp-slide-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--bp-muted);
  font-size: 13px;
  padding: 12px;
  text-align: center;
  line-height: 1.5;
}

.bp-slide-counter {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 8px;
  z-index: 2;
}

.bp-zoom-hint {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(255,255,255,.92);
  color: #111827;
  border: 1px solid rgba(0,0,0,.06);
  font-size: 11px;
  border-radius: 999px;
  padding: 4px 8px;
  z-index: 2;
  pointer-events: none;
}

/* thumbs */
.bp-thumbs {
  margin-top: 10px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(104px, 132px);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scroll-snap-type: x proximity;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.bp-thumb {
  border: 1px solid var(--bp-line);
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  cursor: pointer;
  display: grid;
  gap: 5px;
  scroll-snap-align: start;
  min-width: 0;
  text-align: left;
}
.bp-thumb.is-active {
  border-color: var(--bp-accent);
  box-shadow: 0 0 0 2px rgba(250, 82, 82, 0.12);
}

.bp-thumb-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #f3f4f6;
  border-radius: 8px;
  border: 1px solid #eef0f5;
}

.bp-thumb-title {
  font-size: 11px;
  line-height: 1.35;
  color: var(--bp-text);
  overflow: hidden;
  word-break: break-word;
}

/* ===== Detail panel ===== */
.bp-detail-panel {
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.bp-detail-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-width: 0;
}

.bp-category-pill,
.bp-budget-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--bp-line);
  background: #fafafa;
  color: var(--bp-text);
  min-width: 0;
  max-width: 100%;
}

.bp-category-pill {
  background: var(--bp-accent-soft);
  border-color: #ffd1d1;
  color: #991b1b;
  font-weight: 700;
}

.bp-budget-pill { font-weight: 700; }

.bp-policy-title {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.45;
  color: var(--bp-text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* metrics (2 columns) */
.bp-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.bp-metric {
  border: 1px solid var(--bp-line);
  background: #fafbff;
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}

.bp-metric-label {
  font-size: 11px;
  color: var(--bp-muted);
  margin-bottom: 4px;
  line-height: 1.35;
}

.bp-metric-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--bp-text);
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* blocks */
.bp-block {
  border-top: 1px solid var(--bp-line);
  padding-top: 10px;
  margin-top: 10px;
  min-width: 0;
}

.bp-block-label {
  font-size: 12px;
  color: var(--bp-muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.bp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.bp-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--bp-line);
  background: #fff;
  font-size: 12px;
  color: var(--bp-text);
  line-height: 1.3;
  max-width: 100%;
  word-break: break-word;
}

.bp-tag.v1 { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.bp-tag.v2 { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.bp-tag.v3 { background: #fefce8; border-color: #fde68a; color: #854d0e; }
.bp-tag.v4 { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.bp-tag.v5 { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }
.bp-tag.v6 { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.bp-tag.v7 { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.bp-tag.v8 { background: #faf5ff; border-color: #e9d5ff; color: #86198f; }

.bp-life-text {
  margin: 0;
  color: var(--bp-text);
  font-size: 14px;
  line-height: 1.75;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ===== 画像拡大モーダル ===== */
.bp-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}
.bp-modal.is-open { display: block; }

.bp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
}

.bp-modal-dialog {
  position: absolute;
  inset: 20px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.bp-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bp-modal-title {
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  min-width: 0;
  word-break: break-word;
}

.bp-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.bp-modal-close:hover { background: rgba(255,255,255,0.2); }

.bp-modal-stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.bp-modal-stage {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
}

.bp-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.bp-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(17,24,39,0.55);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bp-modal-nav:hover { background: rgba(17,24,39,0.75); }
.bp-modal-nav.prev { left: 10px; }
.bp-modal-nav.next { right: 10px; }

.bp-modal-caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.bp-modal-caption-main,
.bp-modal-caption-count {
  background: rgba(17,24,39,0.72);
  color: #fff;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.4;
}

.bp-modal-caption-main {
  max-width: min(75%, 680px);
  word-break: break-word;
}

.bp-modal-caption-count { white-space: nowrap; }

/* ===== responsive ===== */
@media (max-width: 1180px) {
  .bp-main {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .bp-slider-panel,
  .bp-detail-panel { height: auto; }
  .bp-detail-panel { overflow: visible; }
}

@media (max-width: 980px) {
  .bp-slide-stage { min-height: 220px; }
  .bp-modal-dialog { inset: 12px; }
  .bp-modal-nav.prev { left: 6px; }
  .bp-modal-nav.next { right: 6px; }
}

@media (max-width: 640px) {
  .budget-priority-section { padding: 10px; }

  .bp-header,
  .bp-overview-top {
    flex-direction: column;
    align-items: stretch;
  }

  .bp-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .bp-reload-btn,
  .bp-source-link {
    width: fit-content;
    margin-left: 0;
    align-self: flex-end;
  }

  .bp-policy-title { font-size: 16px; }

  .bp-slide-stage {
    aspect-ratio: 4 / 3;
    min-height: 200px;
  }

  .bp-thumbs { grid-auto-columns: minmax(96px, 116px); }

  .bp-zoom-hint {
    font-size: 10px;
    padding: 3px 6px;
  }

  .bp-modal-caption {
    flex-direction: column;
    align-items: stretch;
  }
  .bp-modal-caption-main { max-width: 100%; }

  /* 狭い端末でも2列維持 */
  .bp-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .bp-metric { padding: 9px; }
  .bp-metric-label { font-size: 10px; }
  .bp-metric-value { font-size: 13px; line-height: 1.3; }
}

/* =========================
   3秒リアクション（AI要約カード下）
========================= */
.bp-reaction {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.bp-reaction-btn {
  appearance: none;
  border: 1px solid rgba(248,113,113,.35);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

.bp-reaction-btn:active { transform: translateY(1px); }

.bp-reaction-btn[aria-pressed="true"] {
  border-color: rgba(248,113,113,.7);
  background: rgba(254,226,226,.75);
}

.bp-reaction-emoji { font-size: 16px; }
.bp-reaction-label { font-weight: 600; color: #111827; }
.bp-reaction-count {
  font-size: 12px;
  color: #6b7280;
  background: rgba(17,24,39,.06);
  padding: 3px 8px;
  border-radius: 999px;
}

.bp-reaction-note {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

/* =========================
   3秒リアクション：ミニ傾向バー
========================= */
.bp-reaction-bar {
  margin: 6px 0 8px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
  display: flex;
}

.bp-reaction-bar[hidden] { display: none; }

.bp-reaction-bar-seg {
  height: 100%;
  width: 0%;
}

.bp-reaction-bar-seg.up {
  background: rgba(239, 68, 68, 0.75); /* 支持 */
}
.bp-reaction-bar-seg.unknown {
  background: rgba(148, 163, 184, 0.9); /* わからない */
}
.bp-reaction-bar-seg.down {
  background: rgba(0, 139, 255, 0.7); /* 支持しない */
}

/* 任意：バーの下に小さい注釈を入れるなら */
.bp-reaction-bar-caption {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(100, 116, 139, 0.95);
}