/* ==========================================================================
   timapheev · radio — полноэкранный плеер
   ========================================================================== */

@font-face {
    font-family: 'Funnel Display';
    src: url('../fonts/FunnelDisplay-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 300 800;
    font-display: swap;
}

:root {
    /* палитра трека — переопределяется из JS */
    --c1: #ab54db;
    --c2: #b7dbf9;
    --c3: #ef9a91;

    --bg: #05060f;
    --bg-2: #090c1c;
    --fg: #f4f6ff;
    --muted: rgba(244, 246, 255, .52);
    --line: rgba(255, 255, 255, .10);
    --glass: rgba(255, 255, 255, .045);

    --r-lg: 28px;
    --r-md: 18px;

    --ease: cubic-bezier(.22, 1, .36, 1);
    --ease-io: cubic-bezier(.65, 0, .35, 1);

    --sat: 1;
    --pad: clamp(14px, 2.4vw, 34px);
}

* { box-sizing: border-box; }

/* display: grid/flex у элемента перебивает атрибут hidden — возвращаем его силу */
[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Funnel Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

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

svg { display: block; }

svg path, svg circle, svg rect, svg line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

svg .fill { fill: currentColor; stroke: none; }

::selection { background: color-mix(in oklab, var(--c1) 60%, transparent); }

/* ---------------------------------------------------------------- каркас */

.app {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    padding: max(var(--pad), env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right))
             max(var(--pad), env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
    isolation: isolate;
}

.scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    display: block;
}

/* мягкие световые пятна за сценой */
.glow {
    position: fixed;
    z-index: -3;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .5;
    pointer-events: none;
    transition: background 1.2s var(--ease), opacity .8s var(--ease);
    will-change: transform;
}

.glow--a {
    width: 58vmax; height: 58vmax;
    left: -18vmax; top: -22vmax;
    background: radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--c1) 70%, transparent), transparent 68%);
    animation: drift-a 26s var(--ease-io) infinite;
}

.glow--b {
    width: 52vmax; height: 52vmax;
    right: -20vmax; bottom: -24vmax;
    background: radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--c2) 60%, transparent), transparent 68%);
    animation: drift-b 32s var(--ease-io) infinite;
}

@keyframes drift-a {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(8vmax, 6vmax, 0) scale(1.12); }
}

@keyframes drift-b {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
    50%      { transform: translate3d(-7vmax, -5vmax, 0) scale(.92); }
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(120% 90% at 50% 45%, transparent 35%, rgba(3, 4, 12, .55) 78%, rgba(2, 3, 9, .92) 100%),
        linear-gradient(180deg, rgba(4, 6, 16, .55) 0%, transparent 22%, transparent 62%, rgba(3, 4, 12, .8) 100%);
}

/* ---------------------------------------------------------------- шапка */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 6;
}

.logo {
    display: block;
    line-height: 0;
    filter: drop-shadow(0 0 18px color-mix(in oklab, var(--c1) 45%, transparent));
    transition: transform .5s var(--ease), filter .6s var(--ease);
}

.logo img {
    width: clamp(112px, 13vw, 168px);
    height: auto;
    display: block;
    user-select: none;
}

.logo:hover { transform: translateY(-1px) scale(1.02); }

.topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.iconbtn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--fg);
    background: var(--glass);
    border: 1px solid var(--line);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    transition: transform .35s var(--ease), background .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease);
}

.iconbtn svg { width: 20px; height: 20px; }

.iconbtn:hover {
    background: color-mix(in oklab, var(--c1) 26%, transparent);
    border-color: color-mix(in oklab, var(--c1) 55%, transparent);
    transform: translateY(-2px);
}

.iconbtn:active { transform: translateY(0) scale(.94); }

.iconbtn.is-on {
    color: #0a0a16;
    background: linear-gradient(140deg, var(--c2), var(--c1));
    border-color: transparent;
}

/* громкость */
.volume {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 2px;
    border-radius: 16px;
    transition: background .35s var(--ease);
}

