@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@900&display=swap');
/* 全体の基本設定 */
body {
    font-family: sans-serif;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
}

/* ヘッダー */
header {
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
}
header h1 {
    text-align: center;
    font-size: 2em;
    color: #444;
    margin: 10px 0;
}

/* カテゴリナビゲーション */
.category-nav {
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 5px 0;
}
.category-nav ul {
    list-style-type: none;
    margin: 0;
    padding: 10px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; 
}
.category-nav li { margin: 5px 8px; }

.category-nav a {
    display: block;
    padding: 8px 18px;
    background-color: #f1f3f5;  /* ▼【変更】薄いグレーの背景色を追加 */
    color: #495057;          /* ▼【変更】少し濃いめの文字色に */
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid #dee2e6;  /* ▼【変更】薄いグレーの枠線を追加 */
    transition: all .2s ease-in-out;
    white-space: nowrap;
}

/* アクティブ時とホバー時のスタイル */
.category-nav a:hover, .category-nav a.active {
    background-color: #343a40; /* 背景色を濃いグレーに */
    color: #fff;              /* 文字色を白に */
    border-color: #343a40;   /* 枠線も同色に */
}

/* ダークモード時のスタイルは変更なし、元のままでOK */
body.dark-mode .category-nav a {
    background-color: #343a40;
    color: #adb5bd;
    border-color: #495057;
}
body.dark-mode .category-nav a:hover, body.dark-mode .category-nav a.active {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #f8f9fa;
}

/* メインコンテンツエリア */
main {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 20px;
}

.main-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    padding-bottom: 10px;
}
.main-heading h2 { margin: 0; border: none; padding: 0; font-size: 1.5em; }

.controls-container { display: flex; align-items: center; gap: 20px; }
.sort-options { display: flex; align-items: center; }
.sort-options a {
    margin: 0 5px;
    text-decoration: none;
    color: #888;
    font-size: .9em;
    padding: 5px 10px;
    border-radius: 5px;
}
.sort-options a.active, .sort-options a:hover {
    color: #007bff;
    background-color: #e9f5ff;
}
.view-switcher { display: flex; gap: 5px; }
.view-switcher button {
    background-color: transparent;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}
.view-switcher button.active, .view-switcher button:hover {
    background-color: #e9f5ff;
    border-color: #007bff;
}

/* --- リスト表示のスタイル --- */
#stories-container.view-list #stories-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background-color: #ddd;
    border: 1px solid #ddd;
}
#stories-container.view-list .story-card {
    display: flex;
    background-color: #fff;
    padding: 15px;
    transition: all .2s ease-in-out; /* ★ この行を追加 ★ */ 
}

#stories-container.view-list .story-card:hover { 
    background-color: #f8f9fa;
    transform: scale(1.01); /* ★ 少しだけ拡大する */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); /* ★ 影を付ける */
}
#stories-container.view-list .story-card a { display: flex; text-decoration: none; color: inherit; width: 100%; }
#stories-container.view-list .thumbnail { flex-shrink: 0; width: 160px; height: 110px; }

/* --- グリッド表示のスタイル --- */
#stories-container.view-grid #stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}
#stories-container.view-grid .story-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    transition: transform .2s;
}
#stories-container.view-grid .story-card:hover { transform: translateY(-5px); }
#stories-container.view-grid .story-card a { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
#stories-container.view-grid .thumbnail { width: 100%; height: 170px; }

/* --- 共通カード内要素のスタイル --- */
.story-card .thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
#stories-container.view-grid .thumbnail img { border-radius: 0; }
.story-card .content { flex-grow: 1; display: flex; flex-direction: column; }
#stories-container.view-grid .content { padding: 15px; }
/* ▼▼▼【修正点1】リスト表示の間隔をmargin-leftで確保 ▼▼▼ */
#stories-container.view-list .content { margin-left: 30px; } 

