/* カルーセル Reboot - ジャストサイズ版（v2.2.8 - 横伸び問題完全解決） */

/* ==========================================================================
   基本カルーセルスタイル（ジャストサイズ版）
   ========================================================================== */

/* カルーセルコンテナ */
.carousel-reboot-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 20px auto;
    padding: 0 50px;
    box-sizing: border-box;
}

/* カルーセル本体 */
.carousel-reboot {
    display: flex;
    transition: transform 0.4s ease;
    gap: 15px;
    will-change: transform;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%; /* 重要：100%固定 */
}

.carousel-reboot.transitioning {
    transition: transform 0.4s ease;
}

/* **修正: カルーセルアイテム（ジャストサイズ版）** */
.carousel-reboot-item {
    /* JSで動的に設定されるため、ここでは基本設定のみ */
    flex: 0 0 auto; /* JSで正確に計算された値が適用される */
    min-width: 200px; /* 最小幅のみ設定 */
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    visibility: visible;
    opacity: 1;
    box-sizing: border-box;
    position: relative;
    border: 1px solid #f0f0f0;
    height: auto;
}

/* 非表示アイテムの完全な隠蔽 */
.carousel-reboot-item.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* **修正: 軽いホバーエフェクト** */
.carousel-reboot-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: #e0e0e0;
}

/* ==========================================================================
   画像とサムネイル関連
   ========================================================================== */

/* 画像コンテナ */
.carousel-reboot-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.2s ease, opacity 0.2s ease;
    background-color: #f8f8f8;
    display: block;
    flex-shrink: 0;
}

.carousel-reboot-item:hover img {
    transform: scale(1.01);
}

/* ローディング状態 */
.carousel-reboot-item.loading {
    position: relative;
    min-height: 220px;
    background-color: #fafafa;
}

.carousel-reboot-item.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #999;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* エラー状態のスタイリング */
.carousel-reboot-item.error img {
    opacity: 0.5;
    filter: grayscale(50%);
}

.carousel-reboot-item.error .thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f8f8, #f0f0f0);
    color: #999;
    font-size: 13px;
    text-align: center;
    border: 1px dashed #ddd;
}

/* サムネイル プレースホルダー */
.thumbnail-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #fafafa, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #999;
    text-align: center;
    border-radius: 4px 4px 0 0;
    position: relative;
    flex-shrink: 0;
}

.thumbnail-placeholder::before {
    content: '📽️';
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

/* 画像エラー時のプレースホルダー */
.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    color: #999;
    font-size: 13px;
    text-align: center;
    border-radius: 4px;
}

/* ==========================================================================
   コンテンツエリア（ジャストサイズ版）
   ========================================================================== */

/* コンテンツエリア */
.carousel-reboot-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* **修正: タイトルのスタイル** */
.carousel-reboot-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: #333 !important;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500 !important;
    word-wrap: break-word;
    hyphens: auto;
    /* 黒枠関連のスタイルを完全削除 */
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
}

.carousel-reboot-text {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 6px;
    word-wrap: break-word;
    hyphens: auto;
    flex-shrink: 0;
}

/* リンクのスタイル */
.carousel-reboot-item a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.carousel-reboot-item a:hover {
    color: inherit;
}

.carousel-reboot-item a:focus {
    outline: none;
}

/* ==========================================================================
   ナビゲーションコントロール（ジャストサイズ版）
   ========================================================================== */

/* **修正: ナビゲーションボタン** */
.carousel-reboot-prev,
.carousel-reboot-next {
    position: absolute !important;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95) !important;
    color: #555 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    cursor: pointer !important;
    font-size: 16px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1000 !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation !important;
    font-family: Arial, sans-serif;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    min-width: 40px !important;
    min-height: 40px !important;
}

.carousel-reboot-prev:hover,
.carousel-reboot-next:hover {
    background: rgba(255, 255, 255, 1) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    transform: translateY(-50%) scale(1.05) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    color: #333 !important;
}

.carousel-reboot-prev:active,
.carousel-reboot-next:active {
    transform: translateY(-50%) scale(0.98);
}