.volume .i-mute { display: none; }
body.is-muted .volume .i-vol { display: none; }
body.is-muted .volume .i-mute { display: block; }

.volume__slider {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width .45s var(--ease), opacity .3s var(--ease), margin .45s var(--ease);
    cursor: pointer;
    padding: 14px 0;
    touch-action: none;
}

.volume:hover .volume__slider,
.volume__slider:focus-visible,
.volume.is-open .volume__slider {
    width: 92px;
    opacity: 1;
    margin-right: 10px;
    margin-left: 4px;
}

.volume__track {
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .16);
    overflow: hidden;
}

.volume__fill {
    height: 100%;
    width: 80%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--c2), var(--c1));
    box-shadow: 0 0 14px color-mix(in oklab, var(--c1) 70%, transparent);
}

/* ---------------------------------------------------------------- плеер */

.player {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 2.2vh, 26px);
    min-height: 0;
    padding-bottom: clamp(0px, 2vh, 20px);
}

/* --- обложка --- */

.cover {
    position: relative;
    z-index: 4;
    width: clamp(200px, 34vh, 360px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    perspective: 900px;
    flex: 0 1 auto;
}

.cover__ring {
    position: absolute;
    inset: -27%;
    width: 154%;
    height: 154%;
    pointer-events: none;
}

.cover__frame {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--r-lg);
    transform-style: preserve-3d;
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .6s var(--ease);
    box-shadow:
        0 30px 70px -20px rgba(0, 0, 0, .85),
        0 0 0 1px rgba(255, 255, 255, .07) inset,
        0 0 60px -10px color-mix(in oklab, var(--c1) 55%, transparent);
}

.cover__art {
    position: absolute;
    inset: 0;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: #0b0e1e;
}

.art__layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.12) rotate(1.5deg);
    filter: blur(14px) saturate(1.25);
    transition: opacity .75s var(--ease), transform 1.1s var(--ease), filter .75s var(--ease);
}

.art__layer.is-active {
    opacity: 1;
    transform: scale(1) rotate(0);
    filter: blur(0) saturate(1.05);
}

.cover__shine {
    position: absolute;
    inset: 0;
    border-radius: var(--r-lg);
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .30) 0%, rgba(255, 255, 255, 0) 38%),
        radial-gradient(120% 90% at 80% 0%, rgba(255, 255, 255, .18), transparent 55%);
    mix-blend-mode: screen;
    opacity: .8;
}

.cover__scan {
    position: absolute;
    inset: 0;
    border-radius: var(--r-lg);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
}

.cover__scan::after {
    content: '';
    position: absolute;
    left: -30%;
    top: -60%;
    width: 60%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: rotate(18deg);
    filter: blur(6px);
}

body.is-switching .cover__scan { opacity: 1; }
body.is-switching .cover__scan::after { animation: sweep .85s var(--ease); }

@keyframes sweep {
    from { transform: translateX(-40%) rotate(18deg); }
    to   { transform: translateX(320%) rotate(18deg); }
}

.cover__reflection {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: -14%;
    height: 22%;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 0%, color-mix(in oklab, var(--c1) 55%, transparent), transparent 70%);
    filter: blur(22px);
    opacity: .75;
    transition: opacity .6s var(--ease), transform .3s linear;
    transform: scaleY(var(--refl, 1));
}

body.is-playing .cover__frame { animation: breathe 6s var(--ease-io) infinite; }

@keyframes breathe {
    0%, 100% { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(0); }
    50%      { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-8px); }
}

body.is-switching .cover__frame {
    animation: none;
    transform: rotateY(-12deg) scale(.94);
}

/* --- название --- */

.meta {
    position: relative;
    z-index: 8;                 /* над кольцевым спектром обложки */
    text-align: center;
    max-width: min(680px, 92vw);
    display: grid;
    gap: 6px;
    padding: 10px 26px 12px;
    margin-top: clamp(2px, 1.4vh, 14px);
}

