/* スタイリッシュなビデオプレーヤー */
:root {
    --primary-color: #1da1f2;
    --secondary-color: #657786;
    --background-color: #15202b;
    --light-bg-color: #192734;
    --text-color: #ffffff;
    --border-color: #38444d;
    --hover-color: #1a91da;
    --success-color: #4BB543;
    --danger-color: #FF3B30;
    --shadow-color: rgba(0, 0, 0, 0.2);
}

/* メインレイアウト */
.stylish-video-page {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.stylish-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    flex: 1;
    overflow-x: hidden;
}

@media (min-width: 1024px) {
    .stylish-container {
        max-width: 900px;
        margin: 0 auto;
        padding: 20px 24px;
    }

    .stylish-video-title {
        font-size: 24px;
        line-height: 1.4;
    }

    .stylish-video-info {
        padding: 24px;
    }
}

/* ヘッダー */
.stylish-header {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    z-index: 100;
}

.stylish-header-title {
    font-size: 20px;
    font-weight: bold;
}

.stylish-header-actions {
    margin-left: auto;
    display: flex;
    gap: 16px;
}

.stylish-header-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: transparent;
    color: var(--text-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.stylish-header-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ビデオプレーヤーセクション */
.stylish-player-section {
    background-color: var(--light-bg-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .stylish-player-section {
        max-width: 900px;
        margin: 0 auto;
    }
}

.stylish-video-container {
    position: relative;
    padding-top: 56.25%; /* 16:9 アスペクト比 */
    background-color: #000;
}

.stylish-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
    z-index: 1;
}

/* iOS Safariでの再生サポート */
.stylish-video-player::-webkit-media-controls {
    display: none !important;
}

.stylish-video-player::-webkit-media-controls-enclosure {
    display: none !important;
}

/* ビデオコントロール */
.stylish-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stylish-video-container:hover .stylish-video-controls {
    opacity: 1;
}

.stylish-progress-container {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    margin-bottom: 12px;
}

.stylish-progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
    width: 0;
}

.stylish-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: none;
}

.stylish-progress-container:hover .stylish-progress-handle {
    display: block;
}

.stylish-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stylish-controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stylish-control-button {
    background-color: transparent;
    border: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.stylish-control-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.stylish-control-button i {
    font-size: 18px;
}

.stylish-time-display {
    color: var(--text-color);
    font-size: 14px;
    margin-left: 8px;
}

/* ビデオ情報 */
.stylish-video-info {
    padding: 20px;
}

.stylish-video-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 12px;
    line-height: 1.3;
}

.stylish-video-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.stylish-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stylish-stat-item i {
    font-size: 16px;
}

.stylish-video-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stylish-action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

a.stylish-action-button:visited {
    color: var(--text-color);
}

.stylish-action-button:hover {
    background-color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
}

a.stylish-action-button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.stylish-action-button i {
    font-size: 16px;
}

.stylish-action-button.liked {
    color: var(--danger-color);
}

.stylish-action-button.liked i {
    color: var(--danger-color);
}

.stylish-video-description {
    margin-bottom: 24px;
    line-height: 1.5;
    color: var(--text-color);
    font-size: 16px;
    white-space: pre-line;
}

/* ユーザー情報 */
.stylish-user-section {
    display: none !important;
}

.stylish-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 16px;
}

.stylish-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stylish-user-info {
    flex: 1;
}

.stylish-user-name {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 4px;
}

.stylish-user-handle {
    color: var(--secondary-color);
    font-size: 14px;
}

.stylish-follow-button {
    background-color: var(--text-color);
    color: var(--background-color);
    border: none;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.stylish-follow-button:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.stylish-follow-button.following {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* 関連動画セクション */
.stylish-related-section {
    background-color: var(--light-bg-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
    height: fit-content;
}

.stylish-related-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.2);
}

.stylish-related-header i {
    font-size: 18px;
    color: var(--primary-color);
}

.stylish-related-header .stylish-related-title {
    padding: 0;
    border: none;
    font-size: 18px;
    font-weight: bold;
}

.stylish-related-title {
    padding: 16px;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
}

.stylish-related-list {
    padding: 16px;
}

.stylish-related-item {
    display: flex;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.stylish-related-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.stylish-related-thumbnail {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
}

.stylish-related-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stylish-related-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 12px;
}

.stylish-related-info {
    flex: 1;
}

.stylish-related-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0;
    border: none;
}

.stylish-related-views {
    font-size: 12px;
    color: var(--secondary-color);
}

.stylish-related-item {
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.stylish-related-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.stylish-no-related {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--secondary-color);
}

.stylish-no-related i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.stylish-no-related p {
    margin-bottom: 16px;
    font-size: 14px;
}

