:root {
    --bg-color-1: #15181e;
    --bg-color-2: #15181e;
    --bg-color-3: #15181e;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.72);
    --accent-color: #dc2626;
    --accent-color-rgb: 220, 38, 38;
    --icon-color: #ffffff;
}

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

html,
body {
    width: 100%;
    height: 100px;
    min-height: 100px;
    overflow: hidden;
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
    background: transparent;
    color: var(--text-primary);
}

button,
input {
    font: inherit;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 12, 16, 0.9);
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.radio-player {
    position: relative;
    width: 100%;
    height: 100px;
    min-height: 100px;
    overflow: hidden;
    background: linear-gradient(110deg, var(--bg-color-1), #25272d 45%, var(--bg-color-3));
    border-radius: 0 0 0px 0px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.dynamic-cover-bg,
.minimal-glass-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.dynamic-cover-bg {
    z-index: 0;
    opacity: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(20px) saturate(1.45) brightness(0.78);
    transform: scale(1.2);
    transition: opacity 0.9s ease-in-out;
}

.dynamic-cover-bg.active {
    opacity: 0.92;
}

.minimal-glass-overlay {
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(8, 10, 14, 0.34), rgba(10, 12, 16, 0.46) 48%, rgba(8, 10, 14, 0.38)),
        radial-gradient(circle at 48% 50%, rgba(255, 255, 255, 0.08), transparent 28%),
        rgba(12, 14, 18, 0.24);
    backdrop-filter: blur(14px) saturate(1.08);
    -webkit-backdrop-filter: blur(14px) saturate(1.08);
}

.background-glow {
    position: absolute;
    inset: -40px;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(circle at 24% 50%, rgba(255, 255, 255, 0.1), transparent 22%),
        radial-gradient(circle at 75% 48%, rgba(255, 255, 255, 0.12), transparent 28%);
    filter: blur(16px);
    opacity: 0.32;
}

.visualizer-canvas {
    display: none;
}

.player-container {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100px;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) minmax(260px, 410px);
    align-items: center;
    column-gap: 18px;
    padding: 10px 28px;
}

.cover-section,
.info-section,
.controls-section,
.main-controls,
.volume-control {
    min-width: 0;
}

.cover-section {
    grid-column: 1;
    width: 80px;
    height: 80px;
}

.cover-container {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.cover-container::before {
    content: "";
    position: absolute;
    inset: -18px;
    z-index: 0;
    background-image: var(--cover-bg);
    background-position: center;
    background-size: cover;
    filter: blur(18px);
    opacity: 0.35;
}

.cover-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
}

.cover-container img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.cover-container img.active {
    opacity: 1;
    transform: scale(1);
}

.cover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    background: rgba(0, 0, 0, 0.32);
    transition: opacity 0.2s ease;
}

.cover-container:hover .cover-overlay {
    opacity: 1;
}

.cover-toggle,
.mute-button,
.max-volume-button,
.visualizer-toggle,
.history-button,
.share-button,
.history-close-btn {
    border: 0;
    color: var(--icon-color);
    background: transparent;
    cursor: pointer;
}

.cover-toggle {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.info-section {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    overflow: hidden;
}

.track-info {
    order: 1;
    width: 100%;
    min-width: 0;
}

.now-playing {
    display: none;
}

.track-title-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    mask-image: linear-gradient(to right, black 0%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 0%, black 92%, transparent 100%);
}

.track-title {
    display: inline-block;
    max-width: 100%;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 760;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.track-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.track-title.loading {
    min-width: 180px;
    height: 1.1em;
    color: transparent;
    border-radius: 5px;
    opacity: 1;
    transform: none;
    background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.2), rgba(255,255,255,0.08));
    background-size: 200% 100%;
    animation: shimmer 1.1s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.track-title-scroller {
    display: inline-flex;
    gap: 48px;
    white-space: nowrap;
}

.track-title-scroller.scrolling {
    animation: scroll-title 18s linear infinite;
}

