/*
Theme Name: dlrank
Theme URI: https://lovecul.dmm.co.jp/
Description: DLsite & FANZA Tracking and Ranking Theme
Version: 1.0.0
Author: Sasaki Akari
Author URI: https://github.com/
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dlrank
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* ==========================================
   1. CSS Variables & Design Tokens
   ========================================== */
:root {
  /* Colors */
  --primary-color: #0066cc;
  --primary-hover-color: #004bb1;
  --bg-color: #f7f9fa;
  --card-bg-color: #ffffff;
  --text-color: #455671;
  /* 目に優しい淡い黒色 */
  --text-muted: #777777;
  /* 優しいグレー */
  --border-color: #e1e4e8;
  --accent-color: #ff0000;
  --discount-bg: #ff0000;
  --discount-text: #ffffff;
  --point-green: #00a656;

  /* Layout & Fonts */
  --font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  --max-width: 1300px;
  --sidebar-width: 240px;

  /* Ranking Badges */
  --gold-color: #e6b422;
  --silver-color: #a5a5a5;
  --bronze-color: #a8793a;
}

html.dark-mode {
  --primary-color: #64b5f6;
  --primary-hover-color: #90caf9;
  --bg-color: #121212;
  --card-bg-color: #1e1e1e;
  --text-color: #e2e8f0;
  --text-muted: #a0aec0;
  --border-color: #2d3748;
  --accent-color: #ff4d4d;
}

/* ==========================================
   2. Reset & Global Styles
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  padding-bottom: 50px;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover-color);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 15px;
}

/* ==========================================
   3. Header Section (DLsite-like Layout)
   ========================================== */
