* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: #f4f5f7; color: #1a1a2e;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* ── Header ── */
header {
  background: #1a1a2e; color: #fff;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.logo { font-size: 18px; font-weight: 700; }
.logo span { color: #4fc3f7; }
.header-meta { font-size: 12px; color: #90caf9; }

/* ── Tabs ── */
.tabs {
  background: #fff; border-bottom: 1px solid #e0e0e0;
  padding: 0 24px; display: flex; gap: 4px; overflow-x: auto;
  position: sticky; z-index: 90;
}
#tabs { top: 56px; }
.tab {
  padding: 12px 16px; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; color: #666;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tab.active { border-bottom-color: #1565c0; color: #1565c0; font-weight: 600; }

/* 国別タブ（2段目）: チップ型 */
.country-tabs { top: 101px; padding: 8px 24px; gap: 8px; border-bottom: 1px solid #eee; }
.country-tabs .tab {
  padding: 5px 14px; border-radius: 999px; border: 1px solid #ddd;
  background: #fafafa;
}
.country-tabs .tab.active { background: #1565c0; color: #fff; border-color: #1565c0; }

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 20px 24px; }

/* HTML の hidden 属性は display:none 相当だが、display:flex 等で上書きされてしまうため強制 */
[hidden] { display: none !important; }

/* ════════════════════════════════════════════════════════════════════════
   HOME VIEW
   ════════════════════════════════════════════════════════════════════════ */

.home-view { display: flex; flex-direction: column; gap: 32px; }
.section-label {
  font-size: 12px; font-weight: 700; color: #1565c0;
  text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px;
}
.section-title {
  font-size: 18px; font-weight: 700; color: #1a1a2e; margin-bottom: 12px;
  border-left: 4px solid #1565c0; padding-left: 10px;
}

/* ② ヒーロー（テキスト左 / 画像右の2カラム） */
.hero-wrap { margin-bottom: 4px; }
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #1e3a5f 60%, #1565c0 100%);
  color: #fff; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(21,101,192,.25);
  cursor: pointer; transition: transform .2s, box-shadow .2s;
  display: grid; grid-template-columns: minmax(0, 1fr) 220px;
  overflow: hidden; height: 240px; /* 固定高さ */
}
.hero:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(21,101,192,.35); }
.hero-text {
  padding: 32px 36px;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden; /* はみ出しを封じる */
}
.hero-image {
  background-size: cover; background-position: center;
  background-repeat: no-repeat;
  position: relative;
  box-shadow: inset 8px 0 24px -8px rgba(0,0,0,0.35);
}
.hero-image::after {
  /* 左端を本体グラデにフェード */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(21,101,192,.35) 0%, rgba(21,101,192,0) 25%);
  pointer-events: none;
}
.hero-placeholder {
  background: #e8eaf0; color: #999; cursor: default;
  align-items: center; justify-content: center; text-align: center;
}
.hero-placeholder:hover { transform: none; box-shadow: 0 8px 32px rgba(21,101,192,.25); }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-title {
  font-size: 22px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-summary {
  font-size: 14px; line-height: 1.7; opacity: 0.92;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1; /* 残りスペースを使い切る */
}
.hero-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; opacity: 0.85; flex-shrink: 0; /* フッターは常に表示 */
}

/* ③ 今日のポイント */
.todays-points {
  background: #fff; border-radius: 12px; padding: 24px 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border-left: 4px solid #f59e0b;
}
.todays-points .section-title { border-left: none; padding-left: 0; }
.todays-points-body {
  font-size: 14px; line-height: 1.9; color: #333; margin-top: 8px;
}

/* ④ 国別セクション */
.country-sections { display: flex; flex-direction: column; gap: 28px; }
.country-section-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

/* ════════════════════════════════════════════════════════════════════════
   BROWSE VIEW
   ════════════════════════════════════════════════════════════════════════ */

/* ── 適用中フィルタ チップバー ── */
.active-filters {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: #eef2ff; border: 1px solid #c5d8ff; border-radius: 10px;
  padding: 10px 16px; margin-bottom: 16px;
}
.active-filters-label {
  font-size: 12px; font-weight: 700; color: #1565c0;
  text-transform: uppercase; letter-spacing: 1px; white-space: nowrap;
}
.active-filters-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #1565c0; color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.filter-chip-remove {
  background: none; border: none; color: rgba(255,255,255,.8);
  cursor: pointer; font-size: 13px; line-height: 1;
  padding: 0 2px; border-radius: 50%;
}
.filter-chip-remove:hover { color: #fff; background: rgba(255,255,255,.2); }
.clear-all-btn {
  background: none; border: 1px solid #1565c0; color: #1565c0;
  border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.clear-all-btn:hover { background: #1565c0; color: #fff; }

.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stats-bar { display: flex; gap: 16px; flex-wrap: wrap; }
.stat {
  background: #fff; border-radius: 8px; padding: 12px 20px;
  font-size: 13px; color: #666; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stat strong { font-size: 22px; color: #1a1a2e; display: block; }
.sort-control { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #666; }
.sort-control select {
  font-family: inherit; font-size: 13px; padding: 6px 10px;
  border: 1px solid #ccc; border-radius: 8px; background: #fff; color: #1a1a2e; cursor: pointer;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

/* ── Card ── */
.card {
  background: #fff; border-radius: 10px; padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .2s, transform .1s; cursor: pointer;
  border: 2px solid transparent;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.13); }
.card.selected { border-color: #1565c0; }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge-source { background: #e3f2fd; color: #1565c0; }
.badge-country{ background: #ede7f6; color: #4527a0; }
.badge-economics  { background: #e8f5e9; color: #2e7d32; }
.badge-finance    { background: #fff3e0; color: #e65100; }
.badge-policy     { background: #f3e5f5; color: #6a1b9a; }
.badge-research   { background: #fce4ec; color: #880e4f; }
.badge-geopolitics{ background: #e0f2f1; color: #00695c; }

.score { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #888; white-space: nowrap; }
.score-bar { width: 48px; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #42a5f5, #1565c0); }

.card-title {
  font-size: 15px; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-summary {
  font-size: 13px; color: #555; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.card-date { font-size: 11px; color: #aaa; }

/* ── Buttons ── */
.btn { font-size: 12px; padding: 5px 14px; border-radius: 6px; border: none; cursor: pointer; font-weight: 500; font-family: inherit; }
.btn-secondary { background: #f0f4ff; color: #1565c0; border: 1px solid #c5d8ff; }
.btn-primary {
  display: block; text-align: center; text-decoration: none;
  background: #1565c0; color: #fff; padding: 10px; font-size: 13px;
  border-radius: 8px; font-weight: 600;
}

/* ════════════════════════════════════════════════════════════════════════
   詳細パネル: PCもモバイルもフローティングモーダル
   ════════════════════════════════════════════════════════════════════════ */

.detail-panel {
  position: fixed;
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  z-index: 200;
  /* デスクトップ: 中央寄せモーダル */
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(560px, 92vw); max-height: 85vh; overflow-y: auto;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.detail-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.detail-panel h3 { font-size: 14px; font-weight: 700; color: #1565c0; }
.detail-close {
  background: none; border: none; font-size: 22px; color: #999;
  cursor: pointer; line-height: 1; padding: 4px 10px; border-radius: 6px;
}
.detail-close:hover { background: #f0f0f0; color: #333; }
.detail-empty { font-size: 13px; color: #aaa; line-height: 1.7; }
.detail-title { font-size: 22px; font-weight: 700; margin: 10px 0; line-height: 1.45; }
.detail-source { font-size: 13px; color: #888; margin-bottom: 14px; }
.detail-summary { font-size: 17px; color: #333; line-height: 1.85; margin-bottom: 16px; }
.detail-divider { border: none; border-top: 1px solid #eee; margin: 14px 0; }

/* 背景オーバーレイ */
.detail-overlay-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.detail-overlay-bg.open { opacity: 1; pointer-events: auto; }

/* ── States ── */
.loading { text-align: center; color: #aaa; font-size: 13px; padding: 30px; }
.empty-state { text-align: center; color: #aaa; font-size: 14px; padding: 40px; }
.load-more-wrap { text-align: center; margin-top: 20px; }
#load-more { padding: 10px 24px; }

/* ════════════════════════════════════════════════════════════════════════
   PC（801px以上）: 1.2倍スケーリング
   ════════════════════════════════════════════════════════════════════════ */

@media (min-width: 801px) {
  body { font-size: 16px; }
  .container { max-width: 1200px; padding: 28px 32px; }

  /* タブ */
  .tab { padding: 14px 20px; font-size: 15px; }
  .country-tabs .tab { padding: 7px 18px; }

  /* セクションタイトル */
  .section-title { font-size: 22px; }
  .section-label { font-size: 13px; }

  /* ヒーロー */
  .hero { grid-template-columns: minmax(0, 1fr) 280px; height: 300px; }
  .hero-text { padding: 40px 44px; gap: 18px; }
  .hero-title { font-size: 28px; -webkit-line-clamp: 2; }
  .hero-summary { font-size: 16px; -webkit-line-clamp: 3; }
  .hero-footer { font-size: 14px; }

  /* 今日のポイント */
  .todays-points { padding: 28px 32px; }
  .todays-points-body { font-size: 16px; line-height: 2; }

  /* チップバー */
  .active-filters { padding: 12px 20px; }
  .filter-chip { font-size: 15px; padding: 5px 14px; }
  .active-filters-label { font-size: 13px; }
  .clear-all-btn { font-size: 14px; padding: 5px 16px; }

  /* カードグリッド：1.2倍カードを意識して min を上げる */
  .cards { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; }

  /* カード本体 */
  .card { padding: 22px; gap: 12px; border-radius: 12px; }
  .card-title { font-size: 18px; }
  .card-summary { font-size: 15px; }
  .card-date { font-size: 13px; }
  .badge { font-size: 12px; padding: 3px 10px; }
  .score { font-size: 13px; }
  .score-bar { width: 56px; height: 7px; }
  .btn { font-size: 14px; padding: 6px 16px; }

  /* 統計 */
  .stat { padding: 14px 24px; font-size: 15px; }
  .stat strong { font-size: 26px; }
  .sort-control, .sort-control select { font-size: 15px; }

  /* 詳細モーダル（PC、本文1.2倍） */
  .detail-panel { padding: 32px; width: min(640px, 86vw); }
  .detail-title { font-size: 26px; }
  .detail-summary { font-size: 19px; line-height: 1.9; }
  .detail-source { font-size: 14px; }
}

/* ════════════════════════════════════════════════════════════════════════
   モバイル（800px以下）: ボトムシート型モーダル
   ════════════════════════════════════════════════════════════════════════ */

@media (max-width: 800px) {
  .container { padding: 16px; }
  .cards { grid-template-columns: 1fr; }
  .country-section-grid { grid-template-columns: 1fr; }

  /* ヒーローは縦並び（画像上 / テキスト下） */
  .hero { grid-template-columns: 1fr; grid-template-rows: 120px 1fr; height: 340px; }
  .hero-image { order: -1; box-shadow: none; }
  .hero-image::after {
    background: linear-gradient(180deg, rgba(21,101,192,0) 60%, rgba(21,101,192,.35) 100%);
  }
  .hero-text { padding: 22px 22px 24px; gap: 12px; }
  .hero-title { font-size: 18px; }

  /* 詳細をボトムシートに */
  .detail-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto; max-height: 85vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .detail-panel.open { transform: translateY(0); }
}
