/* ============================================
   📱 COMMON (共通設定・全体のリセット)
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ededf0;
    color: #333333;
}

a {
    text-decoration: none;
    color: inherit;
}



.age-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.age-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.age-box button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #ff3366;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* ============================================
   🏢 HEADER (検索窓・3つのタブ)
   ============================================ */

.header-container {
    width: 100%;
    padding: 20px 20px 10px;
    background-color: #fff;
}

.header-logo-area {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}


.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    height: 30px;
    width: auto;
    display: block;
}

.site-catchphrase {
    font-size: 13px;
    color: #666666;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.search-toggle-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    color: #555;
    cursor: pointer;
}

.search-box {
    margin-top: 20px;
    display: none;
    gap: 0;
}

.search-box.active {
    display: flex;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    background-color: #f0f0f2;
    border: 1px solid #e0e0e4;
    border-radius: 8px 0 0 8px;
    color: #333;
    font-size: 15px;
    outline: none;
}

.search-btn {
    width: 48px;
    border: none;
    border-radius: 0 8px 8px 0;
    background: #ff3366;
    color: white;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 16px;
}

.face-search-section {
    background-color: #ffffff;
    text-align: center;
    padding: 10px 15px 20px;
}

.upload-box {
    border: 1px solid #e0e0e4;
    padding: 20px 15px;

}

.upload-label {
    display: block;
    font-size: 14px;
    color: #333333;
    margin-bottom: 15px;
    font-weight: bold;
}

/* プレビュー表示エリアの全体枠 */
.preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    background-color: #f8f8fa;
    border-radius: 12px;
    border: 1px dashed #e0e0e4;
    overflow: hidden;
    position: relative; /* 🆕 エラーマスクを絶対配置でピッタリ重ねるため必須 */
}

/* 🖼️ 写真全体のバランスを保ちつつ、無駄な余白を完全にカット */
#face-preview {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background-color: #ffffff;
}

/* 🆕 【新設】エラー時に画像の上に被せる黒い半透明レイヤーのスタイル */
.preview-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px;
    z-index: 10;
    animation: fadeInErrorOverlay 0.2s ease forwards;
}

/* 🆕 【新設】エラーオーバーレイ内の❌アイコンと文字のスタイル */
.preview-error-overlay i {
    color: #ff3366; /* 鮮やかな赤文字/赤アイコン */
    font-size: 24px;
}

.preview-error-overlay span {
    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); /* 文字をくっきり見せる */
}

@keyframes fadeInErrorOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}


.file-input {
    display: none;
}

.custom-file-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: #ff3366;
    color: #fff;
    padding: 14px;
    font-size: 15px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 51, 102, 0.2);
    transition: all 0.2s ease;
}

.custom-file-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(255, 51, 102, 0.2);
}

.fa-camera {
    margin-right: 8px;
    font-size: 16px;
}


.upload-privacy-note {
    font-size: 11px;
    color: #999999;
    margin-top: 10px;
    text-align: center;
    line-height: 1.4;
}



/* ============================================
   📦 顔認証スキャン画面のベース（レスポンシブ対応）
   ============================================ */
.scan-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeInOverlay 0.3s ease forwards;
}

/* 🔍 PCでは最大400px、スマホでは画面の90%幅に自動フィットするカード */
.scan-card {
    background: #ffffff;
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.scan-title {
    font-size: 16px;
    font-weight: bold;
    color: #333333;
    margin-bottom: 12px;
    line-height: 1.4;
}

#scan-count-span {
    color: #ff3366;
    font-weight: bold;
}

