/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffc9d2; /* 背景色を変更 */
    color: #fff;
    position: relative;
}

/* 年齢確認画面 */
.age-verification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ff6b9d 0%, #feca57 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    transition: opacity 0.5s ease;
}

.age-verification.hidden {
    opacity: 0;
    pointer-events: none;
}

.age-verification-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.age-verification h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 700;
}

.warning-icon {
    margin: 20px auto;
    color: #ff4757;
}

.age-question {
    color: #333;
    font-size: 20px;
    font-weight: 600;
    margin: 20px 0;
}

.age-warning {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 20px 0;
}

.age-buttons {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-direction: column;
}

.age-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.age-btn-yes {
    background: linear-gradient(135deg, #ff6b9d 0%, #ee5a87 100%);
    color: white;
}

.age-btn-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
}

.age-btn-no {
    background: #f0f0f0;
    color: #666;
}

.age-btn-no:hover {
    background: #e0e0e0;
}

.age-notice {
    color: #999;
    font-size: 12px;
    margin-top: 20px;
}

/* モバイル対応 */
@media (max-width: 480px) {
    .age-verification-content {
        padding: 30px 20px;
        width: 95%;
    }
    
    .age-verification h1 {
        font-size: 24px;
    }
    
    .age-question {
        font-size: 18px;
    }
    
    .age-warning {
        font-size: 13px;
    }
    
    .age-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* アプリコンテナ */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 420px;  /* スマホサイズに固定 */
    margin: 0 auto;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PC版での背景色調整 */
@media (min-width: 768px) {
    .app-container {
        background: transparent; /* PC版では透明に */
    }
    
    .video-swiper {
        background: #000;
    }
}

/* ビデオスワイパー */
.video-swiper {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.video-swiper:active {
    cursor: grabbing;
}

/* ビデオアイテム */
.video-item {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    z-index: 1;
}

.video-item.active {
    z-index: 10;
    transform: translateY(0);
}

.video-item.prev {
    z-index: 1;
    transform: translateY(-100%);
}

.video-item.next {
    z-index: 1;
    transform: translateY(100%);
}

/* ビデオプレイヤー */
.video-player {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    height: 60%;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-player iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    border: none;
}





/* タイトルオーバーレイ（左下） */
.video-title-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 15;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: none;
}

/* FANZAボタン（右上） */
.fanza-button {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 15;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.fanza-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.fanza-button svg {
    width: 16px;
    height: 16px;
}

.fanza-button span {
    white-space: nowrap;
}

/* プレースホルダー */
.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #111;
}

.video-placeholder img {
    max-width: 80%;
    max-height: 60%;
    object-fit: contain;
    margin-bottom: 20px;
    opacity: 0.5;
}

.video-placeholder p {
    color: #666;
    font-size: 14px;
}

/* ナビゲーションボタン（非表示） */
.navigation {
    display: none;
}



/* ローディング画面 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffc9d2; /* 背景色を統一 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
}

.loader {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader p {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}

/* ローディング中の広告 */
.loading-ads {
    display: none;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.loading-ad-wrapper {
    width: 300px;
    height: 250px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.6s ease-out;
}

/* ローディング広告のPR表記 */
.loading-ad-wrapper::after {
    content: 'PR';
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    z-index: 100;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-ad-wrapper .widget-banner {
    display: block;
    width: 300px;
    height: 250px;
}

.loading-ad-wrapper iframe {
    width: 300px !important;
    height: 250px !important;
    border: none;
    display: block;
}

/* PC版でローディング広告を表示 */
@media (min-width: 1024px) {
    .loading-ads {
        display: flex;
    }
    
    .loading-content {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 60px;
    }
    
    .loading-ads {
        flex-direction: column;
        margin-top: 0;
    }
}

/* 大画面では横に3つ並べる */
@media (min-width: 1400px) {
    .loading-ads {
        flex-direction: row;
    }
}

/* スマホ版では広告非表示 */
@media (max-width: 1023px) {
    .loading-ads {
        display: none !important;
    }
    
    .loading-content {
        flex-direction: column;
    }
}

/* タッチヒント */
.touch-hint {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 25;
    animation: bounce 2s ease infinite;
    transition: opacity 0.3s ease;
}

.touch-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.touch-hint svg {
    opacity: 0.6;
    margin-bottom: 10px;
}

.touch-hint p {
    font-size: 12px;
    opacity: 0.6;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* エラーメッセージ */
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 201, 210, 0.95); /* ピンク系半透明背景 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.error-message.hidden {
    display: none;
}

.error-content {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 300px;
}

.error-content h3 {
    color: #ff4444;
    margin-bottom: 15px;
}

.error-content p {
    margin-bottom: 20px;
    color: #ccc;
    font-size: 14px;
}

.error-content button {
    background: #ff4444;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    margin: 0 5px;
}

.error-content button:hover {
    background: #ff6666;
}



/* 広告コンテナ（PC版のみ） */
.ad-container {
    display: none;
    flex-direction: column;
    gap: 15px; /* 間隔を調整 */
    padding: 20px 15px; /* 左右のパディングを調整 */
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    max-height: 100vh;
    scrollbar-width: thin;
    scrollbar-color: #ffb3c1 #ffc9d2;
    width: 330px; /* 幅を明示的に指定 */
    align-items: center; /* 中央揃え */
    background: transparent; /* 透明背景 */
}

.ad-container::-webkit-scrollbar {
    width: 6px;
}

.ad-container::-webkit-scrollbar-track {
    background: #ffc9d2;
}

.ad-container::-webkit-scrollbar-thumb {
    background: #ffb3c1;
    border-radius: 3px;
}

.ad-container::-webkit-scrollbar-thumb:hover {
    background: #ff9fb3;
}

.ad-wrapper {
    width: 300px;
    height: 250px;
    background: rgba(255, 255, 255, 0.8); /* 白半透明背景 */
    border-radius: 8px;
    overflow: visible; /* 広告全体が表示されるように */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0 auto 15px; /* 中央揃えと下マージン */
    flex-shrink: 0; /* 縮小を防ぐ */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ad-wrapper:hover {
    transform: scale(1.02);
    z-index: 10; /* ホバー時に前面に */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* PR表記 */
.ad-wrapper::after {
    content: 'PR';
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    z-index: 100;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 広告バナー要素のスタイル */
.ad-wrapper .widget-banner {
    display: block;
    width: 300px;
    height: 250px;
    position: relative;
}

/* 広告iframe対応 */
.ad-wrapper iframe {
    width: 300px !important;
    height: 250px !important;
    min-width: 300px !important;
    min-height: 250px !important;
    max-width: 300px !important;
    max-height: 250px !important;
    border: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* 広告画像対応 */
.ad-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

/* 左側広告 */
.ad-container-left {
    order: 1;
}

/* 右側広告 */
.ad-container-right {
    order: 3;
}

/* ビデオスワイパーの順序 */
.video-swiper {
    order: 2;
    flex-shrink: 0;
}

/* デスクトップでも同じ縦長レイアウト */
@media (min-width: 768px) {
    .app-container {
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
        max-width: 100%;
        justify-content: space-between;
    }
    
    .video-swiper {
        max-width: 420px;
        width: 420px;
    }
}

/* 大画面PC版で広告を表示 */
@media (min-width: 1200px) {
    .ad-container {
        display: flex;
    }
}

/* 中画面PC版で片側のみ表示 */
@media (min-width: 1024px) and (max-width: 1199px) {
    .ad-container-right {
        display: flex;
    }
}

/* スマホ・タブレットでは広告非表示 */
@media (max-width: 1023px) {
    .app-container {
        max-width: 420px;
    }
    
    .ad-container {
        display: none !important;
    }
}

/* 非表示クラス */
.hidden {
    display: none !important;
}

/* APIエラー時の白い背景画面 */
.api-error-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.api-error-screen.show {
    display: flex;
}

.api-error-content {
    text-align: center;
    padding: 40px;
    max-width: 500px;
}

.api-error-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 48px;
}

.api-error-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 15px;
}

.api-error-message {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.api-error-button {
    background: #ff3366;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.api-error-button:hover {
    background: #ff1a4d;
    transform: scale(1.05);
}