.carousel-reboot-prev:focus,
.carousel-reboot-next:focus {
    outline: 2px solid #4169e1;
    outline-offset: 2px;
}

.carousel-reboot-prev {
    left: 10px;
}

.carousel-reboot-next {
    right: 10px;
}

/* **修正: ドットナビゲーション** */
.carousel-reboot-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 15px;
    padding: 8px 0;
}

.carousel-reboot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.carousel-reboot-dot:hover {
    background: #bbb;
    transform: scale(1.2);
}

.carousel-reboot-dot:focus {
    outline: 2px solid #4169e1;
    outline-offset: 2px;
}

.carousel-reboot-dot.active {
    background: #666;
    width: 24px;
    border-radius: 4px;
}

/* **修正: YouTube関連要素のスタイル** */
.carousel-reboot-item .carousel-reboot-title,
.carousel-reboot-item .youtube-channel,
.carousel-reboot-item .youtube-meta,
.youtube-item .carousel-reboot-title,
.youtube-item .youtube-channel,
.youtube-item .youtube-meta {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
}

/* YouTube動画用スタイル */
.youtube-item .youtube-thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #000;
    border-radius: 4px 4px 0 0;
    flex-shrink: 0;
}

.youtube-item .youtube-thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* YouTube再生ボタンオーバーレイ */
.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 42px;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 3;
}

.carousel-reboot-item:hover .play-button-overlay {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.05);
}

/* 動画の長さ表示 */
.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    z-index: 3;
    backdrop-filter: blur(2px);
}

