/* CST Public Listener Player */
:root {
    --bg: #080a0e;
    --accent: #6366f1;
    --accent2: #8b5cf6;
    --green: #22c55e;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 20px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* Animated gradient background */
.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 30% 40%, rgba(99, 102, 241, 0.2) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 70% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
        var(--bg);
    animation: bgPulse 8s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgPulse {
    0% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

/* Screens */
.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
}

.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 200ms;
}

.back-btn:hover {
    color: var(--text);
}

.listener-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--green);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 1.4s ease-in-out infinite;
}

/* Channel Selection */
.channel-select-content {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
}

.channel-select-content h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.channel-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.channel-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: all 200ms;
    text-decoration: none;
    display: block;
    color: var(--text);
}

.channel-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.channel-item-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.channel-item-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.channel-item-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.channel-item-live {
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
    margin-top: 8px;
}

/* Player */
.player-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.player-card {
    width: 100%;
    max-width: 380px;
    border-radius: var(--radius);
    padding: 36px 32px;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    animation: fadeUp 0.4s ease;
}

.channel-art {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 24px;
}

.art-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    z-index: 1;
}

.audio-rings {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(99, 102, 241, 0.3);
    opacity: 0;
}

.r1 {
    inset: -20px;
    animation: ringExpand 2s ease-out infinite;
}

.r2 {
    inset: -20px;
    animation: ringExpand 2s ease-out 0.6s infinite;
}

.r3 {
    inset: -20px;
    animation: ringExpand 2s ease-out 1.2s infinite;
}

.audio-rings.playing .ring {
    animation-play-state: running;
}

.audio-rings:not(.playing) .ring {
    animation-play-state: paused;
    opacity: 0;
}

.channel-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.channel-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.player-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.live {
    background: var(--green);
    animation: pulse 1.4s ease-in-out infinite;
}

.status-dot.waiting {
    background: var(--text-muted);
}

.status-dot.error {
    background: #ef4444;
}

.play-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 200ms;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    margin: 0 auto 24px;
}

.play-btn:hover:not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5);
}

.play-btn.disabled {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
}

.play-btn.playing {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.4);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.vol-icon {
    font-size: 16px;
}

.vol-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.extra-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.extra-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    padding: 7px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 200ms;
}

.extra-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.extra-btn.muted {
    opacity: 0.5;
    cursor: default;
}

.extra-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--accent);
}

/* Error state */
.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.error-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.btn-back {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.state-msg {
    color: var(--text-muted);
    padding: 48px;
    text-align: center;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@keyframes ringExpand {
    0% {
        transform: scale(0.9);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.subtitle {
    color: var(--text-muted);
    font-size: 15px;
}

/* Responsive */
@media (max-width: 480px) {
    .player-card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .channel-name {
        font-size: 20px;
    }
}