:root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --bg-hover: #1c2230;
    --border: #2a3240;
    --text: #e6edf3;
    --text-dim: #8b949e;
    --accent: #4f9cf9;
    --accent-soft: rgba(79, 156, 249, .14);
    --ok: #3fb950;
    --err: #f85149;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
                 "PingFang SC", "Hiragino Sans GB", Roboto, sans-serif;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- 顶栏 ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

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

.logo {
    font-size: 26px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f6feb, #8957e5);
    border-radius: 12px;
}

.topbar h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: .3px; }
.topbar .sub { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); }

.source { display: flex; align-items: center; gap: 8px; }
.source label { font-size: 12px; color: var(--text-dim); }

select, input[type="search"] {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

select:focus, input:focus { border-color: var(--accent); }
select { max-width: 220px; cursor: pointer; }

.searchbar { display: flex; gap: 8px; margin-left: auto; }
.searchbar input[type="search"] { width: 260px; }

button {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, border-color .15s;
}

button:hover { background: #262d3a; border-color: #3a4454; }

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #06121f;
    font-weight: 700;
    min-width: 52px;
}

button.primary:hover { background: #62a8fa; }

button.ghost { background: transparent; }

/* ---------- 状态条 ---------- */
.status {
    padding: 8px 20px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-dim);
}

.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* ---------- 主区 ---------- */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
    gap: 16px;
    padding: 16px 20px;
    min-height: 0;
}

.panel {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

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

.panel-head h2 { margin: 0; font-size: 13px; font-weight: 650; color: var(--text-dim); text-transform: uppercase; letter-spacing: .8px; }
.hint { font-size: 12px; color: var(--text-dim); }

.result-list { overflow-y: auto; flex: 1; }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(42, 50, 64, .5);
    transition: background .12s;
}

.row:hover { background: var(--bg-hover); }
.row .idx { width: 30px; color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .dur { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }

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

/* ---------- 播放面板 ---------- */
.now-panel { position: relative; }

.now { display: flex; gap: 14px; padding: 16px; align-items: center; }

.cover {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1f6feb, #8957e5);
    display: grid;
    place-items: center;
    font-size: 26px;
    flex-shrink: 0;
}

.now-meta { min-width: 0; flex: 1; }
.now-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { font-size: 13px; color: var(--text-dim); margin-top: 3px; }
.now-album { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
    cursor: pointer;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.vol { display: flex; align-items: center; gap: 6px; margin-left: auto; width: 140px; }
.vol input { width: 100px; }

.lyric-box {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    min-height: 60px;
}

.lyric-box:empty { display: none; }
.lyricLine { transition: color .2s; }
.lyricLine.active { color: var(--accent); font-weight: 600; }

/* 歌词按钮：点击后覆盖在结果区上方 */
body.showLyric .results-panel { display: none; }
body.showLyric .main { grid-template-columns: minmax(0, 1fr) minmax(340px, 520px); }

/* ---------- 底栏 ---------- */
.playerbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-dim);
    font-size: 12px;
}

.playerbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.playerbar .sep { opacity: .4; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #303a49; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3d495a; }

@media (max-width: 900px) {
    .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .searchbar { width: 100%; margin-left: 0; }
    .searchbar input[type="search"] { flex: 1; width: auto; }
}
