:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --card-hover: #24344d;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent-color: #a855f7;
    --accent-hover: #9333ea;
    --border-color: #334155;

    --theme-desire: #ec4899;
    --theme-loss: #6366f1;
    --theme-love: #f43f5e;
    --theme-solitude: #8b5cf6;
    --theme-work: #f59e0b;
    --theme-ambient: #10b981;
    --theme-aftermath: #6366f1;
    --theme-hope: #f59e0b;
    --theme-other: #a855f7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: url('images/background-v2.jpg');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-blend-mode: overlay;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

/* Background overlay for readability */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.nav-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.nav-bar a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.95rem;
}
.nav-bar a:hover {
    background: var(--card-bg);
    color: var(--accent-color);
}
.nav-bar a.active {
    background: var(--accent-color);
    color: white;
}

.page-header {
    margin-bottom: 2rem;
}
.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}
.page-header h1 .accent {
    color: var(--accent-color);
}
.page-header .subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.theme-section {
    margin-bottom: 2.5rem;
}
.theme-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.music-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    position: relative;
}
.music-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: var(--card-hover);
}

.music-card .card-art {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: linear-gradient(135deg, #334155, #1e293b);
}
.music-card .card-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.music-card:hover .card-art img {
    transform: scale(1.05);
}

.music-card .play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.music-card:hover .play-overlay {
    opacity: 1;
}
.music-card .play-overlay a {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}
.music-card .play-overlay a:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.music-card .card-body {
    padding: 1rem;
}
.music-card .card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.3;
    color: var(--text-primary);
}
.music-card .card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.theme-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.theme-badge.desire { background: var(--theme-desire); color: white; }
.theme-badge.loss { background: var(--theme-loss); color: white; }
.theme-badge.love { background: var(--theme-love); color: white; }
.theme-badge.solitude { background: var(--theme-solitude); color: white; }
.theme-badge.work { background: var(--theme-work); color: #0f172a; }
.theme-badge.ambient { background: var(--theme-ambient); color: white; }
.theme-badge.aftermath { background: var(--theme-aftermath); color: white; }
.theme-badge.hope { background: var(--theme-hope); color: #0f172a; }
.theme-badge.other { background: var(--theme-other); color: white; }

.theme-heading.desire { color: var(--theme-desire); border-bottom-color: var(--theme-desire); }
.theme-heading.loss { color: var(--theme-loss); border-bottom-color: var(--theme-loss); }
.theme-heading.love { color: var(--theme-love); border-bottom-color: var(--theme-love); }
.theme-heading.solitude { color: var(--theme-solitude); border-bottom-color: var(--theme-solitude); }
.theme-heading.work { color: var(--theme-work); border-bottom-color: var(--theme-work); }
.theme-heading.ambient { color: var(--theme-ambient); border-bottom-color: var(--theme-ambient); }
.theme-heading.aftermath { color: var(--theme-aftermath); border-bottom-color: var(--theme-aftermath); }
.theme-heading.hope { color: var(--theme-hope); border-bottom-color: var(--theme-hope); }
.theme-heading.other { color: var(--theme-other); border-bottom-color: var(--theme-other); }

.search-wrapper {
    position: relative;
    margin-bottom: 2rem;
    max-width: 500px;
}
.search-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.search-wrapper input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}
.search-wrapper input::placeholder {
    color: var(--text-muted);
}
.search-wrapper .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-results-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
}
.search-results-info.visible {
    display: block;
}

.stats-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 600px;
}
.stats-box h2 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}
.stats-box ul {
    list-style: none;
}
.stats-box li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stats-box li:last-child {
    border-bottom: none;
}
.stats-box .badge {
    background: var(--accent-color);
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.stats-box .summary {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sandbox-badge {
    display: inline-block;
    background: #f59e0b;
    color: #0f172a;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.player-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1rem;
}
#songTitle {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
#albumArt {
    max-width: 200px;
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}
.player-container h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}
#lyricsDisplay {
    white-space: pre-wrap;
    font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.9rem;
    background: #162033;
    color: var(--text-secondary);
    padding: 1rem;
    border-radius: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
    clear: both;
    border: 1px solid var(--border-color);
    line-height: 1.7;
}
audio {
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 0.25rem;
}
.loading-message, .error-message {
    text-align: center;
    padding: 2rem;
    font-weight: 600;
}
.loading-message { color: var(--text-secondary); }
.error-message {
    color: #f87171;
    background: var(--card-bg);
    border-radius: 0.75rem;
    border: 1px solid #f87171;
}
.hidden { display: none; }

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 0.75rem;
    }
    .page-header h1 {
        font-size: 1.8rem;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
    #albumArt {
        max-width: 120px;
        float: none;
        margin: 0 auto 1rem;
        display: block;
    }
}
@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .page-header h1 {
        font-size: 1.5rem;
    }
}

/* ── Homepage ── */
.theme-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.theme-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    transition: transform 0.2s;
}
.theme-card:hover {
    transform: translateY(-3px);
}
.theme-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.theme-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.stats-footer {
    text-align: center;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--accent-color);
    color: white;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}
.btn-secondary {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid #334155;
}
.btn-secondary:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.sandbox-badge {
    display: inline-block;
    background: #f59e0b;
    color: #0f172a;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* ── Home Grid ── */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.home-card {
    background: var(--card-bg);
    border: 1px solid #2d3748;
    border-radius: var(--card-radius);
    padding: 1.5rem;
    text-decoration: none;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.home-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.15);
}
.home-card-icon {
    font-size: 2rem;
    line-height: 1;
}
.home-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}
.home-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ── Content Card (About, Donate, Story) ── */
.content-card {
    background: var(--card-bg);
    border: 1px solid #2d3748;
    border-radius: var(--card-radius);
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
    color: var(--text-primary);
}

/* ── Album Grid ── */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.album-card {
    background: var(--card-bg);
    border: 1px solid #2d3748;
    border-radius: var(--card-radius);
    padding: 2rem 1.5rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.25s;
}
.album-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.15);
}
.album-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 auto 0.75rem;
}
.album-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.album-count {
    font-size: 0.88rem;
    color: var(--text-secondary);
}
