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

:root {
    --primary: #9147ff;
    --primary-dark: #772ce8;
    --primary-light: #a970ff;
    --accent: #00d4aa;
    --star: #ffc107;

    --bg-primary: #0e0e10;
    --bg-secondary: #18181b;
    --bg-tertiary: #1f1f23;
    --bg-hover: #26262c;
    --bg-active: #323238;

    --text-primary: #efeff1;
    --text-secondary: #adadb8;
    --text-muted: #848494;

    --live: #eb0400;
    --success: #00d4aa;
    --error: #eb0400;

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

    --sidebar-width: 300px;
    --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);
}

*,
*::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(--primary-light);
    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;
}

.twitch-icon {
    width: 28px;
    height: 28px;
    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);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

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

.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);
    transform: scale(1.05);
}

.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;
}

.streamer-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.streamer-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;
}

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

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

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

.live-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--live);
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
}

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

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

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

.streamer-status.live {
    color: var(--live);
}

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

.streamer-item:hover .follow-btn {
    opacity: 1;
}

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

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

.follow-btn.followed svg {
    fill: var(--primary);
}

.btn-load-more {
    margin: 16px;
    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);
}

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

.player-container {
    max-width: 1200px;
    margin: 0 auto;
}

.player-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Archive Player Specific Override */
#archive-player-wrapper {
    aspect-ratio: auto;
    height: 75vh;
    min-height: 600px;
    display: block;
    overflow: visible;
    /* Ensure chat isn't clipped */
}

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

/* Split Layout Styles */
.player-wrapper.with-chat {
    display: flex !important;
    align-items: stretch;
}

#archive-player-wrapper.with-chat {
    display: flex !important;
}

.video-container {
    flex: 1;
    height: 100%;
    background: #000;
}

.chat-container {
    width: 340px;
    height: 100%;
    background: #0e0e10;
    border-left: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.player-wrapper:not(.with-chat) .chat-container {
    display: none;
}

.placeholder-content {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.placeholder-content.small {
    transform: scale(0.8);
    padding: 20px;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    fill: var(--text-muted);
    margin-bottom: 16px;
}

.placeholder-content .sub-text {
    font-size: 0.9rem;
    margin-top: 8px;
    opacity: 0.7;
}

.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);
}

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

.streamer-archives-section {
    margin-top: 24px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}

/* 4分割 */
.split-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    height: calc(100vh - var(--header-height) - 40px);
}

.split-player {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-player:hover {
    box-shadow: 0 0 0 2px var(--primary);
}

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

.split-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all var(--transition-fast);
}

.split-close-btn:hover {
    background: var(--error);
}

/* ===================================
   モーダル共通
   =================================== */
.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;
}

.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);
    }
}

/* プロフィール */
.profile-modal-content {
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.profile-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

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

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

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

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

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

.profile-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.status-live {
    color: var(--live);
    font-weight: 600;
}

.status-offline {
    color: var(--text-muted);
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

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

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

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

/* アーカイブ */
.archive-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 24px;
}

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

.archive-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
}

.archive-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: 250px;
}

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

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

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

.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: 16px;
}

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

.archive-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.archive-meta .game-name {
    color: var(--primary-light);
}

/* お気に入り★ */
.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);
}

/* ===================================
   再生リストモーダル
   =================================== */
.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 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.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;
}

.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;
}

.subfolders-section {
    margin-bottom: 24px;
}

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

.folder-archives {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* お気に入りから追加 (Detailed List) */
.add-favorites-modal-content {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    margin-bottom: 20px;
}

.selectable-archives-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 20px;
}

.selectable-archives {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selectable-archive-item {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

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

.selectable-archive-item.selected {
    border-color: var(--primary);
    background: rgba(145, 71, 255, 0.1);
}

.selectable-archive-item .thumbnail {
    width: 160px;
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

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

.selectable-archive-item .check-mark {
    position: absolute;
    inset: 0;
    background: rgba(145, 71, 255, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
}

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

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

.selectable-archive-item .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.selectable-archive-item .title {
    font-weight: 600;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.modal-footer {
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

/* アーカイブプレイヤー */
.archive-player-modal-content {
    max-width: 1200px;
    max-height: 95vh;
}

.archive-player-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

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

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

/* ボタン */
.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;
}

.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(145, 71, 255, 0.4);
}

.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);
}

.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);
}

/* 確認ダイアログ */
.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;
}

/* フォーム */
.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:focus {
    outline: none;
    border-color: var(--primary);
}

/* トースト */
#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(0, 212, 170, 0.4);
}

.toast.error {
    border-color: rgba(235, 4, 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;
    margin: 40px auto;
}

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

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

    .content {
        margin-left: 0;
    }

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

    .split-container {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
    }

    .profile-modal-content,
    .playlist-modal-content,
    .folder-modal-content {
        max-height: 95vh;
        padding: 20px;
    }

    .archive-search input {
        width: 150px;
    }
}

/* ===================================
   設定モーダル・ブロック機能
   =================================== */
.settings-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.blocked-users-list {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 8px;
}

.blocked-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
}

.blocked-user-item:last-child {
    border-bottom: none;
}

.unblock-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

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

/* プレイヤーヘッダーとブロックボタン */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.player-title-box {
    flex: 1;
}

.btn-danger-small {
    padding: 8px 16px;
    background: rgba(235, 4, 0, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.btn-danger-small:hover {
    background: var(--error);
    color: white;
}

/* Chat Toggle & Flex Player */
.player-container {
    display: flex;
    flex-direction: column;
}

.player-wrapper {
    /* aspect-ratio: 16 / 9;  Removed or overridden when in flex mode */
    display: flex;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.player-wrapper.with-chat {
    aspect-ratio: auto;
    height: calc(100vh - var(--header-height) - 100px);
    max-height: 800px;
}

.video-container {
    flex: 1;
    position: relative;
    background: black;
    height: 100%;
    min-width: 0;
}

.chat-container {
    width: 340px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--glass-border);
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease;
}

.chat-container.hidden {
    display: none;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.player-header button {
    margin-left: 10px;
}

.btn-toggle-chat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid var(--glass-border);
}

.btn-toggle-chat:hover {
    background: var(--bg-active);
}

.video-container iframe,
.chat-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}