* {
    box-sizing: border-box;
}

:root {
    --bg: #f3f5ef;
    --surface: rgba(255, 255, 255, .78);
    --surface-solid: #ffffff;
    --ink: #10120f;
    --text: #191b17;
    --muted: #70756d;
    --muted-strong: #464b43;
    --line: rgba(18, 22, 17, .12);
    --line-strong: rgba(18, 22, 17, .18);
    --accent: #087b73;
    --accent-deep: #065e58;
    --accent-soft: rgba(8, 123, 115, .13);
    --danger: #b23b47;
    --blue: #486ed6;
    --gold: #d99f34;
    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --shadow:
        0 28px 80px rgba(19, 27, 22, .13),
        0 3px 10px rgba(19, 27, 22, .06);
    --shadow-soft:
        0 12px 34px rgba(19, 27, 22, .08),
        0 1px 3px rgba(19, 27, 22, .06);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
    --bg: #090b0a;
    --surface: rgba(17, 21, 18, .82);
    --surface-solid: #121713;
    --ink: #f4f7f1;
    --text: #e8ece4;
    --muted: #a4aa9f;
    --muted-strong: #ccd2c7;
    --line: rgba(236, 244, 231, .13);
    --line-strong: rgba(236, 244, 231, .20);
    --accent: #9be36f;
    --accent-deep: #c7ff9d;
    --accent-soft: rgba(155, 227, 111, .14);
    --danger: #ff7d8a;
    --blue: #84a3ff;
    --gold: #f0c15b;
    --shadow:
        0 28px 80px rgba(0, 0, 0, .38),
        0 3px 10px rgba(0, 0, 0, .24);
    --shadow-soft:
        0 12px 34px rgba(0, 0, 0, .26),
        0 1px 3px rgba(0, 0, 0, .22);
}

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

