/* =========================================================
   MUSIC-GRANIK — BLUE EDITION
   Pełny CSS: player, playlist, odsłuchania, czas i responsywność
   ========================================================= */

:root {
    color-scheme: dark;

    --blue: #05acfa;
    --blue2: #0d4b68;
    --white1: #f9f8fa;

    --bg: #06121c;
    --bg2: #081c29;

    --panel: rgba(8, 31, 45, 0.88);
    --panel-solid: #0a2433;
    --panel-hover: rgba(13, 75, 104, 0.42);

    --text: var(--white1);
    --text-muted: #a8c2d0;
    --text-subtle: #7896a7;

    --accent: var(--blue);
    --accent-strong: #0094dc;
    --accent-light: #72d3ff;

    --border: rgba(170, 220, 245, 0.12);
    --border-active: rgba(5, 172, 250, 0.48);

    --music-background: url("../images/logogranik.png");

    --radius-xl: 26px;
    --radius-lg: 19px;
    --radius-md: 14px;

    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

/* ================= RESET ================= */

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;

    color: var(--white1);

    background:
        radial-gradient(
            ellipse at 50% 0%,
            rgba(13, 75, 104, 0.55),
            transparent 55%
        ),
        var(--bg);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

img {
    display: block;
    max-width: 100%;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 4px;
}

/* ================= TŁO ================= */

.app {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    padding: 28px 24px 20px;
    overflow: hidden;
}

.app::before {
    position: fixed;
    z-index: -2;
    inset: -8%;

    content: "";
    pointer-events: none;

    background-image:
        linear-gradient(
            120deg,
            rgba(4, 15, 24, 0.8),
            rgba(5, 24, 36, 0.9)
        ),
        var(--music-background);

    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;

    filter: blur(42px) saturate(1.2);
    opacity: 0.55;

    transform: scale(1.08);
    animation: background-drift 36s ease-in-out infinite alternate;

    transition: background-image 0.8s ease;
}

.app::after {
    position: fixed;
    z-index: -1;
    inset: 0;

    content: "";
    pointer-events: none;

    background:
        radial-gradient(
            ellipse at 50% 12%,
            rgba(5, 172, 250, 0.12),
            transparent 48%
        ),
        linear-gradient(
            180deg,
            rgba(4, 15, 24, 0.2),
            rgba(4, 15, 24, 0.76)
        );
}

@keyframes background-drift {
    0% {
        transform: scale(1.08) translate3d(-1%, -1%, 0);
    }

    50% {
        transform: scale(1.15) translate3d(1%, 0.8%, 0);
    }

    100% {
        transform: scale(1.1) translate3d(-0.5%, 1%, 0);
    }
}

/* ================= HEADER ================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: min(1120px, 100%);
    margin: 0 auto 34px;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    color: var(--white1);
    text-decoration: none;
}

.brand-logo {
    display: grid;
    flex: 0 0 60px;
    place-items: center;

    width: 46px;
    height: 46px;

    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;

    box-shadow:
        0 7px 25px rgba(5, 172, 250, 0.23),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);

    color: var(--white1);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -1px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand-name {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 11px;
}

.topbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 9px 13px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: rgba(13, 75, 104, 0.2);
    color: #d1e8f4;

    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background: var(--blue);

    box-shadow: 0 0 12px rgba(5, 172, 250, 0.85);
}

/* ================= GŁÓWNY UKŁAD ================= */

.player-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    align-items: start;

    width: min(1120px, 100%);
    margin: 0 auto;
    gap: 22px;
}

.player-card,
.playlist-section {
    min-width: 0;

    border: 1px solid var(--border);
    border-radius: var(--radius-xl);

    background: var(--panel);
    box-shadow: var(--shadow);

    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 26px 28px 20px;
}

.section-label {
    display: flex;
    align-items: center;
    align-self: flex-start;
    gap: 9px;

    margin-bottom: 23px;

    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.7px;
}

.section-label-icon {
    color: var(--blue);
    font-size: 17px;
}

/* ================= OKŁADKA ================= */

.cover-wrap {
    position: relative;
    isolation: isolate;

    width: min(100%, 300px);
    aspect-ratio: 1;
    margin: 0 auto 23px;
}

.cover-glow {
    position: absolute;
    z-index: -1;
    inset: 12%;

    border-radius: 50%;
    background: var(--blue);

    opacity: 0.35;
    filter: blur(35px);
    transform: translateY(12px);

    transition: background 0.5s ease;
}