.stylish-browse-more {
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.stylish-browse-more:hover {
    background-color: var(--hover-color);
}

/* モバイル対応 */
@media (max-width: 767px) {
    .stylish-video-title {
        font-size: 18px;
    }

    .stylish-video-stats {
        gap: 16px;
    }

    .stylish-related-thumbnail {
        width: 120px;
        height: 68px;
    }

    .stylish-user-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .stylish-user-avatar {
        margin-bottom: 12px;
    }

    .stylish-follow-button {
        margin-top: 12px;
        align-self: flex-start;
    }

    .stylish-controls-row {
        flex-wrap: wrap;
    }

    .stylish-time-display {
        font-size: 12px;
    }

    .stylish-control-button {
        width: 36px;
        height: 36px;
    }

    /* スマホでの動画表示位置調整 */
    .stylish-container {
        display: flex;
        flex-direction: column;
        min-height: auto;
        padding-top: 10px;
        padding-bottom: 20px;
    }

    .stylish-player-section {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .container {
        width: 100%;
        padding: 0 10px;
    }
}

/* 再生アイコン */
.stylish-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.stylish-play-icon.show {
    opacity: 1;
}

.stylish-play-icon i {
    color: var(--text-color);
    font-size: 32px;
}

/* 部分的に読み込むアニメーション */
.skeleton-loading {
    background: linear-gradient(90deg, var(--light-bg-color) 25%, var(--border-color) 50%, var(--light-bg-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* コピーしたときのトースト通知 */
.stylish-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.stylish-toast.show {
    opacity: 1;
}

/* スクロールバーのスタイリング */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* モーダル関連のスタイル改善 */
.modal00 {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9999 !important;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}

.modal00.modal00-show {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

.modal00-bg {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    z-index: 10000 !important;
}

.modal00-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 400px !important;
    width: 90% !important;
    z-index: 10001 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
}

/* ダウンロードモーダル関連 */
#download-modal .desc-basic {
    background: rgba(30, 35, 45, 0.95) !important;
    border-radius: 12px !important;
    padding: 20px !important;
    color: #fff !important;
}

#download-modal .title {
    text-align: center !important;
    font-size: 1.5rem !important;
    margin-bottom: 20px !important;
    font-weight: bold !important;
}

#download-modal .btn-primary {
    background: linear-gradient(90deg, #9982F2, #4F1787) !important;
    border: none !important;
    width: 100% !important;
    padding: 12px 15px !important;
    margin: 10px 0 !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

#download-modal .btn-secondary {
    background: #333333 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    width: 100% !important;
    padding: 12px 15px !important;
    margin: 10px 0 !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

#download-modal .closeBtnBottomCenter {
    text-align: center !important;
    margin-top: 20px !important;
}

#download-modal .closeBtnBottomCenter span {
    color: #fff !important;
    cursor: pointer !important;
    padding: 8px 20px !important;
    display: inline-block !important;
    border-radius: 5px !important;
    transition: all 0.2s !important;
}

#download-modal .closeBtnBottomCenter span:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* 戻るボタン */
.stylish-back-button-container {
    margin-bottom: 16px;
    width: 100%;
    padding-top: 10px;
}

.stylish-back-button {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: fit-content;
}

.stylish-back-button:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(-5px);
}

.stylish-back-button i {
    font-size: 16px;
    margin-right: 8px;
}

.stylish-back-button span {
    font-weight: 500;
}

@media (max-width: 767px) {
    .stylish-back-button-container {
        margin-bottom: 12px;
        padding-top: 5px;
    }

    .stylish-back-button {
        padding: 6px 12px;
    }
}

/* CSP Phase 3: classes replacing inline style= attributes */
.stylish-video-page.sp-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sp-transparent {
    background-color: transparent !important;
}

.sp-icon-white {
    color: white;
    font-size: 20px;
}

.sp-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sp-controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sp-control-btn {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

/* Purchase required overlay */
.purchase-required-overlay {
    width: 100%;
    min-height: 400px;
    height: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}

.purchase-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.purchase-icon {
    font-size: 40px;
    margin-bottom: 15px;
    color: #FFD700;
}

.purchase-heading {
    font-size: 20px;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.purchase-text {
    font-size: 14px;
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.4;
}

.purchase-price-wrap {
    margin-bottom: 20px;
}

.purchase-price {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
}

.purchase-button {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.purchase-button:hover,
.purchase-button:focus {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

/* Stylish toast (overrides to match inline style) */
.sp-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

/* Video controls override for transparent background pages */
.sp-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.2)) !important;
    padding: 10px;
    z-index: 10;
    backdrop-filter: blur(10px);
}

/* Video player object-fit */
.sp-video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
