:root {
    --accent-color: #9d85ff;
    --accent-glow: rgba(157, 133, 255, 0.5);
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.18);
    --side-menu-bg: rgba(28, 28, 58, 0.92);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.72);
    --danger-color: #ff7373;
    --success-color: #3bd682;
    --warning-color: #ffc247;
    --topbar-height: 74px;
    --sidebar-width: 304px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

body {
    background: #09111f;
    color: var(--text-primary);
    overflow: hidden;
}

button,
input {
    font: inherit;
}

a,
button,
input {
    -webkit-tap-highlight-color: transparent;
}

.glass-bg,
.screen-vignette {
    position: fixed;
    inset: 0;
}

.glass-bg {
    background-size: cover;
    background-position: center;
    filter: blur(4px) brightness(0.84) saturate(1.12);
    transform: scale(1.08);
    z-index: -3;
}

.screen-vignette {
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 42%),
        linear-gradient(180deg, rgba(8, 12, 25, 0.23) 0%, rgba(8, 12, 25, 0.53) 62%, rgba(8, 12, 25, 0.73) 100%);
    z-index: -2;
}

.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 18px;
    background: rgba(11, 16, 33, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    z-index: 1000;
}

.app-topbar-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.14);
}

.app-topbar-spacer,
.menu-toggle {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1001;
}

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: calc(var(--topbar-height) + 18px) 16px 18px;
    background: var(--side-menu-bg);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.34);
    display: flex;
    flex-direction: column;
    z-index: 1200;
    transition: transform 0.32s ease;
}

.menu-logo {
    width: 138px;
    height: 138px;
    object-fit: contain;
    margin: 0 auto 22px;
    filter: drop-shadow(0 0 22px rgba(255, 255, 255, 0.12));
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 10px;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid transparent;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    line-height: 1.35;
    position: relative;
    transition: color 0.22s ease, transform 0.22s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 10px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 999px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.32s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
}

.nav-links a.is-danger {
    color: #ffd2d2;
}

.divider {
    height: 1px;
    margin: 16px 4px;
    background: rgba(255, 255, 255, 0.1);
}

.section-label {
    padding: 0 16px;
    margin: 0 0 6px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.menu-footer-logo {
    width: 42px;
    margin-top: auto;
    opacity: 0.22;
    align-self: center;
}

#main-content {
    position: relative;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-height) + 28px) 28px 28px;
}

.view-panel {
    display: none;
    min-height: calc(100vh - var(--topbar-height) - 56px);
    align-items: center;
    justify-content: center;
}

.view-panel.is-active {
    display: flex;
}

.player-container {
    width: min(100%, 440px);
}

.video-shell {
    width: min(100%, 860px);
}

.glass-card {
    position: relative;
    background: rgba(16, 22, 40, 0.5);
    backdrop-filter: blur(36px);
    -webkit-backdrop-filter: blur(36px);
    border: 1px solid rgba(229, 242, 255, 0.25);
    border-radius: 36px;
    box-shadow:
        0 40px 90px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 30px rgba(143, 187, 255, 0.08);
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.18) 0%, transparent 40%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    padding: 1px;
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    pointer-events: none;
}

.player-card {
    padding: 50px 40px;
    text-align: center;
}

.album-art-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto 40px;
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 50px var(--accent-glow);
}

.live-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

.visualizer-bars {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 30px;
}

.bar {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--accent-color);
}

.playing .bar {
    animation: bounce 0.8s infinite alternate ease-in-out;
}

.playing .bar:nth-child(1) { animation-delay: 0.1s; animation-duration: 0.58s; }
.playing .bar:nth-child(2) { animation-delay: 0.2s; animation-duration: 0.7s; }
.playing .bar:nth-child(3) { animation-delay: 0.3s; animation-duration: 0.8s; }
.playing .bar:nth-child(4) { animation-delay: 0.4s; animation-duration: 0.9s; }
.playing .bar:nth-child(5) { animation-delay: 0.15s; animation-duration: 0.62s; }
.playing .bar:nth-child(6) { animation-delay: 0.25s; animation-duration: 0.75s; }
.playing .bar:nth-child(7) { animation-delay: 0.35s; animation-duration: 0.84s; }
.playing .bar:nth-child(8) { animation-delay: 0.45s; animation-duration: 0.69s; }

@keyframes bounce {
    0% { height: 4px; opacity: 0.5; }
    100% { height: 28px; opacity: 1; }
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 12px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.08);
}

.track-info h2 {
    margin-bottom: 10px;
    font-size: 1.62rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.25;
}

.track-info p {
    color: var(--text-secondary);
}

