:root {
    --primary-color: #5170FF;
    /* Blue R=81 G=112 B=255 */
    --secondary-color: #00d2ff;
    /* Cyan (Keeping as secondary/highlight) */
    --accent-color: #FF66C4;
    /* Pink R=255 G=102 B=196 */
    --bg-dark: #0a0a12;
    /* Deep dark background */
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --glass-input: rgba(0, 0, 0, 0.3);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-color);
    width: 100%;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Mobile viewport fix */
    overflow: hidden;
    /* Prevent scrolling */
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(98, 0, 234, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 210, 255, 0.15) 0%, transparent 40%);
}

.app-container {
    position: relative;
    width: 100%;
    height: 100vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    z-index: 1;
}

/* Background Animation */
.bg-circles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.c1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
    animation: move 15s infinite alternate ease-in-out;
}

.c2 {
    width: 350px;
    height: 350px;
    background: var(--accent-color);
    bottom: -50px;
    right: -100px;
    animation: moveReverse 18s infinite alternate ease-in-out;
}

.c3 {
    width: 300px;
    height: 300px;
    background: var(--secondary-color);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 10s infinite ease-in-out;
    opacity: 0.3;
}

@keyframes move {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(100px, 50px);
    }
}

@keyframes moveReverse {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-80px, -60px);
    }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
}

/* Header */
header {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 1rem;
}

.logo-header {
    height: 80px;
    /* Larger header logo */
    width: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    transition: transform 0.3s ease;
}

.logo-header:hover {
    transform: scale(1.05);
}

/* Audio Player Structure */
main {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    /* Stack vertically by default */
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    /* Take available space */
}

/* Player Card - Glassmorphism */
.player-card {
    width: 100%;
    max-width: 400px;
    /* Default Mobile Width */
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    border-radius: 40px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.4s ease;
}

.visualizer-container {
    position: relative;
    margin-bottom: 2rem;
    transition: margin 0.3s ease;
}

.album-art {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    /* Circle for modern radio look, matches logo shape often */
    background: transparent;
    overflow: hidden;
    position: relative;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.6);
    animation: spin 10s linear infinite;
    animation-play-state: paused;
}

.album-art.playing {
    animation-play-state: running;
    box-shadow:
        0 10px 40px rgba(98, 0, 234, 0.4),
        0 0 20px rgba(0, 210, 255, 0.3);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent;
    padding: 0;
    /* Zoom in slightly to ensure it touches the edges if the image has whitespace */
    transform: scale(1.15);
}

/* Wave Animation Overlay */
.wave-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 40%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 2;
}

.album-art.playing .wave-animation {
    opacity: 1;
}

.wave-animation span {
    width: 6px;
    height: 100%;
    background: var(--accent-color);
    border-radius: 10px;
    animation: shimmerSound 1s infinite ease-in-out;
    box-shadow: 0 0 10px var(--accent-color);
}

.wave-animation span:nth-child(1) {
    animation-delay: 0.1s;
    height: 40%;
}

.wave-animation span:nth-child(2) {
    animation-delay: 0.2s;
    height: 70%;
}

.wave-animation span:nth-child(3) {
    animation-delay: 0.3s;
    height: 100%;
}

.wave-animation span:nth-child(4) {
    animation-delay: 0.2s;
    height: 70%;
}

.wave-animation span:nth-child(5) {
    animation-delay: 0.1s;
    height: 40%;
}

@keyframes shimmerSound {

    0%,
    100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }

    50% {
        transform: scaleY(1.2);
        opacity: 1;
        filter: brightness(1.5);
    }
}

/* Info */
.track-info {
    width: 100%;
    margin-bottom: 2rem;
}

.track-info h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.track-info p {
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
}

/* Stream Selector */
.stream-select-container {
    margin-bottom: 1.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

select#streamSelect {
    background: var(--glass-input);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 20px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 10px auto;
    padding-right: 40px;
}

select#streamSelect:hover,
select#streamSelect:focus {
    background: var(--glass-highlight);
    border-color: var(--primary-color);
}

select#streamSelect option {
    background: var(--bg-dark);
    color: var(--text-color);
}

.play-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: white;
    /* Clean white play button */
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    /* For absolute centering of SVGs if needed */
}

