:root {
  --bg: #141416; --bg2: #1a1a1e; --bg3: #202026;
  --fg: #f0f0f0; --fg2: #d0d0d0; --mid: #888; --dim: #555;
  --line: #2a2a30; --red: #e82020; --red-h: #ff3333;
  --green: #00dd66; --amber: #f0a020; --blue: #1535ee;
  --font: 'JetBrains Mono', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { min-height: 100vh; background: var(--bg); color: var(--fg); font: 12px/1.55 var(--font); letter-spacing: .3px; -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--dim); }
::selection { background: var(--red); color: #fff; }

/* ── BAR ── */
.bar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--line); gap: 14px; }
.bar-left { display: flex; align-items: baseline; gap: 0; flex-shrink: 0; }
.bar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 17px; color: var(--fg); text-decoration: none; letter-spacing: .5px; }
.logo-div { color: var(--dim); font-size: 17px; font-weight: 400; margin: 0 6px; }
.logo-section { font-size: 13px; font-weight: 700; color: var(--mid); letter-spacing: 1px; text-transform: uppercase; }
.search { background: var(--bg); border: 1px solid var(--line); color: var(--fg); font: 11px var(--font); padding: 8px 12px; width: 180px; outline: none; letter-spacing: .5px; transition: border-color .15s; }
.search::placeholder { color: var(--dim); }
.search:focus { border-color: var(--red); }
.filter-wrap { display: flex; }
.filter-select { background: var(--bg); border: 1px solid var(--line); color: var(--fg2); font: 700 10px var(--font); padding: 8px 10px; cursor: pointer; letter-spacing: .5px; outline: none; }
.filter-select:focus { border-color: var(--red); }
.filter-select option { background: var(--bg2); color: var(--fg); }

/* ── BUTTONS ── */
.b { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border: 1px solid var(--line); background: var(--bg3); color: var(--fg2); font: 700 10px var(--font); letter-spacing: .8px; text-transform: uppercase; cursor: pointer; transition: all .12s; white-space: nowrap; }
.b:hover { border-color: var(--fg); color: var(--fg); }
.b.accent { background: var(--red); border-color: var(--red); color: #fff; font-weight: 800; }
.b.accent:hover { background: var(--red-h); border-color: var(--red-h); }
.b.danger { background: transparent; border-color: var(--red); color: var(--red); }
.b.danger:hover { background: var(--red); color: #fff; }
.file-wrap { position: relative; overflow: hidden; }
.file-wrap input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.q-count { display: inline-block; min-width: 16px; text-align: center; padding: 1px 4px; background: var(--red); color: #fff; font-size: 9px; font-weight: 800; border-radius: 2px; margin-left: 2px; }

/* ── MAIN ── */
.main { padding: 20px; max-width: 1300px; margin: 0 auto; }
.stats { font-size: 10px; color: var(--mid); font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 14px; }
.search-info { font-size: 11px; color: var(--fg2); margin-bottom: 14px; padding: 10px 14px; background: var(--bg2); border: 1px solid var(--line); }
.search-info .clear-search { color: var(--red); cursor: pointer; text-decoration: underline; background: none; border: none; font: 700 11px var(--font); margin-left: 10px; }

/* ── NOW PLAYING ── */
.now-playing { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg2); border: 1px solid var(--red); margin-bottom: 14px; }
.np-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.np-label { font-size: 8px; font-weight: 800; letter-spacing: 1.5px; color: var(--red); text-transform: uppercase; padding: 2px 6px; border: 1px solid var(--red); flex-shrink: 0; }
.np-title { font-size: 12px; font-weight: 800; color: var(--fg); text-transform: uppercase; letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-artist { font-size: 11px; color: var(--fg2); flex-shrink: 0; }
.np-controls { display: flex; gap: 4px; flex-shrink: 0; }
.np-btn { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); color: var(--fg); font-size: 12px; cursor: pointer; transition: all .12s; }
.np-btn:hover { border-color: var(--fg); }
.np-close:hover { border-color: var(--red); color: var(--red); }
.player-container { margin-bottom: 14px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.player-container iframe { width: 100%; height: 80px; display: block; }

/* ── QUEUE PANEL ── */
.queue-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 90vw); background: var(--bg2); border-left: 2px solid var(--fg); z-index: 200; display: flex; flex-direction: column; }
.qp-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.qp-title { font-weight: 800; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--fg); }
.qp-actions { display: flex; gap: 6px; align-items: center; }
.qp-close { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); color: var(--fg); font-size: 18px; cursor: pointer; transition: all .12s; }
.qp-close:hover { border-color: var(--red); color: var(--red); }
.qp-list { flex: 1; overflow-y: auto; padding: 8px; }
.qp-empty { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.qp-empty p { font-size: 10px; color: var(--dim); letter-spacing: 1.5px; font-weight: 700; text-align: center; }

/* Queue items */
.qi { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); margin-bottom: 4px; background: var(--bg); cursor: grab; transition: all .12s; }
.qi:hover { border-color: var(--dim); }
.qi-active { border-color: var(--red); background: rgba(232, 32, 32, .06); }
.qi-dragging { opacity: .4; }
.qi-over { border-color: var(--blue); background: rgba(21, 53, 238, .06); }
.qi-handle { color: var(--dim); font-size: 10px; cursor: grab; flex-shrink: 0; }
.qi-num { font-size: 14px; font-weight: 800; color: var(--dim); min-width: 20px; flex-shrink: 0; }
.qi-info { flex: 1; min-width: 0; }
.qi-name { font-size: 11px; font-weight: 800; color: var(--fg); text-transform: uppercase; letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-artist { font-size: 10px; color: var(--fg2); }
.qi-playing { color: var(--red); font-size: 10px; flex-shrink: 0; }
.qi-play, .qi-del { width: 24px; height: 24px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); color: var(--mid); font-size: 10px; cursor: pointer; transition: all .12s; flex-shrink: 0; }
.qi-play:hover { border-color: var(--green); color: var(--green); }
.qi-del:hover { border-color: var(--red); color: var(--red); }

