:root {
  --bg: #0f1013;
  --panel: #17191e;
  --panel-2: #1d2026;
  --line: #2a2d34;
  --text: #f4f5f7;
  --muted: #8e949f;
  --accent: #9b6cff;
  --accent-2: #b28cff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }

.topbar {
  height: 64px; padding: 0 24px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line);
  background: #121318; position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; display: flex; gap: 10px; align-items: center; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: white; }
.status { color: var(--muted); font-size: 13px; }

.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.library { border-right: 1px solid var(--line); background: var(--panel); padding: 18px; overflow: auto; }
.library-head h2 { margin: 0 0 14px; font-size: 18px; }
#search { width: 100%; border: 1px solid var(--line); background: #111318; color: var(--text); padding: 11px 12px; border-radius: 9px; outline: none; }
#search:focus { border-color: var(--accent); }
.song-list { margin-top: 14px; display: grid; gap: 6px; }
.song-item { padding: 12px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.song-item:hover { background: var(--panel-2); }
.song-item.active { background: #292132; border-color: #61478e; }
.song-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.empty { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 20px; }
.hidden { display: none !important; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.song-head { min-height: 96px; padding: 20px 28px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--accent-2); font-size: 10px; letter-spacing: .12em; font-weight: 700; }
.song-head h1 { margin: 5px 0 4px; font-size: 23px; }
.muted { color: var(--muted); font-size: 13px; }
.format-badge { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; }

.score-wrap { position: relative; flex: 1; min-height: 400px; overflow: auto; background: #d9d9d9; }
#alphaTab { min-height: 100%; padding: 30px 20px 180px; color: #111; }
#alphaTab .at-surface { max-width: 1100px; margin: 0 auto; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(15,16,19,.75); color: white; z-index: 5; }
.spinner { width: 28px; height: 28px; border: 3px solid #555; border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.player { background: #17191e; border-top: 1px solid var(--line); padding: 12px 20px 16px; position: sticky; bottom: 0; z-index: 10; }
.transport { display: flex; align-items: center; gap: 8px; }
.icon-btn, .play-btn, .small-btn { border: 1px solid var(--line); background: #22252b; color: var(--text); cursor: pointer; border-radius: 8px; }
.icon-btn { width: 38px; height: 34px; }
.icon-btn:hover, .small-btn:hover { background: #2b2e35; }
.play-btn { width: 46px; height: 38px; background: var(--accent); border-color: var(--accent); font-size: 16px; }
.play-btn:hover { background: var(--accent-2); }
.time { color: var(--muted); font-size: 12px; margin-left: 8px; min-width: 105px; }
.progress-row { padding: 8px 0 4px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
.settings-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.settings-row strong { color: var(--text); }
.settings-row > input[type="range"] { width: 150px; }
.volume-label { margin-left: 12px; }
.small-btn { padding: 7px 10px; font-size: 12px; }
.tracks { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.tracks-title { color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.track-list { display: flex; flex-wrap: wrap; gap: 6px; }
.track-chip { border: 1px solid var(--line); background: #202329; color: var(--text); padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.track-chip.active { border-color: var(--accent); background: #2b223b; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .library { max-height: 230px; border-right: 0; border-bottom: 1px solid var(--line); }
  .song-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .topbar { padding: 0 14px; }
  .status { display: none; }
  .song-head { padding: 16px; }
  .score-wrap { min-height: 420px; }
  .player { padding: 10px 12px 12px; }
}