.site-header {
  background-color: var(--card-bg-color);
  border-bottom: 1px solid var(--border-color);
  padding: 15px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo */
.header-logo {
  flex-shrink: 0;
  position: relative;
  left: 20px;
}

.header-logo img {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.header-logo-text {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

/* Search Bar with Integrated Category Dropdown */
.header-search-form {
  flex: 1;
  max-width: 600px;
  display: flex;
  align-items: center;
  border: 2px solid #5a9bd4;
  /* ロゴのパステルブルー */
  /* 両端が丸い検索バー（ピル型）。子の角丸と合わせて形を作る */
  border-radius: 999px;
  /* カスタムカテゴリメニューが切れないよう visible */
  overflow: visible;
  background-color: var(--card-bg-color);
  position: relative;
  z-index: 20;
}

.search-cat-dropdown {
  position: relative;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
}

.search-cat-trigger {
  border: none;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: grid;
  grid-template-columns: 1fr 14px;
  align-items: stretch;
  padding: 0;
  min-width: 7.5em;
  font-size: 14px;
  font-weight: normal;
  outline: none;
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  height: 100%;
  position: relative;
  /* 左端を外側のピル型に合わせる */
  border-radius: 999px 0 0 999px;
}

.search-cat-trigger-label {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-column: 1;
  width: 100%;
  padding: 8px 6px;
  line-height: 1.3;
  box-sizing: border-box;
}

/* 右端のシェブロン（区切り線なし・右端寄せの小さめサイズ） */
.search-cat-chevron {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 7px;
  box-sizing: border-box;
}

.search-cat-chevron::before {
  content: "";
  display: block;
  width: 9px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6' fill='none'%3E%3Cpath d='M1 1L4.5 4.75L8 1' stroke='%23555' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 9px 6px;
}

html.dark-mode .search-cat-chevron::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6' fill='none'%3E%3Cpath d='M1 1L4.5 4.75L8 1' stroke='%23ccc' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.search-cat-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: max-content;
  /* 文字幅に合わせてメニュー幅を自動で広げる */
  min-width: 100%;
  /* ドロップダウントリガーの横幅よりは狭くならないように保証 */
  margin: 0;
  padding: 6px 8px;
  padding-inline-start: 8px;
  /* ブラウザデフォルトの40pxを上書きリセット */
  list-style: none;
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  z-index: 50;
  box-sizing: border-box;
}

.search-cat-menu[hidden] {
  display: none;
}

.search-cat-menu li {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.02em;
  color: var(--text-color);
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.2s;
}

.search-cat-menu li:hover,
.search-cat-menu li.is-selected {
  background-color: #5a9bd4;
  color: #fff;
}

/* フォーム送信用。画面上はカスタムUIを使う */
.search-cat-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-field {
  flex: 1;
  min-width: 0;
  position: relative;
  align-self: stretch;
  display: flex;
}

.search-input {
  flex: 1;
  width: 100%;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  color: var(--text-color);
  background-color: transparent;
}

/* キーワード入力欄の真下に出す検索履歴サジェスト（枠は現状維持、中身はもちもち3Dのリスト型に寄せる） */
.search-suggest {
  position: absolute;
  /* 検索バーとのすき間（狭め） */
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px 8px;
  /* 左右対称の余白に修正 */
  padding-inline-start: 8px;
  /* ブラウザデフォルトの40pxを上書きリセット */
  list-style: none;
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  z-index: 60;
  max-height: 280px;
  overflow-y: auto;
  box-sizing: border-box;
}

.search-suggest[hidden] {
  display: none;
}

.search-suggest li {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.02em;
  color: var(--text-color);
  cursor: pointer;
  display: block;
  border-bottom: 1px dashed #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: 0.2s;
}

.search-suggest li:last-child {
  border-bottom: none;
}

.search-suggest li:hover,
.search-suggest li.is-active {
  background-color: #f3f3f3;
  color: #5a9bd4;
}

html.dark-mode .search-suggest li {
  border-bottom-color: #2a2a2a;
}

html.dark-mode .search-suggest li:hover,
html.dark-mode .search-suggest li.is-active {
  background-color: #2a2a2a;
  color: #5a9bd4;
}

/* サジェスト グループタイトル */
.search-suggest li.suggest-group-title {
  font-size: 11px;
  font-weight: bold;
  color: var(--text-muted);
  background-color: var(--border-color);
  opacity: 0.85;
  cursor: default;
  border-bottom: none;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
  padding: 6px 12px;
  margin: 4px 0 2px 0;
  border-radius: 4px;
}

/* サジェスト作品名（2行表示用） */
.search-suggest li.suggest-work {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: normal;
}

.search-suggest li.suggest-work .suggest-title {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-suggest li.suggest-work .suggest-circle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* サジェストタグ */
.search-suggest li.suggest-tag {
  font-size: 13px;
  font-weight: bold;
  color: #eb7ca3;
  /* タグらしいピンク系カラー */
}

html.dark-mode .search-suggest li.suggest-tag {
  color: #c86980;
}

/* 履歴アイテムのレイアウト調整 */
.search-suggest li.suggest-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
}

.suggest-history-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 丸っこい削除ボタン */
.suggest-history-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background-color: var(--border-color);
  color: var(--text-muted);
  font-size: 9px;
  /* 太い✖用に少しサイズ調整 */
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

.suggest-history-delete-btn:hover {
  background-color: #5a9bd4;
  /* テーマのパステルブルー */
  color: #ffffff;
}

html.dark-mode .suggest-history-delete-btn {
  background-color: #2a2a2a;
}

html.dark-mode .suggest-history-delete-btn:hover {
  background-color: #5a9bd4;
  /* テーマのパステルブルー */
  color: #ffffff;
}

.search-submit-btn {
  background-color: #5a9bd4;
  /* ロゴのパステルブルー */
  border: none;
  color: #ffffff;
  padding: 8px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
  /* 右端を外側のピル型に合わせる */
  border-radius: 0 999px 999px 0;
  align-self: stretch;
}

.search-submit-btn:hover {
  background-color: #000000;
  /* 少し濃いブルー */
}

/* Header Right Options (Favorites & Theme Switch) */
.header-options {
  display: flex;
  align-items: center;
  gap: 15px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  font-size: 11px;
  gap: 2px;
  transition: transform 0.15s ease;
}

.option-btn:hover {
  transform: translateY(-1px);
}

/* ==========================================
   4. Navigation Bar (12 Categories)
   ========================================== */
.site-nav {
  background-color: var(--card-bg-color);
  border-bottom: 2px solid var(--border-color);
  padding: 10px 0;
}

.nav-title {
  display: none;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  justify-content: flex-start;
  gap: 10px;
}

.nav-item a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  color: var(--text-color);
  border-radius: 50px;
  /* 丸いピル型 */
  white-space: nowrap;
  background-color: var(--bg-color);
  border: 2px solid transparent;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, color 0.2s, border-color 0.2s;
}

.nav-item.active a {
  background-color: #5a9bd4;
  /* 検索と同じパステル水色！ */
  color: #ffffff;
  border-color: #337ec0;
  box-shadow: 0 4px 10px rgba(90, 155, 212, 0.2);
  text-decoration: none;
}

.nav-item a:hover {
  background-color: #e8f3fc;
  /* 薄いパステル水色 */
  color: #3a80bc;
  /* 濃い水色 */
  text-decoration: none;
  transform: translateY(-3px);
  /* ぴょこっと跳ねる！ */
}

/* 女性向け TL/BLへ カプセルリンク */
.nav-item-girls-bl-link {
  display: flex;
  align-items: center;
}

.nav-item-girls-bl-link a.girls-bl-link-btn {
  display: inline-block;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: bold;
  color: #eb7ca3;
  border: 1px solid #ef5b8f;
  border-radius: 50px;
  background-color: transparent;
  white-space: nowrap;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
}

.nav-item-girls-bl-link a.girls-bl-link-btn:hover {
  background-color: rgba(239, 91, 143, 0.1);
  color: #d83b72;
  border-color: #d83b72;
  transform: translateY(-2px);
  text-decoration: none;
}

/* ダークモードでの対応 */
html.dark-mode .nav-item-girls-bl-link a.girls-bl-link-btn {
  color: #c86980;
  border-color: #b44d66;
}

html.dark-mode .nav-item-girls-bl-link a.girls-bl-link-btn:hover {
  background-color: rgba(255, 117, 151, 0.15);
  color: #ff9ebb;
  border-color: #ff9ebb;
}

/* ==========================================
   5. Site Layout Grid (2 Columns)
   ========================================== */
.site-main-grid {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  align-items: flex-start;
}

.sidebar-column {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.content-column {
  flex: 1;
}

/* ==========================================
   6. Sidebar Widgets (Tag Filter)
   ========================================== */
.widget-card {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  /* 6pxから12pxに変更（優しく丸く！） */
  padding: 18px 20px;
  /* パディングを広げて窮屈さを解消 */
  margin-bottom: 20px;
}

.accordion-icon {
  display: none;
}

.widget-title {
  font-size: 14px;
  font-weight: bold;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 6px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-tag-list {
  list-style: none;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Scrollbar Customization */
.sidebar-tag-list::-webkit-scrollbar {
  width: 4px;
}

.sidebar-tag-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.sidebar-tag-item {
  margin-bottom: 6px;
}

.tag-filter-label {
  display: flex;
  align-items: center;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.tag-filter-label input {
  margin-right: 6px;
}

.tag-count {
  color: var(--text-muted);
  margin-left: auto;
  font-size: 11px;
}

.reset-filter-btn {
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.reset-filter-btn:hover {
  background-color: var(--bg-color);
  color: var(--text-color);
}

.ranking-scroll-sentinel {
  width: 100%;
  height: 1px;
}

.ranking-scroll-status {
  text-align: center;
  padding: 20px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.ranking-scroll-status p {
  margin: 0;
}

/* ==========================================
   6-b. Archive Date Navigator (日付アーカイブナビ)
   ========================================== */
.archive-nav-card {
  padding: 14px 14px;
}

.archive-nav-date-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.archive-nav-btns-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.archive-nav-btn-latest {
  flex: 0 0 auto;
}

.archive-nav-btn {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--primary-color);
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.archive-nav-btn:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  text-decoration: none;
}

.archive-nav-btn.is-disabled {
  color: var(--text-muted);
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.archive-date-display {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-variant-numeric: tabular-nums;
}

.archive-date-part {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-color);
  padding: 2px 3px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.archive-date-part:hover {
  color: var(--primary-color);
  background-color: var(--bg-color);
}

.archive-date-part.is-open {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.archive-date-sep {
  font-size: 13px;
  color: var(--text-muted);
}

.archive-picker {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  animation: archive-picker-in 0.18s ease;
}

@keyframes archive-picker-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.archive-picker-caption {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.archive-picker-grid {
  display: grid;
  gap: 5px;
}

.archive-picker-grid.years {
  grid-template-columns: repeat(3, 1fr);
}

.archive-picker-grid.months {
  grid-template-columns: repeat(4, 1fr);
}

.archive-picker-grid.days {
  grid-template-columns: repeat(7, 1fr);
}

.archive-picker-cell {
  font-family: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 7px 0;
  text-align: center;
  color: var(--text-color);
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.archive-picker-cell:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.archive-picker-cell.is-active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.archive-picker-cell.is-disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ==========================================
   7. Main Content & Ranking Card Styles
   ========================================== */
.ranking-header {
  position: relative;
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  /* 6pxから12pxに変更（カードと統一） */
  padding: 15px 20px;
  /* 左右の余白を広げて文字の寄りすぎを解消 */
  margin-bottom: 20px;
  /* 「選択中」耳・切替枠のはみ出しを切らない */
  overflow: visible;
}

/* 高さはトグルの62pxに揃う。横並びのFlexboxにして、耳のはみ出しを崩さない */
.ranking-header-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
}

.ranking-header-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  /* 行間の調整 */
  order: 2;
  /* テキストを右側に配置 */
}

.ranking-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  /* タイトルと日付の隙間 */
}

.ranking-site-line {
  margin: 0;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.3;
  color: var(--text-color);
}

.ranking-title {
  font-size: 18px;
  font-weight: bold;
  margin: 0;
  line-height: 1.3;
}

.ranking-date-line {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.3;
  display: inline-block;
  /* spanタグ化に対応 */
}

/* Site Toggle (DLsite / FANZA) — 外枠真四角＋枠の外に「選択中」耳
   Flexboxの通常フローに乗せ、order: 1で左側に配置する */
.site-toggle-tabs {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: none;
  padding: 0;
  border: none;
  margin: 0;
  order: 1;
  /* トグルボタンを左側に配置 */
  transform: translateY(6px);
}

/* 外側の枠そのものが真四角。非選択時も同じ余白・枠幅なので外寸は常に同じ
   大きさの微調整: この width / height / min-width / min-height を同じ値で変える */
.toggle-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 62px;
  height: 62px;
  min-width: 62px;
  min-height: 62px;
  aspect-ratio: 1 / 1;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  line-height: 1;
  flex-shrink: 0;
}

.toggle-tab:hover {
  text-decoration: none;
}

/* 選択中だけ外枠線を表示（光りなし）。
   左上だけ角丸をやめて、耳が枠の角から直線でつながるようにする */
.toggle-tab.is-active {
  border-color: #9aa5b5;
  border-radius: 0 12px 12px 12px;
}

html.dark-mode .toggle-tab.is-active {
  border-color: #8a9bb0;
}

/*
  「選択中」耳:
  色付き面の内側ではなく、外枠のさらに外側（上方向）に突き出す。
  下辺を外枠の上辺に重ねて「枠から生えた耳」にする。
  外枠の左上は角丸なし（直角）なので、耳の左辺を枠の左辺に
  ぴったり揃える（-2px は枠線の太さ分）。
*/
.toggle-tab-badge {
  display: none;
  position: absolute;
  top: 0;
  left: -2px;
  z-index: 2;
  transform: translateY(-100%);
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
  padding: 3px 7px 2px;
  border-radius: 6px 6px 0 0;
  background-color: #ffffff;
  color: #455671;
  border: 2px solid #9aa5b5;
  border-bottom: none;
  pointer-events: none;
  white-space: nowrap;
}

.toggle-tab.is-active .toggle-tab-badge {
  display: block;
}

html.dark-mode .toggle-tab-badge {
  background-color: #2d3748;
  color: #e2e8f0;
  border-color: #8a9bb0;
}

.toggle-tab-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  font-size: 13px;
  font-weight: bold;
  color: #ffffff;
}

.toggle-tab-dlsite .toggle-tab-face {
  background-color: #0066cc;
}

.toggle-tab-fanza .toggle-tab-face {
  background-color: #d90000;
}

.toggle-tab-composite .toggle-tab-face {
  background-color: #ffcf75;
  color: #353535;
}

/* 未選択は色を薄く。選択中（.is-active）は今の濃さのまま
   薄さの微調整: この opacity を変える（小さいほど薄い） */
.toggle-tab:not(.is-active) .toggle-tab-face {
  opacity: 0.25;
}

.toggle-tab:not(.is-active):hover .toggle-tab-face {
  opacity: 1;
  filter: none;
}

.toggle-tab.is-active:hover .toggle-tab-face {
  filter: none;
}

/* Ranking Items Loop */
.ranking-list-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  /* 順位バッジのはみ出し分（微調整はここ／下の transform） */
  padding-top: 12px;
  padding-left: 12px;
}

/* 専用モード・検索モードなど順位バッジ表示なしの時は左パディングを0にして並び替えボタンと左端を100%統一 */
.ranking-list-container:not(.has-rank-badges) {
  padding-left: 0;
}

.work-card {
  display: flex;
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  /* 6pxから12pxに変更（優しく丸く！） */
  padding: 18px 20px;
  /* パディングを広げて窮屈さを解消！ */
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  /* 順位バッジが枠外にはみ出せるよう visible */
  overflow: visible;
  min-width: 0;
}

.work-card:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Ranking Badges
   微調整ポイント:
   - 位置: .rank-badge-container の top / left / transform
   - 枠線: .rank-badge の border
   - はみ出し余白: .ranking-list-container の padding-top / padding-left
*/
.rank-badge-container {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* カード左上の角に少し重なる（負の方向にはみ出す） */
  transform: translate(-35%, -32%);
}

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  background-color: #bababa;
  border: 2px solid #ffffff;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.rank-badge.rank-1 {
  background-color: var(--gold-color);
}

.rank-badge.rank-2 {
  background-color: var(--silver-color);
}

.rank-badge.rank-3 {
  background-color: var(--bronze-color);
}

.rank-metric {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 5px;
  text-align: center;
  line-height: 1.2;
}

.rank-metric-val {
  font-weight: bold;
  color: var(--text-color);
  display: block;
}

/* サムネイルの大きさ */
.work-thumbnail {
  width: 260px;
  flex-shrink: 0;
  margin-right: 15px;
  align-self: flex-start;
  border: none;
  background-color: transparent;
  overflow: visible;
}

/* Product Thumbnail Image */
.work-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

/* 同人総合ランキング: ゲーム横長と漫画縦長が混在するためサムネ枠の高さを揃える */
.ranking-list-mixed-doujin .work-thumbnail a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.ranking-list-mixed-doujin .work-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
  border-radius: 0;
}

html.dark-mode .ranking-list-mixed-doujin .work-thumbnail a {
  background-color: rgba(255, 255, 255, 0.04);
}

/* Product Information Center */
.work-detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.work-release-date {
  font-size: 11px;
  color: var(--text-muted);
}

.work-title-link {
  font-size: 15px;
  font-weight: bold;
  color: #1a0dab;
  /* 元の青色リンクに変更！ */
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.work-title-link:visited {
  color: #1a0dab;
}

.work-title-link:hover {
  color: #004bb1;
  text-decoration: underline;
}

html.dark-mode .work-title-link {
  color: var(--primary-color);
}

html.dark-mode .work-title-link:visited {
  color: var(--primary-color);
}

html.dark-mode .work-title-link:hover {
  color: var(--primary-hover-color);
}

.work-circle-name {
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* サークル名と声優名の区切り（DLsite風にスラッシュ前後へ余白） */
.work-circle-name .work-circle-voice-actors::before {
  content: '/';
  margin: 0 0.5em 0 0.45em;
  color: var(--text-muted);
  opacity: 0.85;
}

.work-circle-name .work-circle-voice-actors .voice-actor-link+.voice-actor-link {
  margin-left: 0.45em;
}

.work-rating-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-color);
  margin-top: 4px;
  flex-wrap: wrap;
}

.work-rating-row .rating-val {
  font-weight: bold;
  font-size: 13px;
}

.rating-stars {
  color: #f5a623;
  font-size: 13px;
}

.work-snippet {
  font-size: 13px;
  color: var(--text-color);
  line-height: 1.4;
  margin-top: 5px;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* 個別ページと同じ段落分け（改行を残す） */
  white-space: pre-line;
}

.work-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.work-tag-chip {
  background-color: var(--bg-color);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.work-tag-chip:hover {
  background-color: var(--border-color);
  color: var(--text-color);
}

/* Product Pricing & Cart (Right side of card) */
.work-action-col {
  width: 220px;
  /* 縦並び情報のために少し幅を広げます */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* 上から順に積む（余白は gap / margin で調整） */
  justify-content: flex-start;
  border-left: 1px solid var(--border-color);
  padding-left: 15px;
  margin-left: 10px;
  gap: 10px;
}

.price-box {
  text-align: right;
  width: 100%;
}

.price-current {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-color);
  display: block;
}

.price-original {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-right: 5px;
}

.discount-rate-badge {
  background-color: var(--discount-bg);
  color: var(--discount-text);
  font-size: 10px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 2px;
  vertical-align: middle;
}

.point-return-text {
  font-size: 11px;
  color: var(--point-green);
  margin-top: 2px;
  display: block;
}

.action-buttons-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-buy {
  display: block;
  width: 100%;
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  font-weight: bold;
  border-radius: 50px;
  /* 丸いピル型 */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-buy:active {
  transform: scale(0.96);
}

.btn-buy.btn-dlsite {
  background: #0066cc;
  color: white !important;
  border: 1px solid #004bb1;
}

.btn-buy.btn-dlsite:hover {
  background: #004bb1;
  text-decoration: none;
}

.btn-buy.btn-fanza {
  background: #d90000;
  color: white !important;
  border: 1px solid #b30000;
}

.btn-buy.btn-fanza:hover {
  background: #b30000;
  text-decoration: none;
}

/* ==========================================
   8. Favorite Star Icon Styles & Animation
   ========================================== */
.favorite-star-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  display: inline-block;
  transition: transform 0.15s ease, fill 0.15s ease, stroke 0.15s ease;
  user-select: none;
  stroke: #333333;
  stroke-width: 2px;
  stroke-linejoin: round;
  fill: #ffffff;
  cursor: pointer;
}

.favorite-star-icon:hover {
  transform: scale(1.3);
}

.favorite-star-icon:active {
  transform: scale(1.6) !important;
}

.favorite-star-icon.is-active {
  fill: #ffcc33;
}

html.dark-mode .favorite-star-icon {
  stroke: #e2e8f0;
}

html.dark-mode .favorite-star-icon.is-active {
  fill: #ffcc33;
  stroke: #333333;
}

.card-favorite-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  padding: 6px 0;
  border-radius: 50px;
  /* 丸いピル型 */
  cursor: pointer;
  gap: 5px;
  font-size: 11px;
  color: var(--text-color);
  transition: background-color 0.2s, transform 0.15s;
}

.card-favorite-btn:hover {
  background-color: var(--border-color);
}

.card-favorite-btn:active {
  transform: scale(0.96);
}

/* ==========================================
   9. Responsive Mobile Styles
   ========================================== */
@media (max-width: 768px) {
  .site-main-grid {
    flex-direction: column;
  }

  .sidebar-column {
    width: 100%;
    position: static;
  }

  .content-column {
    width: 100%;
  }

  .ranking-list-container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .ranking-header-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .site-toggle-tabs {
    transform: none;
  }

  .header-logo {
    left: 0;
  }

  .work-card {
    flex-direction: column;
    gap: 15px;
    padding: 15px 12px;
  }

  .work-thumbnail {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
  }

  .work-snippet,
  .work-tags-container {
    display: none !important;
  }

  /* ==========================================
     スマホお気に入り画面限定のグラフ・価格優先レイアウト（Flexbox & order）
     ========================================== */
  /* カード自体のフレックス縦並び化 */
  .in-favorites-mode .work-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    padding: 15px 12px !important;
  }

  /* 画像（一番上） */
  .in-favorites-mode .work-thumbnail {
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
  }

  /* 中間コンテナ（詳細情報＋グラフ＋スマホ価格）をフレックス縦並びに */
  .in-favorites-mode .work-detail-info.fav-detail-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  /* グラフ（価格推移）を一番上に配置し、横幅いっぱいに拡大 */
  .in-favorites-mode .fav-chart-container {
    order: 1 !important;
    width: 100% !important;
    height: 220px !important;
    margin-top: 10px !important;
  }

  .in-favorites-mode .fav-price-chart {
    width: 100% !important;
    height: 100% !important;
  }

  /* スマホ用価格比較・購入ボタンを二番目に配置 */
  .in-favorites-mode .fav-mobile-price {
    order: 2 !important;
    display: block !important;
    width: 100% !important;
    border-top: 1px solid var(--border-color) !important;
    padding-top: 15px !important;
  }

  /* タイトル・サークル・評価（三番目） */
  .in-favorites-mode .fav-info-left {
    order: 3 !important;
    width: 100% !important;
    border-top: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding-top: 15px !important;
    padding-bottom: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  /* スマホ用販売日・販売数を表示し、スタイルを調整 */
  .in-favorites-mode .fav-mobile-metadata {
    display: block !important;
    margin-top: 6px !important;
  }

  .in-favorites-mode .fav-mobile-metadata .meta-item {
    display: inline-block !important;
    margin-right: 15px !important;
    font-size: 11px !important;
    color: var(--text-muted) !important;
  }

  .in-favorites-mode .fav-mobile-metadata .meta-label {
    font-weight: 500 !important;
    margin-right: 4px !important;
  }

  /* アクション列（PC用・削除ボタン）を一番下に配置 */
  .in-favorites-mode .work-action-col {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin-top: 5px !important;
  }

  /* アクション列内の削除ボタンの上マージン調整 */
  .in-favorites-mode .card-favorite-btn {
    margin-top: 5px !important;
  }

  /* アクション列内のPC用価格・PC用メタデータを非表示 */
  .in-favorites-mode .fav-desktop-price {
    display: none !important;
  }

  .in-favorites-mode .work-action-col .action-metadata-wrap {
    display: none !important;
  }

  /* スマホ専用の文字サイズ縮小（お気に入り画面限定） */
  .in-favorites-mode .work-title-link {
    font-size: 14px !important;
  }

  .in-favorites-mode .work-circle-name {
    font-size: 11px !important;
  }

  .work-action-col {
    width: 100%;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    align-items: flex-start;
  }

  .price-box {
    text-align: left;
    margin-bottom: 10px;
  }

  .price-compare.is-inline {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .price-compare.is-inline .price-btn-right {
    width: 100%;
  }

  .price-compare.is-inline .btn-buy-inline {
    width: 100%;
  }

  .header-top {
    flex-direction: column;
    align-items: stretch;
  }

  /* ==========================================
     カテゴリナビのスマホ版すっきりデザイン
     ========================================== */
  .site-nav {
    padding: 8px 0;
  }

  .nav-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .nav-title {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    margin-left: 4px;
  }

  .nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: center;
  }

  .nav-item {
    display: flex;
    align-items: center;
  }

  /* アイテムの間に縦線区切りを入れる */
  .nav-item:not(:last-child)::after {
    content: "|";
    color: var(--border-color);
    margin: 0 8px;
    font-size: 11px;
    font-weight: normal;
  }

  .nav-item a {
    display: inline;
    padding: 4px 0;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-color);
    background-color: transparent !important;
    border: none !important;
    border-radius: 0;
    box-shadow: none !important;
    transform: none !important;
    white-space: nowrap;
  }

  /* ホバーやアクティブ時のスタイル */
  .nav-item a:hover {
    color: var(--primary-color);
    background-color: transparent !important;
    text-decoration: underline;
  }

  .nav-item.active a {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color) !important;
    text-decoration: none;
  }

  /* 女性向けカプセルリンクもスマホでは普通のテキストに統一 */
  .nav-item-girls-bl-link a.girls-bl-link-btn {
    display: inline;
    padding: 4px 0;
    font-size: 13px;
    color: #eb7ca3;
    border: none !important;
    border-radius: 0;
    background-color: transparent !important;
    transform: none !important;
  }

  .nav-item-girls-bl-link a.girls-bl-link-btn:hover {
    color: #d83b72;
    text-decoration: underline;
  }

  html.dark-mode .nav-item-girls-bl-link a.girls-bl-link-btn {
    color: #c86980;
  }

  html.dark-mode .nav-item-girls-bl-link a.girls-bl-link-btn:hover {
    color: #ff9ebb;
  }

  /* ==========================================
     絞り込みタグのアコーディオン開閉制御
     ========================================== */
  .tag-filter-widget .widget-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .tag-filter-widget .accordion-icon {
    display: inline-block;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    margin-left: 2px;
  }

  .tag-filter-widget.is-open .accordion-icon {
    transform: rotate(180deg);
  }

  .tag-filter-widget .tag-filter-content {
    display: none;
    margin-top: 12px;
  }

  .tag-filter-widget.is-open .tag-filter-content {
    display: block;
  }
}