/* мягкая тёмная вуаль, чтобы полосы спектра не мешали читать */
.meta::before {
    content: '';
    position: absolute;
    inset: -6% -4%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(60% 62% at 50% 50%, rgba(4, 5, 14, .82) 0%, rgba(4, 5, 14, .55) 55%, transparent 100%);
    filter: blur(12px);
    pointer-events: none;
}

.meta__title {
    font-size: clamp(21px, 3.1vw, 38px);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
    background: linear-gradient(96deg, #fff 12%, color-mix(in oklab, var(--c2) 85%, #fff) 52%, color-mix(in oklab, var(--c1) 75%, #fff) 92%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 18px rgba(3, 4, 12, .9), 0 0 42px color-mix(in oklab, var(--c1) 35%, transparent);
    transition: opacity .45s var(--ease), transform .55s var(--ease), filter .45s var(--ease);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta__artist {
    font-size: clamp(12px, 1.15vw, 15px);
    font-weight: 500;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(244, 246, 255, .74);
    text-shadow: 0 2px 14px rgba(3, 4, 12, .95);
    transition: opacity .45s var(--ease) .06s, transform .55s var(--ease) .06s;
}

body.is-switching .meta__title {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(9px);
}

body.is-switching .meta__artist {
    opacity: 0;
    transform: translateY(10px);
}

/* --- прогресс --- */

.progress {
    width: min(640px, 92vw);
    display: grid;
    gap: 9px;
}

.progress__bar {
    position: relative;
    height: 26px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    outline: none;
}

.progress__bar::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
    transition: height .3s var(--ease);
}

.progress__buffer {
    position: absolute;
    left: 0;
    height: 6px;
    width: 0;
    border-radius: 99px;
    background: rgba(255, 255, 255, .14);
    transition: width .5s linear, height .3s var(--ease);
}

.progress__fill {
    position: absolute;
    left: 0;
    height: 6px;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--c2), var(--c1) 60%, var(--c3));
    box-shadow:
        0 0 18px color-mix(in oklab, var(--c1) 75%, transparent),
        0 0 42px color-mix(in oklab, var(--c1) 35%, transparent);
    transition: height .3s var(--ease);
}

.progress__knob {
    position: absolute;
    right: 0;
    top: 50%;
    width: 15px;
    height: 15px;
    margin-right: -7px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%) scale(.72);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--c1) 30%, transparent), 0 0 22px rgba(255, 255, 255, .8);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.progress__bar:hover::before,
.progress__bar:hover .progress__fill,
.progress__bar:hover .progress__buffer,
.progress__bar.is-drag::before,
.progress__bar.is-drag .progress__fill,
.progress__bar.is-drag .progress__buffer { height: 10px; }

.progress__bar:hover .progress__knob,
.progress__bar:focus-visible .progress__knob,
.progress__bar.is-drag .progress__knob {
    transform: translateY(-50%) scale(1.16);
    box-shadow: 0 0 0 6px color-mix(in oklab, var(--c1) 34%, transparent), 0 0 30px rgba(255, 255, 255, .95);
}

.progress__tip {
    position: absolute;
    bottom: calc(100% + 6px);
    transform: translateX(-50%) translateY(6px) scale(.9);
    padding: 4px 9px;
    border-radius: 9px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    background: rgba(10, 12, 26, .9);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
    white-space: nowrap;
}

.progress__bar:hover .progress__tip,
.progress__bar.is-drag .progress__tip {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.progress__times {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

/* --- кнопки --- */

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.2vw, 26px);
}

.ctl {
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--fg);
    transition: transform .4s var(--ease), color .35s var(--ease), background .35s var(--ease), opacity .35s var(--ease);
}

.ctl:active { transform: scale(.9); }

.ctl--ghost {
    width: 42px;
    height: 42px;
    color: var(--muted);
}

.ctl--ghost svg { width: 19px; height: 19px; }

