:root {
    --sidebar-bg: #181c24;
    --sidebar-bg-light: #f9fafb;
    --sidebar-primary: #2563eb;
    --sidebar-border: #232730;
    --sidebar-border-light: #e5e7eb;
    --sidebar-radius: 14px;
    --sidebar-shadow: 0 4px 40px 0 rgba(0,0,0,0.11);
}
body {
    margin: 0;
    padding: 0;
    background: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
    transition: background 0.3s, color 0.3s;
}
body.light {
    background: #f7f9fa;
    color: #222;
}
.container {
    display: flex;
    height: 100vh;
    position: relative;
}
#player {
    width: 100%;
    height: 100vh;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-radius: var(--sidebar-radius) 0 0 var(--sidebar-radius);
    box-shadow: var(--sidebar-shadow);
    z-index: 22;
    border-left: 1.5px solid var(--sidebar-border);
    overflow: hidden;
}
.sidebar.light {
    background: var(--sidebar-bg-light);
    color: #232323;
    border-left: 1.5px solid var(--sidebar-border-light);
}
.sidebar.hidden {
    transform: translateX(110%);
    box-shadow: none;
}
.sidebar-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.sidebar-footer {
    flex-shrink: 0;
    background: transparent;
    width: 100%;
    font-size: 0.92rem;
    text-align: center;
    color: #bbb;
    border-top: 1px solid var(--sidebar-border);
    padding: 10px 0 10px 0;
}
.sidebar.light .sidebar-footer {
    color: #909090;
    border-top: 1.5px solid var(--sidebar-border-light);
}
.sidebar-toggle,
.theme-toggle-btn {
    position: fixed;
    top: 6px;
    z-index: 41;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #232532;
    color: #e0e0e0;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 1px 8px 0 rgba(0,0,0,0.13);
    transition: background 0.18s, color 0.18s, right 0.25s;
}
.theme-toggle-btn { right: 78px; }
.sidebar-toggle { right: 24px; }
.sidebar-toggle.light,
.theme-toggle-btn.light { background: #e5e7eb; color: #232323; }
.sidebar-toggle:hover,
.theme-toggle-btn:hover { background: #363b48; }
.sidebar-toggle.light:hover,
.theme-toggle-btn.light:hover { background: #f1f2f5; }
.localtime-bar {
    position: fixed;
    top: 10px;
    left: 18px;
    z-index: 100;
    background: rgba(25,28,36,0.90);
    color: #fff;
    font-size: 1.03rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 5px 14px 4px 14px;
    border-radius: 23px;
    box-shadow: 0 1px 7px 0 rgba(0,0,0,0.10);
    user-select: none;
    min-width: 120px;
    text-align: center;
    pointer-events: none;
}
body.light .localtime-bar { background: #e5e7eb; color: #222; }
.upload-panel, .search-panel {
    padding: 13px 18px 0 18px;
    background: transparent;
}
.upload-panel h3 {
    font-size: 1.08rem;
    margin: 0 0 8px 0;
    font-weight: 600;
}
.upload-panel input[type="file"] {
    width: 90%;
    padding: 10px 13px;
    margin: 6px 0px 6px 0px;
    background: #232532;
    color: #e0e0e0;
    border: 1.5px solid #232730;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.2s, background 0.2s;
}
.upload-panel input[type="file"].light { background: #f5f6f7; color: #232323; border: 1.5px solid #e5e7eb; }
.url-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
#urlInput {
    flex: 1 1 0px;
    padding: 10px 13px;
    background: #232532;
    color: #e0e0e0;
    border: 1.5px solid #232730;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.2s, background 0.2s;
}
#urlInput.light {
    background: #f5f6f7;
    color: #232323;
    border: 1.5px solid #e5e7eb;
}
#loadUrl {
    background: var(--sidebar-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    padding: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    margin-left: 4px;
    font-size: 1.1rem;
    transition: background 0.19s;
}
#loadUrl:hover { background: #1e40af; }
#loadUrl.light { background: #e5e7eb; color: #222; }
#loadUrl.light:hover { background: #d1d5db; }
.search-panel input[type="text"] {
    width: 90%;
    padding: 10px 13px;
    margin-bottom: 4px;
    background: #232532;
    color: #e0e0e0;
    border: 1.5px solid #232730;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.2s, background 0.2s;
}
.search-panel input[type="text"].light {
    background: #f5f6f7;
    color: #232323;
    border: 1.5px solid #e5e7eb;
}
.tabs {
    display: flex;
    border-bottom: 1.5px solid var(--sidebar-border);
    margin: 5px 0 0 0;
    padding: 0 10px 0 10px;
}
.tabs.light { border-bottom-color: var(--sidebar-border-light); }
.tab {
    flex: 1;
    padding: 10px 0 7px 0;
    text-align: center;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1.08rem;
    font-weight: 500;
    color: #b3b6c9;
    transition: background 0.14s, color 0.14s;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
}
.tab.light { color: #999; }
.tab.active { color: var(--sidebar-primary); background: #232532; border-bottom: 3px solid var(--sidebar-primary); }
.tab.active.light { color: var(--sidebar-primary); background: #f4f6fa; border-bottom: 3px solid var(--sidebar-primary); }
.tab:hover:not(.active) { background: #232730; color: #f4f4f4; }
.tab.light:hover:not(.active) { background: #ededed; color: #232323; }
.tab-content {
    display: none;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 0 7px 0 7px;
    height: 0;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: none;
}
.channel-list, .history-list, .favorites-list {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    min-height: 44px;
    max-height: 100%;
}
.history-list-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 8px 0 0 0;
    background: inherit;
    position: sticky;
    bottom: 0;
    z-index: 10;
}
.history-deleteall-btn {
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 0.94rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s, color 0.16s;
}
.history-deleteall-btn:hover {
    background: #a81b2f;
}
.favorites-list-bar {
    position: sticky;
    bottom: 0;
    background: inherit;
    padding: 8px 0 0 0;
    text-align: right;
}
.favorites-export-btn {
    background: var(--sidebar-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 18px;
    font-size: 0.98rem;
    font-weight: 500;
    margin-right: 3px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.favorites-export-btn:hover { background: #1841a1; }
.channel-list button, .favorites-list button, .history-list button {
    width: 100%;
    padding: 10px 10px;
    margin-bottom: 4px;
    background: #232532;
    color: #f5f6fa;
    border: none;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    font-size: 1.01rem;
    box-shadow: 0 1px 4px 0 rgba(0,0,0,0.06);
    letter-spacing: 0.01em;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.channel-list button.light, .favorites-list button.light, .history-list button.light { background: #f5f6f7; color: #232323; }
.channel-list button:hover, .favorites-list button:hover, .history-list button:hover {
    background: #282d41;
    color: #fff;
    box-shadow: 0 2px 12px 0 rgba(37,99,235,0.10);
}
.channel-list button.light:hover, .favorites-list button.light:hover, .history-list button.light:hover { background: #e8ecef; color: #222; }
.channel-list img, .favorites-list img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 7px;
    background: #f5f6fa;
}
.default-logo {
    background: #f2f2f2;
}
.channel-list .favorite-btn, .favorites-list .favorite-btn {
    margin-left: auto;
    cursor: pointer;
    z-index: 2;
    transition: color 0.18s;
}
.playlist-current { border: 2px solid var(--sidebar-primary) !important; background: #1e293b !important; color: #fff !important; box-shadow: 0 3px 20px 0 rgba(37,99,235,0.13); }
.playlist-favorite { background: #202c2b !important; color: #ff2970 !important; }
.playlist-current .favorite-btn, .playlist-favorite .favorite-btn { color: #ff2970 !important; fill: #ff2970 !important; }
.playlist-current.playlist-favorite { background: linear-gradient(90deg, #2563eb 60%, #ff2970 100%) !important; color: #fff !important; }
.history-list button { align-items: center; }
.history-list .history-label {
    flex: 1 1 0px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.history-list .action-btn, .history-list .delete-btn { margin-left: 7px; cursor: pointer; z-index: 2; opacity: 0.85; transition: opacity 0.15s; }
.history-list .action-btn:hover, .history-list .delete-btn:hover { opacity: 1; }
.analysis-panel {
    text-align: center;
    margin: 0 0 8px 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
.analysis-panel h3 {
    font-size: 1.10rem;
    font-weight: 600;
    margin: 10px 0 7px 0;
}
.analysis-panel .analysis-buttons {
    margin: 9px 0 3px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.analysis-panel .analysis-buttons button {
    background: #232532;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 6px 16px;
    font-size: 0.98rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s, color 0.16s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.analysis-panel .analysis-buttons button.active,
.analysis-panel .analysis-buttons button:focus { background: var(--sidebar-primary); color: #fff; }
.analysis-panel .analysis-buttons button#showTotal { background: var(--sidebar-primary);}
.analysis-panel .analysis-buttons button#showOnline { background: #28a745;}
.analysis-panel .analysis-buttons button#showOffline { background: #dc3545;}
.analysis-panel .analysis-buttons button#showTotal.active, .analysis-panel .analysis-buttons button#showTotal:focus { background: #1e40af;}
.analysis-panel .analysis-buttons button#showOnline.active, .analysis-panel .analysis-buttons button#showOnline:focus { background: #17682b;}
.analysis-panel .analysis-buttons button#showOffline.active, .analysis-panel .analysis-buttons button#showOffline:focus { background: #ad1e2d;}
.manual-check-btn {
    background: #e5e7eb;
    color: #2563eb;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.28rem;
    box-shadow: 0 1px 6px 0 rgba(0,0,0,0.06);
    margin-left: 8px;
    vertical-align: middle;
    transition: background 0.16s, color 0.16s;
}
.manual-check-btn:hover { background: #2563eb; color: #fff; }
.analysis-panel .analysis-status-summary {
    margin: 10px 0 0 0;
    font-size: 1.07em;
    font-weight: 600;
    cursor: pointer;
}
.analysis-panel canvas { max-width: 100%; margin: 8px auto 0 auto; }
.player-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: rgba(32,32,48,0.95);
    color: #fff;
    font-size: 1.18rem;
    font-weight: 500;
    border-radius: 14px;
    padding: 22px 36px 22px 36px;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 4px 24px 0 rgba(0,0,0,0.23);
    min-width: 220px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}
.player-notification.show {
    opacity: 1;
    pointer-events: auto;
}
.player-notification .spinner {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
.hide-on-idle {
    opacity: 1;
    transition: opacity 0.4s;
}
.hide-on-idle.idle {
    opacity: 0;
    pointer-events: none;
}
@media (max-width: 1024px) {
    .sidebar { width: 96vw; max-width: 370px; border-radius: var(--sidebar-radius) 0 0 var(--sidebar-radius); }
    .sidebar-footer { width: 100vw; max-width: 370px; }
    .sidebar-toggle, .theme-toggle-btn { right: 0; }
}
@media (max-width: 650px) {
    .sidebar { width: 100vw; max-width: 100vw; border-radius: 0; }
    .sidebar-footer { width: 100vw; max-width: 100vw; border-radius: 0; }
    .sidebar-toggle, .theme-toggle-btn { right: 0; }
}