/* 🔍 補足メッセージ全体のスタイル */
.scan-subtitle {
    font-size: 15px; 
    color: #555555;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 💡 ドットの横幅を完全固定して、文字の左ズレを防ぐパーツ */
.scan-dots-box {
    display: inline-block;
    width: 24px;      /* ドット3個分の領域を常にキープ */
    text-align: left; /* 点は左詰めで増えていく */
    margin-left: 2px; /* 文字とのちょうどいい隙間 */
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* ============================================
   ⏳ 王道のシンプル・ローディング演出（サイズ最適化版）
   ============================================ */

/* 🔍 写真を際立たせるための200px正方形の枠 */
.scan-container {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 200px;
    height: 200px;
    margin: 0 auto 30px auto;
    background-color: #f8f8fa;
    border-radius: 16px;
    border: 1px solid #e0e0e4;
}

/* 🔍 枠内95%の大きさに引き上げ、限界まで写真を大きく表示 */
#scan-face-clone {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    background-color: #ffffff;
    display: block;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1; /* スピナーの奥に配置 */
}

/* 🔍 写真のサイズに合わせて直径185pxに拡大した美しいグラデーションスピナー */
.scan-spinner {
    position: absolute;
    width: 185px;
    height: 185px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #ff3366;
    border-right-color: rgba(218, 54, 114, 0.3);
    z-index: 5; /* 写真の手前で回す */
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.main-content {
    background-color: #fff;
    width: 100%;
    padding-bottom: 30px;

}

.tab-container {
    display: flex;
    background-color: #ededf0;
    overflow: hidden;
    padding: 5px 10px;
    margin: 5px 0;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 10px 5px;
    font-size: 14px;
    color: #666666;
    border-radius: 6px;
    font-weight: bold;
}

.tab-item.active {
    color: #222222;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-result-info {
    margin: 10px 0;
    padding: 0 10px;
    overflow-wrap: anywhere;
    word-break: break-word;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;

    overflow: hidden;
}

.match-advice-text {
    margin: 0 auto 12px auto;
    padding: 10px 0 0 10px;
    font-size: 11px;
    color: #868e96;
    text-align: left;
}

.match-advice-text i {
    color: #adb5bd;
    margin-right: 4px;
}



/* ============================================
   📹 TOP PAGE (動画一覧)
   ============================================ */

.related-videos-title {
    padding-left: 5px;
}

.video-grid {
    display: flex;
    flex-direction: column;
    background-color: #ededf0;
    padding: 0;
    gap: 10px;
}

.video-card {
    background-color: #ffffff;
    display: flex;
    flex-direction: row;
    padding: 0;
    align-items: stretch;
    width: 100%;
}

.thumb-wrapper {
    width: 45%;
    aspect-ratio: 3 / 2;
    flex-shrink: 0;
    background-color: #000000;
    margin-right: 12px;
    position: relative;
    overflow: hidden;
}

.thumb-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.video-info {
    width: 55%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 3px 6px 0;
    overflow: hidden;
}

.video-card-title {
    font-size: 14px;
    font-weight: 500;
    color: #222222;
    line-height: 1.4;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: auto;
}

.video-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    min-height: 20px;
}


.match-badge-inline {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    background: rgba(255, 51, 102, 0.06);
    color: #ff3366;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 51, 102, 0.15);
    margin-top: 6px;
}

.match-badge-inline i {
    margin-right: 3px;
    color: #ff922b;
}

.release-date-text {
    font-size: 0.75rem;
    color: #777;
    font-weight: bold;
    font-family: monospace;
    margin-left: auto;
    padding-right: 12px;
}

.rank-gold,
.rank-silver,
.rank-bronze,
.rank-normal{
    display:inline-flex;
    align-items:center;
    width:fit-content;
    padding:3px 8px;
    margin-top:6px;

    font-size:11px;
    font-weight:bold;

    border-radius:4px;
}

/* 1位 */
.rank-gold{
    color:#c99700;
    background:#fff7d6;
    border:1px solid #f3d76b;
}

/* 2位 */
.rank-silver{
    color:#4f6d8c;
    background:#edf5ff;
    border:1px solid #b8d8ff;
}

/* 3位 */
.rank-bronze{
    color:#a45b2a;
    background:#fff0e4;
    border:1px solid #e8b18a;
}

/* 4位以降 */
.rank-normal{
    color:#8a8a8a;
    background:#f7f7f7;
    border:1px solid #e5e5e5;
}



#no-videos-fallback {
    padding: 40px;
    text-align: center;
    color: #666;
    background: #fff;
    width: 100%;
}

/* ==================================================
   📸 写真未選択時の一致度タブ専用：空っぽ画面（Empty State）
   ================================================== */