.ctl--ghost:hover { color: var(--fg); transform: translateY(-2px); }

.ctl--ghost[aria-pressed="true"] {
    color: var(--c2);
    text-shadow: 0 0 16px currentColor;
    filter: drop-shadow(0 0 10px color-mix(in oklab, var(--c2) 70%, transparent));
}

.ctl--ghost .rep1 {
    font-size: 8px;
    font-weight: 700;
    fill: currentColor;
    stroke: none;
    text-anchor: middle;
    opacity: 0;
    transition: opacity .3s var(--ease);
}

.ctl--ghost.is-one .rep1 { opacity: 1; }

.ctl--side {
    width: clamp(50px, 7vw, 62px);
    height: clamp(50px, 7vw, 62px);
    background: var(--glass);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
}

.ctl--side svg { width: 22px; height: 22px; }

.ctl--side:hover {
    transform: translateY(-3px);
    background: color-mix(in oklab, var(--c1) 24%, transparent);
    border-color: color-mix(in oklab, var(--c1) 50%, transparent);
    box-shadow: 0 12px 34px -12px color-mix(in oklab, var(--c1) 80%, transparent);
}

.ctl--play {
    width: clamp(74px, 10.5vw, 94px);
    height: clamp(74px, 10.5vw, 94px);
    color: #08091a;
    background: linear-gradient(150deg, #ffffff 0%, var(--c2) 45%, var(--c1) 100%);
    box-shadow:
        0 18px 48px -14px color-mix(in oklab, var(--c1) 90%, transparent),
        0 0 0 1px rgba(255, 255, 255, .35) inset;
}

.ctl--play svg { width: 30px; height: 30px; position: relative; z-index: 2; }

.ctl--play:hover { transform: translateY(-3px) scale(1.04); }

.ctl__halo {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in oklab, var(--c1) 55%, transparent), transparent 68%);
    opacity: .55;
    filter: blur(10px);
    transform: scale(var(--halo, 1));
    transition: transform .12s linear, opacity .4s var(--ease);
    pointer-events: none;
}

.ctl__ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid color-mix(in oklab, var(--c2) 60%, transparent);
    opacity: 0;
    pointer-events: none;
}

body.is-playing .ctl__ring { animation: pulse-ring 2.6s var(--ease-io) infinite; }

@keyframes pulse-ring {
    0%   { opacity: .7; transform: scale(1); }
    70%  { opacity: 0;  transform: scale(1.45); }
    100% { opacity: 0;  transform: scale(1.45); }
}

.i-pause { display: none; }
body.is-playing .ctl--play .i-play { display: none; }
body.is-playing .ctl--play .i-pause { display: block; }

.i-fsout { display: none; }
body.is-fs .i-fsin { display: none; }
body.is-fs .i-fsout { display: block; }

/* ------------------------------------------- плейлист: витрина поверх плеера */

.deck {
    position: fixed;
    inset: 0;
    z-index: 24;
    display: flex;
    flex-direction: column;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
             max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background:
        radial-gradient(120% 80% at 50% -10%, color-mix(in oklab, var(--c1) 24%, transparent), transparent 60%),
        rgba(4, 5, 14, .74);
    backdrop-filter: blur(26px) saturate(1.5);
    -webkit-backdrop-filter: blur(26px) saturate(1.5);
    opacity: 0;
    visibility: hidden;
    transform: scale(1.04);
    transition: opacity .5s var(--ease), transform .6s var(--ease), visibility .6s;
}