/* ── GRID ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }

/* ── CARD ── */
.card { background: var(--bg2); border: 1px solid var(--line); cursor: pointer; transition: all .15s; position: relative; }
.card:hover { border-color: var(--red); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.card:hover .card-title { color: var(--red); }
.card:hover .card-overlay { opacity: 1; }
.card.playing { border-color: var(--red); }
.card-cover { width: 100%; aspect-ratio: 1; background: var(--bg); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); position: relative; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover .no-img { font-size: 36px; color: var(--dim); font-weight: 800; opacity: .35; }

/* Card overlay with play + queue */
.card-overlay { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.card-play, .card-queue-btn { width: 34px; height: 34px; border-radius: 50%; border: none; display: grid; place-items: center; cursor: pointer; transition: all .15s; font: 700 11px var(--font); box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.card-play { background: var(--red); color: #fff; font-size: 13px; }
.card-play:hover { background: var(--red-h); transform: scale(1.1); }
.card-queue-btn { background: var(--bg2); color: var(--fg); font-size: 9px; border: 1px solid var(--line); }
.card-queue-btn:hover { border-color: var(--fg); transform: scale(1.1); }

.card-playing-indicator { position: absolute; bottom: 10px; left: 10px; display: flex; align-items: flex-end; gap: 2px; height: 20px; }
.card-playing-indicator span { width: 3px; background: var(--red); animation: bars 0.8s ease-in-out infinite alternate; }
.card-playing-indicator span:nth-child(1) { height: 8px; animation-delay: 0s; }
.card-playing-indicator span:nth-child(2) { height: 14px; animation-delay: 0.2s; }
.card-playing-indicator span:nth-child(3) { height: 10px; animation-delay: 0.4s; }
@keyframes bars { 0% { height: 4px; } 100% { height: 18px; } }

.card-body { padding: 12px 14px; }
.card-title { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--fg); transition: color .12s; line-height: 1.3; }
.card-artist { font-size: 11px; color: var(--fg2); margin-top: 3px; }
.card-album { font-size: 10px; color: var(--dim); margin-top: 2px; font-style: italic; }
.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }
.card-genre { font-size: 9px; color: var(--dim); letter-spacing: .5px; font-weight: 700; }
.badge { font-size: 8px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; padding: 3px 7px; border: 1px solid; }
.badge.fav { color: var(--red); border-color: var(--red); }
.badge.queue { color: var(--amber); border-color: var(--amber); }
.badge.archived { color: var(--mid); border-color: var(--dim); }
.card-rating { font-size: 11px; font-weight: 800; color: var(--red); margin-top: 6px; }

.empty { display: grid; place-items: center; padding: 100px 20px; }
.empty-inner { text-align: center; }
.empty-icon { font-size: 48px; color: var(--dim); opacity: .3; margin-bottom: 16px; }
.empty-msg { font-size: 12px; color: var(--mid); letter-spacing: 2px; font-weight: 700; }
.hidden { display: none !important; }

/* ── MODALS ── */
.modal { border: none; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; margin: auto; top: 0; bottom: 0; }
.modal::backdrop { background: rgba(10, 10, 12, .82); backdrop-filter: blur(4px); }
.m-card { width: min(560px, calc(100vw - 32px)); background: var(--bg2); border: 2px solid var(--fg); margin: 0 auto; }
.m-card.wide { width: min(700px, calc(100vw - 32px)); }
.m-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.m-title { font-weight: 800; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--fg); }
.m-x { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); color: var(--fg); font-size: 20px; cursor: pointer; transition: all .12s; }
.m-x:hover { border-color: var(--red); color: var(--red); }
.m-body { padding: 18px; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }

.fg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f { display: flex; flex-direction: column; gap: 5px; }
.f label { font-size: 9px; letter-spacing: 1.2px; color: var(--fg2); text-transform: uppercase; font-weight: 700; }
.f.full { grid-column: 1 / -1; }
.inp { background: var(--bg); border: 1px solid var(--line); color: var(--fg); font: 12px var(--font); padding: 9px 12px; outline: none; transition: border-color .12s; }
.inp::placeholder { color: var(--dim); }
.inp:focus { border-color: var(--red); }
.ta { resize: vertical; }
select.inp { cursor: pointer; }
select.inp option { background: var(--bg2); color: var(--fg); }
.rating-row { display: flex; align-items: center; gap: 10px; }
.rating-inp { width: 80px; }
.rating-display { font-size: 12px; font-weight: 800; color: var(--red); }

.cover-methods { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.cover-method { display: flex; flex-direction: column; gap: 6px; }
.cover-label { font-size: 9px; color: var(--mid); letter-spacing: .8px; font-weight: 700; }
.cover-url-row { display: flex; gap: 6px; }
.flex-inp { flex: 1; min-width: 180px; font-size: 11px; }
.cover-file-row { display: flex; gap: 6px; }
.cover-or { font-size: 9px; color: var(--dim); letter-spacing: 1px; align-self: flex-end; padding-bottom: 9px; font-weight: 700; }
.cover-box { margin-top: 12px; width: 130px; aspect-ratio: 1; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.cover-box img { width: 100%; height: 100%; object-fit: cover; display: none; }
.cover-ph { font-size: 10px; color: var(--dim); letter-spacing: 1px; font-weight: 700; }

.detail-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.detail-top { display: flex; gap: 16px; flex: 1; min-width: 0; }
.detail-cover { width: 110px; height: 110px; flex-shrink: 0; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-cover .no-img { font-size: 28px; color: var(--dim); opacity: .5; }
.detail-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.detail-title { font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: .5px; line-height: 1.2; color: var(--fg); }
.detail-artist { font-size: 12px; color: var(--fg2); }
.detail-sub { font-size: 11px; color: var(--mid); font-weight: 700; }
.detail-rating-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.detail-rating { font-size: 20px; font-weight: 800; color: var(--red); line-height: 1; }
.detail-rating-label { font-size: 10px; color: var(--dim); letter-spacing: .5px; }
.detail-status { margin-top: 4px; }
.detail-btns { display: flex; gap: 6px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.detail-body { padding: 18px; }
.detail-links { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.detail-section { margin-bottom: 16px; }
.detail-section-label { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--mid); margin-bottom: 8px; text-transform: uppercase; }
.detail-notes { font-size: 12px; color: var(--fg2); line-height: 1.7; white-space: pre-wrap; }
.pill { padding: 6px 14px; border: 1px solid var(--line); color: var(--fg2); font: 700 10px var(--font); letter-spacing: .8px; text-decoration: none; text-transform: uppercase; transition: all .12s; }
.pill:hover { border-color: var(--fg); color: var(--fg); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(60px); background: var(--bg2); border: 1px solid var(--line); font: 700 11px var(--font); padding: 10px 20px; z-index: 9000; opacity: 0; transition: all .25s; pointer-events: none; letter-spacing: .5px; color: var(--fg); }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }

@media (max-width: 620px) {
  .bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .bar-right { justify-content: flex-start; }
  .search { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .flex-inp { min-width: 140px; }
  .np-info { flex-wrap: wrap; gap: 6px; }
  .queue-panel { width: 100vw; }
}