.story-card h3 { font-size: 1.15em; margin: 0 0 8px 0; }
.story-card .synopsis {
    font-size: .9em; color: #555; margin: 0 0 10px 0;
    display: -webkit-box; -webkit-line-clamp: 3; 
    overflow: hidden; -webkit-box-orient: vertical;
}
.story-card .meta {
    margin-top: auto;
    font-size: .85em;
    color: #888;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}
.story-card .meta .meta-item {
    /* 必要であれば個別のスタイル */
}
.story-card .meta .category {
    color: #007bff;
    font-weight: bold;
}
.story-card .meta .meta-bottom-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* フッター */
footer { text-align: center; margin-top: 40px; padding: 20px; color: #888; }

/* --- 詳細ページのスタイル --- */
.story-header-image { width: 100%; text-align: center; margin: 0 auto 30px auto; }
.story-header-image img { max-width: 100%; max-height: 500px; width: auto; height: auto; object-fit: contain; border-radius: 8px; }
.story-container { background-color: #fff; padding: 30px 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.story-body { font-size: 1.1em; line-height: 1.9; letter-spacing: .05em; }
/* --- アクションエリアのスタイル --- */
.story-actions {
    margin-top: 30px;
    display: flex;
    flex-direction: column; /* 上下に並べるように変更 */
    align-items: center;
    gap: 25px; /* 上下の要素の隙間 */
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.story-engagement {
    display: flex;
    align-items: center;
    gap: 20px;
}

.story-sharing .share-buttons {
    justify-content: center; /* シェアボタンを中央揃えに */
}
.like-button-style { background-color: #f0f0f0; border: 1px solid #ccc; border-radius: 20px; padding: 8px 15px; cursor: pointer; font-size: 1em; transition: background-color .2s; }
.like-button-style:hover { background-color: #e0e0e0; }

/* --- モバイル用の特別スタイル --- */
@media (max-width: 768px) {
    main { padding: 0 10px; }
    .category-nav ul { justify-content: center; flex-wrap: wrap; }
    .main-heading { flex-direction: column; align-items: flex-start; gap: 15px; }
    #stories-container.view-list .content { margin-left: 15px; }
    #stories-container.view-list .thumbnail { width: 100px; height: 75px; }
    .story-card h3 { font-size: 1.1em; }
    .story-container { padding: 20px; }
    .story-card .synopsis {
        -webkit-line-clamp: unset;
    }
}
/* --- ▼▼▼ シェアボタンのスタイルを追加 ▼▼▼ --- */
.story-actions .meta-item {
    font-size: 1em;
    color: #555;
}
.share-buttons {
    margin-left: auto; /* 右端に配置する */
    display: flex;
    gap: 10px;
}
.share-button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    font-size: 0.9em;
    transition: opacity 0.2s;
}
.share-button:hover {
    opacity: 0.8;
}
.share-x {
    background-color: #1DA1F2; /* X (Twitter) のブランドカラー */
}
.share-line {
    background-color: #00B900; /* LINEのブランドカラー */
}

/* --- ▼▼▼ NEWバッジのスタイル（モダンなデザインに修正） ▼▼▼ --- */
.new-badge {
    background-color: #495057; /* 落ち着いたダークグレーに変更 */
    color: #fff;
    font-size: 0.7em;
    font-weight: bold;
    padding: 3px 8px; /* 少しだけ余白を調整 */
    border-radius: 10px; /* 角丸を強くして、よりモダンな見た目に */
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.05em; /* 文字間を少しだけ広げる */
}
/* --- ▼▼▼ NEWアイコンのスタイル ▼▼▼ --- */
.new-icon {
    color: #ff8c00; /* 少し落ち着いたオレンジ色 */
    font-size: 0.8em;
    margin-left: 8px;
    vertical-align: middle; 
}
.footer-links {
    margin-bottom: 15px;
    display: flex;
    gap: 40px;
    justify-content: center;
    font-size: 0.9em;
}
.footer-links a {
    text-decoration: none;
    color: #555;
}
.footer-links a:hover {
    text-decoration: underline;
}
/* --- ▼▼▼ 物語詳細ページのデザイン改善（メタ情報＋アクションエリア） ▼▼▼ --- */

/* メタ情報（カテゴリタグ）のスタイル */
.story-meta-revised {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 15px 0 25px 0;
    flex-wrap: wrap;
}
.story-category-tag {
    display: inline-block;
    background-color: #f1f3f5;
    color: #495057;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #dee2e6;
}
.story-date {
    font-size: 0.9em;
    color: #868e96;
}

/* --- アクションエリアのスタイル --- */
.story-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
    padding-top: 30px;
    /* ▼▼▼ 以下を追記 ▼▼▼ */
    padding-bottom: 30px; /* 下方向にも余白を追加 */
    margin-bottom: 30px;  /* 広告との間に余白を追加 */
    border-bottom: 1px solid #eee; /* シェアボタンと広告の間に区切り線を追加 */
}
/* ダークモード用の区切り線 */
body.dark-mode .story-actions {
    border-top-color: #383838;
    border-bottom-color: #383838;
}
.like-button-style {
    background-color: #fff0f0;
    border: 1px solid #ffc0c0;
    color: #d9534f;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all .2s ease-in-out;
}
.like-button-style:hover {
    background-color: #ffe0e0;
    border-color: #ffb0b0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.share-buttons {
    margin-left: 0;
}
/* --- ▼▼▼ フォント設定と可読性向上 ▼▼▼ --- */

/* サイト全体の基本フォントをゴシック体に設定 */
body {
    font-family: 'Noto Sans JP', sans-serif;
}

/* 物語本文のフォントを明朝体に設定し、一行の長さを調整 */
.story-body {
    font-family: 'Noto Serif JP', serif;
    max-width: 42em;    /* 読みやすい一行の長さに調整 */
    margin-left: auto;  /* 中央揃え */
    margin-right: auto; /* 中央揃え */
    margin-top: 1.5em;  /* 先頭に、文字1.5行分の余白を追加 */
    margin-bottom: 3em; /* 末尾に、文字3つ分ほどの余白を追加 */
}
/* --- ▼▼▼ スマホ版いいねボタンの色を修正 ▼▼▼ --- */
@media (max-width: 768px) {
    /* スマホ表示の際に、詳細ページのいいねボタンの色が
      他のスタイルに上書きされないよう、より具体的に指定します。
    */
    .story-actions .like-button-style {
        color: #d9534f;
    }
}
/* --- ▼▼▼ 「もっと見る」ボタンのスタイルを追加 ▼▼▼ --- */
#load-more-container {
    text-align: center; /* ボタンを中央に配置 */
    margin: 30px 0 40px 0; /* 上下の余白を調整 */
}

#load-more-btn {
    background-color: #ffffff; /* 背景は白 */
    border: 2px solid #333;    /* 枠線はヘッダーと同じ黒系 */
    color: #333;               /* 文字色も黒系 */
    padding: 12px 30px;        /* パディングを大きくして押しやすく */
    font-size: 1em;
    font-weight: bold;
    border-radius: 50px;       /* 角丸を強くしてモダンに */
    cursor: pointer;
    transition: all 0.3s ease; /* アニメーション効果を滑らかに */
    display: inline-block;
}

/* マウスカーソルを乗せた時のスタイル */
#load-more-btn:hover {
    background-color: #333;    /* 背景と文字色を反転 */
    color: #ffffff;
    transform: translateY(-2px); /* 少し浮き上がるエフェクト */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
/* --- ▼▼▼ サイト紹介セクションのデザイン改善案 ▼▼▼ --- */

.site-introduction {
    /* 背景に、左から右への淡いグラデーションを設定 */
    background: linear-gradient(to right, #eef2f3, #e0eafc);
    
    border: none; /* 枠線をなくし、よりモダンな印象に */
    border-radius: 12px; /* 角丸を少し強くする */
    
    padding: 35px 40px; /* 内側の余白を少し広げる */
    margin: 20px auto;
    
    text-align: center;
    
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* 薄い影を追加して立体感を出す */
}

.site-introduction h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
    color: #2c3e50; /* 少し深みのある色に変更 */
    font-weight: 700; /* フォントを少し太くする */
}

.site-introduction p {
    margin-bottom: 0;
    line-height: 1.8; /* 行間を広げて読みやすく */
    font-size: 1em;
    color: #34495e; /* 少し濃いめの文字色に */
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}
/* --- ▼▼▼ 「前後の物語へ」ナビゲーションのスタイル ▼▼▼ --- */
.story-navigation {
    display: flex;
    justify-content: center; /* 中央揃えに変更 */
    gap: 20px; /* ボタン間の隙間を追加 */
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.nav-link {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 50px;
    text-decoration: none;
    color: #555;
    font-weight: bold;
    transition: all 0.2s ease-in-out; /* ★ この行を追加 ★ */
}

.nav-link:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
    transform: translateY(-2px); /* ★ この行を追加 ★ */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* ★ この行を追加 ★ */
}
.nav-link.next {
}
/* --- ▼▼▼ スケルトンローダーのスタイル ▼▼▼ --- */
.skeleton-card {
    display: flex;
    background-color: #fff;
    padding: 15px;
    border: 1px solid #ddd;
    margin-bottom: 1px;
}
.skeleton-thumbnail {
    flex-shrink: 0;
    width: 160px;
    height: 110px;
    background-color: #e0e0e0;
    border-radius: 4px;
}
.skeleton-content {
    flex-grow: 1;
    margin-left: 30px;
    display: flex;
    flex-direction: column;
}
.skeleton-line {
    background-color: #e0e0e0;
    border-radius: 4px;
    height: 1em;
    margin-bottom: 10px;
}
.skeleton-line.short {
    width: 60%;
}
.skeleton-line.meta {
    width: 80%;
    height: 0.8em;
    margin-top: auto;
}

/* アニメーション効果 */
.skeleton-card {
    position: relative;
    overflow: hidden;
}
.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        left: -150%;
    }
    100% {
        left: 150%;
    }
}
/* --- ▼▼▼ フッターのデザイン改善 ▼▼▼ --- */