body.q-open .deck {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* плеер уезжает вглубь */
body.q-open .player,
body.q-open .topbar {
    transform: scale(.96);
    filter: blur(7px);
    opacity: .3;
    pointer-events: none;
}

.player, .topbar {
    transition: transform .6s var(--ease), filter .6s var(--ease), opacity .6s var(--ease);
}

.deck__inner {
    width: min(1240px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

/* --- шапка витрины --- */

.deck__head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(12px, 2.4vw, 28px);
    padding: 6px 4px clamp(14px, 2.2vh, 24px);
}

.deck__titles { min-width: 0; }

.deck__title {
    font-size: clamp(22px, 3.4vw, 40px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    background: linear-gradient(100deg, #fff, color-mix(in oklab, var(--c2) 90%, #fff) 55%, color-mix(in oklab, var(--c1) 85%, #fff));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.deck__sub {
    margin-top: 7px;
    font-size: 11.5px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.deck__search {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 50px;
    padding: 0 20px;
    border-radius: 99px;
    color: var(--muted);
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    transition: border-color .35s var(--ease), background .35s var(--ease), box-shadow .35s var(--ease);
}

.deck__search:focus-within {
    border-color: color-mix(in oklab, var(--c1) 60%, transparent);
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--c1) 12%, transparent),
                0 14px 40px -20px color-mix(in oklab, var(--c1) 90%, transparent);
}

.deck__search svg { width: 18px; height: 18px; flex: none; }

.deck__search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: none;
    color: var(--fg);
    font: inherit;
    font-size: 15px;
}

.deck__search input::placeholder { color: rgba(244, 246, 255, .34); }
.deck__search input::-webkit-search-cancel-button { filter: invert(1) opacity(.45); }

.deck__close {
    width: 50px;
    height: 50px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--fg);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    transition: transform .4s var(--ease), background .35s var(--ease), border-color .35s var(--ease);
}

.deck__close svg { width: 20px; height: 20px; }

.deck__close:hover {
    background: color-mix(in oklab, var(--c1) 34%, transparent);
    border-color: color-mix(in oklab, var(--c1) 60%, transparent);
    transform: rotate(90deg);
}

/* --- сетка карточек --- */

.deck__grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 15vw, 208px), 1fr));
    gap: clamp(12px, 1.6vw, 22px);
    padding: 4px 4px clamp(20px, 6vh, 60px);
    align-content: start;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.deck__grid::-webkit-scrollbar { width: 7px; }
.deck__grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 7px; }

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    color: var(--fg);
    border-radius: 20px;
    padding: 0 0 4px;
    transition: transform .45s var(--ease);
    animation: cardin .6s var(--ease) both;
}

@keyframes cardin {
    from { opacity: 0; transform: translateY(26px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

.card:hover { transform: translateY(-6px); }
.card:active { transform: translateY(-2px) scale(.98); }

.card:focus-visible {
    outline: none;
    transform: translateY(-6px);
}

.card:focus-visible .card__art {
    box-shadow: 0 0 0 2px var(--c2), 0 22px 55px -22px color-mix(in oklab, var(--c2) 90%, transparent);
}

.card__art {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 18px;
    overflow: hidden;
    background: #0d1024 center/cover no-repeat;
    box-shadow: 0 18px 40px -22px #000, 0 0 0 1px rgba(255, 255, 255, .07) inset;
    transition: box-shadow .45s var(--ease);
}

.card__art::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(4, 5, 14, .05) 30%, rgba(4, 5, 14, .72) 100%);
    opacity: .7;
    transition: opacity .4s var(--ease);
}

.card:hover .card__art {
    box-shadow: 0 26px 60px -24px color-mix(in oklab, var(--c1) 85%, #000),
                0 0 0 1px color-mix(in oklab, var(--c2) 40%, transparent) inset;
}

.card__num {
    position: absolute;
    left: 12px;
    top: 11px;
    z-index: 2;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    color: rgba(255, 255, 255, .72);
    text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
    font-variant-numeric: tabular-nums;
}

.card__time {
    position: absolute;
    right: 11px;
    bottom: 10px;
    z-index: 2;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, .82);
    padding: 3px 8px;
    border-radius: 99px;
    background: rgba(6, 8, 20, .55);
    backdrop-filter: blur(6px);
}

.card__play {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity .35s var(--ease);
}

.card__play span {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #08091a;
    background: linear-gradient(150deg, #fff, var(--c2) 50%, var(--c1));
    box-shadow: 0 14px 34px -12px color-mix(in oklab, var(--c1) 95%, transparent);
    transform: scale(.72);
    transition: transform .4s var(--ease);
}

.card__play svg { width: 20px; height: 20px; }

.card:hover .card__play { opacity: 1; }
.card:hover .card__play span { transform: scale(1); }
.card:hover .card__art::after { opacity: .45; }

/* текущий трек */
.card.is-current .card__art {
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--c1) 85%, transparent),
                0 22px 55px -22px color-mix(in oklab, var(--c1) 90%, transparent);
}

