:root {
    --bg-color: #0c0c0e;
    --text-color: #ffffff;
    --secondary-text: rgba(255, 255, 255, 0.4);
    --glass-bg: rgba(20, 20, 22, 0.7);
    /* Darker glass for better contrast with white text */
    --glass-border: rgba(255, 255, 255, 0.1);
    --ui-track: rgba(255, 255, 255, 0.1);
    --ui-thumb: #ffffff;
    --accent-color: #fa243c;
    --orb-1: #fa243c;
    --orb-2: #4a90e2;
    --orb-3: #f5a623;
}

[data-theme="cyberpunk"] {
    --accent-color: #f7f700;
    --orb-1: #f7f700;
    --orb-2: #00f7f7;
    --orb-3: #f700f7;
    --bg-color: #050505;
}

[data-theme="retro"] {
    --accent-color: #ff00ff;
    --orb-1: #ff00ff;
    --orb-2: #00ffff;
    --orb-3: #7000ff;
    --bg-color: #1a0b2e;
}

[data-theme="midnight"] {
    --accent-color: #3b82f6;
    --orb-1: #1e3a8a;
    --orb-2: #1e40af;
    --orb-3: #3b82f6;
    --bg-color: #020617;
}

/* GitHub Themes */
[data-theme="gh-dark"] {
    --bg-color: #0d1117;
    --accent-color: #58a6ff;
    --text-color: #e6edf3;
    --orb-1: #1f6feb;
    --orb-2: #238636;
    --orb-3: #8b949e;
}

[data-theme="gh-light"] {
    --bg-color: #ffffff;
    --accent-color: #0969da;
    --text-color: #1f2328;
    --secondary-text: rgba(0, 0, 0, 0.5);
    --orb-1: #54aeff;
    --orb-2: #2da44e;
    --orb-3: #afb8c1;
    --glass-bg: rgba(255, 255, 255, 0.8);
    /* Light glass for light theme */
    --glass-border: rgba(0, 0, 0, 0.1);
    --ui-track: rgba(0, 0, 0, 0.1);
    --ui-thumb: #1f2328;
}

[data-theme="gh-dark-dimmed"] {
    --bg-color: #22272e;
    --accent-color: #539bf5;
    --text-color: #adbac7;
    --orb-1: #316dca;
    --orb-2: #347d39;
    --orb-3: #768390;
}

[data-theme="gh-dark-default"] {
    --bg-color: #010409;
    --accent-color: #2f81f7;
    --text-color: #f0f6fc;
    --orb-1: #1f6feb;
    --orb-2: #238636;
    --orb-3: #30363d;
}

[data-theme="gh-light-default"] {
    --bg-color: #f6f8fa;
    --accent-color: #218bff;
    --text-color: #1f2328;
    --secondary-text: rgba(0, 0, 0, 0.5);
    --orb-1: #54aeff;
    --orb-2: #2da44e;
    --orb-3: #afb8c1;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --ui-track: rgba(0, 0, 0, 0.1);
    --ui-thumb: #1f2328;
}

[data-theme="gh-dark-cb"] {
    --bg-color: #0d1117;
    --accent-color: #1f6feb;
    --text-color: #e6edf3;
    --orb-1: #388bfd;
    --orb-2: #f69d50;
    --orb-3: #8b949e;
}

[data-theme="gh-light-cb"] {
    --bg-color: #ffffff;
    --accent-color: #0969da;
    --text-color: #1f2328;
    --secondary-text: rgba(0, 0, 0, 0.5);
    --orb-1: #218bff;
    --orb-2: #f69d50;
    --orb-3: #afb8c1;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --ui-track: rgba(0, 0, 0, 0.1);
    --ui-thumb: #1f2328;
}

/* Mono Themes */
[data-theme="mono-dark"] {
    --bg-color: #000000;
    --accent-color: #ffffff;
    --text-color: #ffffff;
    --secondary-text: rgba(255, 255, 255, 0.4);
    --orb-1: #333333;
    --orb-2: #666666;
    --orb-3: #999999;
}

[data-theme="mono-light"] {
    --bg-color: #ffffff;
    --accent-color: #000000;
    --text-color: #000000;
    --secondary-text: rgba(0, 0, 0, 0.5);
    --orb-1: #e0e0e0;
    --orb-2: #cccccc;
    --orb-3: #b3b3b3;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --ui-track: rgba(0, 0, 0, 0.1);
    --ui-thumb: #000000;
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: all 0.8s ease;
}

.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.glow-orb {
    position: absolute;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
    animation: move 20s infinite alternate linear;
    transition: background 1.5s ease;
}

.orb-1 {
    background: var(--orb-1);
    top: -10%;
    left: -10%;
}

