/* リセット・基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", sans-serif;
    background-color: #f8f9fa;
    color: #333;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

/* ヘッダー */
header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #e94560, #d63851);
    border-bottom: none;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.15);
}

.header-link {
    text-decoration: none;
    color: inherit;
}

header h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

header .subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

/* メインナビゲーション */
.main-nav {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.5rem 1.25rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: #fff;
    border-color: #fff;
}

.nav-btn.active {
    background: #fff;
    color: #e94560;
    border-color: #fff;
}

/* メインコンテンツ */
.main-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    gap: 1.5rem;
}

main {
    flex: 1;
    min-width: 0;
    max-width: 1200px;
    padding: 1.5rem;
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    padding-top: 1.5rem;
    position: sticky;
    top: 1rem;
    align-self: flex-start;
}

.sidebar-admax {
    width: 100%;
    height: 600px;
    border: none;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* フィルタエリア */
.filters {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 1rem;
}

.search-box input::placeholder {
    color: #aaa;
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #d63851;
}

.advanced-search-toggle {
    padding: 0.75rem 1rem !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    color: #666 !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
}

.advanced-search-toggle:hover {
    border-color: #e94560 !important;
    color: #e94560 !important;
}

.advanced-search-toggle.active {
    background: #e94560 !important;
    border-color: #e94560 !important;
    color: #fff !important;
}

/* 作品グリッド */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.work-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.work-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.work-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    object-position: top;
    display: block;
}

.work-card img.portrait {
    object-fit: contain !important;
    background: #f0f0f0;
}

.work-card .card-info {
    padding: 1rem;
}

.work-card .card-info h3 {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
    color: #333;
}

.work-card .card-info .card-description {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.work-card .card-info .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.work-card .card-info .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.card-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #f0f4ff;
    border-radius: 12px;
    color: #666;
}

.card-tag.category {
    background: #e94560;
    color: #fff;
}

.image-count {
    font-size: 0.75rem;
    color: #999;
    white-space: nowrap;
}

/* パンくずリスト */
.breadcrumb {
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: #e94560;
    text-decoration: none;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.breadcrumb a:hover {
    opacity: 0.8;
}

/* 作品詳細 */
.work-header {
    margin-bottom: 2rem;
}

.work-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    color: #333;
}

.work-description {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.work-description .desc-toggle {
    background: none;
    border: 1px solid #ccc;
    color: #e94560;
    font-size: 0.85rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 0.25rem;
    transition: all 0.2s;
}

.work-description .desc-toggle:hover {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

/* サンプル画像グリッド */
.sample-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.sample-gallery.grid-mode,
.sample-gallery.layout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 100%;
}

.sample-gallery.grid-mode .sample-card img,
.sample-gallery.layout-grid .sample-card img {
    height: 300px;
    object-fit: contain;
    background: #f5f5f5;
}

.sample-gallery.layout-single {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 800px;
}

/* レイアウト切り替えボタン */
.layout-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.layout-btn {
    width: 32px;
    height: 32px;
    background: #fff;
    color: #999;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.layout-btn:hover {
    color: #e94560;
    border-color: #e94560;
}

.layout-btn.active {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.sample-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sample-card img {
    width: 100%;
    height: auto;
    display: block;
}

.sample-card-link {
    display: block;
    width: 100%;
}

.sample-gallery-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    width: 100%;
    grid-column: 1 / -1;
}

.sample-gallery-meta .meta-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border-radius: 16px;
}

/* SSRページのバッジリンク */
a.meta-badge,
a.card-tag {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
}

a.meta-badge:hover,
a.card-tag:hover {
    opacity: 0.8;
}

/* 関連作品 */
.related-section {
    width: 100%;
    margin-top: 2rem;
}

.related-title {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 0.75rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.related-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.related-card img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    background: #f5f5f5;
    display: block;
}

.related-info {
    padding: 0.75rem;
}

