/**
 * ちいかわ日和 - データベースページ共通CSS
 * ファイル名: chiikawa-db.css
 * 配置先: テーマフォルダ内 /css/
 */

/* ============================================================
   AFFINGER干渉リセット
   ============================================================ */
.chiikawa-db-wrap *,
.chiikawa-episode-wrap * {
  box-sizing: border-box;
}

.chiikawa-db-wrap a,
.chiikawa-episode-wrap a {
  text-decoration: none;
  color: inherit;
}

.chiikawa-db-wrap ul,
.chiikawa-db-wrap li,
.chiikawa-episode-wrap ul,
.chiikawa-episode-wrap li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chiikawa-db-wrap h1,
.chiikawa-db-wrap h2,
.chiikawa-db-wrap h3,
.chiikawa-episode-wrap h1,
.chiikawa-episode-wrap h2,
.chiikawa-episode-wrap h3 {
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--ck-text) !important;
  font-size: inherit !important;
  line-height: inherit !important;
}
.chiikawa-db-wrap h1::before,
.chiikawa-db-wrap h2::before,
.chiikawa-db-wrap h3::before,
.chiikawa-db-wrap h1::after,
.chiikawa-db-wrap h2::after,
.chiikawa-db-wrap h3::after,
.chiikawa-episode-wrap h1::before,
.chiikawa-episode-wrap h2::before,
.chiikawa-episode-wrap h3::before,
.chiikawa-episode-wrap h1::after,
.chiikawa-episode-wrap h2::after,
.chiikawa-episode-wrap h3::after {
  display: none !important;
  content: none !important;
}

.chiikawa-db-wrap button,
.chiikawa-db-wrap input,
.chiikawa-episode-wrap button,
.chiikawa-episode-wrap input {
  font-family: inherit;
}


/* ============================================================
   CSS変数
   ============================================================ */
:root {
  --ck-cream:        #fdf6ee;
  --ck-warm:         #fffaf4;
  --ck-accent:       #e07b39;
  --ck-accent-light: #f4a261;
  --ck-accent-pale:  #fff0e0;
  --ck-text:         #3a2e28;
  --ck-muted:        #9a8880;
  --ck-border:       #ead8c8;
  --ck-tag-bg:       #f5ede3;
  --ck-nav:          #3a2e28;
  --ck-green:        #5a8a5a;
  --ck-green-light:  #edf5ed;
  --ck-blue:         #4a7fa8;
  --ck-blue-light:   #e8f2f8;
  --ck-pink:         #c0627a;
  --ck-pink-light:   #faedf0;
  --ck-radius:       10px;
  --ck-shadow:       0 2px 12px rgba(58,46,40,0.08);
}

/* ============================================================
   共通
   ============================================================ */
.chiikawa-db-wrap,
.chiikawa-episode-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  color: var(--ck-text);
}

.tag-pill {
  display: inline-block;
  font-size: 0.7em;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}
.tag-pill:hover { opacity: 0.8; }
.tag-arc  { background: var(--ck-blue-light);  color: var(--ck-blue); }
.tag-char { background: var(--ck-green-light); color: var(--ck-green); }
.tag-mood { background: var(--ck-pink-light);  color: var(--ck-pink); }
.tag-generic { background: var(--ck-tag-bg);   color: var(--ck-muted); }

/* ============================================================
   一覧ページ
   ============================================================ */

.db-page-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ck-border);
}
.db-page-title {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--ck-text);
  margin: 0 0 6px;
}
.db-page-desc {
  font-size: 0.88em;
  color: var(--ck-muted);
}
.db-page-desc strong { color: var(--ck-accent); }

/* フィルターバー */
.db-filter-bar {
  background: #fff;
  border: 1.5px solid var(--ck-border);
  border-radius: var(--ck-radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  overflow: hidden;
}

.filter-row {
  margin-bottom: 14px;
  max-width: 100%;
  overflow: hidden;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #888;
  margin: 0 0 8px 0;
}
.filter-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e5e5;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
}

.filter-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-chips .chip:hover {
  background: #f0f0f0;
  border-color: #aaa;
  text-decoration: none;
}
.filter-chips .chip.active {
  background: #1D9E75;
  border-color: #1D9E75;
  color: #fff;
  font-weight: 500;
}
.filter-chips .chip-count {
  font-size: 11px;
  opacity: 0.75;
}
.filter-chips .chip-arc.active {
  background: #2979C2;
  border-color: #2979C2;
  color: #fff;
}
.filter-chips .chip-tag.active {
  background: #BA7517;
  border-color: #BA7517;
  color: #fff;
}
.filter-chips .chip-year {
  font-weight: 500;
}