#radio-tagline {
    margin-bottom: 26px;
    font-size: 0.94rem;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.player-status {
    margin: 0 auto 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 152px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.player-status-stopped { background: rgba(255, 255, 255, 0.07); }
.player-status-connecting { background: rgba(255, 194, 71, 0.18); border-color: rgba(255, 194, 71, 0.32); }
.player-status-live { background: rgba(59, 214, 130, 0.16); border-color: rgba(59, 214, 130, 0.3); }
.player-status-error { background: rgba(255, 115, 115, 0.16); border-color: rgba(255, 115, 115, 0.32); }

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-ctrl {
    width: 85px;
    height: 85px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #6f7eff);
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 18px 40px var(--accent-glow);
}

.volume-row {
    width: 100%;
    margin-top: 34px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

input[type="range"] {
    flex: 1;
    accent-color: var(--accent-color);
}

.video-shell {
    padding: 24px;
}

.video-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    min-height: 0;
    border-radius: 30px;
    overflow: hidden;
    background: rgba(6, 10, 20, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-stage::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 120px;
    background: linear-gradient(180deg, rgba(8, 12, 25, 0) 0%, rgba(8, 12, 25, 0.78) 100%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-stage.is-playing::after,
.video-stage.show-controls::after {
    opacity: 1;
}

.video-stage-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(157, 133, 255, 0.18), transparent 32%),
        radial-gradient(circle at bottom left, rgba(59, 214, 130, 0.15), transparent 28%),
        linear-gradient(180deg, rgba(8, 12, 25, 0.3), rgba(8, 12, 25, 0.92));
}

.video-player,
.video-poster {
    position: absolute;
    inset: 0;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    opacity: 0;
    transition: opacity 0.28s ease;
}

.video-stage.is-playing .video-player {
    opacity: 1;
}

.video-poster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 30px 34px;
    text-align: center;
    z-index: 2;
    background: linear-gradient(180deg, rgba(8, 12, 25, 0.12) 0%, rgba(8, 12, 25, 0.2) 40%, rgba(8, 12, 25, 0.42) 100%);
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.video-stage.is-playing .video-poster {
    opacity: 0;
    visibility: hidden;
}

.video-poster-logo {
    width: 132px;
    height: 132px;
    object-fit: contain;
    filter: drop-shadow(0 0 26px rgba(255, 255, 255, 0.12));
}

.video-controls-bar {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 4;
    display: grid;
    grid-template-columns: auto 1fr auto minmax(92px, 140px) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(8, 12, 25, 0.68);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 34px rgba(0, 0, 0, 0.24);
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.video-stage.is-playing:not(.show-controls) .video-controls-bar {
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    pointer-events: none;
}

.video-control-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

.video-control-primary {
    background: linear-gradient(135deg, var(--accent-color), #6f7eff);
    border-color: transparent;
}

.video-live-track {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0 10px 0 2px;
}

.video-live-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: #ff6666;
    box-shadow: 0 0 14px rgba(255, 102, 102, 0.65);
}

.video-live-line {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff6666 0%, rgba(255, 255, 255, 0.18) 100%);
}

.video-live-label {
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.88);
}

.video-volume-slider {
    width: 100%;
    accent-color: var(--accent-color);
}

.video-meta {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.overlay.active {
    display: block;
}

.glass-toast {
    position: fixed;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%) translateY(0);
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 320px;
    padding: 14px 18px;
    background: rgba(23, 28, 49, 0.82);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    z-index: 2100;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(100px);
}

.toast-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
}

.toast-content {
    flex: 1;
}

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

.btn-update,
.btn-primary {
    border: none;
    border-radius: 14px;
    background: #fff;
    color: #11192d;
    cursor: pointer;
    font-weight: 700;
}

.btn-update {
    padding: 10px 16px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

.btn-skip {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.install-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
}

.install-card {
    width: min(100%, 420px);
    padding: 30px 28px;
    text-align: center;
}

.install-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    margin-bottom: 18px;
}

.install-card h3 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.install-card p {
    color: var(--text-secondary);
    line-height: 1.5;
}

.install-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    padding: 15px 16px;
}

.btn-secondary {
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
}

#ios-guide {
    margin-top: 18px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
}

.hidden {
    display: none !important;
}

@media screen and (min-width: 1025px) {
    .app-topbar {
        padding-left: calc(var(--sidebar-width) + 22px);
    }

    .app-topbar-title {
        text-align: left;
    }
}

@media screen and (max-width: 1024px) {
    .menu-toggle {
        display: inline-flex;
    }

    .app-topbar-spacer {
        display: none;
    }

    #sidebar {
        transform: translateX(calc(-100% - 22px));
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
        padding: calc(var(--topbar-height) + 24px) 20px 20px;
    }
}

@media screen and (max-width: 720px) {
    :root {
        --topbar-height: 68px;
    }

    .app-topbar {
        padding: 0 14px;
    }

    .app-topbar-title {
        font-size: 0.84rem;
        letter-spacing: 0.16em;
    }

    .app-topbar-spacer,
    .menu-toggle {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

    #sidebar {
        width: min(88vw, 304px);
    }

    .player-card,
    .video-shell {
        padding: 22px;
    }

    .player-card {
        border-radius: 30px;
    }

    .album-art-wrapper {
        width: 190px;
        height: 190px;
        margin-bottom: 24px;
    }

    .track-info h2 {
        font-size: 1.34rem;
    }

    .video-stage {
        border-radius: 24px;
    }

    .video-controls-bar {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        margin-top: 14px;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "primary live fullscreen"
            "mute volume volume";
    }

    .video-stage::after {
        display: none;
    }

    .video-stage.is-playing:not(.show-controls) .video-controls-bar {
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
    }

    .video-control-primary {
        grid-area: primary;
    }

    .video-live-track {
        grid-area: live;
    }

    #video-mute-btn {
        grid-area: mute;
    }

    #video-volume-slider {
        grid-area: volume;
    }

    #video-fullscreen-btn {
        grid-area: fullscreen;
    }

    .video-meta {
        margin-top: 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .glass-toast {
        min-width: 0;
        width: calc(100% - 28px);
        padding: 14px;
    }
}
