body {
    background-color: #0f0f12;
    color: #e7e7ea;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

header, footer {
    background: linear-gradient(90deg, #111218, #171a22);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #23242c;
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 1px;
}

nav a {
    color: #cfd3ff;
    text-decoration: none;
    margin: 0 12px;
    font-size: 14px;
}
nav a:hover { color: #8aa1ff; }

main { padding: 24px; }

#track-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.track-item {
    background: #12131a;
    border: 1px solid #23242c;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: transform .2s ease, box-shadow .2s ease;
    cursor: pointer;
}
.track-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

.track-item h2 {
    margin: 0 0 6px;
    font-size: 18px;
}
.meta { color: #9aa0b3; margin: 0 0 8px; font-size: 12px; }

.waveform {
    height: 64px;
    background: #1a1c24;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    background-repeat: no-repeat;
    background-position: left center;
    background-size: 100% 100%;
}
.waveform.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.06), rgba(255,255,255,0));
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.actions { margin-top: 10px; display: flex; gap: 8px; }
.btn {
    background: #2a2f45;
    color: #cfd3ff;
    border: 1px solid #404764;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.btn:hover { background: #343a56; border-color: #5560a0; }

/* Track page */
#waveform { 
    margin-top: 12px; 
    background: #161922; 
    border: 1px solid #23242c; 
    border-radius: 8px; 
    overflow: visible; 
    background-repeat: no-repeat;
    background-position: left center;
    background-size: 100% 100%;
}
/* When showing prerendered PNG, hide canvases to prevent double-visuals */
#waveform.prerendering canvas { opacity: 0 !important; }
#waveform canvas { transition: opacity .15s ease-in-out; }
#play-position { color: #9aa0b3; margin: 8px 0; font-size: 12px; }

#comments { display: flex; flex-direction: column; gap: 10px; }
.comment {
    background: #12131a;
    border: 1px solid #23242c;
    padding: 10px;
    border-radius: 8px;
}
.comment.active { outline: 2px solid #6a7bff; box-shadow: 0 0 0 2px rgba(106,123,255,0.25) inset; }
#comment-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
#comment-form textarea { min-height: 70px; resize: vertical; background: #0f1118; color: #e7e7ea; border: 1px solid #23242c; border-radius: 6px; padding: 8px; }
#comment-form input[type="text"] { background: #0f1118; color: #e7e7ea; border: 1px solid #23242c; border-radius: 6px; padding: 8px; }
#comment-form button { align-self: flex-start; }

/* Toolbar above waveform */
.wave-toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.wave-toolbar .btn { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.wave-toolbar .toolbar-spacer { flex: 1 1 auto; min-width: 0; }
.wave-toolbar .version-group { margin-left: auto; display: flex; align-items: center; gap: 6px; color: #9aa0b3; font-size: 12px; }
.wave-toolbar .version-group label { color: #9aa0b3; }
.wave-toolbar .version-group select.btn { background: #1b2032; color: #cfd3ff; }

@media (max-width: 640px) {
  .wave-toolbar { gap: 6px; }
  .wave-toolbar .btn { padding: 5px 8px; font-size: 11px; }
  .wave-toolbar .version-group { width: 100%; margin-left: 0; order: 99; justify-content: flex-start; }
  .wave-toolbar .version-group select.btn { max-width: 160px; }
}

/* Quick comment modal */
#quick-comment-modal { display:none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1000; align-items: center; justify-content: center; }
#quick-comment-modal .modal-card { width: min(520px, 92vw); background: #12131a; border: 1px solid #23242c; border-radius: 10px; padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#quick-comment-modal h3 { margin: 0 0 8px; }
#quick-comment-modal textarea { width: 100%; min-height: 80px; resize: vertical; background: #0f1118; color: #e7e7ea; border: 1px solid #23242c; border-radius: 6px; padding: 8px; }
#quick-comment-modal .row { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
#quick-comment-modal input[type="text"] { background: #0f1118; color: #e7e7ea; border: 1px solid #23242c; border-radius: 6px; padding: 8px; width: 50%; }

/* Audio element hidden */
#audio-player { display:none; }