/* **修正: YouTubeチャンネル名のスタイル** */
.youtube-channel {
    color: #5a7fa0 !important;
    font-size: 13px;
    margin: 5px 0 3px;
    font-weight: 500 !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 黒枠関連のスタイルを完全削除 */
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* **修正: YouTubeメタ情報のスタイル** */
.youtube-meta {
    color: #777 !important;
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    font-weight: 400 !important;
    /* 黒枠関連のスタイルを完全削除 */
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.youtube-meta .views,
.youtube-meta .published {
    display: inline-block;
}

.youtube-meta .published::before {
    content: '•';
    margin-right: 3px;
    color: #999;
}

/* **修正: YouTube動画用カルーセルアイテムの調整** */
.youtube-item .carousel-reboot-content {
    padding: 12px;
}

.youtube-item .carousel-reboot-title {
    color: #333 !important;
    font-size: 15px;
    line-height: 1.3;
    margin: 6px 0 5px 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.6em;
    font-weight: 500;
    /* 黒枠関連のスタイルを完全削除 */
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.youtube-item .carousel-reboot-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    margin-top: 6px;
    height: 2.4em;
    color: #777;
}

/* ==========================================================================
   レスポンシブ対応（ジャストサイズ版）
   ========================================================================== */

/* デスクトップ（1200px以上） - 4個表示 */
@media (min-width: 1200px) {
    .carousel-reboot-wrapper {
        padding: 0 50px;
    }
    
    .carousel-reboot {
        gap: 15px;
    }
}

/* 小型デスクトップ・大型タブレット（1025px-1199px） - 4個表示 */
@media (min-width: 1025px) and (max-width: 1199px) {
    .carousel-reboot-wrapper {
        padding: 0 45px;
    }
    
    .carousel-reboot {
        gap: 15px;
    }
    
    .carousel-reboot-prev,
    .carousel-reboot-next {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* タブレット（769px-1024px） - 3個表示 */
@media (min-width: 769px) and (max-width: 1024px) {
    .carousel-reboot-wrapper {
        padding: 0 45px;
        margin: 20px auto;
    }
    
    .carousel-reboot {
        gap: 12px;
    }
    
    .carousel-reboot-prev,
    .carousel-reboot-next {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px;
        min-width: 36px !important;
        min-height: 36px !important;
    }
    
    .carousel-reboot-title {
        font-size: 1.05rem;
    }
    
    .youtube-item .carousel-reboot-title {
        font-size: 14px;
    }
    
    .youtube-channel,
    .youtube-meta {
        font-size: 12px;
    }
    
    .play-button-overlay {
        width: 54px;
        height: 38px;
    }
}

/* モバイル（481px-768px） - 2個表示 */
@media (min-width: 481px) and (max-width: 768px) {
    .carousel-reboot-wrapper {
        padding: 0 50px;
        margin: 15px auto;
    }
    
    .carousel-reboot {
        gap: 10px;
    }
    
    .carousel-reboot-prev,
    .carousel-reboot-next {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px;
        min-width: 36px !important;
        min-height: 36px !important;
    }
    
    .carousel-reboot-prev {
        left: 10px;
    }
    
    .carousel-reboot-next {
        right: 10px;
    }
    
    .carousel-reboot-title {
        font-size: 1rem;
    }
    
    .youtube-item .carousel-reboot-title {
        font-size: 13px;
        height: 2.3em;
    }
    
    .youtube-channel,
    .youtube-meta {
        font-size: 11px;
    }
    
    .play-button-overlay {
        width: 50px;
        height: 36px;
    }
    
    .video-duration {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .carousel-reboot-dots {
        margin-top: 12px;
        gap: 5px;
    }
    
    .carousel-reboot-dot {
        width: 7px;
        height: 7px;
    }
    
    .carousel-reboot-dot.active {
        width: 20px;
    }
}

/* 小型モバイル（480px以下） - 1個表示 */
@media (max-width: 480px) {
    .carousel-reboot-wrapper {
        padding: 0 40px;
        margin: 15px auto;
    }
    
    .carousel-reboot {
        gap: 8px;
    }
    
    .carousel-reboot-prev,
    .carousel-reboot-next {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px;
        min-width: 32px !important;
        min-height: 32px !important;
    }
    
    .carousel-reboot-prev {
        left: 8px;
    }
    
    .carousel-reboot-next {
        right: 8px;
    }
    
    .carousel-reboot-content {
        padding: 10px;
    }
    
    .youtube-item .carousel-reboot-content {
        padding: 8px;
    }
    
    .youtube-item .carousel-reboot-title {
        font-size: 12px;
        height: 2.2em;
    }
    
    .youtube-channel,
    .youtube-meta {
        font-size: 10px;
    }
    
    .play-button-overlay {
        width: 44px;
        height: 32px;
    }
    
    .video-duration {
        font-size: 9px;
        padding: 1px 3px;
        bottom: 4px;
        right: 4px;
    }
    
    .carousel-reboot-dots {
        margin-top: 10px;
        gap: 4px;
    }
    
    .carousel-reboot-dot {
        width: 6px;
        height: 6px;
    }
    
    .carousel-reboot-dot.active {
        width: 18px;
    }
}

/* 極小デバイス（320px以下） */
@media (max-width: 320px) {
    .carousel-reboot-wrapper {
        padding: 0 35px;
    }
    
    .carousel-reboot-prev,
    .carousel-reboot-next {
        width: 28px !important;
        height: 28px !important;
        font-size: 10px;
    }
    
    .youtube-item .carousel-reboot-title {
        font-size: 11px;
    }
    
    .youtube-channel,
    .youtube-meta {
        font-size: 9px;
    }
    
    .carousel-reboot-content {
        padding: 8px;
    }
    
    .youtube-item .carousel-reboot-content {
        padding: 6px;
    }
}

/* ==========================================================================
   高解像度ディスプレイ・テーマ対応
   ========================================================================== */

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .play-button-overlay svg {
        width: 64px;
        height: 46px;
    }
    
    @media (max-width: 768px) {
        .play-button-overlay svg {
            width: 54px;
            height: 40px;
        }
    }
    
    @media (max-width: 480px) {
        .play-button-overlay svg {
            width: 48px;
            height: 34px;
        }
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .carousel-reboot-item {
        background: #2a2a2a;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        border-color: #404040;
    }
    
    .carousel-reboot-item:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        border-color: #555;
    }
    
    .carousel-reboot-title {
        color: #f0f0f0 !important;
    }
    
    .youtube-item .carousel-reboot-title {
        color: #f0f0f0 !important;
    }
    
    .carousel-reboot-text {
        color: #ccc;
    }
    
    .youtube-channel {
        color: #8bb4d9 !important;
    }
    
    .youtube-meta {
        color: #bbb !important;
    }
    
    .thumbnail-placeholder {
        background: linear-gradient(135deg, #3a3a3a, #2a2a2a);
        color: #ccc;
        border-color: #555;
    }
    
    .image-placeholder {
        background: #3a3a3a;
        color: #ccc;
    }
    
    .carousel-reboot-item.loading {
        background-color: #333;
    }
    
    /* ダークモード用ナビゲーション */
    .carousel-reboot-prev,
    .carousel-reboot-next {
        background: rgba(40, 40, 40, 0.95) !important;
        color: #ccc !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    .carousel-reboot-prev:hover,
    .carousel-reboot-next:hover {
        background: rgba(50, 50, 50, 1) !important;
        color: #fff !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
    }
    
    .carousel-reboot-dot {
        background: #555;
    }
    
    .carousel-reboot-dot.active {
        background: #888;
    }
}

/* ==========================================================================
   デバッグ用CSS（開発時のみ使用）
   ========================================================================== */

/* デバッグ用CSS（開発時のみ使用） */
.carousel-reboot-wrapper.debug {
    border: 2px solid blue;
    position: relative;
}

.carousel-reboot-wrapper.debug .carousel-reboot-item {
    border: 1px solid red;
    position: relative;
}

.carousel-reboot-wrapper.debug .carousel-reboot-item::before {
    content: attr(data-index);
    position: absolute;
    top: 5px;
    left: 5px;
    background: red;
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    z-index: 100;
    border-radius: 3px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

.carousel-reboot-wrapper.debug .carousel-reboot-item.hidden {
    border-color: gray;
}

.carousel-reboot-wrapper.debug .carousel-reboot-item.hidden::before {
    background: gray;
    content: attr(data-index) " (hidden)";
}

/* **修正: デバッグ情報** */
.carousel-reboot-wrapper.debug::after {
    content: "Just Size: Fixed width calculation";
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: green;
    color: white;
    padding: 5px 10px;
    font-size: 11px;
    z-index: 1000;
    border-radius: 4px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

/* メディアクエリデバッグ表示（開発時のみ） */
.carousel-reboot-wrapper.debug::before {
    position: fixed;
    top: 10px;
    right: 10px;
    background: blue;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    z-index: 1000;
    border-radius: 3px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

@media (max-width: 480px) {
    .carousel-reboot-wrapper.debug::before {
        content: "Mobile - 1 item (≤480px)";
        background: red;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .carousel-reboot-wrapper.debug::before {
        content: "Mobile - 2 items (481-768px)";
        background: green;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .carousel-reboot-wrapper.debug::before {
        content: "Tablet - 3 items (769-1024px)";
        background: orange;
    }
}

@media (min-width: 1025px) {
    .carousel-reboot-wrapper.debug::before {
        content: "Desktop - 4+ items (≥1025px)";
        background: blue;
    }
}

/* ==========================================================================
   Cocoon環境対応（ジャストサイズ版）
   ========================================================================== */

/* Cocoonテーマとの調整 */
.cocoon-body .carousel-reboot-wrapper {
    max-width: 100%;
    position: relative !important;
    z-index: 1 !important;
}

.cocoon-body .carousel-reboot-item a {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cocoon-body .carousel-reboot-item a:hover {
    color: inherit !important;
    text-decoration: none !important;
}

.cocoon-body .carousel-reboot-item a:visited {
    color: inherit !important;
}

/* Cocoon環境での矢印ボタン強化 */
.cocoon-body .carousel-reboot-prev,
.cocoon-body .carousel-reboot-next {
    position: absolute !important;
    z-index: 1000 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #555 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    touch-action: manipulation !important;
}

.cocoon-body .carousel-reboot-prev:hover,
.cocoon-body .carousel-reboot-next:hover {
    background: rgba(255, 255, 255, 1) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    transform: translateY(-50%) scale(1.05) !important;
}

/* **修正: Cocoon環境でのタイトル黒枠完全削除（ジャストサイズ版）** */
.cocoon-body .carousel-reboot-title,
.cocoon-body .carousel-reboot-title *,
.cocoon-body .youtube-item .carousel-reboot-title,
.cocoon-body .youtube-item .carousel-reboot-title * {
    color: #333 !important;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    background-attachment: initial !important;
    background-clip: initial !important;
    background-origin: initial !important;
    background-position: initial !important;
    background-repeat: initial !important;
    background-size: initial !important;
    padding: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-weight: 500 !important;
    outline: none !important;
    text-indent: 0 !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
}

.cocoon-body .youtube-item .carousel-reboot-title,
.cocoon-body .youtube-item .carousel-reboot-title * {
    color: #333 !important;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    text-shadow: none !important;
}

.cocoon-body .youtube-channel,
.cocoon-body .youtube-channel * {
    color: #5a7fa0 !important;
    font-weight: 500 !important;
    background: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    text-shadow: none !important;
}

.cocoon-body .youtube-meta,
.cocoon-body .youtube-meta * {
    color: #777 !important;
    background: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    font-weight: 400 !important;
    text-shadow: none !important;
}

/* **修正: Cocoon環境でのアイテムサイズ制御** */
.cocoon-body .carousel-reboot-item {
    flex-shrink: 0 !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    /* JSで動的に設定される幅に依存 */
}

/* Cocoonダークモード対応 */
.skin-dark .carousel-reboot-item {
    background: #2a2a2a !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    border-color: #404040 !important;
}

.skin-dark .carousel-reboot-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    border-color: #555 !important;
}

.skin-dark .carousel-reboot-title {
    color: #f0f0f0 !important;
    background: none !important;
    background-color: transparent !important;
}

.skin-dark .youtube-item .carousel-reboot-title {
    color: #f0f0f0 !important;
    background: none !important;
    background-color: transparent !important;
}

.skin-dark .carousel-reboot-text {
    color: #ccc !important;
}

.skin-dark .youtube-channel {
    color: #8bb4d9 !important;
    background: none !important;
    background-color: transparent !important;
}

.skin-dark .youtube-meta {
    color: #bbb !important;
    background: none !important;
    background-color: transparent !important;
}

/* ダークモード用ナビゲーション */
.skin-dark .carousel-reboot-prev,
.skin-dark .carousel-reboot-next {
    background: rgba(40, 40, 40, 0.95) !important;
    color: #ccc !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.skin-dark .carousel-reboot-prev:hover,
.skin-dark .carousel-reboot-next:hover {
    background: rgba(50, 50, 50, 1) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* ==========================================================================
   パフォーマンス最適化・アクセシビリティ対応
   ========================================================================== */

/* パフォーマンス最適化 */
.carousel-reboot-item img,
.youtube-thumbnail-wrapper,
.play-button-overlay {
    will-change: transform;
}

.carousel-reboot-wrapper.loading .carousel-reboot {
    opacity: 0.7;
    pointer-events: none;
}

/* 非表示アイテムのパフォーマンス最適化 */
.carousel-reboot-item.hidden * {
    visibility: hidden;
    pointer-events: none;
}

/* GPUアクセラレーションの最適化 */
.carousel-reboot {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.carousel-reboot-item {
    transform: translateZ(0);
}

/* タッチデバイスでの最適化 */
@media (pointer: coarse) {
    .carousel-reboot-prev,
    .carousel-reboot-next {
        min-width: 40px !important;
        min-height: 40px !important;
        touch-action: manipulation !important;
    }
    
    .carousel-reboot-dot {
        min-width: 40px !important;
        min-height: 40px !important;
        touch-action: manipulation !important;
    }
}

/* 印刷時の調整 */
@media print {
    .carousel-reboot-prev,
    .carousel-reboot-next,
    .carousel-reboot-dots,
    .play-button-overlay,
    .video-duration {
        display: none !important;
    }
    
    .carousel-reboot-wrapper {
        padding: 0;
        margin: 15px 0;
        overflow: visible;
    }
    
    .carousel-reboot {
        display: block;
        transform: none !important;
        gap: 0;
    }
    
    .carousel-reboot-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-bottom: 15px;
        page-break-inside: avoid;
        flex: none;
        width: 100%;
        max-width: 100%;
        min-width: auto;
    }
    
    .carousel-reboot-item.hidden {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .carousel-reboot-item img {
        height: 140px;
    }
    
    .youtube-thumbnail-wrapper {
        height: 140px;
    }
}

/* アニメーション無効化設定（ユーザー設定考慮） */
@media (prefers-reduced-motion: reduce) {
    .carousel-reboot {
        transition: none;
    }
    
    .carousel-reboot-item,
    .carousel-reboot-item img,
    .play-button-overlay,
    .carousel-reboot-prev,
    .carousel-reboot-next,
    .carousel-reboot-dot {
        transition: none;
    }
    
    .carousel-reboot-item:hover {
        transform: none;
    }
    
    .carousel-reboot-item:hover .play-button-overlay {
        transform: translate(-50%, -50%);
    }
    
    .carousel-reboot-item:hover img {
        transform: none;
    }
    
    @keyframes spin {
        0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    }
}

/* **修正: 高コントラスト環境でのアクセシビリティ改善** */
@media (prefers-contrast: high) {
    .carousel-reboot-title {
        color: #000000 !important;
        font-weight: bold !important;
        background: none !important;
        background-color: transparent !important;
        border: none !important;
        text-shadow: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    .youtube-channel {
        color: #0000cc !important;
        font-weight: bold !important;
        background: none !important;
        background-color: transparent !important;
        border: none !important;
        padding: 0 !important;
    }
    
    .youtube-meta {
        color: #000000 !important;
        font-weight: bold !important;
        background: none !important;
        background-color: transparent !important;
        border: none !important;
        padding: 0 !important;
    }
    
    .carousel-reboot-prev,
    .carousel-reboot-next {
        background: #ffffff !important;
        color: #000000 !important;
        border: 2px solid #000000 !important;
    }
    
    .carousel-reboot-item {
        border: 1px solid #000000 !important;
    }
}

/* コンパクトモード */
.carousel-reboot-wrapper.compact-mode .carousel-reboot-content {
    padding: 10px;
}

.carousel-reboot-wrapper.compact-mode .carousel-reboot-title {
    font-size: 13px;
    margin-bottom: 3px;
    -webkit-line-clamp: 1;
    height: 1.3em;
}

.carousel-reboot-wrapper.compact-mode .youtube-channel {
    font-size: 11px;
    margin: 3px 0 2px;
}

.carousel-reboot-wrapper.compact-mode .youtube-meta {
    font-size: 10px;
    margin-top: 3px;
}

.carousel-reboot-wrapper.compact-mode .carousel-reboot-text {
    font-size: 11px;
    margin-top: 4px;
    -webkit-line-clamp: 1;
    height: 1.2em;
}

/* スムーズスクロール */
.carousel-reboot-wrapper {
    scroll-behavior: smooth;
}

/* フォーカス管理の改善 */
.carousel-reboot-item:focus-within {
    outline: 2px solid #4169e1;
    outline-offset: 2px;
    z-index: 5;
    position: relative;
}

.carousel-reboot-item a:focus {
    outline: none;
}

/* レガシーブラウザ対応 */
/* Internet Explorer対応 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .carousel-reboot-item {
        flex: 0 0 25%; /* 4個表示用 */
        min-width: 200px;
    }
    
    .carousel-reboot-title,
    .carousel-reboot-text {
        /* IE用の行数制限フォールバック */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Safari対応 */
@supports (-webkit-appearance: none) {
    .carousel-reboot-item img {
        -webkit-transform: translateZ(0);
    }
}