.coex-winamp,
.coex-winamp * {
    box-sizing: border-box;
}

.coex-winamp {
    --winamp-width: 520px;
    --winamp-height: 64px;
    --winamp-radius: 2px;
    --cover-size: 48px;
    --display-bg: #08110b;
    --display-text: #7cff4e;
    --led-color: #7cff4e;
    --bg-dark: #2b2b2b;
    --bg-mid: #3a3a3a;
    --bevel-light: #7a7a7a;
    --bevel-dark: #141414;

    width: min(90%, var(--winamp-width));
    max-width: 100%;
    height: auto;
    min-height: var(--winamp-height);
    padding: 12px;
    border: 1px solid #1a1a1a;
    border-radius: var(--winamp-radius);
    background:
        linear-gradient(180deg, #3b3b3b, #2b2b2b),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 2px, rgba(0, 0, 0, 0.03) 2px 4px);
    box-shadow:
        inset 1px 1px 0 var(--bevel-light),
        inset -1px -1px 0 var(--bevel-dark),
        0 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: hidden;
    margin-inline: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    color: #d8d8d8;
}

.coex-winamp__bar {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
    min-height: var(--winamp-height);
    min-width: 0;
}

.coex-winamp__cover-btn {
    width: var(--cover-size);
    height: var(--cover-size);
    padding: 0;
    border: 1px solid #1a1a1a;
    border-radius: 1px;
    background: linear-gradient(#424242, #2a2a2a);
    box-shadow:
        inset 1px 1px 0 var(--bevel-light),
        inset -1px -1px 0 var(--bevel-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.coex-winamp__cover-btn:focus-visible {
    outline: 2px solid #9bd0ff;
    outline-offset: 2px;
}

.coex-winamp__cover {
    width: calc(var(--cover-size) - 6px);
    height: calc(var(--cover-size) - 6px);
    object-fit: cover;
    display: block;
    border: 1px solid #0d0d0d;
    box-shadow:
        inset 1px 1px 0 #1a1a1a,
        inset -1px -1px 0 #0a0a0a;
}

.coex-winamp__cover--empty {
    display: block;
    width: calc(var(--cover-size) - 8px);
    height: calc(var(--cover-size) - 8px);
    background: linear-gradient(135deg, #0f1a14, #1a2a1f);
    box-shadow:
        inset 1px 1px 0 #1a1a1a,
        inset -1px -1px 0 #0a0a0a;
}

.coex-winamp__cover-icon {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.coex-winamp__cover-icon::before,
.coex-winamp__cover-icon::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 12px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 2px rgba(124, 255, 78, 0.4));
    opacity: 0;
}

.coex-winamp__cover-icon::before {
    background: var(--display-text);
    -webkit-clip-path: polygon(0 0, 100% 50%, 0 100%);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    opacity: 0.9;
}

.coex-winamp__cover-icon::after {
    background: linear-gradient(
        90deg,
        var(--display-text) 0 3px,
        transparent 3px 4px,
        var(--display-text) 4px 7px,
        transparent 7px 10px
    );
    opacity: 0;
}

.coex-winamp.is-playing .coex-winamp__cover-icon::before {
    opacity: 0;
}

.coex-winamp.is-playing .coex-winamp__cover-icon::after {
    opacity: 1;
}

.coex-winamp__main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.coex-winamp__display {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 22px;
    padding: 2px 6px;
    border: 1px solid #0c1a12;
    border-radius: 1px;
    background: var(--display-bg);
    box-shadow:
        inset 1px 1px 0 #0f1f15,
        inset -1px -1px 0 #050a07;
    color: var(--display-text);
    overflow: hidden;
}

.coex-winamp__status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    letter-spacing: 0.3px;
}

.coex-winamp__meter {
    position: relative;
    width: 26px;
    height: 12px;
    align-self: center;
    flex: 0 0 auto;
    border: 1px solid #0b120d;
    background: linear-gradient(180deg, #0c1510, #08110b);
    box-shadow:
        inset 1px 1px 0 #0f1f15,
        inset -1px -1px 0 #050a07;
}

.coex-winamp__meter::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 2px;
    width: 3px;
    height: 8px;
    background: var(--display-text);
    opacity: 0.9;
    box-shadow:
        5px 0 0 var(--display-text),
        10px 0 0 var(--display-text);
}

.coex-winamp__meter::after {
    content: "";
    position: absolute;
    width: 3px;
    height: 4px;
    left: 4px;
    bottom: 2px;
    background: rgba(124, 255, 78, 0.45);
    box-shadow:
        5px 0 0 rgba(124, 255, 78, 0.65),
        10px 0 0 rgba(124, 255, 78, 0.85);
}

.coex-winamp__state {
    font-weight: 700;
    display: inline-block;
    width: 5ch;
    text-align: left;
    white-space: nowrap;
}

.coex-winamp__led {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: #1e2a23;
    box-shadow:
        inset 0 0 2px rgba(0, 0, 0, 0.8),
        0 0 0 1px #0b0b0b;
}

.coex-winamp.is-playing .coex-winamp__led {
    background: var(--led-color);
    box-shadow:
        0 0 4px rgba(124, 255, 78, 0.8),
        inset 0 0 2px rgba(0, 0, 0, 0.6);
    animation: coex-led 1s steps(2, end) infinite;
}

.coex-winamp__ticker {
    position: relative;
    flex: 1;
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
}

.coex-winamp__ticker span {
    display: inline-block;
    padding-right: 24px;
}

.coex-winamp__ticker.is-overflow span {
    animation: coex-ticker var(--ticker-duration, 10s) linear infinite;
}

.coex-winamp__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.coex-winamp__buttons {
    display: inline-flex;
    gap: 4px;
    flex: 0 0 auto;
}

.coex-winamp__btn {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #1a1a1a;
    border-radius: 1px;
    background: linear-gradient(#4a4a4a, #2f2f2f);
    box-shadow:
        inset 1px 1px 0 var(--bevel-light),
        inset -1px -1px 0 var(--bevel-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e6e6e6;
}

.coex-winamp__btn svg {
    width: 12px;
    height: 12px;
    display: block !important;
    fill: currentColor !important;
}

.coex-winamp__btn[data-action="play"] svg {
    fill: #7cff4e !important;
}

.coex-winamp__btn[data-action="play"] {
    color: #7cff4e;
}

.coex-winamp__btn:hover {
    background: linear-gradient(#5a5a5a, #3a3a3a);
}

.coex-winamp__btn:active {
    transform: translateY(1px);
    box-shadow:
        inset -1px -1px 0 var(--bevel-light),
        inset 1px 1px 0 var(--bevel-dark);
}

.coex-winamp.is-playlist-open .coex-winamp__btn--playlist {
    background: linear-gradient(#3a3a3a, #1f1f1f);
}

.coex-winamp__mute-slash {
    display: none;
}

.coex-winamp.is-muted .coex-winamp__mute-slash {
    display: inline;
}

.coex-winamp__btn:focus-visible {
    outline: 2px solid #9bd0ff;
    outline-offset: 2px;
}

.coex-winamp__progress {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
}

.coex-winamp__track {
    position: relative;
    flex: 1 1 auto;
    height: 6px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid #141414;
    border-radius: 2px;
    background: #1b1b1b;
    box-shadow:
        inset 1px 1px 0 #0d0d0d,
        inset -1px -1px 0 #2f2f2f;
    cursor: pointer;
}

.coex-winamp__track:focus-visible {
    outline: 2px solid #9bd0ff;
    outline-offset: 2px;
}

.coex-winamp__progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6ad050, #97ff6e);
    border-right: 1px solid #0d0d0d;
}

.coex-winamp__knob {
    position: absolute;
    top: -2px;
    left: 0;
    width: 8px;
    height: 10px;
    border: 1px solid #1a1a1a;
    border-radius: 1px;
    background: linear-gradient(#e0e0e0, #9f9f9f);
    box-shadow:
        inset 1px 1px 0 #f3f3f3,
        inset -1px -1px 0 #6b6b6b;
}

.coex-winamp__time {
    min-width: 0;
    flex: 0 0 auto;
    text-align: right;
    font-size: 11px;
    color: #cfcfcf;
    white-space: nowrap;
}

.coex-winamp__playlist-panel {
    width: 100%;
    margin-top: 6px;
    padding: 6px;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    background: linear-gradient(180deg, #2e2e2e, #1f1f1f);
    box-shadow:
        inset 1px 1px 0 var(--bevel-light),
        inset -1px -1px 0 var(--bevel-dark);
}

.coex-winamp__playlist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.coex-winamp__playlist-item {
    width: 100%;
    text-align: left;
    padding: 4px 6px;
    border: 1px solid #101010;
    border-radius: 1px;
    background: #161616;
    color: #cfcfcf;
    font-size: 11px;
    cursor: pointer;
}

.coex-winamp__playlist-item:hover {
    background: #222222;
}

.coex-winamp__playlist-item[aria-selected="true"] {
    background: #0f1f15;
    color: var(--display-text);
    border-color: #0b120d;
}

@keyframes coex-ticker {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(-1 * var(--ticker-distance, 100px)));
    }
}

@keyframes coex-led {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

@media (max-width: 480px) {
    .coex-winamp {
        padding: 12px;
        --cover-size: 40px;
        width: 90%;
        max-width: 100%;
    }

    .coex-winamp__controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .coex-winamp__progress {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 6px;
    }

    .coex-winamp__btn {
        width: 16px;
        height: 16px;
    }

    .coex-winamp__btn svg {
        width: 10px;
        height: 10px;
    }

    .coex-winamp__display {
        height: 20px;
        font-size: 11px;
    }

    .coex-winamp__time {
        min-width: 56px;
        font-size: 10px;
    }

    .coex-winamp__track {
        min-width: 0;
    }
}

@media (max-width: 430px) {
    .coex-winamp__buttons {
        flex-wrap: wrap;
        row-gap: 4px;
    }
}

@media (max-width: 380px) {
    .coex-winamp__bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .coex-winamp__main {
        width: 100%;
    }
}