.cover-image {
    position: relative;
    z-index: 1;

    width: 100%;
    height: 100%;

    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;

    background: var(--blue2);
    object-fit: cover;

    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(255, 255, 255, 0.025);

    animation: cover-appear 0.45s ease both;
}

.cover-overlay {
    position: absolute;
    z-index: 2;
    inset: 0;

    display: grid;
    place-items: center;

    border-radius: 20px;

    background: linear-gradient(
        180deg,
        transparent 55%,
        rgba(0, 0, 0, 0.15)
    );

    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cover-overlay-icon {
    display: grid;
    place-items: center;

    width: 55px;
    height: 55px;

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;

    background: rgba(5, 30, 44, 0.65);
    color: var(--white1);
    font-size: 26px;

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.cover-wrap:hover .cover-overlay {
    opacity: 1;
}

@keyframes cover-appear {
    from {
        opacity: 0.65;
        transform: scale(0.985);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ================= TYTUŁ I WYKONAWCA ================= */

.track-details {
    width: 100%;
    min-width: 0;
    text-align: center;
}

.track-title {
    max-width: 100%;
    margin: 0;

    overflow-wrap: anywhere;
    color: var(--white1);

    font-size: clamp(20px, 2.3vw, 27px);
    font-weight: 800;
    letter-spacing: -0.9px;
    line-height: 1.3;
}

.track-artist {
    margin: 8px 0 0;

    overflow-wrap: anywhere;
    color: var(--blue);

    font-size: 14px;
    font-weight: 700;
}

.track-album {
    min-height: 15px;
    margin: 6px 0 0;

    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: 11px;
}

/* ================= WIZUALIZACJA ================= */

.visualizer-wrap {
    width: 100%;
    height: 46px;
    margin: 15px 0 9px;
}

.visualizer {
    display: block;
    width: 100%;
    height: 100%;
}

/* ================= PASEK POSTĘPU ================= */

.progress-section {
    width: 100%;
    margin-top: 3px;
}

.progress-slider {
    display: block;
    width: 100%;
    height: 5px;
    margin: 0;

    border-radius: 999px;
    outline: none;

    background: rgba(255, 255, 255, 0.13);
    accent-color: var(--blue);

    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.progress-slider::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
}

.progress-slider::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
}

.progress-slider::-webkit-slider-thumb {
    width: 13px;
    height: 13px;
    margin-top: -4px;

    border: 2px solid var(--white1);
    border-radius: 50%;

    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(5, 172, 250, 0.13);

    appearance: none;
    -webkit-appearance: none;
}

.progress-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;

    border: 2px solid var(--white1);
    border-radius: 50%;

    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(5, 172, 250, 0.13);
}

.time-labels {
    display: flex;
    justify-content: space-between;

    margin-top: 10px;

    color: var(--text-subtle);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

/* ================= PRZYCISKI ODTWARZACZA ================= */

.controls {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    margin-top: 19px;
    gap: clamp(9px, 1.5vw, 19px);
}

.control-button,
.play-button {
    position: relative;

    display: grid;
    flex: 0 0 auto;
    place-items: center;

    border: 1px solid transparent;
    cursor: pointer;

    transition:
        transform 0.18s ease,
        color 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.control-button {
    width: 43px;
    height: 43px;

    border-radius: 14px;
    background: transparent;
    color: #b4cbd7;
}

.control-button svg {
    width: 20px;
    height: 20px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.control-button:hover {
    border-color: var(--border);
    background: rgba(5, 172, 250, 0.1);
    color: var(--white1);
    transform: translateY(-2px);
}

.control-button.is-active {
    border-color: rgba(5, 172, 250, 0.25);
    background: rgba(5, 172, 250, 0.13);
    color: var(--blue);
}

.secondary-control {
    color: #86a7b8;
}

.play-button {
    width: 59px;
    height: 59px;

    border-radius: 20px;

    background: linear-gradient(145deg, #48c6ff, var(--blue));

    box-shadow:
        0 9px 25px rgba(5, 172, 250, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);

    color: #03283b;
}

.play-button:hover {
    box-shadow:
        0 12px 32px rgba(5, 172, 250, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);

    transform: translateY(-2px) scale(1.03);
}

.play-button:active,
.control-button:active {
    transform: scale(0.95);
}

.play-icon {
    display: block;
    padding-left: 2px;

    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.repeat-one-badge {
    position: absolute;
    right: 7px;
    bottom: 6px;

    display: none;
    place-items: center;

    width: 12px;
    height: 12px;

    border-radius: 50%;
    background: var(--blue);
    color: #062232;

    font-size: 8px;
    font-weight: 900;
}

.repeat-button[data-mode="2"] .repeat-one-badge {
    display: grid;
}

/* ================= STATUS ODTWARZACZA ================= */

.player-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    min-height: 34px;
    margin-top: 13px;

    color: var(--text-subtle);
    font-size: 10px;
    text-align: center;
}

.status-indicator {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;

    border-radius: 50%;
    background: var(--blue2);
}

/* ================= PLAYLISTA ================= */

.playlist-section {
    display: flex;
    flex-direction: column;

    min-height: 100%;
    padding: 25px 22px 18px;
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding-bottom: 23px;
}

.playlist-eyebrow {
    margin: 0 0 7px;

    color: var(--blue);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.playlist-heading {
    margin: 0;

    color: var(--white1);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.9px;
}

.playlist-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 60px;
    min-height: 57px;
    padding: 7px 10px;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: rgba(13, 75, 104, 0.22);
}

.playlist-count #songCount {
    color: var(--blue);
    font-size: 19px;
    font-weight: 800;
    line-height: 1.2;
}

.playlist-count > span:last-child {
    margin-top: 3px;
    color: var(--text-subtle);
    font-size: 9px;
}

.playlist-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 10px;

    padding: 0 10px 11px;

    border-bottom: 1px solid var(--border);
    color: var(--text-subtle);

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.playlist-columns span:last-child {
    text-align: center;
}

/* Lista przewijana */

.playlist {
    display: flex;
    flex-direction: column;
    gap: 5px;

    max-height: 590px;
    min-height: 100px;
    padding: 8px 4px 8px 0;

    overflow-x: hidden;
    overflow-y: auto;

    scrollbar-color: rgba(5, 172, 250, 0.35) transparent;
    scrollbar-width: thin;
}

.playlist::-webkit-scrollbar {
    width: 5px;
}

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

.playlist::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(5, 172, 250, 0.35);
}

/* Pojedynczy utwór */

.playlist-item {
    display: grid;
    grid-template-columns: 49px minmax(0, 1fr) 72px;
    align-items: center;
    gap: 12px;

    width: 100%;
    min-height: 76px;
    padding: 10px;

    border: 1px solid transparent;
    border-radius: 15px;

    background: transparent;
    color: var(--white1);
    text-align: left;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.playlist-item:hover {
    border-color: var(--border);
    background: rgba(5, 172, 250, 0.06);
}

.playlist-item:active {
    transform: scale(0.99);
}

.playlist-item.is-active {
    border-color: var(--border-active);

    background:
        linear-gradient(
            100deg,
            rgba(5, 172, 250, 0.17),
            rgba(13, 75, 104, 0.17)
        );
}

.playlist-cover {
    width: 49px;
    height: 49px;

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;

    background: var(--blue2);
    object-fit: cover;
}

/* Informacje */

.playlist-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0px;
}

.playlist-title {
    display: block;
    overflow: hidden;

    color: #eaf6fc;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-artist {
    display: block;
    overflow: hidden;

    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.3;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item.is-active .playlist-title {
    color: var(--blue);
}

.playlist-item.is-active .playlist-artist {
    color: #a9e3ff;
}

/* Liczba odsłuchań */

.playlist-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 1px;
}

.playlist-listens {
    display: block;
    overflow: hidden;

    color: var(--blue);
    font-size: 14px;
    line-height: 1.3;

    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Czas i numer utworu */

.playlist-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-width: 0;
}

.playlist-duration {
    color: var(--white1);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.playlist-indicator {
    display: grid;
    place-items: center;

    width: 30px;
    height: 27px;

    border-radius: 9px;

    color: var(--text-subtle);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.playlist-item.is-active .playlist-indicator {
    background: rgba(5, 172, 250, 0.13);
    color: var(--blue);
    font-size: 17px;
    font-weight: 800;
}

/* ================= ŁADOWANIE PLAYLISTY ================= */

.playlist-loading,
.playlist-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;

    min-height: 110px;
    padding: 20px;

    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.loading-spinner {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;

    border: 2px solid rgba(5, 172, 250, 0.18);
    border-top-color: var(--blue);

    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.playlist-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    margin-top: auto;
    padding-top: 17px;

    border-top: 1px solid var(--border);

    color: var(--text-subtle);
    font-size: 10px;
}

.footer-music-icon {
    color: var(--blue);
    font-size: 15px;
}

/* ================= STOPKA ================= */

.page-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;

    width: min(1120px, 100%);
    margin: 30px auto 0;

    color: var(--text-subtle);
    font-size: 15px;
}

.footer-brand {
    display: grid;
    place-items: center;

    width: 30px;
    height: 30px;

    border-radius: 6px;
    background: rgba(5, 172, 250, 0.13);
    color: var(--blue);

    font-size: 8px;
    font-weight: 900;
}

.footer-separator {
    color: var(--blue2);
}

/* ================= TABLET ================= */

@media (max-width: 850px) {
    .app {
        padding: 22px 18px 18px;
    }

    .topbar {
        margin-bottom: 24px;
    }

    .player-layout {
        grid-template-columns: minmax(0, 1fr);
        max-width: 560px;
        gap: 18px;
    }

    .player-card {
        padding: 25px 28px 20px;
    }

    .cover-wrap {
        width: min(100%, 290px);
    }

    .playlist-section {
        min-height: auto;
    }

    .playlist {
        max-height: 440px;
    }

    .page-footer {
        margin-top: 24px;
    }
}

/* ================= TELEFON ================= */

@media (max-width: 480px) {
    .app {
        padding: 17px 12px 15px;
    }

    .topbar {
        gap: 8px;
        margin-bottom: 17px;
    }

    .brand {
        gap: 9px;
    }

    .brand-logo {
        width: 40px;
        height: 40px;
        flex-basis: 40px;

        border-radius: 13px;
        font-size: 13px;
    }

    .brand-name {
        font-size: 14px;
    }

    .brand-subtitle {
        font-size: 10px;
    }

    .topbar-badge {
        gap: 6px;
        padding: 8px 9px;
        font-size: 9px;
    }

    .player-card {
        padding: 19px 17px 15px;
        border-radius: 22px;
    }

    .section-label {
        margin-bottom: 18px;
        font-size: 9px;
        letter-spacing: 1.3px;
    }

    .cover-wrap {
        width: min(82%, 255px);
        margin-bottom: 19px;
    }

    .cover-image,
    .cover-overlay {
        border-radius: 17px;
    }

    .track-title {
        font-size: 22px;
    }

    .track-artist {
        font-size: 13px;
    }

    .visualizer-wrap {
        height: 37px;
        margin-top: 13px;
    }

    .controls {
        gap: clamp(4px, 2vw, 10px);
        margin-top: 15px;
    }

    .control-button {
        width: 38px;
        height: 40px;
        border-radius: 12px;
    }

    .control-button svg {
        width: 18px;
        height: 18px;
    }

    .play-button {
        width: 54px;
        height: 54px;
        border-radius: 18px;
    }

    .play-icon {
        font-size: 20px;
    }

    .player-status {
        font-size: 9px;
    }

    .playlist-section {
        padding: 20px 10px 15px;
        border-radius: 22px;
    }

    .playlist-heading {
        font-size: 23px;
    }

    .playlist-header {
        padding-bottom: 18px;
    }

    .playlist-columns {
        grid-template-columns: minmax(0, 1fr) 64px;
        gap: 6px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .playlist-item {
        grid-template-columns: 42px minmax(0, 1fr) 64px;
        min-height: 72px;
        gap: 8px;
        padding: 8px 6px;
    }

    .playlist-cover {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .playlist-title {
        font-size: 11px;
    }

    .playlist-artist {
        font-size: 10px;
    }

    .playlist-listens {
        font-size: 9px;
    }

    .playlist-duration {
        font-size: 10px;
    }

    .playlist-meta {
        gap: 5px;
    }

    .playlist-indicator {
        width: 25px;
        height: 25px;
    }

    .page-footer {
        gap: 6px;
        font-size: 9px;
    }
}

/* ================= BARDZO MAŁE EKRANY ================= */

@media (max-width: 350px) {
    .topbar-badge {
        gap: 0;
        font-size: 0;
    }

    .topbar-badge .status-dot {
        width: 8px;
        height: 8px;
    }

    .controls {
        gap: 3px;
    }

    .control-button {
        width: 34px;
    }

    .play-button {
        width: 49px;
        height: 49px;
    }

    .playlist-item {
        grid-template-columns: 36px minmax(0, 1fr) 56px;
        gap: 7px;
        padding-right: 4px;
        padding-left: 4px;
    }

    .playlist-cover {
        width: 36px;
        height: 36px;
    }

    .playlist-listens {
        font-size: 8px;
    }

    .playlist-duration {
        font-size: 9px;
    }

    .playlist-columns {
        grid-template-columns: minmax(0, 1fr) 56px;
    }
}

/* ================= MNIEJ ANIMACJI ================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}