.orb-2 {
    background: var(--orb-2);
    bottom: -10%;
    right: -10%;
}

.orb-3 {
    background: var(--orb-3);
    top: 40%;
    left: 40%;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(150px, 150px) scale(1.3);
    }
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px;
    border: 1px solid var(--glass-border);
    padding: 24px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    overflow: hidden;
}

#visualizer-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 1;
    opacity: 0.5;
    pointer-events: none;
}

.album-art-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 22px auto 18px;
    /* Added margin-top to avoid title overlap */
    z-index: 10;
}

.album-art-container {
    width: 100%;
    height: 100%;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.4);
    /* 40% background for even better visibility */
    backdrop-filter: blur(4px);
    /* Reduced blur to see through more clearly */
    -webkit-backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    z-index: 20;
}

.play-overlay:hover {
    background: rgba(0, 0, 0, 0.6);
    /* Slightly darker on hover but still very transparent */
    border-color: var(--accent-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.play-overlay i {
    opacity: 0.8;
    /* Icon also slightly transparent */
}

/* --- CORE ICON LOGIC --- */
/* By default, hide both, then show based on body class */
.main-play-icon,
.main-pause-icon {
    display: none;
    width: 30px;
    height: 30px;
    color: white;
    fill: white;
}

/* If PAUSED, show PLAY icon */
body.paused .main-play-icon {
    display: block;
}

/* If NOT PAUSED (Playing), show PAUSE icon */
body:not(.paused) .main-pause-icon {
    display: block;
}

/* Visibility: Hide overlay when playing, show on hover */
body:not(.paused) .play-overlay {
    opacity: 0;
    pointer-events: none;
}

.album-art-wrapper:hover .play-overlay {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ----------------------- */

.compact-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 3px;
    transition: color 0.3s;
}

body:not(.paused) .compact-title {
    color: var(--accent-color);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 400;
    opacity: 0.8;
}

.streaming-link {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 0;
    background: var(--ui-track);
    padding: 5px;
    border-radius: 24px;
    text-decoration: none;
    color: #fff;
    font-size: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    white-space: nowrap;
    width: 28px;
    /* Reduced for better layout */
    height: 28px;
    z-index: 20;
    position: relative;
    flex-shrink: 0;
}

.streaming-link:hover {
    background: #fa243c;
    width: 125px;
    /* Proportional expansion */
    padding: 5px 12px;
    font-size: 0.7rem;
    border-color: rgba(255, 255, 255, 0.2);
}

.streaming-link span {
    opacity: 0;
    margin-left: 0;
    transition: opacity 0.3s ease, margin 0.3s ease;
    font-weight: 600;
}

.streaming-link:hover span {
    opacity: 1;
    margin-left: 6px;
}

.am-icon {
    width: 16px;
    /* Scaled down with container */
    height: 16px;
    flex-shrink: 0;
}

/* Header: Logo & Info */
.top-header {
    position: absolute;
    top: 13px;
    left: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 35;
}

.station-logo {
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--secondary-text);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.station-logo:hover {
    color: var(--accent-color);
}

#info-btn {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

#info-btn:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.info-icon {
    width: 14px;
    height: 14px;
}

/* Modal System */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    max-width: 280px !important;
    padding: 30px !important;
    text-align: left !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8) !important;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.modal-main-icon {
    color: var(--accent-color);
    width: 24px;
    height: 24px;
}

.modal-header h2 {
    font-size: 1rem;
    letter-spacing: 2px;
}

.modal-body section {
    margin-bottom: 15px;
}

.modal-body h3 {
    font-size: 0.7rem;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.modal-body h3 i {
    width: 12px;
    height: 12px;
}

.modal-body p {
    font-size: 0.85rem;
    font-weight: 400;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
    font-size: 0.65rem;
    color: var(--secondary-text);
    text-align: center;
}

#theme-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    z-index: 30;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

#theme-btn:hover {
    color: white;
    transform: scale(0.9) rotate(30deg);
}

.volume-container {
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space between badge and slider */
    gap: 15px;
    position: relative;
    z-index: 10;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Slightly tighter */
    flex: 1;
    max-width: 45%;
    /* Further shrunk from 50% */
}

#viz-toggle {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 2px;
}

#viz-toggle:hover {
    color: var(--accent-color);
    transform: scale(1.15);
}

.viz-icon {
    width: 14px;
    height: 14px;
}

.volume-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 15;
    opacity: 0.6;
}

.volume-icon-wrapper:hover {
    opacity: 1;
    transform: scale(1.15);
}

.volume-icon {
    width: 17px;
    /* Matches previous size */
    height: 17px;
    pointer-events: none;
    /* Let the wrapper handle clicks */
}

input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

input[type=range]::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--ui-track);
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--ui-thumb);
    margin-top: -5px;
}

#click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}