/* 月ボタンエリア */
.filter-months {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding: 10px 12px;
  background: #f5f5f5;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.filter-chips .chip-month,
.filter-months .chip-month {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 99px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s;
}
.filter-months .chip-month:hover {
  background: #f0f0f0;
  border-color: #aaa;
}
.filter-months .chip-month.active {
  background: #1D9E75;
  border-color: #1D9E75;
  color: #fff;
  font-weight: 500;
}

/* ソートバー */
.db-sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.result-count { font-size: 0.85em; color: var(--ck-muted); }
.reset-link { color: var(--ck-accent); font-size: 0.9em; text-decoration: none; margin-left: 8px; }
.reset-link:hover { text-decoration: underline; }
.sort-btns { display: flex; align-items: center; gap: 6px; }
.sort-label { font-size: 0.78em; color: var(--ck-muted); }
.sort-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--ck-border);
  background: #fff;
  font-size: 0.78em;
  color: var(--ck-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.sort-btn:hover { border-color: var(--ck-accent-light); color: var(--ck-accent); text-decoration: none; }
.sort-btn.active { background: var(--ck-nav); color: #fff; border-color: var(--ck-nav); }

/* 分析ページへのリンクバナー */
.stats-link-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #e8f7f2, #d0f0e4);
  border: 1px solid #a8ddc8;
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 16px;
  text-decoration: none;
  color: #1D9E75;
  transition: background 0.15s;
}
.stats-link-banner:hover {
  background: linear-gradient(135deg, #d0f0e4, #b8e8d4);
  text-decoration: none;
}
.stats-link-left { display: flex; align-items: center; gap: 10px; }
.stats-link-icon { font-size: 22px; }
.stats-link-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0f6e56;
}
.stats-link-text span { font-size: 12px; color: #3a9e7a; }
.stats-link-arrow { font-size: 18px; color: #1D9E75; }

/* 話カードグリッド */
.episode-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 12px !important;
  margin-bottom: 28px;
  width: 100% !important;
}
.episode-card {
  display: block;
  background: var(--ck-warm);
  border: 1.5px solid var(--ck-border);
  border-radius: var(--ck-radius);
  text-decoration: none;
  color: var(--ck-text);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.episode-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ck-accent-light);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s;
  z-index: 1;
}
.episode-card:hover {
  border-color: var(--ck-accent-light);
  transform: translateY(-2px);
  box-shadow: var(--ck-shadow);
  text-decoration: none;
  color: var(--ck-text);
}
.episode-card:hover::before { transform: scaleX(1); }

.card-body { padding: 12px 14px; }
.card-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.card-num {
  font-size: 0.7em;
  color: var(--ck-accent);
  background: var(--ck-accent-pale);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: bold;
}
.card-date { font-size: 0.7em; color: var(--ck-muted); margin-left: auto; }
.card-title { font-size: 0.97em; font-weight: bold; line-height: 1.4; margin: 0 0 8px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ページネーション */
.db-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.db-pagination .page-numbers {
  display: inline-block;
  padding: 6px 12px;
  border: 1.5px solid var(--ck-border);
  border-radius: 6px;
  font-size: 0.85em;
  color: var(--ck-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.db-pagination .page-numbers:hover { border-color: var(--ck-accent); color: var(--ck-accent); }
.db-pagination .page-numbers.current { background: var(--ck-accent); border-color: var(--ck-accent); color: #fff; }

.no-results { text-align: center; padding: 40px 20px; color: var(--ck-muted); }
.no-results a { color: var(--ck-accent); }

/* ============================================================
   個別話ページ
   ============================================================ */

.ep-breadcrumb {
  font-size: 0.78em;
  color: var(--ck-muted);
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.ep-breadcrumb a { color: var(--ck-muted); text-decoration: none; }
.ep-breadcrumb a:hover { color: var(--ck-accent); }

.ep-layout {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 20px;
  align-items: start;
}

.ep-main {
  background: var(--ck-warm);
  border: 1.5px solid var(--ck-border);
  border-radius: var(--ck-radius);
  overflow: visible;
}

.ep-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--ck-border);
}
.ep-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.78em;
}
.ep-num {
  color: var(--ck-accent);
  font-weight: bold;
  background: var(--ck-accent-pale);
  padding: 2px 8px;
  border-radius: 4px;
}
.ep-date { color: var(--ck-muted); }
.ep-title {
  font-size: 1.5em;
  font-weight: bold;
  line-height: 1.3;
  margin: 0 0 10px;
  color: var(--ck-text);
}
.ep-tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.ep-tag-row .tag-pill { text-decoration: none; }

.ep-tweet-area {
  padding: 20px;
  border-bottom: 1px solid var(--ck-border);
  background: #fafaf8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chiikawa-tweet-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}
.ep-tweet-note {
  font-size: 0.78em;
  color: var(--ck-muted);
  text-align: center;
  margin: 0;
}
.ep-tweet-note a { color: var(--ck-accent); text-decoration: none; }
.ep-tweet-note a:hover { text-decoration: underline; }

.ep-content {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ck-border);
  font-size: 0.92em;
  line-height: 1.8;
}

.ep-nav { padding: 12px 16px; }
.ep-nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.ep-nav-btn {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--ck-border);
  background: #fff;
  font-size: 0.78em;
  color: var(--ck-muted);
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1.4;
}
.ep-nav-btn:hover { border-color: var(--ck-accent-light); color: var(--ck-accent); text-decoration: none; }
.ep-nav-btn.disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.ep-nav-btn.prev { text-align: left; }
.ep-nav-btn.next { text-align: right; }
.ep-nav-direction { display: block; font-size: 0.88em; margin-bottom: 2px; }
.ep-nav-title { font-weight: bold; color: var(--ck-text); }
.ep-nav-list {
  display: block;
  text-align: center;
  font-size: 0.78em;
  color: var(--ck-muted);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1.5px solid var(--ck-border);
  white-space: nowrap;
  transition: all 0.15s;
}
.ep-nav-list:hover { border-color: var(--ck-accent-light); color: var(--ck-accent); text-decoration: none; }

.ep-sidebar { display: flex; flex-direction: column; gap: 14px; }
.sidebar-card {
  background: var(--ck-warm);
  border: 1.5px solid var(--ck-border);
  border-radius: var(--ck-radius);
  overflow: hidden;
}
.sidebar-card-title {
  font-size: 0.75em;
  font-weight: bold;
  color: var(--ck-muted);
  letter-spacing: 0.06em;
  padding: 9px 14px;
  border-bottom: 1px solid var(--ck-border);
  background: var(--ck-tag-bg);
}
.sidebar-card-body { padding: 10px 14px; }
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--ck-border);
  font-size: 0.82em;
}
.info-row:last-child { border-bottom: none; }
.info-key { color: var(--ck-muted); width: 60px; flex-shrink: 0; }
.info-val { color: var(--ck-text); flex: 1; }
.info-val a { color: var(--ck-accent); text-decoration: none; }
.info-val a:hover { text-decoration: underline; }
.char-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.char-chip {
  font-size: 0.78em;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--ck-green-light);
  color: var(--ck-green);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
}
.char-chip:hover { background: var(--ck-green); color: #fff; text-decoration: none; }
.related-list { display: flex; flex-direction: column; }
.related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--ck-border);
  text-decoration: none;
  font-size: 0.8em;
  color: var(--ck-text);
  transition: color 0.15s;
}
.related-item:last-child { border-bottom: none; }
.related-item:hover { color: var(--ck-accent); text-decoration: none; }
.related-num { color: var(--ck-muted); font-size: 0.85em; width: 32px; flex-shrink: 0; }
.related-title { flex: 1; font-weight: 500; }

