/* ===============================
   ReelNavi base styles（2025-10-03 決定版）
   =============================== */

:root {
    --bg: #f7f7f9;
    --panel: #ffffff;
    --ink: #1a1a1a;
    --muted: #6b7280;
    --primary: #ff2f6e;
    --primary-ink: #fff;
    --border: #e5e7eb;
    --radius: 14px;
    --shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

/* Reset-ish */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

/* ===== Layout ===== */
.container {
    width: min(1200px, 92vw);
    margin: 0 auto;
    padding: 16px 0;
}

main.container {
    padding: 20px 0 40px;
}

section {
    margin: 16px 0 24px;
}

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
}

.logo img {
    height: 28px;
    width: auto;
    display: block;
}

.nav {
    display: flex;
    gap: 14px;
    margin-left: auto;
}

.nav a {
    color: #2c2c2c;
    text-decoration: none;
    padding: 10px 8px;
    border-radius: 8px;
}

.nav a:hover {
    background: #f3f4f6;
}

/* Notice */
.notice {
    background: #fff8f9;
    border: 1px solid #ffd0de;
    color: #b91c1c;
    padding: 8px 12px;
    border-radius: 10px;
    margin: 8px 0 16px;
    font-size: .9rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    background: #fff;
}

.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.footer-links a {
    color: #334155;
    text-decoration: none;
}

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

/* ===== Typography ===== */
h1,
h2,
h3 {
    margin: 0 0 10px;
}

h1.page-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
}

a {
    color: #0ea5e9;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--primary-ink);
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
    box-shadow: 0 8px 20px rgba(255, 47, 110, .18);
    transition: transform .05s ease, box-shadow .2s ease, opacity .2s ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(255, 47, 110, .24);
}

.btn.is-disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

/* ===== Grid ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

/* ===== Card ===== */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 0 !important;
    /* ← 画像横ズレ防止（ボディにだけパディングを持たせる） */
}

/* サムネリンク */
.card>.thumb-link {
    position: relative !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    text-decoration: none;
}

/* サムネラッパ：16:9固定＋切り抜き（外部CSS上書き対策に !important） */
.card .thumb-wrap {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    aspect-ratio: 16/9 !important;
    background: #0b0b0b;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* === 中央フィットの決定版（右寄りズレの根治） === */
.card .thumb-wrap>img.thumb {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    /* 真ん中に固定 */
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    right: auto !important;
    bottom: auto !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    margin: 0 !important;
    background: #111;
    filter: contrast(1.05) saturate(1.08) brightness(1.02);
}

/* 画像が黒でも“動画サムネ風”に */
.card .thumb-grad {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 48% !important;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .55) 70%, rgba(0, 0, 0, .78) 100%);
}

/* 再生アイコン（中央固定） */
.card .play-overlay {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .42);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    pointer-events: none;
    opacity: .92;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}

.card .thumb-link:hover .play-overlay {
    transform: translate(-50%, -50%) scale(1.06) !important;
    background: rgba(0, 0, 0, .52) !important;
}

