/* ========== Reset ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: #fff;
    color: #111;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

/* Hide what's meant to be hidden — the native attribute */
[hidden] { display: none !important; }

canvas#particles {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* ========== Catalog ========== */

.catalog {
    max-width: 960px;
    margin: 0 auto;
    padding: 80px 24px 48px;
}

.catalog-header h1 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 48px;
}

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

.card {
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 28px 24px;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
    color: #e8e8ec;
}

.card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.card-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}

.card-track {
    font-size: 0.85rem;
    color: #888892;
    margin-bottom: 12px;
    min-height: 1.3em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-listeners {
    font-size: 0.75rem;
    color: #5a5a64;
}

.player-body .catalog-header h1 {
    color: #fff;
}

@media (max-width: 768px) {
    .catalog-grid { grid-template-columns: 1fr; }
    .catalog { padding: 48px 16px 32px; }
    .catalog-header h1 { font-size: 1.8rem; margin-bottom: 32px; }
}

/* ========== Player ========== */

.player-body {
    background: radial-gradient(circle at 20% 10%, #1c1c22 0%, #0b0b0f 60%, #050507 100%);
    color: #e8e8ec;
    min-height: 100vh;
    min-height: 100dvh;
}

.player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0;
    max-width: 1120px;
    margin: 0 auto;
    min-height: 100vh;
}

.player-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 40px 56px 56px;
    gap: 24px;
}

.back-link {
    font-size: 0.8rem;
    color: #7c7c86;
    letter-spacing: 0.02em;
    transition: color 0.15s;
    align-self: flex-start;
    padding: 4px 8px;
    margin-left: -8px;
    border-radius: 6px;
}

.back-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.station-block {
    margin-top: 24px;
}

.station-eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #6a6a74;
    margin-bottom: 10px;
}

.station-name {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #fff;
    word-break: break-word;
}

/* ----- Play button ----- */

.play-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fff;
    color: #0b0b0f;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.08),
                0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    margin-top: 8px;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.14),
                0 4px 12px rgba(0, 0, 0, 0.5);
}

.play-btn:active {
    transform: scale(0.97);
}

.play-icon {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Single SVG with two paths; dataset drives which one shows */
.play-btn[data-state="paused"] .icon-path-pause,
.play-btn[data-state="playing"] .icon-path-play {
    display: none;
}

.play-btn[data-state="paused"] .play-icon {
    /* nudge play triangle so it looks optically centered */
    transform: translateX(1.5px);
}

/* ----- Current track ----- */

.current-track {
    min-height: 52px;
}

.track-title {
    font-size: 1.05rem;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-size: 0.85rem;
    color: #888892;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- Volume ----- */

.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-icon {
    width: 18px;
    height: 18px;
    fill: #6a6a74;
    flex-shrink: 0;
}

.volume-slider {
    width: 160px;
    height: 20px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    margin-top: -5.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 2px;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.listener-count {
    font-size: 0.75rem;
    color: #5a5a64;
    letter-spacing: 0.04em;
}

/* ----- Tracks panel ----- */

.player-tracks {
    padding: 56px 56px 56px 20px;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.tracks-header {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #6a6a74;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.track-list {
    overflow-y: auto;
    flex: 1;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.track-list li {
    padding: 12px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    gap: 14px;
    align-items: baseline;
    transition: background 0.12s;
    border-radius: 6px;
    padding-left: 10px;
    padding-right: 10px;
    margin-left: -10px;
    margin-right: -10px;
}

.track-list li:hover {
    background: rgba(255, 255, 255, 0.03);
}

.track-list li:last-child {
    border-bottom: none;
}

.track-pos {
    font-size: 0.75rem;
    color: #4a4a54;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-info-title {
    font-size: 0.9rem;
    color: #e8e8ec;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-info-artist {
    font-size: 0.78rem;
    color: #6a6a74;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.track-list::-webkit-scrollbar {
    width: 4px;
}

.track-list::-webkit-scrollbar-track {
    background: transparent;
}

.track-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* ----- Bottom sheet (mobile only) ----- */

.bottom-sheet {
    display: none;
}

@media (max-width: 768px) {
    .player {
        display: flex;
        flex-direction: column;
        min-height: auto;
    }

    .player-controls {
        padding: 28px 24px 140px;
        min-height: 100vh;
        min-height: 100dvh;
        justify-content: center;
    }

    .player-tracks {
        display: none;
    }

    .volume-slider {
        width: 100%;
        max-width: 220px;
    }

    .bottom-sheet {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(18, 18, 22, 0.96);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 18px 18px 0 0;
        transform: translateY(calc(100% - 56px));
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        z-index: 100;
        max-height: 72vh;
        max-height: 72dvh;
    }

    .bottom-sheet.open {
        transform: translateY(0);
    }

    .bottom-sheet-handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 10px 0 12px;
        cursor: pointer;
        user-select: none;
    }

    .handle-bar {
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }

    .handle-label {
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.16em;
        color: #6a6a74;
    }

    .bottom-sheet-content {
        padding: 4px 20px 24px;
        overflow-y: auto;
        max-height: calc(72vh - 56px);
        max-height: calc(72dvh - 56px);
    }
}