/* ===== 価格比較枠の再現 (DLsite=青, FANZA=赤) ===== */

/* ランキングカード右上の価格行（うっすら枠は削除）
   is-inline = 価格と購入ボタンを1行
   is-stacked = 価格の下に購入ボタン（2行）。併売時は片方が2行なら両方 is-stacked */
.price-compare {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  background-color: transparent;
  border: none;
  border-radius: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.price-compare.is-stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.price-compare.is-inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
}

html.dark-mode .price-compare {
  background-color: transparent;
  border-color: transparent;
}

.price-info-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #444;
  min-width: 0;
  flex-wrap: wrap;
}

html.dark-mode .price-info-left {
  color: #e2e8f0;
}

.price-compare.dlsite .price-val {
  font-size: 16px;
  font-weight: bold;
  color: #0066cc;
  /* DLsite価格は青 */
}

html.dark-mode .price-compare.dlsite .price-val {
  color: #64b5f6;
}

.price-compare.fanza .price-val {
  font-size: 16px;
  font-weight: bold;
  color: #d90000;
  /* FANZA価格は赤 */
}

html.dark-mode .price-compare.fanza .price-val {
  color: #ff4d4d;
}

.discount-badge {
  background: #de071d;
  color: white;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 5px;
  font-weight: bold;
  margin-left: 4px;
}