/* バッジ */
.card .badge {
    position: absolute !important;
    left: 8px !important;
    top: 8px !important;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.card .badge-preview {
    background: #ff2f6e;
}

/* 本文（ここにだけパディング） */
.card .body {
    padding: 12px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card .body h3 {
    margin: 4px 0 2px;
    font-size: 1.02rem;
    line-height: 1.35;
}

.card .body h3 a {
    color: var(--ink);
    text-decoration: none;
}

.card .body h3 a:hover {
    text-decoration: underline;
}

.card .body p {
    margin: 0;
    color: #4b5563;
    font-size: .95rem;
}

/* ===== Genre list ===== */
.genre-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.genre-list a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    text-decoration: none;
}

.genre-list a:hover {
    background: #f8fafc;
}

/* ===== Ranking / Pagination ===== */
.subnav .btn.is-active {
    background: #111827;
    color: #fff;
    box-shadow: none;
}

.pagination .btn {
    min-width: 88px;
}

/* ===== Title detail ===== */
.title-detail .thumb {
    width: min(100%, 960px);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

/* ===== プレビューモーダル（保険スタイル） ===== */
.rn-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.rn-modal {
    width: min(92vw, 960px);
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

.rn-modal video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.rn-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    border: 0;
    border-radius: 999px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    line-height: 36px;
}

/* ===== Responsive ===== */
@media (max-width:640px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .nav {
        gap: 8px;
    }

    .container {
        width: 94vw;
    }
}

/* ===== aspect-ratio 非対応ブラウザ用フォールバック ===== */
@supports not (aspect-ratio:16/9) {
    .card .thumb-wrap {
        height: 0 !important;
        padding-top: 56.25% !important;
    }

    .card .thumb-wrap>img.thumb,
    .card .thumb-grad,
    .card .play-overlay,
    .card .badge,
    .card .badge-preview {
        position: absolute !important;
    }
}

.nav a.is-active {
    background: #111827;
    color: #fff;
}

/* ============================
   2025-10-03 Responsive patch
   Header / Footer collapse fix
   ============================ */

/* --- 共通余白の微調整（小画面） --- */
@media (max-width: 980px) {
    .site-header .container {
        flex-wrap: wrap;
        /* 1行に収まらない要素を折り返す */
        gap: 10px;
    }

    .logo img {
        height: 26px;
    }

    .nav {
        order: 2;
        /* ロゴの次に表示 */
        flex: 1 1 100%;
        /* 横いっぱい使う */
        margin-left: 0 !important;
        /* インラインstyle上書き */
        display: flex;
        gap: 10px;
        justify-content: flex-start;
        overflow-x: auto;
        /* はみ出す場合は横スクロール */
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 2px;
        /* スクロールバーが出ても窮屈に見えないように */
    }

    .nav a {
        padding: 8px 6px;
    }

    .nav-search {
        order: 3;
        /* メニューの下に来る */
        flex: 1 1 100%;
        margin-left: 0 !important;
        /* インラインstyle上書き */
    }

    .nav-search input {
        min-width: 0;
        width: 100%;
        /* 1列で広く */
    }

    .nav-search .btn {
        white-space: nowrap;
    }
}

/* さらに狭い画面（スマホ） */
@media (max-width: 640px) {
    .container {
        width: 94vw;
    }

    /* 既定を少しゆるく */
    .logo img {
        height: 24px;
    }

    .nav {
        gap: 8px;
        font-size: 0.95rem;
    }

    .nav a {
        padding: 8px 4px;
    }

    /* フッターは縦積みで左寄せ */
    .site-footer .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* 極小幅での見出し折り返しを綺麗に */
@media (max-width: 420px) {
    h1.page-title {
        font-size: 1.3rem;
    }

    .section-title {
        font-size: 1.15rem;
    }
}


/* ===== ReelNavi: card meta & tags (2025-10-04) ===== */
.rn-meta-line {
    color: #6b7280;
    font-size: .92rem;
    display: block;
    margin-top: 2px;
}

.rn-meta-label {
    /* 太さは指定しない → 周囲と同じ */
    margin-right: 4px;
}

.rn-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.rn-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: .85rem;
}

.rn-desc {
    margin-top: 8px;
    color: #4b5563;
}

/* ===== ReelNavi: actress & series links (2025-10-04) ===== */
.rn-actress-link {
    color: #0ea5e9;
    text-decoration: none;
}

.rn-actress-link:hover {
    text-decoration: underline;
}

.rn-series-line {
    color: #6b7280;
    font-size: .92rem;
    display: block;
    margin-top: 2px;
}

.rn-series-link {
    color: #334155;
    text-decoration: none;
    border-bottom: 1px dotted #cbd5e1;
}

.rn-series-link:hover {
    color: #111827;
    border-bottom-color: #94a3b8;
    text-decoration: none;
}

/* タグリンク（既に chip はあるのでホバー強調だけ） */
.rn-tag-chip {
    text-decoration: none;
    cursor: pointer;
}

.rn-tag-chip:hover {
    background: #f8fafc;
    text-decoration: none;
}

/* ===== Rankings table (responsive) ===== */
.rn-rank-table {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rn-rank-row {
    display: grid;
    grid-template-columns: 48px 120px 1fr 220px 220px 180px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    padding: 8px 10px;
}

.rn-rank-no {
    text-align: center;
    font-weight: 800;
}

.rn-thumb {
    display: block;
    width: 100%;
}

.rn-thumb-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #0b0b0b;
    border-radius: 6px;
    overflow: hidden;
}

.rn-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rn-rank-title {
    min-width: 0;
}

.rn-title-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

.rn-title-link:hover {
    text-decoration: underline;
}

.rn-series-line {
    margin-top: 2px;
}

.rn-series-link {
    color: #0ea5e9;
    text-decoration: none;
}

.rn-series-link:hover {
    text-decoration: underline;
}

.rn-rank-actresses {
    color: #374151;
    font-size: .95rem;
}

.rn-rank-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rn-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    text-decoration: none;
    font-size: .9rem;
}

.rn-tag-chip:hover {
    background: #f8fafc;
}

.rn-rank-metrics {
    text-align: right;
    color: #6b7280;
    font-size: .9rem;
}

.rn-rank-note {
    color: #6b7280;
    font-size: .9rem;
    margin-top: -4px;
}

.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}

