@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;600;700;800&display=swap');

:root {
    --bg: #0b0d12;
    --card: #141821;
    --card-alt: #1b202b;
    --border: #262c38;
    --text: #eef0f4;
    --text-dim: #8a92a3;
    --orange: #ff8a3d;
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Raleway', system-ui, sans-serif;
    min-height: 100vh;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.login-card h1 {
    margin: 0 0 4px;
    font-size: 28px;
}

.subtitle {
    color: var(--text-dim);
    margin: 0 0 28px;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.user-select {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.user-pill {
    position: relative;
    cursor: pointer;
}

.user-pill input { position: absolute; opacity: 0; }

.user-pill span {
    display: inline-block;
    padding: 10px 20px;
    border: 2px solid var(--border);
    border-radius: 999px;
    font-weight: 600;
    color: var(--text-dim);
    transition: all .15s;
}

.user-pill input:checked + span {
    border-color: var(--user-color);
    color: var(--text);
    background: color-mix(in srgb, var(--user-color) 18%, transparent);
}

input[type="password"], input[type="text"] {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

button {
    background: var(--orange);
    color: #12100c;
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
    transition: filter .15s;
}

button:hover { filter: brightness(1.1); }
button:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; }

.alert {
    background: rgba(255, 80, 80, 0.15);
    border: 1px solid rgba(255, 80, 80, 0.4);
    color: #ff9d9d;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* App */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.brand { font-weight: 800; font-size: 16px; }

.me { display: flex; align-items: center; gap: 12px; font-size: 12px; }

.user-badge {
    padding: 3px 10px;
    border-radius: 999px;
    border: 2px solid var(--user-color);
    font-weight: 700;
    font-size: 12px;
}

.vote-account {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vote-dots {
    display: flex;
    gap: 4px;
}

.vote-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--border);
}

.vote-dot.filled { background: var(--orange); }

.vote-account-label { color: var(--text-dim); white-space: nowrap; }

.logout { color: var(--text-dim); text-decoration: none; }
.logout:hover { color: var(--text); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }

.add-song-form {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.sa-input-wrap { flex: 1; position: relative; }
.sa-input-wrap input { width: 100%; }

.sa-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    z-index: 20;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.sa-suggestions.open { display: block; }

.sa-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.sa-item:hover { background: rgba(255,255,255,0.06); }

.sa-item img, .sa-item-noimg {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
}

.sa-item-text { display: flex; flex-direction: column; overflow: hidden; }
.sa-item-text strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-item-text span { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.link-form { margin-top: 6px; max-width: 260px; }
.link-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    text-decoration: underline;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    font-family: inherit;
}
.link-toggle:hover { color: var(--orange); }

.delete-form { display: inline; margin: 0; }
.delete-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    text-decoration: underline;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    font-family: inherit;
}
.delete-toggle:hover { color: #ff6b6b; }

.new-badge {
    background: var(--orange);
    color: #12100c;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 1px 6px;
    border-radius: 999px;
}

.view-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}

.view-tab {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-decoration: none;
}

.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--orange); color: #12100c; }

.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

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

.song-list { display: flex; flex-direction: column; gap: 6px; }

.song-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.song-row { scroll-margin-top: 20px; }
.song-row.status-done { opacity: 0.5; }
.song-row.status-in_progress { border-color: var(--orange); }

.song-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1 1 260px; }

.song-cover {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.song-main-text { min-width: 0; flex: 1; }

.song-title { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.song-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.song-meta { color: var(--text-dim); font-size: 11px; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.song-artist { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex-shrink: 1; }
.song-meta-fixed { display: flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }

.play-toggle {
    background: var(--orange);
    color: #12100c;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 0 1px;
    flex-shrink: 0;
}
.play-toggle:hover { filter: brightness(1.1); }

.song-embed { display: none; margin-top: 8px; max-width: 320px; }
.song-embed.open { display: block; }
.song-embed iframe { border-radius: 8px; }

.status-pill {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--card-alt);
}

.status-pill-in_progress { color: var(--orange); background: rgba(255,138,61,0.15); }
.status-pill-done { color: #7de89a; background: rgba(125,232,154,0.12); }

.song-votes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

.vote-breakdown { display: flex; align-items: center; gap: 4px; }

.vote-chip {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--user-color);
    color: #12100c;
    font-weight: 700;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vote-total { color: var(--text-dim); font-size: 11px; margin-left: 4px; }

.vote-controls { display: flex; align-items: center; gap: 5px; }
.vote-controls form { margin: 0; }

.vote-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
}

.my-votes { min-width: 14px; text-align: center; font-weight: 700; font-size: 12px; }

.status-form { margin: 0; }

select {
    background: var(--card-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 12px;
}

button { padding: 8px 14px; font-size: 13px; }

@media (max-width: 600px) {
    .topbar { justify-content: center; text-align: center; }
    .me { justify-content: center; width: 100%; }

    main { padding: 12px 12px 40px; }

    .add-song-form { flex-direction: column; }
    .add-song-form button { width: 100%; }

    .filter-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .view-tab { padding: 6px 4px; font-size: 11px; }
    .filter-bar label { justify-content: space-between; }
    .filter-bar select { flex: 1; }

    .song-row { flex-direction: column; align-items: stretch; padding: 10px 12px; }
    .song-title { font-size: 14px; }
    .song-meta { font-size: 12px; }

    .song-votes { width: 100%; justify-content: space-between; gap: 10px; }
    .vote-breakdown { order: 1; }
    .vote-controls { order: 2; }
    .status-form { order: 3; }

    .vote-btn {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .my-votes { font-size: 14px; min-width: 18px; }

    select { padding: 8px 10px; font-size: 13px; }
}

.log-title { font-size: 16px; margin: 0 0 12px; }
.log-empty { color: var(--text-dim); font-size: 13px; }

.log-list { display: flex; flex-direction: column; gap: 4px; }

.log-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
}

.log-icon { flex-shrink: 0; }
.log-message { flex: 1; }
.log-time { color: var(--text-dim); font-size: 11px; white-space: nowrap; }
