/* ===================================
   YouTube Custom Viewer - スタイルシート
   =================================== */

:root {
    --primary: #ff0000;
    --primary-dark: #cc0000;
    --primary-light: #ff4444;
    --secondary: #1f1f23;
    --accent: #065fd4;

    --bg-primary: #0f0f0f;
    --bg-secondary: #181818;
    --bg-tertiary: #212121;
    --bg-hover: #272727;
    --bg-active: #3a3a3a;

    --text-primary: #f1f1f1;
    --text-secondary: #aaaaaa;
    --text-muted: #717171;

    --glass-bg: rgba(24, 24, 24, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);

    --sidebar-width: 280px;
    --header-height: 56px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --star: #ffc107;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    background: transparent;
}

input {
    font-family: inherit;
}

.hidden {
    display: none !important;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* ===================================
   上部ナビゲーション
   =================================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

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

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.back-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.youtube-icon {
    width: 32px;
    height: 32px;
    fill: var(--primary);
}

.nav-center {
    display: flex;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ===================================
   メインコンテナ
   =================================== */
.main-container {
    display: flex;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ===================================
   サイドバー
   =================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.search-container {
    padding: 16px;
    display: flex;
    gap: 8px;
}

.search-container input {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.search-icon:hover {
    background: var(--primary-dark);
}

.search-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* タブ */
.tab-container {
    display: flex;
    padding: 0 16px;
    gap: 8px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    background: var(--bg-hover);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

/* アイテムリスト */
.item-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
    position: relative;
}

.list-item:hover {
    background: var(--bg-hover);
}

.list-item.active {
    background: var(--bg-active);
}

.item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    overflow: hidden;
}

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

.item-avatar.playlist {
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
}

.item-avatar.playlist svg {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.list-item:hover .item-actions {
    opacity: 1;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
}

.action-btn:hover svg {
    fill: var(--primary);
}

.action-btn.delete:hover {
    background: rgba(255, 0, 0, 0.1);
}

.action-btn.delete:hover svg {
    fill: var(--primary);
}

/* 追加ボタン */
.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    border: 2px dashed var(--glass-border);
    transition: all var(--transition-fast);
}

.add-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.add-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ===================================
   メインコンテンツ
   =================================== */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    overflow-y: auto;
}

/* おすすめセクション */
.recommendations-container {
    max-width: 1600px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.video-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

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

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.video-info {
    padding: 12px 16px;
    display: flex;
    gap: 12px;
}

.video-channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    overflow: hidden;
}

.video-channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-details {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.video-meta .channel-name {
    color: var(--text-secondary);
}

/* プレイヤービュー */
.player-container {
    max-width: 1200px;
    margin: 0 auto;
}

.close-player-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    transition: all var(--transition-fast);
}

.close-player-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.close-player-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.player-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.player-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.player-info {
    padding: 20px 0;
}

.player-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.player-info p {
    color: var(--text-secondary);
}

/* ===================================
   モーダル
   =================================== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 420px;
    padding: 32px;
    border-radius: var(--border-radius-lg);
    animation: slideUp 0.3s ease;
}

.channel-modal-content {
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.settings-modal {
    max-width: 500px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.checkbox-group {
    margin-bottom: 20px;
}

.checkbox-group label,
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"],
.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
}

/* ===================================
   設定モーダル
   =================================== */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.channel-checklist {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 12px;
}

.channel-checklist .checkbox-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.channel-checklist .checkbox-item:last-child {
    border-bottom: none;
}

/* ===================================
   チャンネルモーダル
   =================================== */
.channel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.channel-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.channel-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}

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

.channel-info {
    flex: 1;
}

.channel-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.channel-subscribers {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.channel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-recommend {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-recommend:hover {
    opacity: 0.9;
}

.btn-recommend.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-delete {
    padding: 10px 20px;
    background: rgba(255, 0, 0, 0.1);
    color: var(--primary);
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-delete:hover {
    background: rgba(255, 0, 0, 0.2);
}

.channel-videos-section {
    flex: 1;
    overflow: hidden;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
}

.channel-videos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
    flex-shrink: 0;
}

.channel-videos-title-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

.channel-videos-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    margin-bottom: 0;
}

.video-filter-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
}

.filter-tab {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.filter-tab.active {
    background: var(--bg-active);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.video-search {
    flex-shrink: 0;
}

.channel-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding-right: 8px;
}

/* ===================================
   確認ダイアログ
   =================================== */
.confirm-dialog {
    text-align: center;
    max-width: 400px;
}

.confirm-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

/* ===================================
   トースト
   =================================== */
#toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    backdrop-filter: blur(20px);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow-lg);
}

.toast.success {
    border-color: rgba(6, 95, 212, 0.4);
}

.toast.error {
    border-color: rgba(255, 0, 0, 0.4);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ===================================
   ローディング
   =================================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    fill: var(--text-muted);
    margin-bottom: 16px;
}

/* ===================================
   レスポンシブ
   =================================== */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: 40vh;
    }

    .content {
        margin-left: 0;
    }

    .main-container {
        flex-direction: column;
    }

    .channel-modal-content {
        max-height: 95vh;
        padding: 20px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   追加スタイル
   =================================== */

/* 動画お気に入り★ */
.video-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all var(--transition-fast);
}