/* ============================================================
   投稿データ分析ページ
   ============================================================ */

.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}
.stat-label { font-size: 11px; color: #888; }
.stat-value { font-size: 28px; font-weight: 700; color: #1D9E75; line-height: 1.2; }
.stat-unit { font-size: 11px; color: #aaa; }

.stats-section { margin-bottom: 36px; }
.stats-section-title { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: #333; }
.stats-note { font-size: 12px; color: #aaa; margin: 0 0 14px; }

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-item { display: flex; align-items: center; gap: 10px; }
.bar-label { font-size: 13px; color: #555; min-width: 28px; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; background: #f0f0f0; border-radius: 99px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; background: #b0dfd0; border-radius: 99px; transition: width 0.6s ease; }
.bar-item--highlight .bar-fill { background: #1D9E75; }
.bar-value { font-size: 12px; color: #888; min-width: 48px; flex-shrink: 0; }

.chart-container { position: relative; width: 100%; height: 260px; }

.stats-hall {
  border: 2px solid #f0c040;
  background: #fffdf0;
  border-radius: 12px;
  padding: 20px 24px;
}
.hall-card { display: flex; flex-direction: column; gap: 14px; }
.hall-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.hall-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.badge-like { background: #fde8e8; color: #c0392b; }
.badge-rt   { background: #e8f4fd; color: #2179c2; }
.hall-stats { display: flex; gap: 24px; }
.hall-stat  { display: flex; align-items: baseline; gap: 5px; }
.hall-stat-value { font-size: 28px; font-weight: 700; color: #1D9E75; }
.hall-stat-label { font-size: 12px; color: #aaa; }
.hall-embed { max-width: 500px; }
.hall-link { font-size: 13px; color: #1D9E75; text-decoration: none; display: inline-block; }
.hall-link:hover { text-decoration: underline; }

.stats-back { text-align: center; margin-top: 24px; }
.stats-back a { font-size: 13px; color: #1D9E75; text-decoration: none; }
.stats-back a:hover { text-decoration: underline; }

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (min-width: 600px) {
  .stats-summary { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 720px) {
  .ep-layout { grid-template-columns: 1fr; }
  .ep-sidebar { order: -1; }
  .ep-nav-inner { grid-template-columns: 1fr 1fr; }
  .ep-nav-list { display: none; }
  .episode-grid { grid-template-columns: 1fr 1fr; }
  .filter-label { width: auto; }
}

@media (max-width: 640px) {
  .filter-months .chip-month {
    padding: 6px 12px;
    font-size: 13px;
  }
  .db-page-title {
    font-size: 18px !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
  }
  .chiikawa-db-wrap a.next.page-numbers {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .episode-grid { grid-template-columns: 1fr; }
  .db-sort-bar { flex-direction: column; align-items: flex-start; }
}