.empty-state-container {
    grid-column: 1 / -1;
    background: #ffffff;
    border-radius: 16px;
    padding: 50px 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin: 20px auto;
    width: 92%;
    max-width: 400px;
    box-sizing: border-box;
    animation: fadeInEmpty 0.4s ease forwards;
}

.empty-state-icon {
    font-size: 56px;
    color: #dddddf;
    margin-bottom: 20px;
}

.empty-state-text {
    font-size: 14px;
    color: #555555;
    line-height: 1.6;
    margin-bottom: 25px;
}
.empty-state-text strong {
    color: #ff3366;
}

.empty-action-btn {
    background: linear-gradient(135deg, #ff3366, #ff5e62);
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 51, 102, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.empty-action-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(255, 51, 102, 0.2);
}

@keyframes fadeInEmpty {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   🔢 PAGINATION
   ============================================ */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 20px 15px 0;
    background: #fff;
    margin-top: 10px;
}

.page-btn {
    display: inline-block;
    background-color: #ffffff;
    color: #333333;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.page-btn.current {
    background-color: #222222;
    color: #ffffff;
    border-color: #222222;
}

/* ============================================
   🗂️ カテゴリ・ジャンルセクション
   ============================================ */

.category-section {
    padding: 20px 15px 30px;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
}

.category-block {
    margin-bottom: 20px;
}

.category-title {
    font-size: 14px;
    color: #222222;
    font-weight: bold;
    margin-bottom: 12px;
    border-left: 4px solid #ff3366;
    padding-left: 8px;
}


.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-link-item {
    font-size: 13px;
    color: #555555;
    background-color: #f0f0f2;
    padding: 6px 12px;
    border-radius: 20px;
}

.category-link-item:hover {
    background-color: #e2e2e6;
    color: #222222;
}

.footer-container {
    background-color: #222222;
    padding: 35px 15px;
    text-align: center;
    font-size: 13px;
    color: #aaaaaa;
}

.footer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.footer-nav a {
    color: #fff;
}


.info-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    background-color: #f8f8fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.info-jacket {
    width: 90px;
    flex-shrink: 0;
}

.info-jacket img {
    width: 100%;
    border-radius: 4px;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.info-texts {
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #555555;
}

.tag-section-title {
    font-size: 14px;
    color: #222222;
    margin-bottom: 10px;
    font-weight: bold;
}

.tag-container-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    background-color: #ffffff;
    color: #555555;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}




/* スマホ対応 */
@media (max-width: 450px) {
    .header-container {
        padding-bottom: 5px;
    }

    .header-logo-area {
        gap: 8px;
    }

    .site-catchphrase {
        width: 100%;
        order: 99;
    }


}

@media (max-width: 400px) {
    .tab-item {
        font-size: 12px;
    }

    .prev-btn {
        font-size: 0;
    }

    .prev-btn::before {
        content: "◀";
        font-size: 14px;
    }

    .next-btn {
        font-size: 0;
    }

    .next-btn::before {
        content: "▶";
        font-size: 14px;
    }
}




/* PC対応 */
@media (min-width: 770px) {

    .header-container {
        display: flex;
        align-items: center;
        gap: 20px;
    }

    .search-box {
        display: flex;
    }

    .search-toggle-btn {
        display: none;
    }

    .search-box {
        flex: 1;
        margin-top: 0;
    }

    .tab-container {
        margin: 0 20px 10px;
        border-radius: 10px;
    }

    .upload-box {
        max-width: 700px;
        margin: 0 auto;
    }

    .search-result-info {
        padding-left: 12px;
    }

    .match-advice-text {
        padding-left: 20px;
    }


    .video-grid {
        background: #fff !important;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 20px;
    }


    .video-card {
        border: 1.5px solid #e8e8e8;
    }



    .detail-container {
        padding: 0 20px;
        background-color: #fff;
    }

    .related-videos-title {
        padding: 0 20px;
    }
}

@media (min-width: 1200px) {

    .site-container {
        max-width: 1200px;
        margin: 0 auto;
    }

    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }


}