.related-info h3,
.related-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #333;
}

.related-info .meta-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
}

/* 属性ページ */
.attribute-page h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.attribute-count {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* 属性検索ページ */
.attr-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.attr-type-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.attr-type-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.attr-type-btn.active {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.attr-card {
    min-height: 120px;
}

.attr-card img {
    height: 300px;
    object-fit: contain !important;
    background: #f5f5f5;
}

.attr-card .card-info h3 {
    font-size: 0.85rem;
    text-align: center;
}

.attr-counts {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .attr-type-tabs {
        gap: 0.3rem;
    }
    .attr-type-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }
}

.album-manage-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* アルバム編集 - お気に入り追加グリッド */
.album-edit-fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.album-edit-fav-grid .selectable-fav {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s;
}

.album-edit-fav-grid .selectable-fav img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.album-edit-fav-grid .selectable-fav.selected-for-album {
    border-color: #e94560;
}

.album-edit-fav-grid .selectable-fav.selected-for-album::after {
    content: "✓";
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: #e94560;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.sample-card .sample-caption {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #888;
}

.sample-card .sample-meta {
    padding: 0 0.75rem 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.sample-card .meta-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 16px;
    color: #fff;
}

.meta-badge.actress {
    background: #8e44ad;
}

.meta-badge.director {
    background: #2980b9;
}

.meta-badge.series {
    background: #27ae60;
}

.meta-badge.label {
    background: #d35400;
}

.meta-badge.category {
    background: #e94560;
}

.meta-badge.tag {
    background: #7f8c8d;
}

/* クリック可能バッジ */
.clickable-badge {
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}

.clickable-badge:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination button {
    padding: 0.5rem 1rem;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-num-btn.active {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.pagination .page-info {
    color: #888;
    font-size: 0.9rem;
}

.pagination a.page-btn {
    padding: 0.5rem 1rem;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.pagination a.page-btn:hover {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.pagination span.page-btn.active {
    padding: 0.5rem 1rem;
    background: #e94560;
    color: #fff;
    border: 1px solid #e94560;
    border-radius: 8px;
}

.pagination span.page-btn {
    padding: 0.5rem 1rem;
}

.pagination .page-ellipsis {
    color: #888;
}

/* 読み込み中 */
.loading {
    text-align: center;
    padding: 3rem;
    color: #999;
}

/* ブラウズページ */
.browse-controls {
    margin-bottom: 1.5rem;
}

.browse-help {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.browse-section {
    margin-bottom: 1rem;
}

.browse-filter-input {
    width: 100%;
    max-width: 300px;
    padding: 0.4rem 0.7rem;
    margin-bottom: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 0.8rem;
}

.browse-filter-input::placeholder {
    color: #bbb;
}

.browse-filter-input:focus {
    outline: none;
    border-color: #e94560;
}

.browse-more-btn {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.3rem 0.8rem;
    background: transparent;
    color: #e94560;
    border: 1px solid #e94560;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.browse-more-btn:hover {
    background: #e94560;
    color: #fff;
}

.browse-more-btn.hidden {
    display: none;
}

.browse-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    padding-left: 0.25rem;
}

.browse-section-title.actress-title { color: #8e44ad; }
.browse-section-title.director-title { color: #2980b9; }
.browse-section-title.series-title { color: #27ae60; }
.browse-section-title.label-title { color: #d35400; }
.browse-section-title.category-title { color: #e94560; }
.browse-section-title.tag-title { color: #7f8c8d; }

.browse-values {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.browse-value-btn {
    padding: 0.4rem 0.8rem;
    background: #f0f4ff;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.browse-value-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.browse-value-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
}

.browse-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.browse-search-btn {
    padding: 0.6rem 2rem;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.browse-search-btn:hover {
    background: #d63851;
}

.browse-clear-btn {
    padding: 0.6rem 1.5rem;
    background: transparent;
    color: #888;
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.browse-clear-btn:hover {
    color: #333;
    border-color: #999;
}

.browse-selected-count {
    color: #888;
    font-size: 0.8rem;
}

.browse-conditions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    min-height: 2.5rem;
}

.browse-conditions:empty {
    display: none;
}

.browse-conditions .condition-label {
    font-size: 0.7rem;
    color: #888;
    margin-right: 0.25rem;
}

.browse-conditions .condition-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 14px;
    font-size: 0.75rem;
    color: #fff;
}

.browse-conditions .condition-badge.actress { background: #8e44ad; }
.browse-conditions .condition-badge.director { background: #2980b9; }
.browse-conditions .condition-badge.series { background: #27ae60; }
.browse-conditions .condition-badge.label { background: #d35400; }
.browse-conditions .condition-badge.category { background: #e94560; }
.browse-conditions .condition-badge.tag { background: #7f8c8d; }

.browse-conditions .condition-badge .remove-condition {
    cursor: pointer;
    opacity: 0.7;
    font-size: 0.85rem;
    line-height: 1;
}

.browse-conditions .condition-badge .remove-condition:hover {
    opacity: 1;
}

.browse-conditions .condition-separator {
    color: #ccc;
    font-size: 0.75rem;
    margin: 0 0.15rem;
}

.browse-conditions .result-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #888;
}

.browse-results .sample-card .work-label {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    color: #888;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* 結果なし */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1.1rem;
}

/* フッター */
footer {
    text-align: center;
    padding: 2rem;
    color: #aaa;
    border-top: 1px solid #eee;
    margin-top: 2rem;
    background: #fff;
    position: relative;
}

.ad-banner {
    margin-bottom: 1.5rem;
}

.ad-banner img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.footer-logo {
    position: absolute;
    right: 15%;
    bottom: 1.5rem;
    height: 64px;
    width: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.footer-logo:hover {
    opacity: 1;
}

.footer-link {
    color: #e94560;
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.footer-link:hover {
    opacity: 0.8;
}

/* 問い合わせフォーム */
.contact-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.contact-container h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #333;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e94560;
}

.form-group textarea {
    resize: vertical;
}

.contact-submit-btn {
    padding: 0.7rem 2rem;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.contact-submit-btn:hover {
    background: #d63851;
}

.contact-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.contact-result {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.contact-result.success {
    color: #27ae60;
}

.contact-result.error {
    color: #e94560;
}

/* お気に入りボタン */
.fav-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 5;
    opacity: 0.6;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fav-btn:hover {
    opacity: 1;
}

.fav-btn.active {
    opacity: 1;
    background: rgba(233, 69, 96, 0.9);
}

/* お気に入りページ */
.page-heading {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.fav-count {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.fav-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.album-form {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    max-width: 500px;
}

.album-form h3 {
    margin-bottom: 1rem;
    color: #333;
}

/* アルバム画像選択モード */
.album-select-banner {
    background: #e94560;
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.album-select-banner p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.album-select-actions {
    display: flex;
    gap: 0.5rem;
}

.album-select-actions .contact-submit-btn {
    background: #fff;
    color: #e94560;
}

.album-select-actions .browse-clear-btn {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.album-select-preview {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.album-select-preview h4 {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.album-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.album-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #ddd;
    cursor: grab;
}

.album-preview-item.dragging {
    opacity: 0.4;
}

.album-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-preview-item .preview-number {
    position: absolute;
    top: 0;
    left: 0;
    background: #e94560;
    color: #fff;
    font-size: 0.6rem;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 4px 0;
}

.album-preview-item .preview-remove {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 0.7rem;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0 0 0 4px;
}

.sample-card.selectable {
    cursor: pointer;
}

.sample-card.selected-for-album {
    outline: 3px solid #e94560;
    outline-offset: -3px;
}

.sample-card.selected-for-album::after {
    content: "✓";
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: #e94560;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* 作品へボタン */
.goto-work-btn {
    position: absolute;
    top: 2.75rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
    background: rgba(255, 255, 255, 0.8);
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    z-index: 5;
    opacity: 0.6;
}

.goto-work-btn:hover {
    opacity: 1;
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

/* 先頭に戻るボタン */
.scroll-top-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 900;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    background: #d63851;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    header {
        padding: 1.25rem 0.75rem;
    }

    /* モバイルではレイアウト切り替えを非表示、常に1列 */
    .layout-toggle {
        display: none;
    }

    .sample-gallery.grid-mode,
    .sample-gallery.layout-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        max-width: 800px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header .subtitle {
        font-size: 0.85rem;
    }

    .main-nav {
        margin-top: 0.75rem;
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .nav-btn {
        padding: 0.45rem 0.85rem;
        font-size: 0.8rem;
    }

    main {
        padding: 1rem 0.75rem;
    }

    .sidebar {
        display: none;
    }

    .search-box input {
        font-size: 16px;
        padding: 0.7rem 0.75rem;
    }

    .search-box button {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .search-box {
        flex-wrap: wrap;
    }

    .advanced-search-toggle {
        width: 100%;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .work-card img {
        height: 200px;
    }

    .work-card .card-info {
        padding: 0.6rem;
    }

    .work-card .card-info h3 {
        font-size: 0.85rem;
    }

    .work-card .card-info .card-description {
        font-size: 0.7rem;
        -webkit-line-clamp: 1;
    }

    .card-tag, .meta-badge {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.35rem !important;
    }

    .image-count {
        font-size: 0.65rem;
    }

    .work-header h2 {
        font-size: 1.3rem;
    }

    .work-description {
        font-size: 0.9rem;
    }

    .sample-gallery {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .sample-card img {
        height: auto;
        max-height: none;
    }

    .browse-help {
        font-size: 0.8rem;
    }

    .browse-section {
        margin-bottom: 0.75rem;
    }

    .browse-value-btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }

    .browse-filter-input {
        max-width: 100%;
        font-size: 16px;
    }

    .browse-values {
        max-height: 120px;
    }

    .browse-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .browse-search-btn {
        flex: 1;
        padding: 0.7rem;
        font-size: 0.9rem;
    }

    .browse-clear-btn {
        padding: 0.7rem 1rem;
        font-size: 0.8rem;
    }

    .pagination button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .breadcrumb a {
        font-size: 0.85rem;
        padding: 0.25rem 0;
        display: inline-block;
    }

    /* アルバム */
    .album-form {
        max-width: 100%;
    }

    .album-select-actions {
        flex-wrap: wrap;
    }

    .album-manage-actions {
        flex-wrap: wrap;
    }
}

/* 小さいスマホ（iPhone SE等） */
@media (max-width: 380px) {
    header h1 {
        font-size: 1.3rem;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .work-card img {
        height: 160px;
    }
}

/* 非表示カテゴリトグル */
.hidden-category-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #888;
    cursor: pointer;
}

.hidden-category-toggle input[type="checkbox"] {
    accent-color: #e94560;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* スマホ向けフッターロゴ調整 */
@media (max-width: 768px) {
    .footer-logo {
        position: static;
        display: block;
        margin: 0 auto 0.75rem;
        height: 48px;
    }
}

/* グリッド内広告 */
.ad-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 0.75rem 0;
}

.ad-row img {
    max-width: 100%;
    height: auto;
}

/* 作品詳細ページ広告 */
.detail-ad {
    margin-top: 2rem;
    text-align: center;
}

/* ===== モバイル最終上書き（最優先） ===== */
@media (max-width: 768px) {
    .layout-toggle {
        display: none !important;
    }
    .sample-gallery,
    .sample-gallery.grid-mode,
    .sample-gallery.layout-grid,
    .sample-gallery.layout-single {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        align-items: center !important;
    }
}
