/* =========================================================
   A Little Melody - musik.css
   Halaman pemutar musik dengan tema angkasa yang sama.
   ========================================================= */

:root {
    --space-950: #050816;
    --space-900: #080d20;
    --space-800: #0e1533;
    --panel: rgba(19, 26, 58, 0.82);
    --border: rgba(126, 143, 214, 0.26);
    --border-strong: rgba(159, 140, 255, 0.45);
    --star: #eef1ff;
    --text: #dce2f8;
    --muted: #bcc5e6;
    --label: #a5b0dd;
    --accent: #a99bff;
    --accent-soft: #8f83ff;
    --cyan: #6ee7e0;
    --btn: #5b4fd6;
    --btn-hover: #6f63f0;
    --shadow: 0 22px 55px rgba(2, 4, 14, 0.6);
    --radius: 26px;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--space-950);
    background-image:
        radial-gradient(ellipse 90% 60% at 15% 0%, rgba(96, 82, 220, 0.30), transparent 60%),
        radial-gradient(ellipse 75% 55% at 95% 100%, rgba(32, 116, 160, 0.22), transparent 65%),
        radial-gradient(ellipse 60% 45% at 50% 55%, rgba(124, 60, 190, 0.12), transparent 70%);
    background-attachment: fixed;
    color: var(--text);
    padding: 24px 16px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Bintang latar */
.starfield {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: var(--star);
    box-shadow: 0 0 6px rgba(200, 214, 255, 0.85);
    animation: twinkle 4s ease-in-out infinite;
}

/* Bar atas */
.topbar {
    width: min(100%, 460px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    position: relative;
    z-index: 2;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-strong);
    color: #f4f6ff;
}

.brand {
    font-size: 11px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--label);
}

/* Halaman */
.player-page {
    width: min(100%, 460px);
    position: relative;
    z-index: 2;
}

.player-card {
    position: relative;
    background: linear-gradient(160deg, rgba(30, 39, 82, 0.9), rgba(12, 17, 40, 0.95));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    padding: 32px 26px 26px;
    text-align: center;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
}

.player-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(159, 140, 255, 0.7), transparent);
}

/* Piringan / planet */
.disc {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, #2b3268 0 22%, #131a3a 60%, #0a0f26 100%);
    border: 1px solid rgba(126, 143, 214, 0.3);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55),
                0 0 40px rgba(120, 100, 240, 0.22);
    display: grid;
    place-items: center;
}

.disc-groove {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: repeating-radial-gradient(circle at 50% 50%, #0000 0 3px, #ffffff0c 3px 5px);
}

.disc-cover {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #b9aeff, #6b5ce0 55%, #2c2768);
    display: grid;
    place-items: center;
    font-size: 44px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 26px rgba(139, 123, 240, 0.5);
}

.disc-orbit {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px dashed rgba(110, 231, 224, 0.35);
}

.disc.is-playing {
    animation: spin 12s linear infinite;
}

.disc.is-playing .disc-cover {
    animation: spin-reverse 12s linear infinite;
}

/* Teks */
.eyebrow {
    font-size: 10.5px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--label);
    margin-bottom: 8px;
}

h1 {
    font-size: 25px;
    color: #f4f6ff;
    line-height: 1.25;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
    text-shadow: 0 0 28px rgba(159, 140, 255, 0.35);
}

.artist {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 22px;
}

/* Progres */
.progress-wrap {
    margin-bottom: 8px;
}

.progress,
.volume {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(126, 143, 214, 0.28);
    cursor: pointer;
}

.progress::-webkit-slider-thumb,
.volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a99bff, #6b5ce0);
    border: 2px solid #eef1ff;
    box-shadow: 0 0 10px rgba(159, 140, 255, 0.8);
}

.progress::-moz-range-thumb,
.volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a99bff;
    border: 2px solid #eef1ff;
}

.time-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--label);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

/* Kontrol */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 14px 0 18px;
}

.play-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 1px solid rgba(180, 190, 255, 0.35);
    background: linear-gradient(135deg, #6f63f0, #4a3fc0);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 12px 30px rgba(50, 35, 150, 0.55);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.play-btn:hover {
    background: linear-gradient(135deg, #8377ff, #5a4fdc);
    transform: scale(1.05);
    box-shadow: 0 16px 34px rgba(80, 60, 200, 0.6);
}

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

.control {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.control:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-strong);
    color: #f4f6ff;
}

/* Pengaturan tambahan */
.extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px dashed rgba(126, 143, 214, 0.25);
}

.loop-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: inherit;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.loop-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f4f6ff;
}

.loop-btn[aria-pressed="true"] {
    background: rgba(159, 140, 255, 0.18);
    border-color: rgba(159, 140, 255, 0.6);
    color: #e4e0ff;
}

.volume-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 130px;
    max-width: 180px;
    font-size: 14px;
}

.volume {
    height: 5px;
}

.status {
    min-height: 18px;
    margin-top: 14px;
    font-size: 12px;
    color: var(--label);
}

/* Daftar lagu */
.playlist {
    margin-top: 18px;
    background: rgba(14, 20, 45, 0.72);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px 18px 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.playlist h2 {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--label);
    font-weight: 600;
    margin-bottom: 10px;
}

.playlist ul {
    list-style: none;
}

.playlist li + li {
    border-top: 1px dashed rgba(126, 143, 214, 0.25);
}

.track-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.track-item:hover {
    color: var(--accent);
}

.track-item .track-emoji {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(159, 140, 255, 0.16);
    border: 1px solid rgba(159, 140, 255, 0.3);
    display: grid;
    place-items: center;
    font-size: 17px;
    flex-shrink: 0;
}

.track-item .track-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.track-item .track-detail {
    font-size: 12px;
    color: var(--label);
}

.track-item.is-active {
    color: var(--accent);
    font-weight: 600;
}

.track-item.is-active .track-detail::after {
    content: " • sedang diputar";
}

.track-item.is-missing .track-detail::after {
    content: " • berkas belum ada";
    color: #ff9b8a;
}

.hint {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    line-height: 1.7;
    color: var(--label);
}

.hint code {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 5px;
}

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

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

@keyframes twinkle {
    0%, 100% {
        opacity: 0.25;
        transform: scale(0.85);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 12px 28px;
    }

    .player-card {
        padding: 26px 18px 22px;
    }

    .disc {
        width: 165px;
        height: 165px;
    }

    .disc-cover {
        width: 84px;
        height: 84px;
        font-size: 38px;
    }

    h1 {
        font-size: 22px;
    }
}

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

    .disc.is-playing,
    .disc.is-playing .disc-cover {
        animation: none;
    }
}