.play-btn:hover {
    transform: scale(1.05);
    /* Subtle scale */
    box-shadow: 0 15px 40px rgba(255, 255, 255, 0.5);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn svg {
    width: 42px;
    height: 42px;
    fill: var(--primary-color);
    margin: 0;
    display: block;
}

/* Play icon often needs a small nudge to the right to appear optically centered */
.play-btn .icon-play {
    margin-left: 5px;
}

.play-btn .icon-pause {
    display: none;
    margin: 0;
}

.play-btn.playing .icon-play {
    display: none;
}

.play-btn.playing .icon-pause {
    display: block;
}

/* Live Tag */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.dot {
    width: 8px;
    height: 8px;
    background: #ff0055;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff0055;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

/* Bottom Icons Container */
.bottom-icons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    width: 100%;
}

/* Icon Buttons (History & Site) */
.icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.icon-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.icon-btn:hover {
    background: var(--glass-highlight);
    transform: scale(1.1);
    border-color: var(--primary-color);
}

/* Modal Popup */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    /* Black w/ opacity */
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1a1a2e;
    border: 1px solid var(--glass-border);
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.close-modal {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #ddd;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Reuse history item styles but tweak text color */
.history-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-item:last-child {
    border-bottom: none;
}

.history-title {
    color: #fff;
    display: block;
    /* Stack title/artist cleanly */
    font-size: 1rem;
}

.history-artist {
    color: #ccc;
    font-size: 0.85rem;
}


footer {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 2rem;
}

/* =========================================
   MEDIA QUERIES - RESPONSIVE DESIGN
   ========================================= */

/* Tablets & Desktop (Landscape-ish or Layout Shift) */
/* REPLACED by new block at bottom, removing old block to avoid conflict */


/* PC / Large Screens */
@media (min-width: 1024px) {
    .player-card {
        max-width: 900px;
        padding: 4rem;
        -webkit-backdrop-filter: blur(40px);
        backdrop-filter: blur(40px);
    }

    .album-art {
        width: 320px;
        height: 320px;
    }

    .play-btn {
        width: 100px;
        height: 100px;
    }

    .play-btn svg {
        width: 40px;
        height: 40px;
    }
}

/* History and Site Btn - OLD STYLES REMOVED via replacement */
/* Ensure new bottom icons are handled */
@media (min-width: 1024px) {
    /* No special fixed positioning needed as they are now inside the user card */
    /* Adjust if you want them somewhere specific, but inside card is good for layout */
}


/* =========================================
   MEDIA QUERIES - RESPONSIVE DESIGN
   ========================================= */

/* Tablets & Desktop (Landscape-ish or Layout Shift) */
@media (min-width: 768px) {

    /* For standard tablets in portrait, keep column but make it wider/nicer */
    .app-container {
        padding: 3rem;
    }

    .player-card {
        max-width: 500px;
        padding: 3rem;
    }

    .history-section {
        max-width: 500px;
    }
}

/* Landscape Tablets & Desktops */
@media (min-width: 1024px) {
    main {
        flex-direction: row;
        gap: 2rem;
        align-items: flex-start;
        justify-content: center;
    }

    .player-card {
        max-width: 500px;
        /* Keep it compact even on desktop, or make it horizontal */
        flex-direction: column;
        /* Keep vertical layout for consistency, or strictly horizontal if preferred */
        /* Let's try a horizontal layout for the player card on large screens */
        max-width: 800px;
        flex-direction: row;
        gap: 3rem;
        align-items: center;
    }

    .visualizer-container {
        margin-bottom: 0;
    }

    .history-section {
        max-width: 300px;
        /* Side bar history */
        margin-top: 0;
        height: 100%;
        align-self: stretch;
    }

    .site-btn {
        position: fixed;
        bottom: 2rem;
        right: 2rem;
        margin: 0;
    }
}

/* Specific Tweak for "Tab 2016" (Often 800x1280 or similar) */
/* Ensure it fits vertically if height is constrained */
@media (max-height: 800px) and (min-width: 600px) {
    .app-container {
        padding: 1rem;
    }

    .player-card {
        padding: 1.5rem;
    }

    .album-art {
        width: 200px;
        height: 200px;
    }
}

/* Small Phones (A55 is usually fine, but ensure safe areas) */
@media (max-width: 380px) {
    .player-card {
        padding: 1.5rem;
        width: 100%;
    }

    .album-art {
        width: 160px;
        height: 160px;
    }

    .track-info h2 {
        font-size: 1.3rem;
    }

    .history-section {
        padding: 1rem;
    }
}