.video-favorite svg {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    transition: all var(--transition-fast);
}

.video-favorite:hover svg,
.video-favorite.active svg {
    fill: var(--star);
}

/* チャンネル説明 */
.channel-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 動画検索 */
.channel-videos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.channel-videos-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    margin: 0;
}

.video-search input {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    width: 200px;
}

.video-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.channel-videos-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

/* もっと読み込むボタン */
.btn-load-more {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 24px auto;
    padding: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-load-more:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* 再生リストモーダル */
.playlist-modal-content {
    max-width: 1100px;
    max-height: 90vh;
    overflow: hidden;
}

.playlist-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.playlist-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
}

.section-title .count {
    background: var(--bg-tertiary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.star-icon {
    width: 20px;
    height: 20px;
}

.star-icon.filled {
    fill: var(--star);
}

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* フォルダリスト */
.folders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.folder-item:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.folder-item svg {
    width: 32px;
    height: 32px;
    fill: var(--primary-light);
    flex-shrink: 0;
}

.folder-item .folder-info {
    flex: 1;
}

.folder-item .folder-name {
    font-weight: 600;
}

.folder-item .folder-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* フォルダモーダル */
.folder-modal-content {
    max-width: 1100px;
    max-height: 90vh;
    overflow: hidden;
}

.folder-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.folder-header h2 {
    flex: 1;
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
}

.folder-actions {
    display: flex;
    gap: 8px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-back:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-back svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.btn-danger-small {
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-weight: 500;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.btn-danger-small:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* アーカイブスタイル (再利用) */
.archive-item {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.archive-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.archive-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

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

.archive-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.archive-info {
    padding: 12px;
}

.archive-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.archive-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all var(--transition-fast);
}

.archive-favorite svg {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    transition: all var(--transition-fast);
}

.archive-favorite:hover svg,
.archive-favorite.active svg {
    fill: var(--star);
}

/* お気に入りから追加モーダル */
.selectable-archives {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.selectable-archive {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.selectable-archive img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.selectable-archive.selected {
    box-shadow: 0 0 0 3px var(--primary);
}

.selectable-archive .check-mark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.selectable-archive.selected .check-mark {
    display: flex;
}

.selectable-archive .check-mark svg {
    width: 16px;
    height: 16px;
    fill: white;
}

/* チャンネル登録ボタン */
.btn-subscribe {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-subscribe:hover {
    background: var(--primary-dark);
}

.btn-subscribe.subscribed {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.video-channel-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===================================
   ジャンル別セクション
   =================================== */
.genre-section {
    margin-bottom: 40px;
}

.genre-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.genre-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.genre-nav {
    display: flex;
    gap: 8px;
}

.genre-scroll-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.genre-scroll-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.genre-scroll-btn:active {
    transform: scale(0.95);
}

.genre-scroll-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-secondary);
}

.genre-scroll-btn:hover svg {
    fill: var(--text-primary);
}

.genre-carousel-container {
    position: relative;
    overflow: hidden;
}

.genre-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 4px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.genre-carousel::-webkit-scrollbar {
    display: none;
}

.genre-carousel .video-card {
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
}

.all-recommendations {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--glass-border);
}

.all-recommendations .genre-title {
    margin-bottom: 20px;
}

/* ローディングスピナー for genre carousel */
.genre-carousel .loading-spinner {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.genre-carousel:empty::after {
    content: '読み込み中...';
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 20px;
}

/* ===================================
   ショート動画 / 拡張プレイヤー
   =================================== */

/* プレイヤーのスクロール対応 */
.player-container {
    padding-bottom: 40px;
    height: 100%;
    overflow-y: auto;
    /* スクロールバーのスタイル（必要に応じて） */
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) var(--bg-primary);
}

.player-content-scroll {
    min-height: 100%;
    position: relative;
    padding-bottom: 40px;
}

/* 関連動画セクション */
.related-videos-section {
    margin-top: 32px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}

.related-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ショート動画コンテナ */
.shorts-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 2000;
    /* ナビゲーションより上 */
    display: flex;
    justify-content: center;
}

.shorts-scroll-wrapper {
    width: 100%;
    max-width: 480px;
    /* モバイル画面サイズくらいに制限 */
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    /* スクロールバー非表示 */
}

.shorts-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.shorts-video-slide {
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    position: relative;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shorts-iframe-wrapper {
    width: 100%;
    height: 100%;
    pointer-events: all;
}

.shorts-iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

/* ショート用のコントロール */
.close-shorts-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    /* 左上に配置 */
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2100;
    transition: background 0.2s;
}

.close-shorts-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.close-shorts-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.shorts-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
    /* 下の要素をクリック可能にする場合 */
    z-index: 2050;
}

.shorts-info-overlay * {
    pointer-events: auto;
}

.shorts-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.shorts-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 500;
}

border: 1px solid rgba(255, 255, 255, 0.5);
}

/* プレイヤーヘッダーのプロフィールリンク */
.player-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.channel-link-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.channel-link-container:hover {
    background: var(--bg-active);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.channel-icon-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.channel-icon-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}