body {
    min-width: 320px;
    background:
        radial-gradient(circle at 18% 12%, rgba(72, 110, 214, .16), transparent 30rem),
        radial-gradient(circle at 82% 18%, rgba(217, 159, 52, .18), transparent 25rem),
        linear-gradient(150deg, #fafaf6 0%, var(--bg) 56%, #eaf2ee 100%);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

[data-theme="dark"] body {
    background:
        radial-gradient(circle at 18% 12%, rgba(132, 163, 255, .18), transparent 30rem),
        radial-gradient(circle at 82% 18%, rgba(155, 227, 111, .14), transparent 25rem),
        linear-gradient(150deg, #050605 0%, var(--bg) 58%, #101710 100%);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    content: "";
    pointer-events: none;
    opacity: .42;
    background:
        linear-gradient(rgba(16, 18, 15, .042) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 18, 15, .035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 74%);
}

[data-theme="dark"] body::before {
    opacity: .28;
    background:
        linear-gradient(rgba(244, 247, 241, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(244, 247, 241, .045) 1px, transparent 1px);
}

button,
input {
    font: inherit;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.shell {
    display: grid;
    min-height: 100svh;
    padding: clamp(14px, 3vw, 34px);
    place-items: center;
}

.workspace {
    width: min(100%, 920px);
    padding: clamp(20px, 3.6vw, 40px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .88), rgba(255, 255, 255, .70)),
        var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px) saturate(1.12);
    animation: workspace-enter .5s var(--ease) both;
}

[data-theme="dark"] .workspace {
    background:
        linear-gradient(180deg, rgba(18, 23, 19, .94), rgba(12, 15, 13, .78)),
        var(--surface);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: clamp(30px, 5vw, 58px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 780;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 36px;
    height: 36px;
    align-items: end;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 8px;
    border-radius: 12px;
    background:
        linear-gradient(145deg, #151812, #060706);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .14),
        0 8px 22px rgba(16, 18, 15, .18);
}

.brand-mark span {
    display: block;
    border-radius: 999px;
    background: #fff;
    transform-origin: bottom;
    animation: meter 1.15s ease-in-out infinite alternate;
}

.brand-mark span:nth-child(1) {
    height: 9px;
}

.brand-mark span:nth-child(2) {
    height: 17px;
    animation-delay: .16s;
}

.brand-mark span:nth-child(3) {
    height: 12px;
    animation-delay: .32s;
}

[data-theme="dark"] .brand-mark {
    background:
        linear-gradient(145deg, #f2ffe8, #9be36f);
}

[data-theme="dark"] .brand-mark span {
    background: #071007;
}

.top-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    position: relative;
    width: 42px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .66);
    color: var(--muted-strong);
    cursor: pointer;
    box-shadow: 0 1px 1px rgba(255, 255, 255, .6) inset;
    transition:
        background .2s ease,
        border-color .2s ease,
        color .2s ease,
        transform .2s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

.theme-toggle svg {
    position: absolute;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition:
        opacity .18s ease,
        scale .18s ease,
        rotate .18s ease;
}

.moon-icon,
[data-theme="dark"] .sun-icon {
    opacity: 0;
    scale: .72;
    rotate: -18deg;
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
    scale: 1;
    rotate: 0deg;
}

[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .system-state {
    background: rgba(18, 23, 19, .78);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset;
}

.system-state {
    min-width: 96px;
    min-height: 34px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .66);
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 760;
    box-shadow: 0 1px 1px rgba(255, 255, 255, .6) inset;
    transition:
        border-color .2s ease,
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}

.system-state.busy {
    border-color: rgba(8, 123, 115, .26);
    background: var(--accent-soft);
    color: var(--accent-deep);
}

.system-state.error {
    border-color: rgba(178, 59, 71, .22);
    background: rgba(178, 59, 71, .09);
    color: var(--danger);
}

.hero {
    margin-bottom: 20px;
}

h1 {
    max-width: 100%;
    margin: 0;
    color: var(--ink);
    font-size: clamp(38px, 7vw, 72px);
    line-height: .96;
    font-weight: 820;
    letter-spacing: 0;
    text-wrap: balance;
    white-space: nowrap;
}

.result {
    display: none;
    margin: 0 0 18px;
}

.result.visible {
    display: grid;
    grid-template-columns: minmax(260px, 44%) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
    animation: result-enter .42s var(--ease) both;
}

.playlist {
    display: none;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 21px;
    background: rgba(255, 255, 255, .76);
    box-shadow: var(--shadow-soft);
}

[data-theme="dark"] .playlist,
[data-theme="dark"] .feed-section {
    background: rgba(18, 23, 19, .62);
}

.playlist.visible {
    display: block;
    animation: result-enter .35s var(--ease) both;
}

.playlist-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.playlist-head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.playlist-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

.playlist-items {
    display: grid;
    gap: 8px;
}

.playlist-item {
    width: 100%;
    min-height: 72px;
    padding: 8px;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, .64);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

[data-theme="dark"] .playlist-item {
    background: rgba(18, 23, 19, .62);
}

.playlist-item:hover {
    border-color: rgba(8, 123, 115, .28);
    background: #fff;
}

[data-theme="dark"] .playlist-item:hover {
    background: rgba(24, 31, 26, .92);
}

.playlist-item.loading,
.feed-card.loading {
    opacity: .62;
    filter: saturate(.7);
}

.playlist-item.ready,
.feed-card.ready {
    border-color: rgba(8, 123, 115, .36);
}

.playlist-item.ready .pick-state,
.feed-card.ready .pick-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.feed-card.ready .pick-state {
    width: fit-content;
    margin-top: 7px;
}

.playlist-item img {
    width: 74px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
}

.playlist-item strong {
    display: block;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

.cover {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: auto;
    aspect-ratio: 16 / 10;
    border: 1px solid rgba(255, 255, 255, .44);
    border-radius: 21px;
    background:
        linear-gradient(135deg, rgba(8, 123, 115, .20), rgba(72, 110, 214, .16)),
        #e5e8df;
    box-shadow: var(--shadow-soft);
    isolation: isolate;
}

[data-theme="dark"] .cover {
    border-color: rgba(244, 247, 241, .14);
    background:
        linear-gradient(135deg, rgba(155, 227, 111, .18), rgba(132, 163, 255, .16)),
        #121713;
}

.cover::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    content: "";
    pointer-events: none;
    background:
        linear-gradient(to top, rgba(0, 0, 0, .54), transparent 56%),
        linear-gradient(120deg, rgba(255, 255, 255, .20), transparent 34%);
}

.cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .98;
    scale: 1.018;
    transition:
        opacity .26s ease,
        scale .7s var(--ease);
}

.result.visible .cover img {
    scale: 1;
}

.waveform {
    position: absolute;
    right: 16px;
    bottom: 58px;
    z-index: 2;
    display: grid;
    height: 52px;
    width: clamp(54px, 13vw, 92px);
    grid-template-columns: repeat(12, minmax(2px, 1fr));
    align-items: end;
    gap: clamp(2px, .55vw, 4px);
    opacity: .95;
}

.waveform span {
    display: block;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    transform-origin: bottom;
    animation: wave 1.1s ease-in-out infinite;
}

.waveform span:nth-child(2n) {
    animation-delay: .12s;
}

.waveform span:nth-child(3n) {
    animation-delay: .24s;
}

.waveform span:nth-child(4n) {
    animation-delay: .36s;
}

.cover-meta {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.meta-chip {
    min-height: 31px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(13, 16, 14, .72);
    color: #fff;
    font-size: 12px;
    font-weight: 760;
    backdrop-filter: blur(8px);
}

.info {
    min-width: 0;
    padding: clamp(18px, 2.4vw, 24px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: 21px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .78));
    box-shadow: var(--shadow-soft);
}

[data-theme="dark"] .info {
    background:
        linear-gradient(180deg, rgba(20, 25, 21, .94), rgba(16, 20, 17, .82));
}

.title {
    margin: 0;
    color: var(--ink);
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(22px, 2.6vw, 30px);
    line-height: 1.12;
    font-weight: 800;
    overflow-wrap: anywhere;
    word-break: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 13px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 620;
}

.dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gold);
}

.download {
    width: 100%;
    margin-top: 24px;
}

.download svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 7px;
    border: 1px solid var(--line-strong);
    border-radius: 19px;
    background: rgba(255, 255, 255, .86);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .8) inset,
        0 12px 30px rgba(19, 27, 22, .07);
    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

[data-theme="dark"] .search {
    background: rgba(18, 23, 19, .86);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .08) inset,
        0 12px 30px rgba(0, 0, 0, .20);
}

