/* ランキング一覧ページ専用スタイル */

/* ページタイトル */
.ichiran-page-title {
  text-align: center;
  font-size: 1.8rem;
  color: #333;
  margin: 20px 0 30px;
  padding-bottom: 10px;
  border-bottom: 3px solid #007bff;
}

/* コンテンツラッパー */
.ichiran-content-wrapper {
  padding-top: 0;
}

.ichiran-container {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  gap: 30px;
}

/* サイドバー（年リスト） */
.ichiran-sidebar {
  width: 200px;
  flex-shrink: 0;
}

.ichiran-sidebar h2 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #333;
}

.year-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.year-list li {
  margin-bottom: 5px;
}

.year-list a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  color: #333;
  border-radius: 4px;
  transition: background 0.2s;
}

.year-list a:hover {
  background: #f0f0f0;
}

.year-list a.active {
  background: #007bff;
  color: #fff;
  font-weight: bold;
}

/* メインコンテンツ */
.ichiran-main {
  flex: 1;
  min-width: 0;
}

/* SPブロック */
.sp-block {
  margin-bottom: 40px;
}

.sp-block h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #d63384;
  color: #d63384;
}

/* 週刊ブロック（月ごと） */
.month-block {
  margin-bottom: 40px;
}

.month-block h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #333;
}

/* カード一覧 */
.ranking-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

/* 1カード */
.ranking-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  transition: box-shadow 0.2s;
}

.ranking-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* カードタイトル（クリッカブル） */
.ranking-card .card-title {
  display: block;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
  text-decoration: none;
  transition: color 0.2s;
}

.ranking-card .card-title:hover {
  color: #007bff;
  text-decoration: underline;
}

.ranking-card .card-title.sp {
  color: #d63384;
}

.ranking-card .card-title.sp:hover {
  color: #a02860;
}

/* 番号部分（#935、SP37など）の色 */
.ranking-card .card-title .ranking-number {
  color: #007bff;
}

/* サムネリンク（クリッカブル） */
.ranking-card .card-thumb-link {
  display: block;
  text-decoration: none;
  margin-bottom: 10px;
}

.ranking-card .card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  transition: opacity 0.2s;
}

.ranking-card .card-thumb-link:hover .card-thumb {
  opacity: 0.85;
}

.ranking-card .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-card .card-thumb .loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 0.9rem;
}

/* カードリンク */
.ranking-card .card-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-card .card-links a {
  display: block;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.ranking-card .card-links .link-ranking {
  background: #007bff;
  color: #fff;
}

.ranking-card .card-links .link-ranking:hover {
  background: #0056b3;
}

.ranking-card .card-links .link-dic {
  background: #333;
  color: #fff;
}

.ranking-card .card-links .link-dic:hover {
  background: #555;
}

/* スマホ対応 */
.mobile-year-toggle {
  display: none;
  padding: 12px 20px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 20px;
  width: 100%;
  position: relative;
  z-index: 999;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998; /* サイドバー(1001)より下 */
  pointer-events: auto;
}

.sidebar-overlay.show {
  pointer-events: auto; /* クリックを受け付ける */
}

@media (max-width: 1024px) {
  .ichiran-page-title {
    font-size: 1.4rem;
    margin: 15px 0 20px;
  }
  
  .ichiran-content-wrapper {
    padding-top: 0;
  }
  
  .ichiran-container {
    flex-direction: column;
    padding: 15px;
  }
  
  .mobile-year-toggle {
    display: block;
  }
  
  .ichiran-sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1001; /* オーバーレイ(998)より上 */
    padding: 20px;
    overflow-y: auto;
    transition: left 0.3s;
  }
  
  .ichiran-sidebar.open {
    left: 0;
  }
  
  /* サイドバー内のリンクがクリックできることを確実にする */
  .ichiran-sidebar a {
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    z-index: 1;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
  }
  
  /* スマホ版の年リストのリンク */
  .ichiran-sidebar .year-list a {
    display: block;
    padding: 15px 20px; /* タップ領域を大きく */
    min-height: 48px; /* アクセシビリティ推奨の最小タップサイズ */
    font-size: 1.1rem;
  }
  
  /* タップ時の視覚的フィードバック */
  .ichiran-sidebar .year-list a:active {
    background: #e0e0e0;
    transform: scale(0.98);
  }
  
  .sidebar-overlay.show {
    display: block;
  }
  
  /* スマホ版では大百科ボタンを非表示 */
  .ranking-card .card-links .link-dic {
    display: none !important;
  }
  
  .ranking-cards {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }
}

/* トップに戻るボタン */
.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background 0.2s;
  z-index: 1000;
}

.scroll-top-btn.show {
  opacity: 1;
  visibility: visible;
}

.scroll-top-btn:hover {
  background: #0056b3;
}

.scroll-top-btn:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .scroll-top-btn {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }
}