:root {
    --bg: #080808;
    --bg-surface: #111111;
    --bg-raised: #1a1a1a;
    --bg-hover: #242424;

    --text: #ddd8ce;
    --text-dim: #706b62;
    --text-muted: #3d3a36;

    --accent: #c9a24d;
    --accent-dim: #7a6330;
    --accent-glow: rgba(201, 162, 77, 0.12);
    --accent-hi: #e6c060;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;

    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    background: var(--bg);
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px;
}

.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.08;
    animation: drift 30s ease-in-out infinite alternate;
}

.ambient__blob--1 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    top: -120px;
    left: -80px;
}

.ambient__blob--2 {
    width: 400px;
    height: 400px;
    background: #3a2510;
    bottom: -100px;
    right: -60px;
    animation-delay: -12s;
    animation-duration: 35s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -20px) scale(1.08);
    }

    100% {
        transform: translate(-15px, 25px) scale(0.96);
    }
}

.state {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: var(--bg);
}

.loader {
    width: 32px;
    height: 32px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.error-icon {
    font-size: 2rem;
    color: var(--accent);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-dim);
    border-radius: 50%;
}

.error-msg {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text);
}

.error-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.player-page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 40px 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeIn 0.6s var(--ease-expo) forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vinyl-wrap {
    width: 200px;
    height: 200px;
    position: relative;
    flex-shrink: 0;
}

.vinyl {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #1e1e1e, #0a0a0a 60%, #050505);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 40px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.4s;
}

.vinyl.is-spinning {
    animation: vinylSpin 2.5s linear infinite;
    box-shadow:
        0 4px 40px var(--accent-glow),
        inset 0 0 40px rgba(0, 0, 0, 0.3);
}

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

.vinyl__groove {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.025);
}

.vinyl__groove--1 {
    inset: 12px;
}

.vinyl__groove--2 {
    inset: 28px;
}

.vinyl__groove--3 {
    inset: 44px;
}

.vinyl__groove--4 {
    inset: 58px;
}

.vinyl__label {
    position: absolute;
    inset: 65px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent-dim) 0%, #4a3318 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
}

.vinyl__label-text {
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.25);
}

.vinyl__shine {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.track-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.track-info__title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text);
    line-height: 1.2;
    max-width: 360px;
    word-break: break-word;
}

.track-info__artist {
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 0.03em;
}

.track-info__badge {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent-dim);
    background: rgba(201, 162, 77, 0.06);
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(201, 162, 77, 0.1);
    margin-top: 4px;
}

.waveform {
    width: 100%;
    height: 48px;
    opacity: 0.25;
    pointer-events: none;
}

.progress-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    letter-spacing: 0.03em;
    user-select: none;
}

.progress-time:last-child {
    text-align: right;
}

.progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}

.progress-bar:hover {
    height: 5px;
}

.progress-bar__fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 999px;
    position: relative;
    overflow: visible;
}

.progress-bar__head {
    position: absolute;
    top: 50%;
    right: -5px;
    width: 10px;
    height: 10px;
    background: var(--accent-hi);
    border-radius: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.15s var(--ease-back);
    box-shadow: 0 0 12px var(--accent-glow);
    pointer-events: none;
}

.progress-bar:hover .progress-bar__head,
.progress-bar.is-active .progress-bar__head {
    transform: translateY(-50%) scale(1);
}

.controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.ctrl-btn svg {
    width: 22px;
    height: 22px;
}

.ctrl-btn:hover {
    color: var(--accent);
    transform: scale(1.08);
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.ctrl-btn--secondary {
    width: 40px;
    height: 40px;
    color: var(--text-dim);
}

.ctrl-btn--play {
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: var(--bg);
    box-shadow: 0 2px 20px var(--accent-glow);
}

.ctrl-btn--play:hover {
    background: var(--accent-hi);
    color: var(--bg);
    box-shadow: 0 4px 30px rgba(201, 162, 77, 0.25);
}

.ctrl-btn--play svg {
    width: 26px;
    height: 26px;
}

.volume-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 160px;
}

.vol-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-dim);
    transition: color 0.2s;
}

.vol-btn:hover {
    color: var(--accent);
}

.vol-btn svg {
    width: 16px;
    height: 16px;
}

.vol-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    cursor: pointer;
    position: relative;
}

.vol-bar__fill {
    height: 100%;
    width: 80%;
    background: var(--text-dim);
    border-radius: 999px;
    transition: background 0.2s;
}

.vol-bar:hover .vol-bar__fill {
    background: var(--accent);
}

.brand {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
    user-select: none;
}

::-webkit-scrollbar {
    width: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-raised);
    border-radius: 999px;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

@media (max-width: 480px) {
    .player-page {
        padding: 32px 20px 24px;
        gap: 20px;
    }

    .vinyl-wrap {
        width: 160px;
        height: 160px;
    }

    .vinyl__groove--4 {
        inset: 48px;
    }

    .vinyl__label {
        inset: 52px;
    }

    .track-info__title {
        font-size: 1.5rem;
    }

    .ctrl-btn--play {
        width: 50px;
        height: 50px;
    }

    .volume-row {
        width: 140px;
    }
}

@media (min-height: 800px) {
    .player-page {
        gap: 28px;
    }

    .vinyl-wrap {
        width: 220px;
        height: 220px;
    }
}