.card.is-current .card__name { color: color-mix(in oklab, var(--c2) 75%, #fff); }

.card__eq {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    display: none;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
}

.card.is-current .card__eq { display: flex; }
.card.is-current:hover .card__eq { opacity: 0; }

.card__eq i {
    width: 3px;
    height: 6px;
    border-radius: 2px;
    background: var(--c2);
    box-shadow: 0 0 10px var(--c2);
    transform-origin: bottom;
    animation: eq 1s var(--ease-io) infinite;
}

.card__eq i:nth-child(2) { animation-delay: .16s; height: 14px; }
.card__eq i:nth-child(3) { animation-delay: .34s; height: 9px; }
.card__eq i:nth-child(4) { animation-delay: .5s; height: 17px; }

body:not(.is-playing) .card__eq i { animation-play-state: paused; }

@keyframes eq {
    0%, 100% { transform: scaleY(.35); }
    50%      { transform: scaleY(1.5); }
}

.card__name {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.25;
    padding: 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .35s var(--ease);
}

.card__by {
    font-size: 11.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deck__empty {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

/* ------------------------------------------- генерация песни нейросетью */

.iconbtn--ai svg { width: 21px; height: 21px; }

.iconbtn--ai {
    color: color-mix(in oklab, var(--c2) 80%, #fff);
    filter: drop-shadow(0 0 10px color-mix(in oklab, var(--c2) 45%, transparent));
}

.iconbtn--ai::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(140deg, color-mix(in oklab, var(--c2) 35%, transparent), transparent 55%);
    opacity: .8;
    pointer-events: none;
}

.iconbtn { position: relative; overflow: hidden; }

.forge {
    position: fixed;
    inset: 0;
    z-index: 26;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    background:
        radial-gradient(110% 70% at 50% -10%, color-mix(in oklab, var(--c2) 22%, transparent), transparent 62%),
        rgba(4, 5, 14, .8);
    backdrop-filter: blur(28px) saturate(1.5);
    -webkit-backdrop-filter: blur(28px) saturate(1.5);
    opacity: 0;
    visibility: hidden;
    transform: scale(1.04);
    transition: opacity .5s var(--ease), transform .6s var(--ease), visibility .6s;
}

body.ai-open .forge {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

body.ai-open .player,
body.ai-open .topbar {
    transform: scale(.96);
    filter: blur(7px);
    opacity: .3;
    pointer-events: none;
}

.forge__inner {
    width: min(560px, 100%);
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2.6vh, 26px);
}

.forge__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.forge__title {
    font-size: clamp(24px, 3.4vw, 36px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    background: linear-gradient(100deg, #fff, color-mix(in oklab, var(--c2) 90%, #fff) 55%, color-mix(in oklab, var(--c1) 85%, #fff));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.forge__sub {
    margin-top: 8px;
    font-size: 11.5px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
}

.forge__form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field__cap {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 11.5px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
    padding-left: 2px;
}

.field__count {
    font-weight: 500;
    letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
    color: rgba(244, 246, 255, .34);
    transition: color .3s var(--ease);
}

.field__count.is-full { color: color-mix(in oklab, var(--c3) 85%, #fff); }

.field__in {
    width: 100%;
    padding: 15px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    color: var(--fg);
    font: inherit;
    font-size: 16px;
    outline: none;
    resize: none;
    transition: border-color .3s var(--ease), background .3s var(--ease), box-shadow .3s var(--ease);
}

.field__in--area { line-height: 1.5; min-height: 96px; }

.field__in--lyrics {
    min-height: 150px;
    max-height: 42vh;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.field__in::placeholder { color: rgba(244, 246, 255, .32); }

.field__in:focus {
    border-color: color-mix(in oklab, var(--c1) 60%, transparent);
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--c1) 12%, transparent);
}

.field__hint {
    font-size: 12px;
    color: rgba(244, 246, 255, .38);
    padding-left: 2px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 2px;
}

.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle__box {
    width: 46px;
    height: 27px;
    flex: none;
    border-radius: 99px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid var(--line);
    position: relative;
    transition: background .35s var(--ease), border-color .35s var(--ease);
}

.toggle__box::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #fff;
    transition: transform .35s var(--ease);
}

.toggle input:checked + .toggle__box {
    background: linear-gradient(120deg, var(--c2), var(--c1));
    border-color: transparent;
}

.toggle input:checked + .toggle__box::after { transform: translateX(19px); }

.toggle input:focus-visible + .toggle__box {
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--c1) 20%, transparent);
}

.toggle__cap { font-size: 14.5px; color: rgba(244, 246, 255, .8); }

.forge__go {
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 58px;
    border-radius: 99px;
    font-size: 16.5px;
    font-weight: 700;
    color: #08091a;
    background: linear-gradient(140deg, #fff, var(--c2) 48%, var(--c1));
    box-shadow: 0 20px 50px -20px color-mix(in oklab, var(--c1) 95%, transparent);
    transition: transform .4s var(--ease), box-shadow .4s var(--ease), opacity .3s var(--ease);
}

.forge__go svg { width: 21px; height: 21px; }

.forge__go:hover { transform: translateY(-2px); }

.forge__go[disabled] {
    opacity: .45;
    pointer-events: none;
    filter: saturate(.5);
}

.forge__err {
    padding: 13px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    color: #ffd9d9;
    background: rgba(255, 90, 90, .12);
    border: 1px solid rgba(255, 120, 120, .35);
}

/* --- ход работы --- */

.forge__work { display: grid; gap: 18px; }

.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 13px;
}

.steps li {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 14.5px;
    color: rgba(244, 246, 255, .38);
    transition: color .4s var(--ease);
}

.steps i {
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .18);
    position: relative;
    transition: border-color .4s var(--ease), background .4s var(--ease);
}

.steps li.is-active { color: var(--fg); }

.steps li.is-active i {
    border-color: color-mix(in oklab, var(--c2) 80%, transparent);
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

.steps li.is-done { color: rgba(244, 246, 255, .8); }

.steps li.is-done i {
    border-color: transparent;
    background: linear-gradient(140deg, var(--c2), var(--c1));
    animation: none;
}

.steps li.is-done i::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3.5px;
    width: 5px;
    height: 10px;
    border: solid #08091a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forge__note {
    font-size: 13px;
    line-height: 1.55;
    color: var(--muted);
}

.forge__results { display: grid; gap: 10px; }

.result {
    display: grid;
    grid-template-columns: 54px 1fr auto;
    align-items: center;
    gap: 13px;
    padding: 10px 14px 10px 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
    animation: cardin .5s var(--ease) both;
}

.result__art {
    width: 54px;
    height: 54px;
    border-radius: 13px;
    background: #10132a center/cover no-repeat;
    flex: none;
}

.result__name { font-size: 15px; font-weight: 600; }

.result__state {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.result__play {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #08091a;
    background: linear-gradient(150deg, #fff, var(--c2) 50%, var(--c1));
    transition: transform .35s var(--ease);
}

.result__play svg { width: 17px; height: 17px; }
.result__play:hover { transform: scale(1.08); }

.forge__again {
    justify-self: start;
    padding: 12px 22px;
    border-radius: 99px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--fg);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    transition: background .35s var(--ease), border-color .35s var(--ease);
}

.forge__again:hover {
    background: color-mix(in oklab, var(--c1) 25%, transparent);
    border-color: color-mix(in oklab, var(--c1) 50%, transparent);
}

/* значок AI на карточке в плейлисте */
.card__ai {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 6px;
    border-radius: 99px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #08091a;
    background: linear-gradient(120deg, #fff, var(--c2));
    box-shadow: 0 6px 16px -6px #000;
}

.card__ai svg { width: 11px; height: 11px; }

/* ---------------------------------------------------------------- интро */

.intro {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    background: radial-gradient(90% 70% at 50% 50%, rgba(9, 11, 26, .75), rgba(3, 4, 12, .96));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: opacity .8s var(--ease), visibility .8s;
}

body.is-started .intro {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro__inner {
    display: grid;
    justify-items: center;
    gap: 22px;
    animation: introin 1.1s var(--ease) both;
}

@keyframes introin {
    from { opacity: 0; transform: translateY(24px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

.intro__logo {
    width: clamp(190px, 26vw, 300px);
    filter: drop-shadow(0 0 40px color-mix(in oklab, var(--c1) 55%, transparent));
}

.intro__sub {
    font-size: 12px;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--muted);
}

.intro__btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 30px 15px 24px;
    border-radius: 99px;
    font-size: 16px;
    font-weight: 600;
    color: #08091a;
    background: linear-gradient(140deg, #fff, var(--c2) 48%, var(--c1));
    box-shadow: 0 20px 50px -18px color-mix(in oklab, var(--c1) 90%, transparent);
    transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}

.intro__btn svg { width: 20px; height: 20px; }

.intro__btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 26px 60px -18px color-mix(in oklab, var(--c1) 100%, transparent);
}

/* ---------------------------------------------------------------- пусто */

.empty {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(3, 4, 12, .9);
    backdrop-filter: blur(18px);
    text-align: center;
}

.empty__box { max-width: 520px; }
.empty h1 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 12px; }
.empty p { color: var(--muted); line-height: 1.65; margin: 0; }

.empty code {
    font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
    font-size: .9em;
    padding: 2px 7px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .08);
    color: var(--c2);
}

/* ------------------------------------------------- покой: интерфейс тает */

.controls,
.progress {
    transition: opacity .8s var(--ease), transform .8s var(--ease);
}

body.ui-idle .topbar { opacity: .22; }
body.ui-idle .controls { opacity: .38; }
body.ui-idle .progress { opacity: .55; }

/* ---------------------------------------------------------------- адаптив */

@media (max-width: 720px) {
    .cover { width: min(66vw, 30vh); }
    .meta__title { font-size: clamp(19px, 5.4vw, 26px); }
    .controls { gap: 14px; }
    .volume__slider { display: none; }
    .topbar__right { gap: 6px; }

    .deck__head {
        grid-template-columns: 1fr auto;
        grid-template-areas: 'titles close' 'search search';
        row-gap: 14px;
    }
    .deck__titles { grid-area: titles; }
    .deck__search { grid-area: search; height: 46px; }
    .deck__close { grid-area: close; width: 44px; height: 44px; }
    .deck__grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
    .card__name { font-size: 13.5px; }
}

/* низкий экран / ландшафт на телефоне */
@media (max-height: 560px) and (orientation: landscape) {
    .app { grid-template-rows: auto 1fr; }
    .player {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            'cover meta'
            'cover progress'
            'cover controls';
        align-items: center;
        justify-items: stretch;
        column-gap: clamp(16px, 4vw, 42px);
        row-gap: 8px;
    }
    .cover { grid-area: cover; width: min(52vh, 240px); }
    .meta { grid-area: meta; text-align: left; justify-self: start; max-width: 46vw; }
    .progress { grid-area: progress; width: 100%; }
    .controls { grid-area: controls; justify-content: flex-start; }
    .cover__ring { inset: -22%; width: 144%; height: 144%; }
}

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