:root {
    --bg: #1e1f22;
    --card: #2b2d31;
    --card-hover: #35373c;
    --text: #f2f3f5;
    --muted: #a7abb3;
    --accent: #5865f2;
    --danger: #da373c;
    --radius: 10px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

[hidden] { display: none !important; }

a { color: inherit; }

main {
    max-width: 860px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    gap: 16px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
}

.muted { color: var(--muted); }
.error { color: #ff8a8a; }

button, .button {
    font: inherit;
    color: var(--text);
    background: var(--card-hover);
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.15); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .button.primary { background: var(--accent); }
button.danger { background: transparent; color: #ff8a8a; }
button.link { background: none; padding: 0; color: var(--muted); text-decoration: underline; }
button.toggle.on { background: var(--accent); }

input[type=text], select {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid #3f4147;
    border-radius: 8px;
    padding: 8px 10px;
}

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { max-width: 380px; text-align: center; }
.login-card h1 { margin-top: 0; }

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--card);
}
.brand { display: flex; gap: 8px; align-items: baseline; margin-right: auto; }
.pill { background: var(--bg); border-radius: 999px; padding: 2px 10px; color: var(--muted); font-size: 13px; }
.user { display: flex; align-items: center; gap: 8px; }
.user img { width: 28px; height: 28px; border-radius: 50%; }

/* Now playing */
.now-playing { display: grid; grid-template-columns: auto 1fr; gap: 16px; }
.artwork { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; }
.track { min-width: 0; }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.title { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
a.title[href]:hover { text-decoration: underline; }
.now-playing .title { font-size: 18px; display: block; margin: 2px 0; }
.progress { height: 6px; background: var(--bg); border-radius: 3px; margin-top: 12px; cursor: pointer; }
.progress #progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.controls { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.volume { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.volume input { width: 140px; }

/* Add */
.add-form { display: flex; gap: 8px; flex-wrap: wrap; }
.add-form input { flex: 1 1 260px; }

/* Queue */
.queue-header { display: flex; align-items: center; justify-content: space-between; }
.queue-header h2 { margin: 0; font-size: 16px; }
.queue { list-style: none; margin: 12px 0 0; padding: 0; }
.queue-item {
    display: grid;
    grid-template-columns: auto 2.5em 1fr auto auto auto;
    gap: 8px;
    align-items: center;
    padding: 6px 4px;
    border-radius: 8px;
}
.queue-item:hover { background: var(--card-hover); }
.queue-item.dragging { opacity: .4; }
.queue-item.drop-target { box-shadow: inset 0 2px 0 var(--accent); }
.queue-item .handle { cursor: grab; color: var(--muted); }
.queue-item .index { color: var(--muted); text-align: right; }
.queue-item .info { min-width: 0; }
.queue-item .title, .queue-item .author { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.queue-item .author { font-size: 13px; }
.queue-item button { padding: 4px 8px; background: transparent; }

/* Equalizer */
.eq-card summary { cursor: pointer; font-weight: 600; }
.eq-bands {
    display: grid;
    grid-template-columns: 5.5em 1fr 3em;
    gap: 4px 12px;
    align-items: center;
    margin-top: 12px;
}
.eq-bands label { color: var(--muted); font-size: 13px; text-align: right; }
.eq-bands input { width: 100%; }
.eq-bands output { font-variant-numeric: tabular-nums; text-align: right; font-size: 13px; }
.eq-bands output.changed { color: var(--accent); font-weight: 600; }
.eq-actions { display: flex; gap: 8px; margin-top: 12px; }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-hover);
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
    max-width: calc(100% - 32px);
}
.toast.error { background: #5c2326; color: var(--text); }

@media (max-width: 560px) {
    .now-playing { grid-template-columns: 1fr; }
    .artwork { width: 100%; height: auto; aspect-ratio: 16 / 9; }
    .volume { margin-left: 0; }
    .queue-item { grid-template-columns: 2em 1fr auto auto; }
    .queue-item .handle, .queue-item .length { display: none; }
}
