:root {
    --bg: #0e1116;
    --bg-soft: #161b22;
    --bg-elev: #1c2230;
    --border: #262d3a;
    --text: #e6eaf0;
    --text-dim: #8b94a3;
    --accent: #4f8cff;
    --accent-soft: rgba(79, 140, 255, 0.15);
    --radius: 12px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

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

html, body { height: 100%; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 22px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 480px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

#search {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

#search::placeholder { color: var(--text-dim); }

#search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.count {
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

/* ---------- Layout ---------- */
.layout {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ---------- Player ---------- */
.player-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 22px;
    min-width: 0;
}

.player-frame {
    flex: 1;
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
}

.player-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.player-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--text-dim);
}

.player-placeholder p { font-size: 14px; }

.now-playing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.np-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    font-weight: 600;
}

.now-playing h2 { font-size: 17px; font-weight: 600; margin: 3px 0; }

.np-id { font-size: 12px; color: var(--text-dim); }

.np-open {
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

.np-open:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 340px;
    flex-shrink: 0;
    background: var(--bg-soft);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-head {
    padding: 16px 20px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.channel-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .12s;
}

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

.channel-item.active {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.ch-avatar {
    width: 38px; height: 38px;
    flex-shrink: 0;
    border-radius: 9px;
    background: var(--bg-elev);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.channel-item.active .ch-avatar { background: var(--accent); color: #fff; }

.ch-meta { min-width: 0; }

.ch-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ch-id { font-size: 12px; color: var(--text-dim); }

.empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
}

/* ---------- Scrollbar ---------- */
.channel-list::-webkit-scrollbar { width: 9px; }
.channel-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 8px;
    border: 2px solid var(--bg-soft);
}
.channel-list::-webkit-scrollbar-thumb:hover { background: #34404f; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        border-left: 0;
        border-top: 1px solid var(--border);
        max-height: 45%;
    }
    .player-panel { padding: 14px; }
    .topbar { flex-wrap: wrap; }
    .search-wrap { order: 3; max-width: none; flex-basis: 100%; }
}
