@charset "UTF-8";
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
    padding: 20px 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    backdrop-filter: blur(15px);
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #ffffff, #a970ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    backdrop-filter: blur(20px);
}

.filter-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: bold;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-controls select {
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-controls select:hover {
    border-color: #9146ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(145, 70, 255, 0.2);
}

.filter-controls select:focus {
    outline: none;
    border-color: #9146ff;
    box-shadow: 0 0 0 3px rgba(145, 70, 255, 0.1);
}

/* 並び順セレクトボックス用の特別なスタイリング */
.filter-controls select[id="sortSelector"] {
    background: linear-gradient(135deg, #f8f4ff, #fff);
    border: 2px solid #e1e5e9;
    position: relative;
}

.filter-controls select[id="sortSelector"]:focus {
    border-color: #9146ff;
    background: linear-gradient(135deg, #f0e6ff, #fff);
}

.filter-controls select[id="sortSelector"] option {
    background: white;
    color: #333;
    padding: 8px;
}

.filter-controls select[id="sortSelector"] option:hover {
    background: #f8f4ff;
}

.stats {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 14px;
    background: rgba(255,255,255,0.7);
    padding: 12px;
    border-radius: 8px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 25px;
    align-items: start;
}

.player-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 20px;
}

.player-container {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #000428, #004e92);
    border-radius: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.player-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0.8;
}

.player-placeholder .icon {
    font-size: 5em;
    opacity: 0.6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.current-clip-info {
    padding: 16px 18px;
    background: linear-gradient(135deg, #f8f4ff, #fff);
    border-radius: 12px;
    border-left: 4px solid #9146ff;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(145, 70, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.current-clip-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(145, 70, 255, 0.15);
}

.current-clip-info .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 0;
    font-weight: 500;
    gap: 12px;
    flex-wrap: wrap;
}

/* 日付を含む2番目のmetaセクションを右上に配置 */
.current-clip-info .meta:last-child {
    position: absolute;
    top: 16px;
    right: 18px;
    margin: 0;
}

.current-clip-info h4 {
    margin-bottom: 12px;
    margin-right: 80px; /* 日付のスペースを確保 */
    color: #2d3748;
    font-size: 1.1em;
    line-height: 1.4;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.clips-list {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    backdrop-filter: blur(20px);
    /* Player sectionの高さに合わせる調整 */
    max-height: calc(400px + 190px); /* player-container + current-clip-info + padding */
    overflow-y: auto;
}

.clips-list h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4em;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 3px solid #f0f0f0;
    position: relative;
}

.clips-list h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #9146ff, #a970ff);
    border-radius: 2px;
}

.clip-grid {
    display: flex;
    flex-direction: column;
    gap: 12px; /* 間隔を20pxから12pxに縮小 */
}

.clip-item {
    background: white;
    border: 2px solid #f5f5f5;
    border-radius: 15px; /* 20pxから15pxに縮小 */
    padding: 15px; /* 25pxから15pxに縮小 */
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.clip-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px; /* 5pxから4pxに縮小 */
    background: linear-gradient(90deg, #9146ff, #a970ff);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.clip-item:hover {
    border-color: #9146ff;
    transform: translateY(-3px); /* -5pxから-3pxに縮小 */
    box-shadow: 0 15px 40px rgba(145, 70, 255, 0.25);
}

.clip-item:hover::before {
    transform: scaleX(1);
}

.clip-item.active {
    border-color: #9146ff;
    background: linear-gradient(135deg, #f8f4ff, #fff);
    transform: translateY(-2px); /* -3pxから-2pxに縮小 */
    box-shadow: 0 15px 40px rgba(145, 70, 255, 0.35);
}

.clip-item.active::before {
    transform: scaleX(1);
}

/* 無効なクリップIDのスタイル */
.clip-item.invalid-clip {
    background: linear-gradient(135deg, #fafafa, #fff);  /* ほぼ白い背景 */
    border-color: #e0e0e0;  /* 薄いグレーのボーダー */
}

.clip-item.invalid-clip::before {
    background: linear-gradient(90deg, #9e9e9e, #757575);  /* グレーのライン */
}

.clip-item.invalid-clip:hover {
    border-color: #bdbdbd;  /* ホバー時も控えめなグレー */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.clip-item.invalid-clip.active {
    background: linear-gradient(135deg, #f5f5f5, #fff);
    border-color: #9e9e9e;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.invalid-badge {
    position: absolute;
    top: 8px; /* 10pxから8pxに縮小 */
    right: 8px; /* 10pxから8pxに縮小 */
    background: #e0e0e0;  /* 薄いグレー背景 */
    color: #616161;  /* ダークグレーの文字 */
    font-size: 10px;  /* 小さめのフォント */
    font-weight: normal;  /* 通常の太さ */
    padding: 2px 5px; /* 3px 6pxから2px 5pxに縮小 */
    border-radius: 8px; /* 10pxから8pxに縮小 */
    box-shadow: none;  /* 影を削除 */
}

/* デフォルト順序による特別なスタイリング */
.clip-item[data-sort-type="default"] {
    position: relative;
}

.clip-item[data-sort-type="default"]::after {
    content: '📌';
    position: absolute;
    top: 12px; /* 15pxから12pxに縮小 */
    right: 12px; /* 15pxから12pxに縮小 */
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.clip-item[data-sort-type="default"]:hover::after {
    opacity: 1;
}

/* サムネイル表示機能のスタイル */
.clip-item.with-thumbnail {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    min-height: 120px;
}

.clip-item.no-thumbnail {
    display: block;
}

.clip-thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.clip-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.clip-item:hover .clip-thumbnail img {
    transform: scale(1.05);
}

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #6c757d;
    font-size: 11px;
    text-align: center;
}

.placeholder-icon {
    font-size: 24px;
    margin-bottom: 4px;
    opacity: 0.7;
}

.placeholder-text {
    font-weight: 500;
    line-height: 1.2;
}

.clip-content {
    flex: 1;
    min-width: 0;
}

/* サムネイル有効時のクリップタイトル調整 */
.clip-item.with-thumbnail .clip-title {
    margin-bottom: 8px;
    font-size: 1.05em;
    line-height: 1.3;
    font-weight: bold;
    color: #333;
}

/* サムネイル有効時のメタ情報調整 */
.clip-item.with-thumbnail .clip-meta {
    margin-bottom: 8px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
}

/* サムネイル有効時の統計情報調整 */
.clip-item.with-thumbnail .clip-stats {
    gap: 12px;
    font-size: 11px;
    display: flex;
    color: #888;
}

/* サムネイル有効時のプレイインジケータ調整 */
.clip-item.with-thumbnail .play-indicator {
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    font-size: 11px;
}

/* サムネイル有効時の無効バッジ調整 */
.clip-item.with-thumbnail .invalid-badge {
    top: 6px;
    right: 6px;
    padding: 2px 4px;
    font-size: 9px;
}

/* サムネイル無効時の従来スタイル維持 */
.clip-item.no-thumbnail .clip-title {
    font-weight: bold;
    margin-bottom: 10px; /* 15pxから10pxに縮小 */
    color: #333;
    font-size: 1.1em; /* 1.2emから1.1emに縮小 */
    line-height: 1.3; /* 1.4から1.3に縮小 */
}

.clip-item.no-thumbnail .clip-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px; /* 14pxから13pxに縮小 */
    color: #666;
    margin-bottom: 10px; /* 15pxから10pxに縮小 */
}

.clip-item.no-thumbnail .clip-stats {
    display: flex;
    gap: 15px; /* 20pxから15pxに縮小 */
    font-size: 12px; /* 13pxから12pxに縮小 */
    color: #888;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px; /* 6pxから5pxに縮小 */
    background: #f8f9fa;
    padding: 4px 10px; /* 6px 12pxから4px 10pxに縮小 */
    border-radius: 6px; /* 8pxから6pxに縮小 */
}

/* 統計アイテムの特別な色分け */
.stat-item:first-child {
    background: linear-gradient(135deg, #e3f2fd, #f8f9fa);
    color: #1976d2;
}

.stat-item:last-child {
    background: linear-gradient(135deg, #f3e5f5, #f8f9fa);
    color: #7b1fa2;
}

.play-indicator {
    position: absolute;
    top: 15px; /* 20pxから15pxに縮小 */
    right: 15px; /* 20pxから15pxに縮小 */
    background: rgba(145, 70, 255, 0.9);
    color: white;
    padding: 6px 12px; /* 8px 15pxから6px 12pxに縮小 */
    border-radius: 15px; /* 20pxから15pxに縮小 */
    font-size: 12px; /* 13pxから12pxに縮小 */
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.clip-item:hover .play-indicator {
    opacity: 1;
    transform: scale(1.05);
}

.clip-item.active .play-indicator {
    opacity: 1;
    background: rgba(145, 70, 255, 1);
    transform: scale(1.05);
}

/* 無効なクリップのプレイインジケータ */
.invalid-clip .play-indicator {
    background: rgba(158, 158, 158, 0.9);  /* グレー */
}

.invalid-clip:hover .play-indicator {
    background: rgba(117, 117, 117, 1);  /* 少し濃いグレー */
}

.empty-state {
    text-align: center;
    color: #666;
    padding: 80px 20px;
    font-style: italic;
}

.empty-state .icon {
    font-size: 5em;
    margin-bottom: 25px;
    opacity: 0.3;
}

.loading {
    text-align: center;
    padding: 60px;
    color: #666;
    font-size: 18px;
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 33% { content: '.'; }
    34%, 66% { content: '..'; }
    67%, 100% { content: '...'; }
}

.refresh-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #9146ff, #a970ff);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(145, 70, 255, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.refresh-button:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 6px 25px rgba(145, 70, 255, 0.6);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: rgba(40, 167, 69, 0.95);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: rgba(220, 53, 69, 0.95);
}

/* クリップ情報の詳細スタイリング */
.current-clip-info #clipCreator {
    background: rgba(145, 70, 255, 0.1);
    color: #6b46c1;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.current-clip-info #clipViews {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.current-clip-info #clipDate {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 11px;
    white-space: nowrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .current-clip-info {
        padding: 14px 16px;
    }

    .current-clip-info h4 {
        font-size: 1em;
        margin-bottom: 10px;
        margin-right: 70px;
    }

    .current-clip-info .meta {
        font-size: 12px;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .current-clip-info .meta:last-child {
        top: 14px;
        right: 16px;
    }

    .current-clip-info #clipDate {
        font-size: 10px;
        padding: 2px 5px;
    }

    /* サムネイル表示のモバイル対応 */
    .clip-item.with-thumbnail {
        flex-direction: column;
        gap: 10px;
        min-height: auto;
    }

    .clip-thumbnail {
        width: 100%;
        height: 100px;
        align-self: center;
        max-width: 200px;
    }

    .clip-item.with-thumbnail .clip-title {
        font-size: 1em;
    }

    .clip-item.with-thumbnail .clip-meta {
        font-size: 11px;
    }

    .clip-item.with-thumbnail .clip-stats {
        font-size: 10px;
        gap: 8px;
    }
}

@media (max-width: 1300px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .player-section {
        position: relative;
        top: 0;
    }

    .clips-list {
        max-height: 85vh; /* モバイルでは元の高さに戻す */
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        align-items: stretch;
    }

    .filter-controls select {
        min-width: 100%;
    }

    .container {
        padding: 15px;
    }

    .controls, .player-section, .clips-list {
        padding: 20px;
    }

    .player-container {
        height: 250px;
    }

    /* モバイルでの clip-item 調整 */
    .clip-item {
        padding: 12px;
    }

    .clip-title {
        font-size: 1em;
    }

    .clip-meta {
        font-size: 12px;
    }

    .clip-stats {
        font-size: 11px;
        gap: 10px;
    }

    .stat-item {
        padding: 3px 8px;
    }
}

/* スクロールバーのスタイリング */
.clips-list::-webkit-scrollbar {
    width: 10px;
}

.clips-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.clips-list::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #9146ff, #a970ff);
    border-radius: 5px;
}

.clips-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #7c3aed, #8b5cf6);
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border-left: 4px solid #dc3545;
}

.twitch-player-container {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
}