@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,
header .site-title-wrapper {
    text-align: center;
    font-size: 2em;
    color: #444;
    margin: 10px 0;
    font-weight: bold;
}

/* カテゴリナビゲーション */
.category-nav {
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 15px 0; /*上下の余白を広げる*/
}
.category-nav ul {
    list-style-type: none;
    margin: 0 auto;
    padding: 0 20px; /*左右に余白*/
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 10px; /*行間とボタン間のスペース*/
    max-width: 1200px; /*コンテナの最大幅を設定*/
}
.category-nav li {
    margin: 0; /*オリジナルのマージンをリセット*/
}

.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; }
.secondary-controls { 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 #e0e0e0; /* ボーダーを薄くモダンに */
    border-radius: 12px; /* 角丸を少し大きく */
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,.05); /* シャドウを柔らかく */
    transition: transform .2s, box-shadow .2s;
}
#stories-container.view-grid .story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,.1);
}
#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-title-in-body {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 2em;
    text-align: center;
    line-height: 1.5;
    margin-top: 0; /* h1のデフォルトマージンをリセット */
}
/* 縦書きモードでは、中央揃えを解除し、通常の流れに任せる */
#reading-container.vertical-mode .story-title-in-body {
    text-align: inherit;
    margin-bottom: 0; /* 縦書きではマージンは不要 */
    margin-left: 2em; /* 代わりに左（上）に余白 */
}

.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; }
    .controls-container {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        width: 100%;
    }
    .sort-options {
        justify-content: center;
        width: 100%;
        display: flex;
        align-items: center;
    }
    /* モバイル用に新しいコンテナのレイアウトを調整 */
    .secondary-controls {
        width: 100%;
        justify-content: space-between; /* 左右に配置 */
        gap: 10px;
    }
    /* 読了時間は左側に */
    .filter-options {
        display: flex;
        align-items: center;
        flex-grow: 1;
    }
    /* ハートと表示切替は右側にまとめてもいいが、space-betweenで自動配置 */

    #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;
    }
    /* ▼▼▼【ここから修正】▼▼▼ */
    /* スマホ表示でもあらすじは全文表示するため、個別の行数制限は削除 */
    /* ▲▲▲【ここまで修正】▲▲▲ */
    /* ▼▼▼【ここから追記】▼▼▼ */
    /* スマホ表示の際、ヒーローの左右ボタンを非表示にする */
    .carousel-wrapper .carousel-btn {
        display: none !important;
    }
    /* ▲▲▲【ここまで追-記】▲▲▲ */
}
/* --- ▼▼▼ シェアボタンのスタイルを追加 ▼▼▼ --- */
.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: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    color: #444; /* 文字色を少し柔らかく */
    line-height: 1.6;
}

/* 物語本文のフォントを明朝体に設定し、一行の長さを調整 */
.story-body {
    font-family: 'Shippori Mincho', 'Noto Serif JP', serif; /* より美しい明朝体があれば優先 */
    font-size: 1.15em; /* フォントサイズを少し大きく */
    max-width: 44em;    /* 一行の長さを少し広げる */
    margin-left: auto;  /* 中央揃え */
    margin-right: auto; /* 中央揃え */
    margin-top: 2em;  /* 余白を増やす */
    margin-bottom: 4em; /* 余白を増やす */
    color: #2b2b2b; /* 真っ黒ではなく読みやすい濃いグレー */
}

/* ダークモード時の本文色設定（強制上書き） */
body.dark-mode .story-body {
    color: #e0e0e0 !important;
}

/* 段落ごとのスタイルを調整して読みやすくする */
.story-body p {
    margin-bottom: 2em; /* 段落間の余白を広げる */
    line-height: 2.1; /* 行間をさらに広げてゆったりさせる */
    text-indent: 1em; /* 段落の先頭を1文字分下げる */
    letter-spacing: 0.08em; /* 文字間隔を少し広げて読みやすく */
}

/* 縦書きモード時の調整 */
#reading-container.vertical-mode .story-body {
    font-family: 'Shippori Mincho', 'Noto Serif JP', serif;
    line-height: 2.0;
    letter-spacing: 0.1em;
}

/* app.pyで追加したh3タグ（章タイトル）のスタイル */
.story-body h3 {
    font-family: 'Noto Sans JP', sans-serif; /* 章タイトルはゴシック体にする */
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    margin-top: 3.5em;
    margin-bottom: 2.5em;
    padding-bottom: 0.6em;
    border-bottom: 1px solid #e0e0e0;
}

body.dark-mode .story-body h3 {
    border-bottom-color: #444;
}
/* --- ▼▼▼ スマホ版いいねボタンの色を修正 ▼▼▼ --- */
@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;
}

/* --- ▼▼▼ Mobile Bottom Navigation (Sticky Footer) ▼▼▼ --- */
.bottom-nav {
    display: none; /* Hidden on desktop */
}
.bottom-nav-spacer {
    display: none;
}

/* スマホ表示時のスティッキーフッター */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #fff;
        border-top: 1px solid #ddd;
        justify-content: space-around;
        padding: 10px 0;
        z-index: 2100;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #888;
        font-size: 0.75em;
        gap: 4px;
    }
    .bottom-nav .nav-item.active {
        color: #007bff;
    }
    .bottom-nav .nav-item i {
        font-size: 1.4em;
    }
    .bottom-nav-spacer {
        display: block;
        height: 70px; /* Height of bottom nav */
    }

    /* Dark mode support for bottom nav */
    body.dark-mode .bottom-nav {
        background-color: #242424;
        border-top-color: #383838;
    }
    body.dark-mode .bottom-nav .nav-item {
        color: #888;
    }
    body.dark-mode .bottom-nav .nav-item.active {
        color: #8ab4f8;
    }

    /* Sepia mode support */
    body.sepia-mode .bottom-nav {
        background-color: #f4e8c8;
        border-top-color: #dcd0b3;
    }
    body.sepia-mode .bottom-nav .nav-item {
        color: #7a6b5a;
    }
    body.sepia-mode .bottom-nav .nav-item.active {
        color: #8c6d46;
    }
}

/* --- ▼▼▼ Scrollable Category Nav (Mobile) ▼▼▼ --- */
@media (max-width: 768px) {
    .category-nav {
        padding: 10px 0;
    }
    /*
    .category-scroll-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .category-scroll-container::-webkit-scrollbar {
        display: none;
    }
    */
    .category-nav ul {
        display: flex;
        flex-wrap: wrap; /* Allow wrapping */
        justify-content: center; /* Center items */
        padding: 0 15px;
        gap: 10px;
        width: 100%; /* Use full width */
    }
    .category-nav li {
        flex-shrink: 1;
    }
    .category-nav a {
        padding: 6px 16px;
        font-size: 0.9em;
    }
}