.footer {
    background-color: #343a40; /* 背景をダークグレーに */
    color: #adb5bd; /* 文字色を少し明るいグレーに */
    padding: 40px 20px;
    margin-top: 60px; /* メインコンテンツとの間隔を広くとる */
    text-align: center;
}

.footer-links {
    margin-bottom: 20px;
    display: flex;
    gap: 20px; /* リンク間のスペースを少し詰める */
    justify-content: center;
    font-size: 0.9em;
}

.footer-links a {
    text-decoration: none;
    color: #dee2e6; /* リンクの文字色を調整 */
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff; /* ホバー時に白くする */
    text-decoration: none;
}

.footer .copyright { /* c 2025... の部分 */
    font-size: 0.85em;
    color: #868e96;
}
/* --- ▼▼▼【最終修正版 Ver.2】UI改善用の全カスタムスタイル ▼▼▼ --- */

/* (ここに、以前ご案内した他のUI改善CSSが入ります。例：詳細ページのメタ情報、アクションエリア、ナビゲーション、スケルトン、もっと見るボタンなど。今回はダークモード部分のみ修正します) */

/* --- ダークモード対応 --- */
body.dark-mode { background-color: #1a1a1a; color: #e0e0e0; }

/* ▼▼▼ このブロックで、リスト表示時とサイト紹介文の背景を修正 ▼▼▼ */
body.dark-mode header,
body.dark-mode .category-nav, /* ← この行を追加 */
body.dark-mode .footer,
body.dark-mode .story-container {
    background-color: #242424 !important;
    border-color: #383838 !important;
}

/* サイト紹介文と物語カードの背景色を、より強力なセレクタで指定 */
body.dark-mode .site-introduction,
body.dark-mode #stories-container.view-list .story-card {
    background: #242424 !important;
}
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 { color: #f5f5f5; }

/* サイト紹介文の文字色を見やすい色に指定 */
body.dark-mode .site-introduction p, 
body.dark-mode .site-introduction h2 {
     color: #e9ecef !important; /* !importantで強制的に上書き */
}

body.dark-mode .category-nav a { background-color: #333; border-color: #444; color: #e0e0e0; }
body.dark-mode .category-nav a:hover, body.dark-mode .category-nav a.active { background-color: #f0f0f0; color: #121212; border-color: #f0f0f0; }

/* ▼▼▼ リスト表示時の文字色も明確に指定 ▼▼▼ */
body.dark-mode .story-card .synopsis,
body.dark-mode .story-card .meta,
body.dark-mode .story-date,
body.dark-mode .sort-options a,
body.dark-mode .nav-link {
    color: #b0b0b0; 
}
body.dark-mode .story-card .meta .category {
    color: #8ab4f8; /* カテゴリリンクの色も調整 */
}


body.dark-mode .footer-links a { color: #ccc; }
body.dark-mode .footer-links a:hover { color: #fff; }
body.dark-mode .footer .copyright { color: #888; }
body.dark-mode .story-container a { color: #8ab4f8; }

#theme-toggle-btn {
    position: fixed; bottom: 20px; right: 20px; background-color: #333;
    color: #fff; border: 1px solid #555; border-radius: 50%;
    width: 50px; height: 50px; font-size: 1.5em; cursor: pointer;
    z-index: 1001; display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


/* 広告コンテナの上下の余白を調整 */
.ad-container {
    margin: 0; /* story-actionsでマージンを管理するため、こちらはリセット */
    text-align: center;
}
/* 最初はPC用広告を表示し、スマホ用は隠す */
.ad-sp {
    display: none;
}

/* 画面幅が768px以下のスマホ表示の場合 */
@media (max-width: 768px) {
    /* PC用広告を隠す */
    .ad-pc {
        display: none;
    }
    /* スマホ用広告を表示する */
    .ad-sp {
        display: inline-block; /* 中央揃えにするためinline-blockに変更 */
    }
}
.header-logo {
    width: 280px; /* ロゴの横幅を280pxに設定します */
    height: auto; /* 高さは自動で調整されます */
}
/* 画面幅が768px以下のスマホ表示の場合のスタイル */
@media (max-width: 768px) {
  .header-logo {
    width: 220px; /* スマホの時は幅を220pxに少し小さくする */
  }
}
/* グリッド表示の時だけ、あらすじの省略(...)を解除 */
#stories-container.view-grid .story-card .synopsis {
    display: block; /* ボックス表示に戻す */
    -webkit-line-clamp: unset; /* 行数制限を解除 */
    overflow: visible; /* はみ出しを許可 */
    height: auto; /* 高さを自動に */
}
/* --- ▼▼▼ 物語詳細ページ下部の統合エリアのスタイル ▼▼▼ --- */
.post-story-area {
    display: flex;
    align-items: center;
    gap: 40px; /* 左右の要素の間の隙間 */
    margin-top: 30px;
}
.post-story-area .story-actions {
    flex: 1; /* 左側（アクションボタン）が取るスペース */
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.post-story-area .ad-container {
    flex: 1; /* 右側（広告）が取るスペース */
    margin-top: 0;
}

/* スマホ表示では、縦積みにする */
@media (max-width: 768px) {
    .post-story-area {
        flex-direction: column;
        gap: 30px;
    }
}
/* --- ▼▼▼ 新しいシェアボタンとエリアのスタイル ▼▼▼ --- */
.share-facebook { background-color: #1877F2; } /* Facebookのブランドカラー */
.share-hatena { background-color: #00A4DE; }   /* はてなブックマークのブランドカラー */

.homepage-actions-area {
    text-align: center;
    margin: 40px 0;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
}
body.dark-mode .homepage-actions-area {
    background-color: #242424;
    border-color: #383838;
}
.homepage-actions-area p {
    margin: 0 0 20px 0;
    font-weight: bold;
    color: #555;
}
body.dark-mode .homepage-actions-area p {
    color: #ccc;
}
.homepage-actions-area .share-buttons {
    justify-content: center;
}
/* --- ▼▼▼ 新しいシェアボタンのスタイル ▼▼▼ --- */
.share-facebook { 
    background-color: #1877F2; /* Facebookのブランドカラー */
}
.share-hatena { 
    background-color: #00A4DE;   /* はてなブックマークのブランドカラー */
}
/* --- ▼▼▼ スマホ表示時のシェアボタンのレイアウト調整 ▼▼▼ --- */
@media (max-width: 768px) {
    .share-buttons {
        flex-wrap: wrap; /* 画面幅が足りなければ、ボタンを折り返す */
        justify-content: center; /* 折り返した際に、ボタンを中央揃えにする */
    }
}
/* --- ▼▼▼ スマホ表示時の物語ナビゲーションボタン改行対策 ▼▼▼ --- */
@media (max-width: 768px) {
    .story-navigation .nav-link {
        font-size: 0.9em; /* 少し大きく */
        padding: 10px 15px; /* 少し広く */
        white-space: nowrap;
    }
}
/* --- グリッド表示時のメタ情報改行対策 (強制版) --- */
#stories-container.view-grid .story-card .meta {
    gap: 8px !important;
    font-size: 0.8em !important;
    flex-wrap: nowrap !important; /* ← これが最重要 */
}
/* --- ▼▼▼ フォントサイズ調整機能のスタイル ▼▼▼ --- */
.font-size-controller {
    display: flex;
    justify-content: flex-end; /* 右寄せにする */
    align-items: center;
    gap: 8px;
    margin-top: 15px; /* 上の要素との余白 */
}
.font-size-controller span {
    font-size: 0.9em;
    color: #555;
}
body.dark-mode .font-size-controller span {
    color: #ccc;
}
.font-size-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.9em;
}
.font-size-btn:hover {
    background-color: #e0e0e0;
}
.font-size-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}
body.dark-mode .font-size-btn {
    background-color: #333;
    border-color: #555;
    color: #eee;
}
body.dark-mode .font-size-btn:hover {
    background-color: #444;
}
body.dark-mode .font-size-btn.active {
    background-color: #8ab4f8;
    color: #121212;
    border-color: #8ab4f8;
}

/* 各フォントサイズの定義 */
.story-body.font-size-small { font-size: 0.95em; }
.story-body.font-size-medium { font-size: 1.1em; } /* デフォルト */
.story-body.font-size-large { font-size: 1.25em; }
/* --- ▼▼▼ ハイブリッド検索フォームのスタイル ▼▼▼ --- */
.search-form {
    display: flex;
    width: 100%;
    margin: 20px 0 30px 0;
}
.search-form input[type="search"] {
    flex-grow: 1;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 1px solid #ddd;
    border-radius: 50px 0 0 50px; /* 左側だけ角丸に */
    border-right: none;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}
.search-form input[type="search"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
    z-index: 2; /* フォーカス時にボタンの上に表示 */
}
.search-form button {
    padding: 0 25px;
    border: 1px solid #007bff;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    border-radius: 0 50px 50px 0; /* 右側だけ角丸に */
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s;
    margin-left: -1px; /* inputとボタンの境界線を綺麗に重ねる */
}
.search-form button:hover {
    background-color: #0056b3;
}
body.dark-mode .search-form input[type="search"] {
    background-color: #333;
    border-color: #555;
    color: #eee;
}
/* --- ▼▼▼ 関連する物語セクションのスタイル ▼▼▼ --- */
.related-stories-container {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}
body.dark-mode .related-stories-container {
    border-top-color: #383838;
}
.related-stories-container h3 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.3em;
}
.related-stories-grid {
    display: grid;
    /* 表示するアイテムの最小幅を少し小さくして、より多くのアイテムが収まるように調整 */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}
.related-story-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}
.related-story-card:hover {
    transform: translateY(-5px);
}
.related-story-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
}
body.dark-mode .related-story-card img {
    border-color: #444;
}
.related-story-card p {
    font-size: 0.9em;
    font-weight: bold;
    margin: 0;
    text-align: center;
}
/* --- ▼▼▼ テキストロゴのスタイル ▼▼▼ --- */
.text-logo {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 2.2em;
    text-decoration: none;

    /* テキストにグラデーションを適用 */
    background: linear-gradient(45deg, #4f80c2, #8ab4f8);
    -webkit-background-clip: text;
    -moz-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -moz-text-fill-color: transparent;

    letter-spacing: 2px; /* 文字間を調整 */
    padding: 10px 0;
    display: inline-block;
}

/* ダークモード時のテキストロゴのスタイル */
body.dark-mode .text-logo {
    background: linear-gradient(45deg, #8ab4f8, #c7d9f7);
    -webkit-background-clip: text;
    -moz-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -moz-text-fill-color: transparent;
}
/* --- ▼▼▼ スマホ表示時のフッター改行対策 ▼▼▼ --- */
@media (max-width: 768px) {
    .footer-links {
        flex-direction: column; /* リンクを縦に並べる */
        gap: 15px; /* リンク間の縦の隙間を調整 */
        align-items: center; /* 中央揃えを維持 */
    }
}
/* --- ▼▼▼ フッターSNSリンクのスタイル ▼▼▼ --- */
.footer-social {
    margin-bottom: 20px;
    text-align: center;
    display: flex; /* アイコンを横に並べるための設定 */
    justify-content: center; /* 中央揃え */
    gap: 15px; /* アイコン間の隙間 */
}
.social-link {
    display: inline-block;
    width: 28px; /* アイコンのサイズ */
    height: 28px;
    transition: opacity 0.2s;
}
.social-link:hover {
    opacity: 0.7;
}
.social-link svg {
    fill: #868e96; /* 通常時のアイコンの色 */
}
body.dark-mode .social-link svg {
    fill: #adb5bd; /* ダークモード時のアイコンの色 */
}
/* --- ▼▼▼ いいねボタンのアニメーション ▼▼▼ --- */

/* ドクン！と脈打つアニメーションの定義 */
@keyframes heartbeat {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); } /* 一瞬1.3倍の大きさになる */
  100% { transform: scale(1); }
}

/* アニメーションを再生するためのクラス */
.liked-animation {
  animation: heartbeat 0.6s ease-in-out;
}
/* --- ▼▼▼ 関連する物語セクションの追加スタイル ▼▼▼ --- */
.related-story-title {
    font-size: 0.9em;
    font-weight: bold;
    margin: 0 0 8px 0; /* タイトルと統計情報の間に余白 */
    text-align: center;
}

.related-story-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.8em;
    color: #868e96;
}

body.dark-mode .related-story-stats {
    color: #adb5bd;
}

.related-story-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}
/* --- ▼▼▼ サイト全体のアイコン統一スタイル ▼▼▼ --- */
.fa-heart, .fa-eye {
    margin-right: 0.4em; /* アイコンと数字の間の隙間 */
}
/* いいねアイコンの色 */
.fa-heart {
    color: #d9534f;
}
body.dark-mode .fa-heart {
    color: #ff8a80;
}
/* 閲覧数アイコンの色 */
.fa-eye {
    color: #555;
}
body.dark-mode .fa-eye {
    color: #b0b0b0;
}
/* --- ▼▼▼ 物語カード内のカテゴリリンクのスタイル ▼▼▼ --- */
.story-card .meta a.category-link-in-card {
    text-decoration: none; /* 下線を削除 */
    color: inherit; /* 親要素(.meta)の色を継承 */
}

.story-card .meta a.category-link-in-card .category {
     transition: color 0.2s; /* ホバー時の色の変化を滑らかに */
}

.story-card .meta a.category-link-in-card:hover .category {
    color: #0056b3; /* ホバー時に少し濃い青色に */
    text-decoration: underline; /* ホバー時のみ下線を表示 */
}

/* ダークモード用のホバースタイル */
body.dark-mode .story-card .meta a.category-link-in-card:hover .category {
    color: #a8c7fa; /* ホバー時に少し明るい青色に */
}
/* --- ▼▼▼ ランキングページ関連のスタイル ▼▼▼ --- */

.ranking-container {
    width: 100%;
}

.ranking-page-title {
    font-size: 1.8em;
    font-weight: bold;
    text-align: center;
    margin: 10px 0 40px 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 20px;
}

.ranking-page-title .fa-crown {
    color: #f9ca24;
    margin-right: 10px;
}

.ranking-shelf {
    overflow: hidden;
    position: relative;
}

.ranking-scroll-container {
    display: flex;
    gap: 25px;
    overflow-x: auto;
    padding: 10px 10px 20px 10px;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}
.ranking-scroll-container::-webkit-scrollbar { height: 8px; }
.ranking-scroll-container::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.ranking-scroll-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
.ranking-scroll-container::-webkit-scrollbar-thumb:hover { background: #aaa; }

.ranking-card {
    display: block;
    flex: 0 0 200px; /* 横幅を固定 */
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease-in-out;
}

.ranking-card:hover {
    transform: translateY(-5px);
}

.ranking-number-container {
    position: relative;
    margin-bottom: 25px; /* 数字とタイトルの間の余白 */
}

.ranking-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.ranking-number {
    position: absolute;
    bottom: -20px;
    left: -15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    border: 4px solid #fff;
    z-index: 1;
}
body.dark-mode .ranking-number {
     border-color: #242424;
}

/* トップ3のメダルカラー */
.ranking-number.rank-1 { background-color: #FFD700; }
.ranking-number.rank-2 { background-color: #C0C0C0; }
.ranking-number.rank-3 { background-color: #CD7F32; }
.ranking-number:not(.rank-1):not(.rank-2):not(.rank-3) {
    background-color: #6c757d;
}

.ranking-card-info {
    padding: 0 5px;
}

.ranking-card-title {
    font-size: 1em;
    font-weight: bold;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.4em;
    line-height: 1.2em;
}

.ranking-card-stats {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    font-size: 0.85em;
    color: #555;
}

/* ダークモード対応 */
body.dark-mode .ranking-page-title { border-bottom-color: #383838; }
body.dark-mode .ranking-card-img { border-color: #444; }
body.dark-mode .ranking-card-stats { color: #aaa; }
.scroll-btn {
    position: absolute;
    top: calc(50% - 35px); /* ボタンが中央に来るように調整 */
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    cursor: pointer;
    font-size: 2em;
    font-weight: lighter;
    color: #333;
    display: none; /* 初期状態では非表示 */
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    padding-bottom: 5px;
    transition: background-color 0.2s, transform 0.2s;
}

.scroll-btn-left { left: 15px; }
.scroll-btn-right { right: 15px; }
.scroll-btn:hover {
    background-color: #fff;
    transform: translateY(-50%) scale(1.1);
}

body.dark-mode .scroll-btn {
    background-color: rgba(40, 40, 40, 0.9);
    border-color: #555;
    color: #eee;
}
body.dark-mode .scroll-btn:hover { background-color: #333; }
/* --- ▼▼▼ ランキングページの追加修正（スマホ対応）▼▼▼ --- */
@media (max-width: 768px) {
    .scroll-btn {
        display: none !important;
    }
}
/* --- ▼▼▼ トップページのランキングプレビュー ▼▼▼ --- */
.top-ranking-preview-container {
    margin-bottom: 50px; /* 「新着ストーリー」との間に余白を設ける */
}

.ranking-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.ranking-preview-header h2 {
    font-size: 1.5em;
    margin: 0;
}

.ranking-preview-header h2 .fa-crown {
    color: #f9ca24;
    margin-right: 10px;
}

.see-all-link {
    font-weight: bold;
    text-decoration: none;
    color: #007bff;
    font-size: 0.9em;
}

.see-all-link:hover {
    text-decoration: underline;
}

/* ダークモード対応 */
body.dark-mode .ranking-preview-header {
    border-bottom-color: #383838;
}
body.dark-mode .see-all-link {
    color: #8ab4f8;
}
/* --- ▼▼▼ ランキング棚のボタン位置を修正する基準点 ▼▼▼ */
.shelf-wrapper {
    position: relative;
}
/* --- ▼▼▼ ランキングカード内のカテゴリ表示スタイル ▼▼▼ --- */
.ranking-card-category {
    font-size: 0.8em;
    font-weight: 600;
    color: #007bff;
    background-color: #e9f5ff;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 10px;
}

body.dark-mode .ranking-card-category {
    color: #8ab4f8;
    background-color: rgba(138, 180, 248, 0.1);
}
/* --- ▼▼▼【新機能】既読の物語カードのスタイル ▼▼▼ --- */
.story-card.is-read > a .thumbnail img {
    filter: grayscale(60%) opacity(0.7);
    transition: filter 0.3s ease;
}

.story-card.is-read > a .content h3 {
    color: #999;
    transition: color 0.3s ease;
}

/* ダークモード時の既読スタイル */
body.dark-mode .story-card.is-read > a .content h3 {
    color: #6c757d;
}

/* 既読カードでも、ホバーすれば通常表示に戻す */
.story-card.is-read:hover > a .thumbnail img {
    filter: grayscale(0%) opacity(1);
}

/* ホバー時にタイトル色も通常に戻す */
body.dark-mode .story-card.is-read:hover > a .content h3,
.story-card.is-read:hover > a .content h3 {
    color: inherit;
}
/* --- ▼▼▼【新機能】物語ページのコントロールボタンのスタイル ▼▼▼ --- */
.story-page-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

body.dark-mode .story-page-controls {
    border-top-color: #333;
}

#mark-as-unread-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 0.8em;
    border-radius: 4px;
    cursor: pointer;
}

#mark-as-unread-btn:hover {
    background-color: #5a6268;
}
/* --- ▼▼▼【新機能】いいね一覧が空の時のメッセージスタイル ▼▼▼ --- */
.empty-shelf-message {
    color: #888;
    text-align: center;
    width: 100%;
    padding: 40px 20px;
    line-height: 1.7;
}
body.dark-mode .empty-shelf-message {
    color: #aaa;
}
/* --- ▼▼▼【修正】検索結果0件メッセージのスタイル ▼▼▼ --- */
.search-no-results {
    padding: 40px 20px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.search-no-results p {
    margin: 0;
    color: #555;
    line-height: 1.7;
}

/* --- ダークモード時のスタイル --- */
body.dark-mode .search-no-results {
    background-color: #2c2c2c;
    border: 1px solid #383838;
}

body.dark-mode .search-no-results p {
    color: #ccc;
}
