/* --- 変数と基本設定 --- */
:root {
    --primary-text-color: #333;
    --secondary-text-color: #555;
    --bg-color: #f4f4f4;
    --card-bg-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --dlsite-color: #0075c3;
    --fanza-color: #e85298;
    --border-radius: 8px;
    --primary-color-for-filter: #ff58ae;
    --primary-hover-for-filter: #ff2796;

}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.public-site {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    line-height: 1.6;
}

/* 変更開始: 新しいヘッダーバーのスタイル (はてなブログ風) */
.header-bar {
    background-color: #f8f8f8; /* 既存ヘッダーよりも薄い色 */
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #eee;
    margin: 0;
    display: flex;
    justify-content: center; /* モバイルでは中央寄せ */
}

.page-logo-container {
    max-width: 160px; /* ロゴを控えめに */
    margin: 0;
}

.page-logo {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* PC/タブレット (1024px以上) では左寄せ */
@media (min-width: 1025px) {
    .header-bar {
        justify-content: flex-start; /* PCでは左寄せ */
        padding: 0.5rem calc((100% - 1100px) / 2 + 1rem); /* コンテンツ幅に合わせたpadding調整 */
    }

    .page-logo-container {
        max-width: 200px; /* PCでは少し大きくても良いが、控えめに */
    }
}
/* 変更終了 */


/* --- 既存のヘッダー (ページタイトル用) --- */
.page-header {
    background-color: var(--card-bg-color);
    text-align: center;
    /* 変更開始: ロゴを削除したため、パディングとマージンを調整 */
    padding: 1.5rem 1rem; 
    border-bottom: 1px solid #ddd;
    margin-bottom: 2rem;
    /* 変更終了 */
}

.page-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.page-header .affiliate-notice {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin: 0.5rem 0 0 0;
}

/* --- 紹介文セクション --- */
.preference-section {
    max-width: 1100px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.genre-box {
    border-radius: var(--border-radius);
    padding: 2.5rem 1.5rem 1.5rem;
    position: relative;
    background-color: var(--card-bg-color);
}

.genre-box-title {
    position: absolute;
    top: -16px;
    left: 20px;
    margin: 0;
    padding: 0.3rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    color: #fff;
    font-weight: bold;
}

.genre-box-title::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 15px;
    border-style: solid;
    border-width: 8px;
}

.genre-box-content {
    margin: 0;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

.genre-box-content p:first-child { margin-top: 0; }
.genre-box-content p:last-child { margin-bottom: 0; }

.genre-box--like { border: 2px solid var(--fanza-color); }
.genre-box--like .genre-box-title { background-color: var(--fanza-color); }
.genre-box--like .genre-box-title::after { border-color: var(--fanza-color) transparent transparent transparent; }

.genre-box--dislike { border: 2px solid #888; }
.genre-box--dislike .genre-box-title { background-color: #888; }
.genre-box--dislike .genre-box-title::after { border-color: #888 transparent transparent transparent; }

.genre-box--remarks { border: 2px solid #ffc107; }
.genre-box--remarks .genre-box-title { background-color: #ffc107; color: #333; }
.genre-box--remarks .genre-box-title::after { display: none; }

/* 変更開始: タグ絞り込みセクションのスタイル */
.tag-filter-section {
    max-width: 1100px;
    margin: 0 auto 2.5rem;
    padding: 0 1rem;
}
.tag-filter-container {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}
.tag-filter-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.2rem;
    text-align: center;
}
.tag-filter-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}
.tag-filter-btn {
    background-color: #e9ecef;
    color: var(--secondary-text-color);
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.tag-filter-btn:hover {
    background-color: #d8dde2;
}
.tag-filter-btn.active {
    background-color: var(--primary-color-for-filter);
    color: #fff;
    font-weight: bold;
}
.tag-filter-reset-wrapper {
    text-align: center;
    margin-top: 1.5rem;
    transition: opacity 0.3s ease;
}
.tag-filter-reset-wrapper.hidden { /* リセットボタン非表示用クラス */
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin-top: 0;
}
.tag-filter-reset {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    cursor: pointer;
    text-decoration: underline;
}
.tag-filter-reset:hover {
    color: var(--primary-color-for-filter);
}
.loading-message {
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
    color: var(--secondary-text-color);
}
/* 変更終了 */


/* --- 全体を囲むコンテナ --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    margin-bottom: 30px;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    /* 変更開始: ローディングオーバーレイの基準点 */
    position: relative;
    /* 変更終了 */
}

/* 変更開始: ローディングオーバーレイのスタイル */
.works-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7); /* 半透明の白 */
    z-index: 10;
    display: none; /* 初期状態では非表示 */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--primary-text-color);
    font-weight: bold;
    transition: opacity 0.3s ease;
    pointer-events: none; /* オーバーレイがクリックを邪魔しないように */
}

.works-loading-overlay.active {
    display: flex;
    opacity: 1;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color-for-filter);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* 変更終了 */


.no-works-message {
    grid-column: 1 / -1; /* カラム全体にまたがるように */
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
    color: var(--secondary-text-color);
}

/* --- 作品カード --- */
.card {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-color);
    margin-bottom: 0;
    overflow: hidden;
    transition: box-shadow 0.3s ease-in-out;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: 0 8px 16px var(--shadow-color);
}

.swiper {
    width: 100%;
    height: auto;
    aspect-ratio: 560 / 420;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    background-color: #000; /* 画像がない場合の背景 */
}

.swiper-slide {
    text-align: center;
    font-size: 18px;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.swiper-slide.no-image {
    background-color: #f0f0f0;
    color: #999;
}

.swiper-button-prev,
.swiper-button-next {
    color: #ffffff !important;
    background-color: rgba(0, 0, 0, 0.5);
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    top: 50%;
    transform: translateY(-50%);
}
.swiper-button-prev:hover,
.swiper-button-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.swiper-button-prev::after,
.swiper-button-next::after {
    font-size: 18px !important;
    font-weight: bold;
}

.card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-rank {
    font-size: 1rem;
    font-weight: bold;
    color: var(--fanza-color);
    margin: 0 0 0.25rem 0;
}

.card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.card-circle {
    margin: 0 0 1rem 0;
    color: var(--secondary-text-color);
    font-size: 1rem;
}

.card-tags {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-item {
    background-color: #e9ecef;
    color: var(--secondary-text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.card-comment {
    margin: 0 0 1.5rem 0;
    background-color: #f8f9fa;
    border-left: 4px solid var(--fanza-color);
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.95rem;
    /* 変更開始 */
    /* flex-grow: 1; を削除し、コメント欄がコンテンツの高さに応じて可変になるように変更 */
    /* 変更終了 */
}
.card-comment p:first-child { margin-top: 0; }
.card-comment p:last-child { margin-bottom: 0; }

.card-links {
    display: flex;
    gap: 1rem;
}

.btn {
    display: block;
    padding: 0.75rem 1rem;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    transition: opacity 0.3s ease;
    flex: 1;
}

.btn:hover {
    opacity: 0.85;
}

.btn.dlsite {
    background-color: var(--dlsite-color);
}

.btn.fanza {
    background-color: var(--fanza-color);
}

/* --- フッター --- */
.page-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 1rem;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    border-top: 1px solid #ddd;
}

.page-footer a {
    color: var(--primary-text-color);
    text-decoration: none;
}

.page-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
    
    /* 変更開始: モバイルでのヘッダーとロゴの調整 */
    .page-header {
        padding: 1rem; /* ページタイトルの上下パディングを調整 */
    }

    .page-header h1 {
        margin: 0;
    }
    /* 変更終了 */

    .card {
        padding: 1.25rem;
    }

    .card-title {
        font-size: 1.3rem;
    }
}