.exclusive-badge {
  background: #ff3366;
  /* 専売らしさを引き立てる鮮やかなローズピンク */
  color: white;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 3px;
  font-weight: bold;
  vertical-align: middle;
  display: inline-block;
  line-height: 1.2;
}

.reserve-badge {
  background: #0073aa;
  color: white;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 3px;
  font-weight: bold;
  vertical-align: middle;
  display: inline-block;
  line-height: 1.2;
  margin-right: 4px;
}

.strike {
  text-decoration: line-through;
  color: #999;
  font-size: 12px;

}

html.dark-mode .strike {
  color: #a0aec0;
}

/* 画像下の大枠カテゴリ表示 (同人総合ランキング用) */
.work-thumbnail-category {
  display: block;
  text-align: center;
  background-color: #fcf1d3;
  /* 薄いベージュ・オレンジ */
  color: #c88a1b;
  /* 濃いオレンジ・ブラウン */
  font-size: 11px;
  font-weight: bold;
  padding: 4px 0;
  margin-top: 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-decoration: none;
}

html.dark-mode .work-thumbnail-category {
  background-color: #3b2c12;
  color: #e5a93c;
  border-color: #3d3d3d;
}

/* ===== 新規UI用の追加スタイル (購入ボタンインライン化 & 右カラム縦並び化) ===== */
.work-card .btn-buy-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  border-radius: 6px;
  margin-left: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s, transform 0.1s;
  vertical-align: middle;
  height: 36px;
  padding: 8px 14px;
  /* 「DLsiteで購入」時代と同程度の横幅を維持 */
  min-width: 110px;
  box-sizing: border-box;
}

