@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Manrope:wght@500;600;700&display=swap');

:root {
    --ink: #f7f3f2;
    --muted: #a89b9a;
    --surface: #160a0a;
    --surface-soft: #211010;
    --line: rgba(255, 255, 255, .09);
    --accent: #e42b22;
    --accent-soft: #ff6258;
    --plyr-color-main: var(--accent);
    --plyr-audio-controls-background: transparent;
    --plyr-audio-control-color: var(--muted);
    --plyr-audio-control-background-hover: rgba(220, 173, 114, .12);
    --plyr-menu-background: #242a2e;
    --plyr-menu-color: var(--ink);
    --plyr-range-fill-background: var(--accent);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: #050202;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 13% 8%, rgba(131, 13, 10, .24), transparent 32rem),
        radial-gradient(circle at 88% 43%, rgba(225, 35, 24, .1), transparent 30rem),
        linear-gradient(145deg, #0d0505 0%, #070303 55%, #110404 100%);
    font-family: 'DM Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
}

@supports (min-height: 100dvh) {
    body { min-height: 100dvh; }
}

@supports (overflow: clip) {
    html, body { overflow-x: clip; }
}

button { font: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }

.album-toolbar {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 28px;
}
.logout-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 7px;
    color: #d8d1d0;
    font-size: .78rem;
    text-decoration: none;
    transition: color .2s ease;
}
.logout-link:hover, .logout-link:focus-visible { color: var(--accent-soft); }
.logout-link:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 4px; border-radius: 2px; }
.logout-link svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.login-shell {
    display: grid;
    min-height: 100vh;
    padding: 32px;
    place-items: center;
}
.login-page {
    color-scheme: light;
    background:
        radial-gradient(circle at 18% 20%, rgba(21, 44, 176, .12), transparent 34rem),
        radial-gradient(circle at 88% 86%, rgba(45, 67, 190, .08), transparent 28rem),
        #eef1f8;
}
.login-page button:focus-visible,
.login-page input:focus-visible { outline-color: #7488ff; }
.login-card {
    display: grid;
    grid-template-columns: minmax(280px, 470px) minmax(340px, 470px);
    width: min(940px, 100%);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: transparent;
    box-shadow: 0 32px 100px rgba(20, 27, 56, .18);
    backdrop-filter: blur(20px);
}
.login-brand {
    display: grid;
    min-height: 560px;
    padding: 70px;
    place-items: center;
    background: transparent;
}
.login-brand img { display: block; width: min(170px, 80%); height: auto; }
.login-content { display: flex; flex-direction: column; justify-content: center; padding: clamp(38px, 6vw, 70px); color: #0b0e17; background: rgba(255, 255, 255, .96); }
.login-kicker { margin: 0 0 16px; color: #7488ff; font-size: .7rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }
.login-content h1 { font-size: clamp(2.8rem, 5vw, 4.5rem); }
.login-intro { margin: 20px 0 36px; color: #656c7c; line-height: 1.65; }
.login-error { margin: -14px 0 24px; padding: 11px 13px; border: 1px solid rgba(255, 98, 88, .35); border-radius: 5px; color: #ffaaa4; background: rgba(228, 43, 34, .1); font-size: .82rem; }
.login-form { display: grid; gap: 20px; }
.form-field { display: grid; gap: 8px; }
.form-field label { color: #373d4c; font-size: .78rem; font-weight: 500; }
.form-field input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #cfd4e1; border-radius: 5px; color: #0b0e17; background: #fff; font: inherit; transition: border-color .2s, background .2s; }
.form-field input:hover, .form-field input:focus { border-color: rgba(21, 44, 176, .75); background: #f9faff; }
.login-submit { height: 49px; margin-top: 8px; border: 0; border-radius: 999px; color: white; background: #152cb0; font-weight: 600; cursor: pointer; transition: background .2s, transform .2s; }
.login-submit:hover { background: #2943d5; transform: translateY(-1px); }

.album-shell {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 72px 0 180px;
}

.album-hero {
    display: grid;
    grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
    gap: clamp(42px, 6vw, 88px);
    align-items: center;
    margin-bottom: 72px;
}
.album-hero > *, .album-copy { min-width: 0; }

.cover-wrap { position: relative; }
.cover {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .48), 0 2px 10px rgba(0, 0, 0, .5);
}
.cover-glow {
    position: absolute;
    inset: 15% -8% -10%;
    background: rgba(220, 27, 20, .5);
    filter: blur(70px);
    opacity: .45;
}

.eyebrow {
    margin: 0 0 18px;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

h1, h2 { font-family: 'Manrope', sans-serif; }
h1 {
    max-width: 700px;
    margin: 0;
    font-size: clamp(3.2rem, 6vw, 5.8rem);
    font-weight: 600;
    letter-spacing: -.065em;
    line-height: .91;
}
.album-meta { margin: 22px 0 0; color: var(--muted); font-size: .9rem; }
.album-meta span { margin: 0 7px; color: #555e63; }

.album-actions { display: flex; gap: 12px; margin-top: 38px; }
.play-album {
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.play-album {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 49px;
    padding: 0 24px;
    border-radius: 999px;
    color: #160303;
    background: var(--accent);
    font-weight: 600;
}
.play-album:hover { transform: translateY(-2px); background: var(--accent-soft); }
.play-album svg { width: 17px; fill: currentColor; }
.track-panel { width: 100%; min-width: 0; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; padding: 0 18px 23px; border-bottom: 1px solid var(--line); }
.panel-heading .eyebrow { margin-bottom: 8px; }
h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.total-duration { margin: 0 0 3px; color: var(--muted); font-size: .82rem; }
.track-list { margin: 0; padding: 0; list-style: none; }
.track { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; width: 100%; min-height: 67px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; cursor: pointer; transition: background .2s ease; }
.track:hover, .track.is-active { background: rgba(255, 255, 255, .035); }
.track.is-active .track-title { color: var(--accent-soft); }
.track-number { position: relative; display: grid; width: 22px; height: 22px; place-items: center; color: #687176; font-size: .76rem; font-variant-numeric: tabular-nums; }
.track-play { display: none; width: 15px; fill: var(--ink); }
.track:hover .number { display: none; }
.track:hover .track-play { display: block; }
.track.is-playing .number, .track.is-playing .track-play { display: none; }
.playing-bars { display: none; align-items: end; gap: 2px; height: 14px; }
.track.is-playing .playing-bars { display: flex; }
.playing-bars i { width: 2px; height: 100%; background: var(--accent); animation: meter .8s ease-in-out infinite alternate; }
.playing-bars i:nth-child(2) { height: 60%; animation-delay: -.3s; }
.playing-bars i:nth-child(3) { height: 80%; animation-delay: -.5s; }
@keyframes meter { to { height: 25%; } }
.track-title { min-width: 0; overflow: hidden; font-size: .96rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.track-duration { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }

.player-dock {
    position: fixed;
    z-index: 20;
    right: 20px;
    bottom: 18px;
    left: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    min-height: 84px;
    padding: 14px 24px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(21, 8, 8, .92);
    box-shadow: 0 16px 60px rgba(0, 0, 0, .46);
    backdrop-filter: blur(22px);
}
.player-error {
    position: absolute;
    right: 18px;
    bottom: calc(100% + 10px);
    max-width: min(460px, calc(100vw - 36px));
    margin: 0;
    padding: 10px 14px;
    border: 1px solid rgba(255, 98, 88, .38);
    border-radius: 6px;
    color: #ffd7d4;
    background: rgba(62, 10, 8, .96);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    font-size: .78rem;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
    transition: opacity .2s ease, transform .2s ease;
}
.player-error.is-visible { opacity: 1; transform: translateY(0); }
.now-playing { display: flex; gap: 14px; align-items: center; min-width: 0; }
.now-playing img { width: 56px; height: 56px; border-radius: 3px; object-fit: cover; }
.now-playing div { min-width: 0; }
.now-playing-copy { flex: 1; }
.current-title-viewport { overflow: hidden; }
.current-title { margin: 0; white-space: nowrap; }
.current-title {
    width: max-content;
    max-width: 100%;
    overflow: hidden;
    font-size: .9rem;
    font-weight: 600;
    text-overflow: ellipsis;
}
.current-title-viewport.is-overflowing .current-title {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    animation: current-title-scroll var(--title-scroll-duration, 9s) ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes current-title-scroll {
    0%, 18% { transform: translate3d(0, 0, 0); }
    82%, 100% { transform: translate3d(calc(0px - var(--title-scroll-distance)), 0, 0); }
}
.player-main { min-width: 0; }
.album-copy .player-main { margin-top: 34px; }
.transport-controls { display: flex; align-items: center; justify-content: space-between; width: min(100%, 460px); height: 64px; margin: 14px auto 0; }
.transport { position: relative; display: grid; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: #e8e3e2; background: transparent; cursor: pointer; transition: color .2s, background .2s, transform .2s; }
.transport:hover { color: white; background: rgba(255, 255, 255, .07); }
.transport svg { width: 19px; fill: currentColor; }
.transport svg path { vector-effect: non-scaling-stroke; }
.transport.secondary { color: #d0c9c8; }
.transport.secondary svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.transport.secondary[aria-pressed='true'] { color: var(--accent-soft); }
.transport.secondary[aria-pressed='true']::after { position: absolute; bottom: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-soft); content: ''; }
.play-toggle { width: 64px; height: 64px; flex-basis: 64px; margin: 0 4px; color: #170303; background: var(--accent-soft); }
.play-toggle svg { width: 25px; }
.play-toggle:hover { color: #170303; background: var(--accent-soft); transform: scale(1.05); }
.pause-icon, .is-playing .play-icon { display: none; }
.is-playing .pause-icon { display: block; }
.player-main .plyr { margin-top: 0; }
.player-main .plyr__controls { padding: 0; }
.player-main .plyr__control[data-plyr='play'] { display: none; }
.player-main .plyr__progress__container { margin-left: 0; }
.player-main .plyr__time {
    flex: none;
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
}
.player-main .plyr__time--current {
    width: 5ch;
    padding-right: 0 !important;
    text-align: right;
}
.player-main .plyr__time--duration {
    width: auto;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left;
}
.player-main .plyr__time + .plyr__time::before {
    margin-right: .5ch;
    margin-left: .5ch;
}
.player-main .plyr__time + .plyr__time {
    margin-left: 0 !important;
    padding-left: 0 !important;
}
.player-main .plyr__volume { max-width: 105px; }
.compact-actions { display: flex; gap: 8px; align-items: center; }
.compact-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: var(--ink); background: transparent; cursor: pointer; transition: color .2s ease, background .2s ease; }
.compact-button:hover { color: var(--accent-soft); background: rgba(255, 255, 255, .06); }
.compact-button svg { width: 22px; fill: currentColor; }
.compact-button:last-child svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.compact-play { border: 1px solid var(--line); }

@media (max-width: 900px) {
    .album-shell { padding-top: 40px; }
    .album-hero { grid-template-columns: minmax(220px, 340px) 1fr; gap: 38px; }
}

@media (max-width: 650px) {
    .album-shell {
        width: min(calc(100% - 32px), 480px);
        padding: max(16px, env(safe-area-inset-top)) 0 calc(112px + max(16px, env(safe-area-inset-bottom)));
    }
    .album-toolbar { min-height: 44px; margin-bottom: 18px; }
    .logout-link { min-width: 44px; justify-content: flex-end; font-size: .84rem; }
    .album-hero { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-bottom: 24px; }
    .cover-wrap { width: min(100%, 430px); margin: 0 auto; }
    .album-copy h1 {
        overflow-wrap: anywhere;
        font-size: clamp(2.25rem, 11vw, 3.35rem);
        line-height: 1.02;
    }
    .album-meta, .album-actions { display: none; }
    .album-copy .player-main { margin-top: 22px; }
    .album-copy .player-main .plyr__controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        width: 100%;
    }
    .album-copy .player-main .plyr__progress__container {
        grid-column: 1 / -1;
        grid-row: 1;
        width: 100%;
        min-height: 32px;
        margin: 0;
    }
    .album-copy .player-main .plyr__progress { width: 100%; }
    .album-copy .player-main input[type='range'] { min-height: 32px; cursor: pointer; }
    .album-copy .player-main .plyr__time { grid-row: 2; width: auto; padding: 0 !important; font-size: .75rem; }
    .album-copy .player-main .plyr__time--current { grid-column: 1; text-align: left; }
    .album-copy .player-main .plyr__time--duration { grid-column: 2; justify-self: end; text-align: right; }
    .album-copy .player-main .plyr__time + .plyr__time::before { display: none; }
    .transport-controls { width: 100%; height: 64px; margin-top: 14px; }
    .transport { width: 44px; height: 44px; flex-basis: 44px; }
    .play-toggle { width: 60px; height: 60px; flex-basis: 60px; margin: 0; }
    .player-main .plyr__volume { display: none; }
    .panel-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    .track-list { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
    .track { grid-template-columns: 38px minmax(0, 1fr) auto; min-height: 64px; padding: 0 12px; }
    .track-list li:last-child .track { border-bottom: 0; }
    .player-dock {
        right: 16px;
        bottom: max(8px, env(safe-area-inset-bottom));
        left: 16px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        min-height: 76px;
        padding: 10px 12px;
    }
    .now-playing img { width: 44px; height: 44px; }
    .current-title-viewport.is-overflowing .current-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; animation: none; }
    .compact-actions { gap: 2px; }
    .login-shell { padding: 15px; }
    .login-card { grid-template-columns: 1fr; }
    .login-brand { min-height: 210px; padding: 34px; }
    .login-brand img { width: 92px; }
    .login-content { padding: 34px 26px 40px; }
}

@media (max-width: 380px) {
    .album-shell { width: calc(100% - 32px); }
    .album-copy h1 { font-size: clamp(2rem, 11vw, 2.7rem); }
    .transport-controls { width: 100%; }
    .compact-actions { gap: 0; }
    .compact-button { width: 44px; }
}

@media (prefers-color-scheme: dark) {
    .login-page {
        color-scheme: dark;
        background:
            radial-gradient(circle at 18% 20%, rgba(21, 44, 176, .2), transparent 34rem),
            radial-gradient(circle at 88% 86%, rgba(45, 67, 190, .12), transparent 28rem),
            #05070d;
    }
    .login-page .login-card {
        border-color: rgba(116, 136, 255, .16);
        background: transparent;
        box-shadow: 0 32px 100px rgba(0, 0, 0, .52);
    }
    .login-page .login-brand {
        border-right: 1px solid rgba(255, 255, 255, .08);
        background: transparent;
    }
    .login-page .login-brand img {
        filter: brightness(0) invert(1);
    }
    .login-page .login-content { color: var(--ink); background: rgba(8, 11, 18, .94); }
    .login-page .login-intro { color: var(--muted); }
    .login-page .form-field label { color: #c9c0bf; }
    .login-page .form-field input {
        border-color: rgba(255, 255, 255, .13);
        color: var(--ink);
        background: rgba(0, 0, 0, .25);
    }
    .login-page .form-field input:hover,
    .login-page .form-field input:focus {
        border-color: rgba(85, 110, 255, .75);
        background: rgba(0, 0, 0, .38);
    }
}

@media (max-width: 650px) and (prefers-color-scheme: dark) {
    .login-page .login-brand {
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .08);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
    .current-title-viewport.is-overflowing .current-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; animation: none; }
}
