:root {
    --gap: 18px;
}
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
    background: linear-gradient(120deg, #0f2027, #203a43, #2c5364);
    color: #fff;
    padding: 20px 20px 92px; /* leave space for player */
}
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--gap);
}
.tile {
    position: relative;
    padding: 18px;
    border-radius: 12px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    color: #fff;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, min-height 0.2s ease;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}
.tile:hover {
    transform: translateY(-6px);
}
.tile.expanded {
    min-height: 300px;
}
.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.tile .title {
    font-weight: 700;
    font-size: 1rem;
}
.tile .play-btn {
    display: none;
}
.tile .expand-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    flex-shrink: 0;
}
.tile.playing {
    outline: 3px solid rgba(255, 255, 255, 0.14);
}
.tile-content {
    margin-top: 12px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}
.tile-content.hidden {
    display: none;
}
.tile-info {
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}
.tile-info .artist {
    font-weight: 600;
    margin-bottom: 4px;
}
.tile-info .genre {
    opacity: 0.9;
}
.tile-lyrics {
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 8px 0;
}

/* tiles aligned: no vertical offset */
.tile {
    margin-top: 0;
}

.player {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 68px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.player-info {
    flex: 0 0 250px;
}
#current-title {
    font-weight: 700;
}
.player-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
#progress {
    flex: 1;
}
#time {
    white-space: nowrap;
    color: #ddd;
    font-size: 0.9rem;
}
#volume {
    width: 100px;
}

/* colorful backgrounds generated via JS-set inline styles or fallback palette */

/* Responsive player layout for vertical/portrait devices */
@media (max-width: 800px) {
    .player {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        padding: 10px;
        gap: 8px;
    }

    .player-info {
        flex: 0 0 auto;
        margin-bottom: 6px;
    }

    .player-controls {
        flex-direction: column;
        gap: 8px;
    }

    #progress {
        width: 100%;
        flex: none;
    }

    #volume {
        width: 100%;
        flex: none;
    }

    #play-pause {
        align-self: flex-start;
    }

    #time {
        font-size: 0.85rem;
    }
}