.buy-external-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.work-action-col .action-metadata-wrap {
  margin-top: 10px;
}

/* お気に入りだけ右カラム最下部に固定（上の価格・販売日の間隔には影響しない） */
.work-action-col .card-favorite-btn {
  margin-top: auto;
}

.btn-buy-inline:active {
  transform: scale(0.95);
}

.btn-buy-inline.btn-dlsite {
  background: #0066cc;
  color: white !important;
  border: 1px solid #004bb1;
}

.btn-buy-inline.btn-dlsite:hover {
  background: #004bb1;
  text-decoration: none;
}

.btn-buy-inline.btn-fanza {
  background: #d90000;
  color: white !important;
  border: 1px solid #b30000;
}

.btn-buy-inline.btn-fanza:hover {
  background: #b30000;
  text-decoration: none;
}

.point-return-text-inline {
  font-size: 11px;
  color: var(--point-green);
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
  font-weight: bold;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.action-metadata-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 5px;
  margin-bottom: 5px;
  text-align: left;
}

.meta-item {
  font-size: 12px;
  color: var(--text-color);
  line-height: 1.5;
  display: flex;
  align-items: center;
}

.meta-label {
  color: var(--text-muted);
  margin-right: 6px;
  font-weight: normal;
}

.meta-val {
  font-weight: bold;
  color: var(--text-color);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  line-height: 1.2;
}