.pagination-indicator {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* <= 980px */
@media (max-width:980px) {
    .rn-rank-row {
        grid-template-columns: 40px 100px 1fr 200px 200px 150px;
        gap: 8px;
    }
}

/* <= 720px */
@media (max-width:720px) {
    .rn-rank-row {
        grid-template-columns: 34px 92px 1fr 1fr;
        grid-template-areas:
            "no thumb title metrics"
            "no thumb acts  tags";
        align-items: start;
    }

    .rn-rank-no {
        grid-area: no;
    }

    .rn-thumb {
        grid-area: thumb;
    }

    .rn-rank-title {
        grid-area: title;
    }

    .rn-rank-actresses {
        grid-area: acts;
    }

    .rn-rank-tags {
        grid-area: tags;
    }

    .rn-rank-metrics {
        grid-area: metrics;
        text-align: right;
    }
}

/* <= 520px */
@media (max-width:520px) {
    .rn-rank-row {
        grid-template-columns: 28px 84px 1fr;
        grid-template-areas:
            "no thumb title"
            "no thumb acts"
            "no thumb tags"
            "no thumb metrics";
    }

    .rn-tag-chip {
        font-size: .85rem;
        padding: 3px 7px;
    }

    .rn-rank-metrics {
        font-size: .85rem;
    }
}

/* ===== title.php: プレイヤーを欠けないレスポンシブに ===== */
.player-frame {
    position: relative;
    max-width: 960px;
    margin: 0 auto 16px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

/* 16:9 を維持（古いブラウザでもOK） */
.player-frame::before {
    content: "";
    display: block;
    padding-top: 56.25%;
}

/* 子要素（iframe/video/img）をフルフィット */
.player-frame>* {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border: 0;
}

/* 欠けない（黒帯OK） */
.player-frame video,
.player-frame img {
    object-fit: contain;
    background: #000;
    display: block;
}

/* MGS が出す固定サイズを上書き */
#mgs-player iframe,
#mgs-player object,
#mgs-player embed,
#mgstage_movie iframe,
#mgstage_movie object,
#mgstage_movie embed {
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    display: block !important;
}

/* ===== title.php: メタ表示（出演/シリーズ/タグ） ===== */
.rn-meta-line {
    color: #6b7280;
    font-size: .95rem;
    display: block;
    margin-top: 6px;
}

.rn-meta-label {
    margin-right: 4px;
}

.rn-actress-link {
    color: #0ea5e9;
    text-decoration: none;
}

.rn-actress-link:hover {
    text-decoration: underline;
}

.rn-series-link {
    color: #334155;
    text-decoration: none;
    border-bottom: 1px dotted #cbd5e1;
}

.rn-series-link:hover {
    color: #111827;
    border-bottom-color: #94a3b8;
    text-decoration: none;
}

.rn-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.rn-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: .9rem;
    text-decoration: none;
}

