:root {
    --bg: #0a0a0a;
    --surface: #101010;
    --surface-raised: #161616;
    --fg: #e5e5e5;
    --muted: #7a7a7a;
    --border: #2a2a2a;
    --border-strong: #3a3a3a;
    --accent: #1db954;
    --accent-fg: #05170a;
    --danger: #ff6b6b;
    --radius: 3px;
    --radius-sm: 2px;
    --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

button, input {
    font-family: inherit;
}

a {
    color: inherit;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 1rem;
    font-family: var(--font-mono);
}

.brand-mark {
    color: var(--accent);
    font-size: 0.95rem;
}

/* ---------------- Auth screen ---------------- */

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 28px 28px;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.25rem 2rem;
}

.auth-card .brand {
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
}

.auth-tagline {
    color: var(--muted);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 1.75rem;
    font-family: var(--font-mono);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.2rem;
    margin-bottom: 1.5rem;
}

.auth-tab {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-mono);
    cursor: pointer;
}

.auth-tab.active {
    background: var(--fg);
    color: #0a0a0a;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--font-mono);
}

.field input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    color: var(--fg);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s ease;
}

.field input:focus {
    border-color: var(--accent);
}

.btn {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--fg);
    padding: 0.65rem 1.1rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-mono);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn:hover {
    border-color: var(--fg);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.btn-primary:hover {
    background: transparent;
    color: var(--accent);
}

.btn-primary[disabled] {
    background: var(--surface-raised);
    border-color: var(--border);
    color: var(--muted);
    cursor: default;
}

.btn-block {
    width: 100%;
    margin-top: 0.25rem;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}

.btn-ghost:hover {
    border-color: var(--fg);
    color: var(--fg);
    background: transparent;
}

.form-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin: -0.4rem 0 0;
    font-family: var(--font-mono);
}

.auth-footnote {
    text-align: center;
    color: var(--muted);
    font-size: 0.72rem;
    margin: 1.5rem 0 0;
    font-family: var(--font-mono);
}

/* ---------------- Dashboard ---------------- */

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 5.5rem;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(6px);
    z-index: 10;
}

.brand-name {
    color: var(--fg);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.me-name {
    color: var(--muted);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 1px;
    max-width: 78rem;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

@media (max-width: 880px) {
    .layout {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    margin: 0;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-mono);
    color: var(--muted);
    font-weight: 600;
}

.panel-sub {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0.85rem 0 1rem;
    line-height: 1.5;
    font-family: var(--font-mono);
}

.reconnect-btn {
    margin: 0 0 1rem;
}

.queue-hint {
    color: var(--muted);
    font-size: 0.72rem;
    font-family: var(--font-mono);
}

/* Row list (playlists) */

.row-list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.row-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.4rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: transparent;
    border-left: 2px solid transparent;
    transition: background 0.1s ease, border-color 0.1s ease;
}

.row-item:hover {
    background: var(--surface-raised);
}

.row-item.active {
    border-left-color: var(--accent);
    background: var(--surface-raised);
    color: var(--accent);
}

.row-index {
    color: var(--muted);
    width: 1.6rem;
    flex-shrink: 0;
    text-align: right;
}

.row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-count {
    color: var(--muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Track list */

.track-list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 34rem;
    overflow-y: auto;
}

.track-row {
    display: grid;
    grid-template-columns: 1.75rem 40px 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    background: transparent;
    border-left: 2px solid transparent;
    transition: background 0.1s ease, border-color 0.1s ease;
}

.track-row:hover {
    background: var(--surface-raised);
}

.track-row.playing {
    border-left-color: var(--accent);
    background: var(--surface-raised);
}

.track-row.playing .track-title {
    color: var(--accent);
}

.track-row img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-raised);
}

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

.track-title {
    font-weight: 500;
    font-size: 0.87rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    color: var(--muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-index {
    color: var(--muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    text-align: right;
    flex-shrink: 0;
}

.track-preview-tag {
    color: var(--muted);
    font-size: 0.68rem;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
}

.empty-state {
    color: var(--muted);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    padding: 1.5rem 0;
    text-align: center;
}

/* ---------------- Now playing bar ---------------- */

.now-playing {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    z-index: 20;
    font-family: var(--font-mono);
}

@media (max-width: 720px) {
    .now-playing {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        text-align: center;
    }
}

.np-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.np-index {
    color: var(--muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.np-text {
    min-width: 0;
}

.np-title {
    font-size: 0.85rem;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-artist {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.4rem;
}

.np-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
}

.np-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--fg);
    width: 2.1rem;
    height: 2.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.12s ease, color 0.12s ease;
}

.np-btn:hover {
    border-color: var(--fg);
}

.np-btn--main {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
    width: 2.4rem;
    height: 2.4rem;
}

.np-btn--main:hover {
    background: transparent;
    color: var(--accent);
}

.np-progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.np-time {
    font-size: 0.7rem;
    color: var(--muted);
    flex-shrink: 0;
    width: 2.5rem;
    text-align: center;
}

.np-bar {
    flex: 1;
    height: 2px;
    background: var(--border);
    position: relative;
    cursor: pointer;
}

.np-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: var(--accent);
}