.rating-val,
.rating-count {
  line-height: 1;
}

/* ==========================================
   Common Star Rating Styles (共通星評価表示用スタイル)
   ========================================== */
.dlrank-star-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin: 0 2px;
  line-height: 1;
}

.star-rating .star-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.star-rating .star-empty {
  color: #cbd5e1;
}

.star-rating .star-full,
.star-rating .star-half {
  color: var(--gold-color);
}



/* ==================================================

   価格比較用追加スタイル (DLsite=青, FANZA=赤)

   ================================================== */

.price-item {

  display: flex;

  align-items: center;

  gap: 8px;

  width: 100%;

}

.price-item>span {

  font-size: 12px;

  color: var(--text-muted);

  font-weight: normal;

  min-width: 48px;

}

.price-btn-double {

  display: flex;

  gap: 8px;

  margin-top: 8px;

  margin-bottom: 8px;

  width: 100%;

}

.price-btn-double .btn-buy-inline {

  flex: 1;

  justify-content: center;

  margin-right: 0;

  min-width: 0;

}

/* ===== 吹き出し警告フォールバック ===== */
#tooltip-anchor {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 10000;
  pointer-events: none;
}

#fallback-tooltip {
  position: absolute;
  bottom: 12px;
  /* ボタンの上から浮かせる距離 */
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  background: #ffffff;
  border: 3px solid #333333;
  border-radius: 12px;
  padding: 10px 16px;
  filter: drop-shadow(3px 3px 0px #4ca9df);
  transform-origin: bottom center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  font-weight: bold;
  color: #333333;
  white-space: nowrap;
  pointer-events: auto;
}