@keyframes scroll-title {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.station-name {
    order: 2;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.station-name::before {
    content: "";
    width: 17px;
    height: 14px;
    flex: 0 0 17px;
    background:
        linear-gradient(var(--text-primary), var(--text-primary)) 0 55% / 3px 7px no-repeat,
        linear-gradient(var(--text-primary), var(--text-primary)) 7px 30% / 3px 12px no-repeat,
        linear-gradient(var(--text-primary), var(--text-primary)) 14px 70% / 3px 5px no-repeat;
    opacity: 0.92;
}

.progress-section {
    display: none;
}

.progress-track,
.progress-fill,
.progress-handle,
.progress-tooltip,
.progress-elapsed,
.progress-remaining {
    display: none;
}

.controls-section {
    grid-column: 3;
    justify-self: end;
    width: min(100%, 410px);
    height: 80px;
    display: grid;
    grid-template-columns: 78px minmax(160px, 250px);
    align-items: center;
    justify-content: end;
    column-gap: 22px;
    align-self: center;
    grid-auto-rows: 80px;
    overflow: visible;
}

.main-controls {
    grid-column: 1;
    grid-row: 1;
    width: 78px;
    height: 80px;
    display: grid;
    place-items: center;
}

.play-button {
    justify-self: center;
    align-self: center;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 0;
    border: 0;
    border-radius: 50%;
    color: #05060a;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.play-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

.play-button:active {
    transform: translateY(0) scale(0.97);
}

.hidden {
    display: none !important;
}

.left-controls,
.live-indicator {
    display: none;
}

.share-container {
    position: relative;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
}

.live-dot.pulsing {
    animation: pulse-live 1.4s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-color-rgb), 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(var(--accent-color-rgb), 0); }
}

.volume-control {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    width: min(100%, 230px);
    display: grid;
    grid-template-columns: 34px minmax(88px, 1fr) 34px;
    align-items: center;
    gap: 13px;
}

.mute-button,
.max-volume-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    opacity: 0.9;
}

.volume-slider-container {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
}

.volume-slider {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.volume-track {
    position: relative;
    width: 100%;
    height: 5px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.34);
}

.volume-fill {
    width: 90%;
    height: 100%;
    border-radius: inherit;
    background: #ffffff;
}

.volume-percentage {
    display: none;
}

.volume-control.muted .volume-fill {
    width: 0 !important;
}

.share-popup {
    position: absolute;
    right: 16px;
    bottom: 108px;
    z-index: 20;
    display: none;
    width: 230px;
    padding: 14px;
    color: #ffffff;
    border-radius: 14px;
    background: rgba(20, 22, 28, 0.96);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.share-popup.active {
    display: block;
}

.share-popup-title {
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.share-icon {
    display: grid;
    place-items: center;
    min-height: 32px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 12px;
    font-weight: 700;
}

.history-overlay {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: none;
    background: rgba(0, 0, 0, 0.32);
}

.history-overlay.visible {
    display: block;
}

.history-panel {
    position: fixed;
    right: 16px;
    bottom: 116px;
    z-index: 19;
    width: min(340px, calc(100vw - 32px));
    max-height: 60vh;
    overflow: hidden;
    transform: translateY(12px);
    opacity: 0;
    visibility: hidden;
    border-radius: 16px;
    background: rgba(17, 19, 25, 0.96);
    box-shadow: 0 24px 52px rgba(0, 0, 0, 0.38);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.history-panel.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-title {
    font-size: 16px;
    font-weight: 700;
}

.history-close-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
}

.history-list {
    list-style: none;
    max-height: calc(60vh - 67px);
    overflow: auto;
    padding: 8px;
}

.history-list li {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-radius: 10px;
}

.history-list li + li {
    margin-top: 4px;
}

@media (max-width: 760px) {
    .player-container {
        grid-template-columns: 64px minmax(0, 1fr) 58px;
        column-gap: 12px;
        padding: 10px 14px;
    }

    .cover-section,
    .cover-container {
        width: 64px;
        height: 64px;
    }

    .track-title {
        font-size: 15px;
    }

    .station-name {
        font-size: 12px;
    }

    .volume-control {
        display: none;
    }

    .controls-section {
        grid-column: 3;
        width: 58px;
        height: 64px;
        grid-template-columns: 58px;
        column-gap: 0;
        grid-auto-rows: 64px;
    }

    .main-controls {
        grid-column: 1;
        grid-row: 1;
        width: 58px;
        height: 64px;
    }

    .play-button {
        width: 54px;
        height: 54px;
    }
}

@media (max-width: 420px) {
    .player-container {
        grid-template-columns: 58px minmax(0, 1fr) 50px;
        column-gap: 10px;
        padding-inline: 10px;
    }

    .cover-section,
    .cover-container {
        width: 58px;
        height: 58px;
        border-radius: 8px;
    }

    .track-title {
        font-size: 14px;
    }

    .station-name {
        font-size: 11px;
    }

    .controls-section {
        width: 50px;
        height: 58px;
        grid-template-columns: 50px;
        grid-auto-rows: 58px;
    }

    .main-controls {
        width: 50px;
        height: 58px;
    }

    .play-button {
        width: 48px;
        height: 48px;
    }
}