/* .fab-surprise removed as requested */

/* --- ▼▼▼【新機能】トップページランキングのスタイル ▼▼▼ --- */
.ranking-section-container {
    margin-bottom: 50px;
}

.ranking-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

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

body.dark-mode .ranking-header {
    border-bottom-color: #383838;
}

/* --- ▼▼▼【新機能】ランダムボタンのスタイル ▼▼▼ --- */
.random-story-section {
    text-align: center;
    margin: 40px 0;
}
.random-story-btn {
    background: linear-gradient(45deg, #6a82fb, #fc5c7d);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.random-story-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.random-story-btn .fa-random {
    font-size: 1.2em;
}
/* --- ▼▼▼ 「前後の物語へ」ナビゲーションのスタイル ▼▼▼ --- */
.story-navigation {
    display: none; /* 古いナビゲーションは非表示 */
}

/* モダンなナビゲーション */
.story-navigation-modern {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap; /* スマホなどで幅が足りない場合は折り返す */
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

/* 不要になった .nav-next-container, .nav-link-primary, .nav-sub-container 等は削除またはコメントアウトしますが、
   念のため後方互換性を考えずにこのブロックごと置き換えます。 */

.nav-link-secondary {
    display: inline-block;
    padding: 10px 20px;
    background-color: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s;
}

.nav-link-secondary:hover {
    background-color: #e9ecef;
    border-color: #ccc;
}

body.dark-mode .story-navigation-modern {
    border-top-color: #383838;
}
/* .nav-link-primary のダークモード設定も不要になったので削除 */
body.dark-mode .nav-link-secondary {
    background-color: #333;
    border-color: #555;
    color: #ccc;
}
body.dark-mode .nav-link-secondary:hover {
    background-color: #444;
    color: #fff;
}

/* --- ▼▼▼ スケルトンローダーのスタイル ▼▼▼ --- */
.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が入ります。例：詳細ページのメタ情報、アクションエリア、ナビゲーション、スケルトン、もっと見るボタンなど。今回はダークモード部分のみ修正します) */

/* --- コメントセクションの基本スタイル (Light Mode) --- */
.comments-section {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px 15px;
    background-color: #fff;
    border-radius: 8px;
    /* モバイル表示時の余白調整 */
    box-sizing: border-box;
}

/* --- ダークモード対応 --- */
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,
body.dark-mode .comments-section {
    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; }
/* ▼▼▼【修正】シェアボタンの文字色を強制的に白にする ▼▼▼ */
body.dark-mode .share-button {
    color: #fff !important;
}

body.sepia-mode .share-button {
    color: #fff !important;
}

/* --- Theme Switcher (Dropdown) --- */
#theme-toggle-li {
    display: flex;
    align-items: center;
}

.theme-switcher-dropdown {
    position: relative;
}

.theme-switcher-toggle {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    font-weight: 600;
    color: #495057;
    transition: all 0.2s ease-in-out;
}

.theme-switcher-toggle:hover {
    background-color: #e9ecef;
}

.theme-switcher-toggle .arrow-icon {
    font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
}

.theme-switcher-toggle[aria-expanded="true"] .arrow-icon {
    transform: rotate(180deg);
}

.theme-switcher-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    list-style: none;
    padding: 5px;
    margin-left: 0; /* ul default margin reset */
    min-width: 120px;
    z-index: 100;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.theme-switcher-menu.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.theme-switcher-menu li {
    margin: 0;
}

.theme-switcher-menu li button {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    border-radius: 4px;
    color: #333;
    font-family: inherit;
}

.theme-switcher-menu li button:hover {
    background-color: #f1f3f5;
}

/* Dark Mode Styles */
body.dark-mode .theme-switcher-toggle {
    background-color: #343a40;
    border-color: #495057;
    color: #adb5bd;
}
body.dark-mode .theme-switcher-toggle:hover {
    background-color: #495057;
}
body.dark-mode .theme-switcher-menu {
    background-color: #2c2c2c;
    border-color: #444;
}
body.dark-mode .theme-switcher-menu li button {
    color: #e0e0e0;
}
body.dark-mode .theme-switcher-menu li button:hover {
    background-color: #3a3a3a;
}

/* Sepia Mode Styles */
body.sepia-mode .theme-switcher-toggle {
    background-color: #e9ddc7;
    border-color: #d3c4a5;
    color: #5b4636;
}
body.sepia-mode .theme-switcher-toggle:hover {
    background-color: #e4d5b9;
}
body.sepia-mode .theme-switcher-menu {
    background-color: #f4e8c8;
    border-color: #dcd0b3;
}
body.sepia-mode .theme-switcher-menu li button {
    color: #5b4636;
}
body.sepia-mode .theme-switcher-menu li button:hover {
    background-color: #efe8d8;
}