#fallback-tooltip::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 8px 0 8px;
  border-style: solid;
  border-color: #333333 transparent transparent transparent;
  display: block;
  width: 0;
}

#fallback-tooltip::before {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 7px 6px 0 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
  display: block;
  width: 0;
  z-index: 1;
}

@keyframes popInCenter {
  0% {
    transform: scale(0.5) translateX(-50%);
    opacity: 0;
  }

  70% {
    transform: scale(1.05) translateX(-50%);
    opacity: 1;
  }

  100% {
    transform: scale(1) translateX(-50%);
    opacity: 1;
  }
}

.animate-pop-in {
  animation: popInCenter 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

html.dark-mode #fallback-tooltip {
  background: #1e1e1e;
  border-color: #e2e8f0;
  color: #e2e8f0;
  filter: drop-shadow(3px 3px 0px #0066cc);
}

html.dark-mode #fallback-tooltip::after {
  border-color: #e2e8f0 transparent transparent transparent;
}

html.dark-mode #fallback-tooltip::before {
  border-color: #1e1e1e transparent transparent transparent;
}

/* ==========================================
   Footer Styling & Links
   ========================================== */
.site-footer {
  margin-top: 50px;
  padding: 30px 0;
  background-color: var(--card-bg-color);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

.footer-links {
  margin-bottom: 15px;
}

.footer-links a {
  color: var(--text-muted);
  margin: 0 12px;
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
}

.footer-links a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .footer-links a {
    margin: 5px 10px;
  }
}