.rn-tag-chip:hover {
    background: #f8fafc;
}

/* ==== Header logo size (safe override) ==== */
.rn-logo-lg img {
    height: 36px;
    /* 既定28px → 拡大 */
}

/* 狭幅時は少しだけ縮める（被り回避のため rn- で限定） */
@media (max-width: 640px) {
    .rn-logo-lg img {
        height: 30px;
    }
}

/* ==== Footer mini links (smaller text) ==== */
.rn-footer-wrap {
    gap: 8px;
}

.rn-footnote {
    font-size: .9rem;
    color: #6b7280;
}

.rn-footer-minilinks {
    font-size: .82rem;
    /* ← 0.9rem → 0.82rem に縮小 */
    gap: 10px;
}

.rn-footer-minilinks a {
    color: #334155;
    text-decoration: none;
}

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

/* 任意：スマホではさらに少し小さく */
@media (max-width: 640px) {
    .rn-footer-minilinks {
        font-size: .78rem;
    }
}


.rn-meta-line {
    font-size: 0.9em;
    margin-top: 3px;
    color: #666;
}

.rn-meta-label {
    font-weight: 600;
    color: #444;
}

/* ==== Rankings (responsive grid) ======================================= */
.rn-rank-table {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rn-rank-row {
    display: grid;
    grid-template-areas:
        "no thumb title metrics"
        "no thumb actresses metrics"
        "no thumb tags metrics";
    grid-template-columns: 64px 120px 1fr 220px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.rn-rank-no {
    grid-area: no;
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    color: #111827;
}

.rn-thumb {
    grid-area: thumb;
    display: block;
}

.rn-thumb-inner {
    width: 100%;
    aspect-ratio: 3 / 4;
    /* 縦長サムネ想定。比率は必要に応じて調整 */
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.rn-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rn-rank-title {
    grid-area: title;
    min-width: 0;
}

.rn-title-link {
    display: inline-block;
    font-weight: 700;
    line-height: 1.35;
}

.rn-series-line {
    margin-top: 4px;
    font-size: 0.95rem;
    color: #4b5563;
}

.rn-rank-actresses {
    grid-area: actresses;
    color: #374151;
    min-width: 0;
}

.rn-rank-actresses .rn-actress-link {
    text-decoration: underline;
}

.rn-rank-tags {
    grid-area: tags;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rn-tag-chip {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
    background: #fff;
    white-space: nowrap;
}

.rn-rank-metrics {
    grid-area: metrics;
    justify-self: end;
    text-align: right;
    color: #4b5563;
}

.rn-rank-metrics>div {
    white-space: nowrap;
}

/* --- Tablet (≤ 960px): metrics を下段へ、3カラム化 --- */
@media (max-width: 960px) {
    .rn-rank-row {
        grid-template-areas:
            "no thumb title"
            "no thumb actresses"
            "no thumb tags"
            "metrics metrics metrics";
        grid-template-columns: 56px 110px 1fr;
        align-items: start;
    }

    .rn-rank-metrics {
        justify-self: start;
        text-align: left;
        margin-top: 4px;
    }
}

/* --- Mobile (≤ 560px): さらにコンパクトに --- */
@media (max-width: 560px) {
    .rn-rank-row {
        grid-template-areas:
            "no thumb title"
            "metrics metrics metrics"
            "actresses actresses actresses"
            "tags tags tags";
        grid-template-columns: 52px 96px 1fr;
        gap: 10px;
        padding: 10px;
    }

    .rn-rank-no {
        font-size: 16px;
    }

    .rn-title-link {
        font-size: 0.98rem;
    }

    .rn-series-line {
        font-size: 0.9rem;
    }

    .rn-rank-metrics>div {
        font-size: 0.9rem;
    }
}