/* --- Sepia Mode --- */
body.sepia-mode { background-color: #fbf0d9; color: #5b4636; }
body.sepia-mode header,
body.sepia-mode .category-nav,
body.sepia-mode .footer,
body.sepia-mode .story-container,
body.sepia-mode .comments-section,
body.sepia-mode .site-introduction,
body.sepia-mode #stories-container.view-list .story-card,
body.sepia-mode .featured-story-card,
body.sepia-mode .homepage-actions-area,
body.sepia-mode .content-shelf {
    background-color: #f4e8c8 !important;
    border-color: #dcd0b3 !important;
}
body.sepia-mode h1, body.sepia-mode h2, body.sepia-mode h3 { color: #4a382b; }
body.sepia-mode .site-introduction p,
body.sepia-mode .site-introduction h2 {
     color: #5b4636 !important;
}
body.sepia-mode .category-nav a { background-color: #e9ddc7; border-color: #d3c4a5; color: #5b4636; }
body.sepia-mode .category-nav a:hover, body.sepia-mode .category-nav a.active { background-color: #6d5440; color: #fbf0d9; border-color: #6d5440; }
body.sepia-mode .story-card .synopsis,
body.sepia-mode .story-card .meta,
body.sepia-mode .story-date,
body.sepia-mode .sort-options a,
body.sepia-mode .nav-link,
body.sepia-mode .reading-time,
body.sepia-mode .story-card .date {
    color: #7a6b5a;
}
body.sepia-mode .story-card .meta .category, body.sepia-mode .story-category-tag {
    color: #8c6d46;
}
body.sepia-mode .footer-links a { color: #7a6b5a; }
body.sepia-mode .footer-links a:hover { color: #4a382b; }
body.sepia-mode .footer .copyright { color: #8a7b6a; }
body.sepia-mode .story-container a, body.sepia-mode .see-all-link { color: #8c6d46; }
body.sepia-mode .story-actions { border-top-color: #dcd0b3; border-bottom-color: #dcd0b3; }
body.sepia-mode .story-body h3 { border-bottom-color: #dcd0b3; }
body.sepia-mode #load-more-btn { background-color: #f4e8c8; border-color: #6d5440; color: #6d5440; }
body.sepia-mode #load-more-btn:hover { background-color: #6d5440; color: #f4e8c8; }
body.sepia-mode .text-logo {
    background: linear-gradient(45deg, #8c6d46, #6d5440);
    -webkit-background-clip: text; -moz-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; -moz-text-fill-color: transparent;
}
body.sepia-mode .like-button-style { background-color: #fbeae0; border-color: #e6c8b4; color: #c97f5f; }
body.sepia-mode .like-button-style:hover { background-color: #f9e2d3; }
body.sepia-mode .like-button-style.liked { background-color: #c97f5f; color: #fff; border-color: #a96849; }
body.sepia-mode .fa-heart { color: #c97f5f; }
body.sepia-mode .like-button-style.liked .fa-heart { color: #fff; }
body.sepia-mode .fa-eye { color: #7a6b5a; }
body.sepia-mode .story-card.is-read > a .content h3 { color: #9e8a78; }
body.sepia-mode .main-nav { border-bottom-color: #dcd0b3; }
body.sepia-mode .main-nav-item a { color: #7a6b5a; }
body.sepia-mode .main-nav-item.active a { color: #8c6d46; }
body.sepia-mode .main-nav-item a::after { background-color: #8c6d46; }
body.sepia-mode .sequel-generator-details { background-color: #f4e8c8; border-color: #dcd0b3; }
body.sepia-mode .sequel-generator-summary { background-color: #e9ddc7; }
body.sepia-mode .sequel-generator-summary:hover { background-color: #e4d5b9; }
body.sepia-mode .sequel-generator-details[open] .sequel-generator-summary { border-bottom-color: #dcd0b3; }
body.sepia-mode .font-size-controller span { color: #7a6b5a; }
body.sepia-mode .font-size-btn { background-color: #e9ddc7; border-color: #d3c4a5; color: #5b4636; }
body.sepia-mode .font-size-btn:hover { background-color: #e4d5b9; }
body.sepia-mode .font-size-btn.active { background-color: #8c6d46; color: #fbf0d9; border-color: #8c6d46; }
body.sepia-mode .reading-mode-controller span { color: #7a6b5a; }
body.sepia-mode .reading-mode-btn { background-color: #e9ddc7; border-color: #d3c4a5; color: #5b4636; }
body.sepia-mode .reading-mode-btn:hover { background-color: #e4d5b9; }
body.sepia-mode .reading-mode-btn.active { background-color: #8c6d46; color: #fbf0d9; border-color: #8c6d46; }


/* 広告コンテナの上下の余白を調整 */
.ad-container {
    margin: 0; /* story-actionsでマージンを管理するため、こちらはリセット */
    text-align: center;
}
/* Story bottom ad specific */
.ad-container-story-bottom {
    margin: 40px 0;
    text-align: center;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}
body.dark-mode .ad-container-story-bottom {
    background-color: #2c2c2c;
}

/* 最初は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-modern {
        flex-wrap: nowrap !important;
        gap: 5px !important;
    }
    .nav-link-secondary {
        padding: 10px 5px !important;
        font-size: 0.75em !important;
        white-space: nowrap;
        flex: 1; /* ボタン幅を均等に割り振る */
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
        min-width: 0; /* フレックスアイテムの縮小を許可 */
    }
}
/* --- グリッド表示時のメタ情報改行対策 (強制版) --- */
#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;
}

/* モバイル時のグリッド表示 */
@media (max-width: 768px) {
    /*
    #related-stories-shelf .ranking-scroll-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        overflow-x: visible;
        white-space: normal;
        padding: 0;
    }
    */
    #related-stories-shelf .ranking-card {
        /* flex: none;
        width: auto;
        max-width: 100%; */
        flex: 0 0 140px; /* Restore flex basis for horizontal scroll */
    }
    #related-stories-shelf .ranking-card-img {
        height: 120px; /* 少し高さを抑える */
    }
    #related-stories-shelf .ranking-card-title {
        font-size: 0.9em;
    }
}


.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;
    flex-wrap: wrap; /* 画面が狭い場合に折り返す */
    gap: 15px; /* 折り返した際の間隔 */
}

@media (max-width: 768px) {
    .story-page-controls {
        flex-direction: column;
        align-items: flex-end; /* 右寄せに */
        gap: 20px; /* 縦に並んだ時の間隔 */
    }
    /* スマホの縦書きモードでは、プログレスバーとページ表示を隠す */
    #reading-container.vertical-mode .progress-container,
    #reading-container.vertical-mode .page-indicator {
        display: none;
    }
}

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;
}
/* --- ▼▼▼ 「いいね済み」ボタンのスタイル ▼▼▼ --- */
.like-button-style.liked {
    background-color: #d9534f;
    color: #fff;
    border-color: #ac2925;
}

.like-button-style.liked:hover {
    background-color: #c9302c;
    border-color: #761c19;
}
/* --- ▼▼▼ いいね済みボタンのハートアイコン色を修正 ▼▼▼ --- */
.like-button-style.liked .fa-heart {
    color: #ffffff;
}
/* --- ▼▼▼ チャット形式のスタイル ▼▼▼ --- */
#chat-timeline {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.chat-bubble {
    padding: 15px 20px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.6;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}
.prompt-bubble { /* ユーザーの入力 */
    background-color: #007bff;
    color: white;
    border-radius: 18px 18px 5px 18px;
    align-self: flex-end;
}
.response-bubble { /* AIの応答 */
    background-color: #f1f1f1;
    border-radius: 18px 18px 18px 5px;
    align-self: flex-start;
}
body.dark-mode .response-bubble {
    background-color: #3a3a3a;
}
.bubble-header {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 8px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* --- ▼▼▼ 続きの物語ジェネレーターのスタイル ▼▼▼ --- */
.sequel-generator-container {
    margin: 40px 0;
    padding: 25px;
    border: 1px dashed #ccc;
    border-radius: 8px;
}
body.dark-mode .sequel-generator-container { border-color: #444; }
.sequel-header { text-align: center; margin-bottom: 20px; }
.sequel-header h3 { margin-top: 0; }
.sequel-header .beta-badge { font-size: 0.7em; background-color: #007bff; color: white; padding: 3px 8px; border-radius: 10px; vertical-align: middle; margin-left: 5px;}
.sequel-prompt-input { display: block; width: 100%; max-width: 600px; margin: 0 auto 15px auto; height: 80px; padding: 10px; border-radius: 4px; border: 1px solid #ccc; font-family: inherit; font-size: 1em; box-sizing: border-box; }
.sequel-controls { text-align: center; }
.sequel-generate-btn { padding: 10px 20px; font-size: 1em; font-weight: bold; cursor: pointer; }
.sequel-counter-display { margin-left: 15px; font-size: 0.9em; color: #555; }
body.dark-mode .sequel-counter-display { color: #ccc; }
.sequel-loading-spinner { text-align: center; margin-top: 20px; }
.sequel-result-area { margin-top: 20px; padding: 20px; background-color: #f8f9fa; border-radius: 4px; line-height: 1.7; white-space: pre-wrap; }
body.dark-mode .sequel-result-area { background-color: #2c2c2c; }
.hidden { display: none; }
/* --- ▼▼▼ 文字数カウンターのスタイル ▼▼▼ --- */
.char-counter-wrapper {
    text-align: right;
    max-width: 600px;
    margin: -10px auto 15px auto;
    font-size: 0.9em;
    color: #888;
}
.char-counter-wrapper.error {
    color: #d9534f;
    font-weight: bold;
}
/* --- ▼▼▼ メインナビゲーションのスタイル（改善版） ▼▼▼ --- */
.main-nav {
    text-align: center;
    border-bottom: 1px solid #eee; /* メニュー全体の下に区切り線を追加 */
    margin-bottom: 30px;
}
body.dark-mode .main-nav {
    border-bottom-color: #3a3a3a;
}
.main-nav-list {
    display: inline-flex; /* 中央揃えを維持しつつ、リストとして扱う */
    list-style: none;
    margin: 0;
    padding: 0;
}
.main-nav-item a {
    display: block;
    text-decoration: none;
    color: #555;
    font-weight: bold;
    padding: 15px 20px;
    position: relative; /* 下線アニメーションの基準点 */
    transition: color 0.3s ease;
}
body.dark-mode .main-nav-item a {
    color: #ccc;
}
.main-nav-item a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    bottom: -1px; /* 区切り線に重なるように調整 */
    left: 0;
    background-color: #007bff;
    transform: scaleX(0); /* 初期状態では非表示 */
    transform-origin: center;
    transition: transform 0.4s ease;
}
.main-nav-item a:hover::after,
.main-nav-item.active a::after {
    transform: scaleX(1); /* ホバー時とアクティブ時に下線を表示 */
}
.main-nav-item.active a {
    color: #007bff; /* アクティブなページの文字色を変更 */
}
body.dark-mode .main-nav-item.active a {
    color: #8ab4f8;
}
/* --- ▼▼▼ スマホ表示時のヘッダー改行対策 ▼▼▼ --- */
@media (max-width: 768px) {
    .main-nav-list {
        flex-wrap: wrap; /* 画面幅が足りない場合に、項目を折り返すようにする */
        justify-content: center; /* 折り返した項目を中央揃えにする */
        padding: 5px 0; /* 折り返した際のための上下の余白を少し調整 */
    }
    .main-nav-item a {
        padding: 10px 12px; /* パディングをさらに調整 */
        font-size: 0.9em;
    }
}
/* --- ▼▼▼ トップページ新セクションのスタイル ▼▼▼ --- */

/* --- セクション共通ヘッダー --- */
.section-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #eee;
    margin-bottom: 25px;
    padding-bottom: 15px;
}
.section-header h2 {
    font-size: 1.5em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-header .fa-star { color: #f9ca24; }
.section-header .fa-rocket { color: #3498db; }
body.dark-mode .section-header { border-bottom-color: #383838; }

/* --- 1. 本日注目の物語 --- */
.featured-story-container {
    margin-bottom: 50px;
}
.featured-story-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}
.featured-story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}
.featured-story-link {
    display: grid;
    grid-template-columns: 1fr 1.2fr; /* 画像とテキストの比率 */
    align-items: start; /* 上揃えに変更して、テキストが長くなってもレイアウトが崩れないようにする */
    text-decoration: none;
    color: inherit;
}
.featured-thumbnail img {
    width: 100%;
    height: 100%;
    max-height: 400px; /* ★画像の最大の高さを400pxに制限 */
    object-fit: cover;
    display: block;
}
.featured-content {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
}
.featured-category {
    background-color: #e9f5ff;
    color: #007bff;
    font-size: 0.85em;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 50px;
    align-self: flex-start;
    margin-bottom: 15px;
}
.featured-content h3 {
    font-size: 1.8em;
    margin: 0 0 15px 0;
}
.featured-synopsis {
    font-size: 0.95em;
    line-height: 1.8;
    color: #555;
    margin-bottom: 25px; /* ボタンとの余白を少し詰める */
    /* 省略表示関連のプロパティを削除 */
}
.read-more-btn {
    background-color: #333;
    color: #fff;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: bold;
    align-self: flex-start;
    transition: background-color 0.2s;
}
.read-more-btn:hover {
    background-color: #555;
}
body.dark-mode .featured-story-card {
    background-color: #2c2c2c;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}
body.dark-mode .featured-synopsis { color: #ccc; }
body.dark-mode .featured-category { background-color: rgba(138, 180, 248, 0.1); color: #8ab4f8; }
body.dark-mode .read-more-btn { background-color: #f0f0f0; color: #121212; }
body.dark-mode .read-more-btn:hover { background-color: #fff; }

/* --- 2. 届きたての新着 --- */
.new-arrivals-container {
    margin-bottom: 50px;
}
.new-arrivals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.new-arrival-card {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}
.new-arrival-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.new-arrival-img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}
.new-arrival-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
}
.new-arrival-category {
    color: #fff;
    background-color: rgba(255,255,255,0.2);
    font-size: 0.75em;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 50px;
}
.new-arrival-title {
    color: #fff;
    font-size: 1.1em;
    margin: 8px 0 0 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

/* --- レスポンシブ対応 --- */
@media (max-width: 992px) {
    .featured-story-link {
        grid-template-columns: 1fr; /* 縦積みに変更 */
    }
    .featured-thumbnail img {
        height: 250px;
    }
    .new-arrivals-grid {
        grid-template-columns: repeat(2, 1fr); /* 2列に */
    }
}
@media (max-width: 576px) {
    .featured-content { padding: 25px; }
    .featured-content h3 { font-size: 1.5em; }
    .new-arrivals-grid {
        grid-template-columns: 1fr; /* 1列に */
    }
}
/* --- ▼▼▼【リニューアル版】物語の続きを生成するUIのスタイル ▼▼▼ --- */
/* 新しいデザインのSummary */
.sequel-generator-summary .summary-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.sequel-generator-summary .summary-icon {
    font-size: 1.2em;
    color: #007bff;
    margin-right: 10px;
}

.sequel-generator-summary .summary-text {
    flex-grow: 1;
    font-size: 1.1em;
    font-weight: bold;
}

.sequel-generator-summary .summary-arrow {
    transition: transform 0.3s ease;
}

.sequel-generator-details[open] .summary-arrow {
    transform: rotate(180deg);
}


.sequel-generator-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 30px 40px;
    margin: 50px 0;
    text-align: center;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.07);
}

body.dark-mode .sequel-generator-container {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.sequel-header .fa-feather-alt {
    font-size: 2em;
    color: #888;
    margin-bottom: 15px;
}
body.dark-mode .sequel-header .fa-feather-alt {
    color: #aaa;
}

.sequel-header h3 {
    font-size: 1.6em;
    margin: 0 0 10px 0;
}

.sequel-header p {
    font-size: 1em;
    color: #555;
    max-width: 600px;
    margin: 0 auto 25px auto;
}
body.dark-mode .sequel-header p {
    color: #ccc;
}

.sequel-prompt-input {
    height: 60px; /* 少し高さを下げる */
    font-size: 1.1em;
    transition: all 0.2s ease-in-out;
}
.sequel-prompt-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15);
}
body.dark-mode .sequel-prompt-input:focus {
    box-shadow: 0 0 0 4px rgba(138, 180, 248, 0.2);
    border-color: #8ab4f8;
}

.sequel-generate-btn {
    font-size: 1.1em;
    padding: 12px 30px;
    border-radius: 50px;
    border: none;
    background-color: #343a40;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.sequel-generate-btn:hover {
    background-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.sequel-generate-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
body.dark-mode .sequel-generate-btn {
    background-color: #f8f9fa;
    color: #212529;
}
body.dark-mode .sequel-generate-btn:hover {
    background-color: #fff;
}
body.dark-mode .sequel-generate-btn:disabled {
    background-color: #444;
    color: #888;
}
/* --- ▼▼▼【追記】本日注目の物語カルーセル用のスタイル ▼▼▼ --- */

/* カルーセル全体を囲むラッパー */
.carousel-wrapper {
    position: relative; /* 左右のボタンを配置する際の基準点 */
    overflow: hidden; /* はみ出したスライドを隠す（重要） */
}

/* 複数のスライドを横一列に並べるコンテナ */
.carousel-slides {
    display: flex;
    /* JavaScriptでスライドを動かすためのアニメーション設定 */
    transition: transform 0.5s ease-in-out;
}

/* 個々のスライド */
.carousel-slide {
    /* 各スライドがラッパーの幅いっぱいを占めるように設定 */
    min-width: 100%;
    box-sizing: border-box;
}

/* 左右のナビゲーションボタン */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.carousel-btn.prev {
    left: 15px;
}

.carousel-btn.next {
    right: 15px;
}
/* --- ▼▼▼【ヒーローセクション改善】スワイプ対応とデザイン調整 ▼▼▼ --- */

/* スワイプ操作中にテキストが選択されるのを防ぐ */
.carousel-wrapper {
    user-select: none;
}

/* ヒーローセクションと下のコンテンツとの間に余白を設ける */
.featured-story-container {
    margin-bottom: 50px;
}

/* 「人気ランキング」や「新着」などの各棚に背景色と余白を追加し、領域を明確化 */
.content-shelf {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

/* ダークモード時の棚の背景 */
body.dark-mode .content-shelf {
    background-color: #2c2c2c;
}
/* --- ▼▼▼【最終FIX】ヒーローセクションのスマホ表示を強制修正 --- */

/* スマートフォン表示（横幅768px以下）の場合にのみ、以下のスタイルを最優先で適用 */
@media (max-width: 768px) {

    /* ヒーローセクションの矢印ボタンを強制的に非表示にする */
    .hero-carousel-container .carousel-btn {
        display: none !important;
    }

    /* ヒーローセクションのあらすじの行数制限を強制的に解除し、全文表示する */
    .hero-carousel-container .carousel-slide .hero-synopsis {
        display: block !important;
        -webkit-line-clamp: unset !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
    }
}
/* --- ▼▼▼【追記】検索結果0件メッセージのスタイル ▼▼▼ --- */
.search-no-results {
    padding: 40px 20px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    color: #555;
    line-height: 1.7;
}

body.dark-mode .search-no-results {
    background-color: #2c2c2c;
    border: 1px solid #383838;
    color: #ccc;
}
/* --- ▼▼▼【追記】グリッド表示時の「検索結果なし」のレイアウト修正 --- */
#stories-container.view-grid .search-no-results {
    /* グリッドの最初の列から最後の列までをすべて使う、という指定 */
    grid-column: 1 / -1;
}
/* --- ▼▼▼【追記】ヒーローセクションのインジケーターのスタイル --- */

/* ドット全体を格納するコンテナの配置 */
.hero-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10; /* 左右の矢印ボタンより手前に表示 */
    display: flex;
    gap: 12px; /* ドット間の隙間 */
}

/* 個々のドットのスタイル */
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    /* ライトモード時のデフォルト色（半透明の黒） */
    background-color: rgba(0, 0, 0, 0.4); 
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

/* 現在のスライドに対応する、アクティブなドットのスタイル */
.dot.active {
    /* ライトモード時のアクティブ色（不透明の黒） */
    background-color: #333; 
    transform: scale(1.2);
}

/* ダークモードの時だけ、ドットの色を白系に上書き */
body.dark-mode .dot {
    background-color: rgba(255, 255, 255, 0.4);
}
body.dark-mode .dot.active {
    background-color: #fff;
}
/* --- ▼▼▼【追記】ストーリーページの「続きを生成」ボタンのレイアウト調整 --- */
.sequel-controls {
    display: flex; /* ボタンとテキストを横並びにする */
    justify-content: center; /* 中央揃えにする */
    align-items: center; /* 上下中央を揃える */
    gap: 15px; /* ボタンとテキストの間の隙間 */
    flex-wrap: wrap; /* スマホで万が一収まらない場合も、自然に折り返す */
}

/* --- ▼▼▼【改善】「続きを生成」機能の折りたたみスタイル ▼▼▼ --- */
.sequel-generator-details {
    margin: 40px 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: #fff; /* 背景色を追加 */
}
.sequel-generator-details[open] {
    border-color: #ccc;
}
.sequel-generator-summary {
    padding: 15px 20px;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.2s;
    list-style: none; /* markerを消す */
    display: block; /* ブロック要素にしてクリック範囲を広げる */
}
.sequel-generator-summary::-webkit-details-marker {
    display: none; /* markerを消す (Chrome/Safari) */
}
.sequel-generator-summary:hover {
    background-color: #e9ecef;
}
.sequel-generator-details[open] .sequel-generator-summary {
    border-bottom: 1px solid #ddd;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.sequel-generator-summary .fa-magic {
    margin-right: 8px;
    color: #007bff;
}
.sequel-generator-container {
    margin: 0;
    border: none;
    padding: 20px;
    background: none; /* 親の<details>に背景色を移したので、こちらはリセット */
    box-shadow: none; /* 同上 */
}
.sequel-header h3 {
    display: none; /* summaryにタイトルを移したので、こちらは非表示に */
}

body.dark-mode .sequel-generator-details {
    border-color: #444;
    background-color: #242424; /* 背景色を追加 */
}
body.dark-mode .sequel-generator-details[open] {
    border-color: #555;
}
body.dark-mode .sequel-generator-summary {
    background-color: #2c2c2c;
}
body.dark-mode .sequel-generator-summary:hover {
    background-color: #3a3a3a;
}
body.dark-mode .sequel-generator-details[open] .sequel-generator-summary {
    border-bottom-color: #444;
}
body.dark-mode .sequel-generator-summary .fa-magic {
    color: #8ab4f8;
}

/* --- ▼▼▼【追加】読了時間表示のスタイル ▼▼▼ --- */
.reading-time {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #555;
    white-space: nowrap; /* 折り返しを防ぐ */
    font-size: 0.95em; /* 他の統計情報とサイズ感を合わせる */
}
.dark-mode .reading-time {
    color: #b0b0b0;
}
.reading-time .fa-clock {
    color: #888;
}
.dark-mode .reading-time .fa-clock {
    color: #aaa;
}

/* --- ▼▼▼【追加】3タブ切り替えコンテンツのスタイル ▼▼▼ --- */
.content-tabs-container {
    margin-bottom: 50px;
}

.content-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #eee;
    margin-bottom: 25px;
}

.dark-mode .content-tabs {
    border-bottom-color: #383838;
}

.content-tab {
    padding: 10px 20px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1.1em;
    font-weight: bold;
    color: #888;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-mode .content-tab {
    color: #aaa;
}

.content-tab:hover {
    color: #333;
}

.dark-mode .content-tab:hover {
    color: #fff;
}

.content-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.dark-mode .content-tab.active {
    color: #8ab4f8;
    border-bottom-color: #8ab4f8;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .content-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        /* Hide scrollbar for IE, Edge and Firefox */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    /* Hide scrollbar for Chrome, Safari and Opera */
    .content-tabs::-webkit-scrollbar {
        display: none;
    }
    .content-tab {
        font-size: 0.9em;
        padding: 8px 12px;
    }
}

/* Featured story card specific styles */
.featured-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.featured-meta .reading-time {
    font-size: 0.9em;
}

/* Ranking card stats adjustment */
.ranking-card-stats {
    flex-wrap: wrap; /* 小さな画面で折り返すように */
}
/* --- ▼▼▼【最終FIX】物語カードのメタ情報レイアウト修正 --- */

/* --- 基本のコンテナ設定（リスト・グリッド共通） --- */
.story-card .meta-stats-container {
    display: flex;
    justify-content: space-between; /* 日付を左、アイコン群を右に配置 */
    align-items: center;
    flex-wrap: wrap; /* 幅が足りなければ折り返す設定 */
    width: 100%;
}

.story-card .stats-right {
    display: flex;
    align-items: center;
    gap: 12px; /* アイコン間の隙間 */
}

.story-card .date {
    font-size: 0.8em;
    color: #666;
}
.dark-mode .story-card .date {
    color: #aaa;
}

.story-card .likes,
.story-card .views,
.story-card .chars {
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- リスト表示の時だけ、下の行に回り込むように設定 --- */
#stories-container.view-list .stats-right {
    flex-basis: 100%; /* アイコン群全体で下の行をすべて使う */
    justify-content: flex-end; /* 右揃えにする */
    margin-top: 5px; /* 上の行（日付）との隙間 */
}
/* --- ▼▼▼【追記】ギャラリーページの説明文スタイル --- */
.gallery-header {
    text-align: center;
    margin-bottom: 30px;
}

.gallery-header h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

.gallery-header p {
    font-size: 1em;
    color: #666;
}

.dark-mode .gallery-header p {
    color: #aaa;
}
/* --- ▼▼▼【追記】拡大プレビュー（モーダル）のスタイル --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background-color: #fff;
    border-radius: 10px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s;
}
.dark-mode .modal-content {
    background-color: #2c2c2c;
}
.sepia-mode .modal-content {
    background-color: #f4e8c8;
    color: #5b4636;
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}
.modal-image {
    flex: 1;
    min-width: 50%;
}
.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.modal-info {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}
.modal-info h3 {
    margin-top: 0;
}
.modal-info .category {
    font-weight: bold;
    color: #007bff;
}
.modal-info .synopsis {
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 20px;
}
.modal-read-more {
    display: inline-block;
    background-color: #007bff;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2em;
    color: #fff;
    cursor: pointer;
}
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
    }
}

/* --- ▼▼▼【新機能】縦読み・横読み機能のスタイル ▼▼▼ --- */

/* --- 読書モード切替ボタン --- */
.reading-mode-controller {
    display: flex;
    align-items: center;
    gap: 8px;
}
.reading-mode-controller span {
    font-size: 0.9em;
    color: #555;
}
body.dark-mode .reading-mode-controller span {
    color: #ccc;
}
.reading-mode-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.reading-mode-btn .fa-rotate-270 {
    transform: rotate(270deg);
}
.reading-mode-btn:hover {
    background-color: #e0e0e0;
}
.reading-mode-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}
body.dark-mode .reading-mode-btn {
    background-color: #333;
    border-color: #555;
    color: #eee;
}
body.dark-mode .reading-mode-btn:hover {
    background-color: #444;
}
body.dark-mode .reading-mode-btn.active {
    background-color: #8ab4f8;
    color: #121212;
    border-color: #8ab4f8;
}

/* --- 読書エリアのコンテナ --- */
#reading-container {
    position: relative;
    margin: 1.5em 0 3em 0;
}

/* --- ページネーション有効時のコンテナスタイル --- */
#reading-container.vertical-mode .story-body-wrapper {
    overflow-x: auto; /* 横スクロールを有効化 */
    overflow-y: hidden; /* 縦スクロールを無効化し、見切れを防ぐ */
    width: 100%;
    height: 70vh;
    max-height: 800px;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body.dark-mode #reading-container.vertical-mode .story-body-wrapper {
    border-color: #444;
}

/* --- スクロールモード（デフォルト）のスタイル --- */
#reading-container.scroll-mode .story-body-wrapper {
    height: auto;
    max-height: none;
    border: none;
    overflow: visible;
}
#reading-container.scroll-mode .story-body {
    max-width: 42em;
    margin: 1.5em auto 3em auto;
}
/* スクロールモードではページ関連UIを非表示 */
#reading-container.scroll-mode .progress-container,
#reading-container.scroll-mode .page-indicator {
    display: none;
}


/* --- 縦読みモードのスタイル --- */
#reading-container.vertical-mode .story-body-wrapper {
    padding: 20px;
}

#reading-container.vertical-mode .story-body {
    height: 100%;
    max-width: none;
    margin: 0;
    writing-mode: vertical-rl;
    text-align: justify;
    column-gap: 60px;
    column-fill: auto;
    display: block;
    transition: transform 0.4s ease-in-out;
}

#reading-container.vertical-mode .story-body p {
    text-indent: 0;
}

/* --- 関連作品スライダーのボタン表示制御 --- */
#related-stories-shelf .scroll-btn {
    display: none; /* スマホでは非表示 */
}
@media (min-width: 769px) {
    #related-stories-shelf .scroll-btn {
        display: flex; /* PCでは表示 */
    }
}

/* --- ▼▼▼ お知らせページのスタイル ▼▼▼ --- */
.news-list {
    border-top: 1px solid #eee;
    margin-top: 30px;
}
.news-list dt {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    padding-top: 25px;
    margin-bottom: 15px;
}
.news-list dd {
    margin-left: 0;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}
.news-list dd h3 {
    font-size: 1.25em;
    margin: 0 0 10px 0;
}
.news-list dd p {
    margin: 0;
    color: #555;
    line-height: 1.8;
}
.news-tag {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 50px;
    color: #fff;
    margin-bottom: 15px;
}
.news-tag.new-feature {
    background-color: #007bff;
}
.news-tag.announcement {
    background-color: #6c757d;
}

/* ダークモード対応 */
body.dark-mode .news-list {
    border-top-color: #383838;
}
body.dark-mode .news-list dt {
    color: #e9ecef;
}
body.dark-mode .news-list dd {
    border-bottom-color: #383838;
}
body.dark-mode .news-list dd p {
    color: #ccc;
}

/* --- ▼▼▼【改善】印刷用スタイル ▼▼▼ --- */
@media print {
    /* ヘッダー、フッター、広告、ボタン類など不要なものをすべて非表示に */
    header,
    footer,
    .story-header-image,
    .story-meta-revised,
    .story-page-controls,
    hr,
    .story-actions,
    .related-stories-container,
    .story-navigation,
    .sequel-generator-details,
    .ad-container,
    #theme-toggle-btn,
    .modal-overlay {
        display: none !important;
    }

    /* メインコンテンツのコンテナから余白や影などをリセット */
    body {
        background-color: #fff !important;
    }
    main.story-container {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background-color: #fff !important;
        border: none !important;
    }

    /* 物語本文のスタイルを調整 */
    .story-body, .story-body p {
        font-size: 12pt !important; /* 印刷に適したフォントサイズ */
        line-height: 1.6 !important;
        color: #000 !important; /* 文字色を黒に */
        max-width: 100% !important; /* ページの幅いっぱいに */
        text-indent: 1.5em !important; /* 字下げも調整 */
        widows: 3; /* 未亡人行の制御 */
        orphans: 3; /* 孤立行の制御 */
    }

    /* ページタイトルは表示する */
    .story-container h2 {
        text-align: center;
        margin-bottom: 2em;
        font-size: 16pt !important;
        color: #000 !important;
    }

    /* 印刷時にはリンクのURLを表示しないようにする */
    a:after {
        content: "" !important;
    }
}

/* --- ▼▼▼【新機能】集中モードのスタイル ▼▼▼ --- */

/* --- 集中モードボタン --- */
.focus-mode-controller {
    display: flex;
    align-items: center;
}

#focus-mode-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#focus-mode-btn:hover {
    background-color: #e0e0e0;
}
body.dark-mode #focus-mode-btn {
    background-color: #333;
    border-color: #555;
    color: #eee;
}
body.dark-mode #focus-mode-btn:hover {
    background-color: #444;
}
body.sepia-mode #focus-mode-btn {
    background-color: #e9ddc7;
    border-color: #d3c4a5;
    color: #5b4636;
}
body.sepia-mode #focus-mode-btn:hover {
    background-color: #e4d5b9;
}


/* --- モーダルオーバーレイ --- */
.focus-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* 他のモーダルより手前に */
}

/* --- モーダルコンテンツ --- */
.focus-modal-content {
    background-color: #fff;
    width: 95%;
    height: 95%;
    padding: 20px;
    border-radius: 8px;
    position: relative;
    box-sizing: border-box; /* パディングを含めてサイズ計算 */
}

#focus-modal-body {
    width: 100%;
    height: 100%;
    overflow: auto; /* コンテンツが多ければスクロール */
}

/* --- 閉じるボタン --- */
.focus-modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 2.5em;
    color: #888;
    cursor: pointer;
    line-height: 1;
    z-index: 2001;
    transition: color 0.2s;
}
.focus-modal-close:hover {
    color: #333;
}

/* --- テーマ対応 --- */
body.dark-mode .focus-modal-content {
    background-color: #242424;
}
body.dark-mode .focus-modal-close {
    color: #aaa;
}
body.dark-mode .focus-modal-close:hover {
    color: #fff;
}
body.sepia-mode .focus-modal-content {
    background-color: #f4e8c8;
}
body.sepia-mode .focus-modal-close {
    color: #7a6b5a;
}
body.sepia-mode .focus-modal-close:hover {
    color: #4a382b;
}

/* 縦書きモードの継承 */
#focus-modal-body.vertical-mode {
    writing-mode: vertical-rl;
    text-align: justify;
    padding: 20px;
    box-sizing: border-box;
    font-size: 1.1em;
    line-height: 1.9;
    letter-spacing: .05em;
    height: auto; /* 高さは自動調整 */
}
#focus-modal-body.vertical-mode .story-title-in-body {
    margin-bottom: 0;
    margin-left: 2em;
}
#focus-modal-body.vertical-mode p {
    margin-bottom: 1.6em;
    line-height: 1.9;
}

/* 横書きモードの中央揃え対応 */
#focus-modal-body:not(.vertical-mode) .focus-modal-story-content {
    max-width: 42em;
    margin-left: auto;
    margin-right: auto;
}

/* --- ▼▼▼ Mobile Bottom Navigation ▼▼▼ --- */
.bottom-nav {
    display: none; /* Hidden on desktop */
}
.bottom-nav-spacer {
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px; /* 高さを固定 */
        background-color: rgba(255, 255, 255, 0.95); /* 透過背景 */
        backdrop-filter: blur(10px); /* すりガラス効果 */
        border-top: 1px solid rgba(0,0,0,0.1);
        justify-content: space-around;
        align-items: center;
        z-index: 9999;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    }
    .bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #999;
        font-size: 0.7em;
        gap: 2px;
        flex: 1;
        height: 100%;
    }
    .bottom-nav .nav-item i {
        font-size: 1.3em;
        margin-bottom: 2px;
        transition: transform 0.2s;
    }
    .bottom-nav .nav-item.active {
        color: #007bff;
        font-weight: bold;
    }
    .bottom-nav .nav-item.active i {
        transform: translateY(-2px);
    }

    .bottom-nav-spacer {
        display: block;
        height: 70px; /* コンテンツが隠れないようにスペーサー */
    }

    /* Dark mode support */
    body.dark-mode .bottom-nav {
        background-color: rgba(36, 36, 36, 0.95);
        border-top-color: rgba(255,255,255,0.1);
    }
    body.dark-mode .bottom-nav .nav-item {
        color: #777;
    }
    body.dark-mode .bottom-nav .nav-item.active {
        color: #8ab4f8;
    }
}

/* --- ▼▼▼ Category Nav (Mobile) - Reverted to Wrapping ▼▼▼ --- */
@media (max-width: 768px) {
    .category-nav {
        padding: 10px 0;
    }
    .category-scroll-container {
        overflow-x: visible; /* Disable scroll */
    }
    .category-nav ul {
        display: flex;
        flex-wrap: wrap !important; /* Force wrapping */
        justify-content: center !important; /* Center align */
        padding: 0 15px;
        gap: 8px; /* Slightly reduced gap */
        width: 100% !important;
    }
    .category-nav li {
        flex-shrink: 1;
    }
    .category-nav a {
        padding: 6px 14px;
        font-size: 0.85em;
    }
}

/* --- FAB (Floating Action Button) --- */
.fab-surprise {
    position: fixed;
    bottom: 80px; /* Above the bottom nav */
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: none;
    cursor: pointer;
    z-index: 999;
    font-size: 1.5em;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.fab-surprise:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.fab-surprise:active {
    transform: scale(0.95);
}

/* Adjust FAB position on desktop (no bottom nav) */
@media (min-width: 769px) {
    .fab-surprise {
        bottom: 30px;
    }
}

/* Ranking Tabs */
.ranking-tabs { display: flex; gap: 5px; margin-left: auto; }
.tab-btn { background: none; border: 1px solid #ddd; border-radius: 20px; padding: 5px 12px; cursor: pointer; font-weight: bold; color: #888; font-size: 0.9em; }
.tab-btn:hover { background-color: #f0f0f0; }
.tab-btn.active { background-color: #333; color: #fff; border-color: #333; }
body.dark-mode .tab-btn { border-color: #555; color: #aaa; }
body.dark-mode .tab-btn:hover { background-color: #444; }
body.dark-mode .tab-btn.active { background-color: #f0f0f0; color: #333; border-color: #f0f0f0; }
.tab-panel { display: none; animation: fadeIn 0.3s; }
.tab-panel.active { display: block; }

/* --- Sensual Filter Button --- */
.sensual-filter-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 50%; /* 丸いボタンに変更 */
    width: 36px;        /* 固定幅 */
    height: 36px;       /* 固定高さ */
    padding: 0;         /* パディングリセット */
    display: flex;      /* アイコンを中央揃え */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ccc;
    transition: all 0.3s;
}

.sensual-filter-btn:hover {
    border-color: #b0b0b0;
    color: #b0b0b0;
}

.sensual-filter-btn.active {
    color: #ce93d8; /* Light Purple (Mauve) */
    border-color: #ce93d8;
    background-color: rgba(206, 147, 216, 0.1); /* Very faint purple bg */
}

/* Make sure the icon inside inherits color */
.sensual-filter-btn i {
    color: inherit !important;
}

.sensual-filter-btn.active i {
    color: #9b59b6 !important;
}

/* Dark mode adjustment if necessary */
body.dark-mode .sensual-filter-btn {
    border-color: #555;
    color: #666;
}
body.dark-mode .sensual-filter-btn:hover {
    border-color: #777;
    color: #777;
}
body.dark-mode .sensual-filter-btn.active {
    color: #ce93d8;
    border-color: #ce93d8;
    background-color: rgba(206, 147, 216, 0.15);
}

/* --- ▼▼▼ ギャラリーのハートバッジスタイル ▼▼▼ --- */
.gallery-heart-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #9b59b6;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 0.9em;
    z-index: 5;
    animation: heartbeat 2s infinite ease-in-out;
}
body.dark-mode .gallery-heart-badge {
    background-color: rgba(44, 44, 44, 0.9);
}

/* --- ▼▼▼ 官能バッジのパルスアニメーション ▼▼▼ --- */
.sensual-badge .fa-heart {
    animation: heartbeat 2s infinite ease-in-out;
}

/* --- ▼▼▼ セピアモードの続き生成UI対応 ▼▼▼ --- */
body.sepia-mode .sequel-generator-container {
    background: linear-gradient(135deg, #fbf0d9 0%, #e9ddc7 100%);
    box-shadow: 0 10px 30px rgba(91, 70, 54, 0.1);
}
body.sepia-mode .sequel-generator-details {
    border-color: #d3c4a5;
    background-color: #f4e8c8;
}
body.sepia-mode .sequel-generator-summary {
    background-color: #e9dec6;
}
body.sepia-mode .sequel-generator-summary:hover {
    background-color: #e4d5b9;
}
body.sepia-mode .sequel-generator-details[open] .sequel-generator-summary {
    border-bottom-color: #d3c4a5;
}
body.sepia-mode .sequel-prompt-input:focus {
    box-shadow: 0 0 0 4px rgba(140, 109, 70, 0.15);
    border-color: #8c6d46;
}
body.sepia-mode .sequel-generate-btn {
    background-color: #6d5440;
    color: #fbf0d9;
}
body.sepia-mode .sequel-generate-btn:hover {
    background-color: #5b4636;
}
body.sepia-mode .sequel-generate-btn:disabled {
    background-color: #d1c5a9;
    color: #8a7b6a;
}

/* --- ▼▼▼ 修正: ハートバッジのアイコン色を強制的に紫にする ▼▼▼ */
.gallery-heart-badge .fa-heart,
.sensual-badge .fa-heart {
    color: #9b59b6 !important;
}

/* --- ▼▼▼ 修正: ハートアイコンの中央揃え補正 (全体設定のmargin-rightを打ち消す) ▼▼▼ */
.sensual-filter-btn .fa-heart,
.gallery-heart-badge .fa-heart,
.sensual-badge .fa-heart {
    margin-right: 0 !important;
}