/* ==========================================
   Page Templates (Privacy Policy, Terms, etc.)
   ========================================== */
.page-container {
  margin-top: 30px;
  margin-bottom: 50px;
}

.page-content-card {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.page-content-card .entry-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 30px;
}

.page-content-card .entry-title {
  font-size: 26px;
  font-weight: bold;
  color: var(--text-color);
}

.page-content-card .entry-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-color);
}

.page-content-card .entry-content h2 {
  font-size: 20px;
  margin-top: 35px;
  margin-bottom: 15px;
  border-left: 4px solid var(--primary-color);
  padding-left: 12px;
  color: var(--text-color);
}

.page-content-card .entry-content h3 {
  font-size: 16px;
  margin-top: 25px;
  margin-bottom: 10px;
  color: var(--text-color);
}

.page-content-card .entry-content p {
  margin-bottom: 20px;
}

.page-content-card .entry-content ul,
.page-content-card .entry-content ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.page-content-card .entry-content li {
  margin-bottom: 8px;
}

.page-content-card .entry-content strong {
  font-weight: bold;
}

/* Contact Form Styling */
.contact-intro {
  margin-bottom: 30px;
}

.contact-form {
  max-width: 700px;
  margin: 0 auto;
}

.contact-form-alert {
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 25px;
  font-size: 14px;
  line-height: 1.5;
}

.contact-form-alert.alert-error {
  background-color: #fde8e8;
  color: #c53030;
  border: 1px solid #f8b4b4;
}

.contact-form-alert.alert-success {
  background-color: #def7ec;
  color: #03543f;
  border: 1px solid #bcf0da;
}

html.dark-mode .contact-form-alert.alert-error {
  background-color: #2d1d1d;
  color: #f8b4b4;
  border-color: #c53030;
}

html.dark-mode .contact-form-alert.alert-success {
  background-color: #142d20;
  color: #bcf0da;
  border-color: #03543f;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-color);
}

.form-label .required {
  color: var(--accent-color);
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: var(--font-family);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

html.dark-mode .form-control:focus {
  box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.25);
}

textarea.form-control {
  resize: vertical;
}

.form-submit-container {
  margin-top: 30px;
  text-align: center;
}

.btn-submit {
  display: inline-block;
  padding: 12px 35px;
  font-size: 15px;
  font-weight: bold;
  color: #ffffff;
  background-color: var(--primary-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-submit:hover {
  background-color: var(--primary-hover-color);
  text-decoration: none;
}

.btn-submit:active {
  transform: scale(0.98);
}

/* ダークモード時の作品カードあらすじ色は元の色（text-muted）を維持 */
html.dark-mode .work-snippet {
  color: var(--text-muted);
}

/* ==========================================
   お気に入りミニグラフ用スタイル
   ========================================== */
.fav-detail-layout {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 15px !important;
  width: 100% !important;
}

.fav-info-left {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
}

.fav-mobile-metadata {
  display: none;
}

.fav-mobile-price {
  display: none;
}

.fav-chart-container {
  width: 230px !important;
  height: 230px !important;
  flex-shrink: 0 !important;
  margin-top: 0 !important;
  padding: 4px !important;
  background-color: var(--body-bg-color) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 4px !important;
  position: relative !important;
  overflow: hidden !important;
}

.fav-price-chart {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* ==========================================
   お気に入りモード時の初期表示制御（チラつき防止）
   ========================================== */
body.in-favorites-mode .sidebar-column {
  display: none !important;
}

body.in-favorites-mode .ranking-site-line,
body.in-favorites-mode .ranking-date-line,
body.in-favorites-mode .site-toggle-tabs,
body.in-favorites-mode .ranking-filter-info {
  display: none !important;
}

/* ==========================================
   11. Back to Top Button (一番上に戻るボタン)
   ========================================== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  border: none;
  display: none; /* デフォルト（PC）は非表示 */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  padding: 0;
  pointer-events: none;
}

.back-to-top-icon {
  width: 24px;
  height: 24px;
  display: block;
}

/* スマホ表示時（画面幅768px以下）のみ有効化 */
@media (max-width: 768px) {
  .back-to-top {
    display: flex; /* スマホなら flex にして配置できるようにする */
  }
  
  .back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* ダークモード対応 */
html.dark-mode .back-to-top {
  background-color: rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

/* タップ時のフィードバック */
.back-to-top:active {
  background-color: rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
}

html.dark-mode .back-to-top:active {
  background-color: rgba(255, 255, 255, 0.35);
}