.search:focus-within {
    border-color: rgba(8, 123, 115, .48);
    box-shadow:
        0 0 0 4px rgba(8, 123, 115, .11),
        0 1px 0 rgba(255, 255, 255, .8) inset,
        0 14px 34px rgba(19, 27, 22, .09);
    transform: translateY(-1px);
}

.input-wrap {
    position: relative;
    min-width: 0;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.8;
    transform: translateY(-50%);
}

.input-wrap input {
    width: 100%;
    height: 56px;
    padding: 0 15px 0 47px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 560;
}

.input-wrap input::placeholder {
    color: #979d94;
}

[data-theme="dark"] .input-wrap input::placeholder {
    color: #7f897d;
}

.primary-action,
.download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 56px;
    border: 0;
    border-radius: 14px;
    background:
        linear-gradient(180deg, #171a15, #0c0e0b);
    color: #fff;
    font-size: 14px;
    font-weight: 780;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .13),
        0 10px 22px rgba(16, 18, 15, .14);
    transition:
        background .16s ease,
        box-shadow .16s ease,
        opacity .16s ease,
        scale .16s ease,
        transform .16s ease;
}

[data-theme="dark"] .primary-action,
[data-theme="dark"] .download {
    background:
        linear-gradient(180deg, #d9ff9b, #9be36f);
    color: #081008;
}

.primary-action {
    min-width: 132px;
    padding: 0 19px;
}

.primary-action:hover:not(:disabled),
.download:hover:not(:disabled) {
    background:
        linear-gradient(180deg, #0b756e, #055a55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .16),
        0 12px 26px rgba(8, 123, 115, .22);
    transform: translateY(-1px);
}

.primary-action:active:not(:disabled),
.download:active:not(:disabled) {
    scale: .986;
}

.primary-action:disabled,
.download:disabled {
    cursor: default;
    opacity: .52;
}

.button-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .36);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.primary-action.loading .button-loader {
    display: block;
}

.status {
    min-height: 28px;
    padding: 11px 3px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 620;
}

.status.error {
    color: var(--danger);
}

.status.pulse {
    animation: pulse-text 1s ease-in-out infinite;
}

.feed {
    margin-top: 26px;
    display: grid;
    gap: 18px;
}

.curated-feed {
    display: grid;
    gap: 18px;
}

.feed-section {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 21px;
    background: rgba(255, 255, 255, .62);
}

.feed-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.feed-head h2 {
    margin: 0;
    font-size: 18px;
}

.feed-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

.feed-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.feed-card {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.feed-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.feed-card strong {
    display: -webkit-box;
    margin-top: 8px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.feed-card span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 720;
}

.ad-slot {
    min-height: 92px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(18, 22, 17, .22);
    border-radius: 18px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    text-transform: uppercase;
}

@keyframes workspace-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.986);
    }

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

@keyframes result-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

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

@keyframes meter {
    to {
        transform: scaleY(.55);
    }
}

@keyframes wave {
    0%,
    100% {
        transform: scaleY(.42);
    }

    50% {
        transform: scaleY(1.62);
    }
}

@keyframes pulse-text {
    50% {
        opacity: .56;
    }
}

@media (max-width: 760px) {
    .workspace {
        width: min(100%, 560px);
    }

    .result.visible {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cover {
        aspect-ratio: 16 / 9;
    }

    .title {
        -webkit-line-clamp: 3;
    }

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

    .playlist-item span {
        display: none;
    }

    .feed-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .shell {
        align-items: start;
        padding: 12px;
    }

    .workspace {
        min-height: calc(100svh - 24px);
        padding: 20px;
        border-radius: 22px;
    }

    .topbar {
        margin-bottom: 42px;
    }

    h1 {
        font-size: clamp(34px, 12vw, 50px);
    }

    .search {
        grid-template-columns: 1fr;
    }

    .primary-action {
        width: 100%;
    }

    .waveform {
        right: 12px;
        bottom: 54px;
        width: clamp(52px, 15vw, 74px);
    }
}

@media (max-width: 390px) {
    h1 {
        font-size: 32px;
    }

    .brand {
        font-size: 16px;
    }

    .system-state {
        min-width: auto;
        padding-inline: 10px;
    }
}

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