/* =========================================
   DETAIL PAGE (LAYOUT BASE)
========================================= */
.detail-top {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px !important;
    align-items: start;
}

.detail-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch !important;
}

/* =========================================
   PROFILE TOP
========================================= */
.profile-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100% !important;
}

/* =========================================
   PROFILE CARD & GRIDS
========================================= */
.profile-card,
.content-card {
    margin-top: 0 !important;
    margin-bottom: 40px !important;
}

.profile-card {
    background: #fff;
    color: #000;
    border-radius: 14px;
    padding: 12px;
    margin-top: 10px;
    font-weight: bold;
}

.profile-item {
    padding: 14px;
    text-align: center;
}

/* 1列グリッド */
.profile-grid.profile-grid-1 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    border: 1px solid #eee !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-direction: unset !important;
}

.profile-grid.profile-grid-1 .profile-item {
    padding: 12px 14px !important;
    text-align: left !important;
    border-bottom: 1px solid #eee !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
}

.profile-grid.profile-grid-1 .profile-item:last-child {
    border-bottom: none;
}

.profile-grid.profile-grid-1 .label {
    display: block !important;
    font-size: 11px !important;
    color: #666 !important;
    margin-bottom: 0 !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: none !important;
}

.profile-grid.profile-grid-1 .value {
    display: block !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #111 !important;
    text-align: left !important;
    line-height: 1.5 !important;
}

/* 2×2グリッド（年齢・身長・体重・Pサイズ） */
.profile-grid.profile-grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

.profile-grid.profile-grid-2 .profile-item {
    padding: 12px 10px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    text-align: center !important;
}

.profile-grid.profile-grid-2 .profile-item:nth-child(2n) {
    border-right: none;
}

.profile-grid.profile-grid-2 .profile-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.profile-grid.profile-grid-2 .label,
.profile-grid.profile-grid-2 .value {
    text-align: center !important;
}

.profile-grid.profile-grid-2 .label {
    display: block !important;
    font-size: 11px !important;
    color: #666 !important;
    margin-bottom: 0 !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
}

.profile-grid.profile-grid-2 .value {
    display: block !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111 !important;
    line-height: 1.4 !important;
}

/* ベースのグリッド */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-top: 10px;
}

/* =========================================
   STANCE CARD (SEX / TACHI / UKE) 1行3列
========================================= */
.profile-card .profile-grid.profile-grid-3 {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 0 !important;
    border: none !important;
    margin: 0 !important;
}

.profile-grid.profile-grid-3 .profile-item,
.profile-grid.profile-grid-stance .profile-item {
    border: 1px solid #eee !important;
    margin: -0.5px !important;
    padding: 12px 8px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    text-align: center !important;
}

.profile-grid.profile-grid-stance {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    display: grid !important;
}

.profile-grid.profile-grid-3 .label,
.profile-grid.profile-grid-3 .value,
.profile-grid.profile-grid-stance .label,
.profile-grid.profile-grid-stance .value {
    text-align: center !important;
}

.profile-grid.profile-grid-3 .label {
    display: block !important;
    font-size: 11px !important;
    color: #666 !important;
    margin-bottom: 0 !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
}

.profile-grid.profile-grid-3 .value {
    display: block !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111 !important;
    line-height: 1.4 !important;
}

/* =========================================
   GALLERY / INTRO PANEL
========================================= */
.detail-left,
.detail-right {
    min-width: 0;
}

.detail-gallery-panel,
.detail-intro-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.detail-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr) !important;
    gap: 8px;
    height: 100% !important;
    align-content: stretch !important;
}

.gallery-thumb {
    width: 100%;
    aspect-ratio: unset !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
}

.detail-intro-card,
.detail-comment-card {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    height: 100%;
    box-sizing: border-box;
}

.detail-intro-card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.detail-comment-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.detail-comment-full {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 18px 20px;
}

.profile-comment-center {
    text-align: center;
}

/* =========================================
   GALLERY MODAL (拡大表示)
========================================= */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.gallery-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.gallery-close:hover {
    color: #ccc;
}

/* =========================================
   SP ONLY (スマホ版 統合レイアウト調整)
========================================= */
@media screen and (max-width: 768px) {

    .profile-card,
    .content-card {
        margin-bottom: 30px !important;
    }

    /* 並び順の変更（名前 → 写真 → プロフ → スタンス） */
    .detail-top {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }

    .profile-content {
        display: contents !important;
    }

    .profile-content h1 {
        order: 1 !important;
        margin: 0 0 4px 0 !important;
        text-align: center !important;
        justify-self: center !important;
        width: 100% !important;
        display: block !important;
        line-height: 1.2 !important;
    }

    .detail-main-image {
        order: 2 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .profile-content .profile-card {
        order: 3 !important;
        margin: 0 !important;
    }

    .profile-buttons {
        order: 4 !important;
        margin-top: 6px !important;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    /* 年齢・身長・体重・Pサイズはスマホでも2×2を維持 */
    .profile-grid.profile-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0 !important;
        margin-top: 0 !important;
    }

    .profile-grid.profile-grid-2 .profile-item {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* セクシャル・タチ・ウケはスマホでも1行3列を維持 */
    .profile-grid.profile-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0 !important;
        margin-top: 0 !important;
    }

    .profile-grid.profile-grid-3 .profile-item {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .detail-two-column {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        align-items: start !important;
    }

    .detail-gallery-panel {
        order: 1 !important;
    }

    .detail-intro-panel {
        order: 2 !important;
    }

    .detail-gallery-grid {
        height: auto !important;
        grid-template-rows: unset !important;
    }

    .gallery-thumb {
        aspect-ratio: 1 / 1 !important;
        height: auto !important;
    }

    .shift-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 30px;
    }
}
