:root {
    --bg: #12151c;
    --card: #1c2130;
    --text: #e8eaf0;
    --muted: #8b93a7;
    --accent: #4f8cff;
    --danger: #e0564f;
    --live: #e0564f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); }

h1, h2 { margin-top: 0; }

.card {
    background: var(--card);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.hidden { display: none; }

.badge {
    display: inline-block;
    background: var(--live);
    color: #fff;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 50% { opacity: 0.6; } }

.now-playing { font-size: 1.2rem; font-weight: 600; margin: 0.4rem 0; }
.np-heading {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    margin-bottom: 0;
}

.chip {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #2a3145;
    color: var(--muted);
    vertical-align: middle;
    margin-left: 0.4rem;
}
.chip-live { background: var(--live); color: #fff; }

/* Song progress bar */
.progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.5rem 0;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--muted);
}
.p-bar {
    flex: 1;
    height: 6px;
    background: #2a3145;
    border-radius: 999px;
    overflow: hidden;
}
#p-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 999px;
    transition: width 1s linear;
}

button {
    background: var(--accent);
    border: 0;
    color: #fff;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
button:hover { filter: brightness(1.15); }
button:disabled { opacity: 0.5; cursor: default; }
button.danger { background: var(--danger); }

/* Listener + login */
main.listener {
    max-width: 480px;
    margin: 8vh auto;
    padding: 0 1rem;
    text-align: center;
}
.footer { margin-top: 2rem; }

/* The one-button player */
.listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding: 0.8rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 999px;
}
.listen-btn.playing { background: var(--danger); }
#listen-icon { font-size: 0.85em; }

.volume {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.9rem;
}
#vol-icon { cursor: pointer; font-size: 1.1rem; }
#volume {
    -webkit-appearance: none;
    appearance: none;
    width: 55%;
    height: 6px;
    border-radius: 999px;
    background: #2a3145;
    outline: none;
}
#volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 0;
}
#volume::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 0;
}

/* Recently played */
.recent ul {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}
.recent li {
    padding: 0.3rem 0;
    border-bottom: 1px solid #2a3145;
    font-size: 0.9rem;
}
.recent li:last-child { border-bottom: 0; }
.recent .ago { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.recent li:first-child { color: var(--text); }
.recent li { color: var(--muted); }

form label { display: block; text-align: left; margin-bottom: 0.75rem; }
form input, form select {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border-radius: 6px;
    border: 1px solid #333a4d;
    background: var(--bg);
    color: var(--text);
}

td.len { color: var(--muted); font-variant-numeric: tabular-nums; }
td.flag { text-align: center; }
.flag-box { accent-color: var(--accent); width: 1rem; height: 1rem; }
tr.row-off td { opacity: 0.45; }
tr.row-off td.flag { opacity: 1; }   /* keep the toggle usable-looking */
td.actions { white-space: nowrap; }
td.actions .del-btn { margin-left: 0.4rem; padding: 0.45rem 0.6rem; }

/* Filler rotation */
.fq-add {
    margin-left: 0.4rem;
    background: #2a3145;
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
}
.fq-del {
    background: none;
    color: var(--muted);
    padding: 0 0.3rem;
    font-size: 0.8rem;
}
.fq-del:hover { color: var(--danger); filter: none; }
#break-list li { margin-bottom: 0.4rem; }
#break-list li.next-break {
    color: var(--accent);
    font-weight: 600;
}

/* Reports */
.big-stat { font-size: 1.6rem; font-weight: 700; margin: 0.4rem 0; }
a.drill { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
a.drill:hover { color: var(--accent); border-bottom-color: var(--accent); }
tr.detail-row td { background: var(--bg); }
.detail-scroll {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.detail-scroll div { padding: 0.1rem 0; }
.cap-bar { height: 10px; margin: 0.5rem 0; }
.cap-bar div { height: 100%; border-radius: 999px; }
.cap-bar .cap-ok { background: #3fae6a; }
.cap-bar .cap-danger { background: var(--danger); }
table.slim { max-width: 320px; }

.log-filter { display: flex; align-items: end; gap: 0.75rem; flex-wrap: wrap; }
.log-filter label { margin-bottom: 0; }
.log-filter input { width: auto; }
.check-label {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    padding-bottom: 0.5rem;
    font-size: 0.9rem;
}
.button-link {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Studio */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--card);
    border-bottom: 1px solid #2a3145;
}
main.studio {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* Library page: full-width content with a live sidebar on the right */
main.library-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.25rem;
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    align-items: start;
}
.library-side {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}
@media (max-width: 1000px) {
    main.library-page { grid-template-columns: 1fr; }
    .library-side { position: static; }
}

.upload-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 1rem;
    margin: 0.5rem 0;
}
#upload-form input[type="file"] { border: 0; padding-left: 0; }
code { background: var(--bg); padding: 0.1rem 0.3rem; border-radius: 4px; }

.queue { padding-left: 1.25rem; }
.queue li { margin-bottom: 0.25rem; }
.mode-btn { display: block; width: 100%; margin: 0.5rem 0 0.75rem; }

.queue-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}
.queue-tab {
    flex: 1;
    background: #2a3145;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.5rem 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.queue-tab.active { background: var(--accent); color: #fff; }

.link-btn {
    display: block;
    background: none;
    color: var(--accent);
    padding: 0.3rem 0 0;
    font-size: 0.75rem;
    text-decoration: underline;
}

.queue li.break-item {
    list-style: none;
    margin-left: -1.25rem;
    padding: 0.2rem 0.5rem;
    border-left: 3px solid var(--live);
    background: #241c26;
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.85rem;
}

table.library { width: 100%; border-collapse: collapse; margin-top: 0.75rem; }
table.library th, table.library td {
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid #2a3145;
}
table.library th { color: var(--muted); font-weight: 600; }
