:root {
    --bg-gradient: linear-gradient(135deg, #7b7fd8, #b57cf2);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --accent: #dfa6ff;
    --accent-glow: rgba(223, 166, 255, 0.5);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --danger: #cf6679;
    --success: #7dffb3;
    --card-radius: 10px;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
    cursor: default;
}

/* Hide Scrollbars */
::-webkit-scrollbar {
    display: none;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(-45deg, #7b7fd8, #b57cf2, #8b5cf6, #6930c3, #7b7fd8);
    background-size: 400% 400%;
    animation: gradientShift 12s ease-in-out infinite;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--text-main);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 100% 50%;
    }
    50% {
        background-position: 50% 100%;
    }
    75% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Background Blobs */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
    opacity: 0.6;
    animation: float 10s infinite alternate;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: #5e60ce;
    top: -50px;
    left: -50px;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: #ff6bf0;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 30px); }
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    padding: 10px; /* Slight padding from window edges if desired, or 0 */
}

.glass-card {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(24px);
    border-radius: var(--card-radius);
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    -webkit-app-region: drag; /* Draggable area */
}

.header-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.status-indicator {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-app-region: no-drag; /* Buttons clickable */
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
    -webkit-app-region: no-drag;
}

.close-btn:hover {
    background: rgba(207, 102, 121, 0.3) !important;
    color: var(--danger);
}

/* Artwork */
.artwork-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.artwork-container {
    width: 220px;
    height: 220px;
    border-radius: 24px;
    padding: 6px; /* spacing for ring */
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1), inset 1px 1px 2px rgba(255,255,255,0.3);
}

.artwork-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4ea8de, #6930c3);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.station-logo-text {
    font-size: 5rem;
    font-weight: 800;
    font-style: italic;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Track Info */
.track-info {
    text-align: center;
    margin-bottom: 20px;
}

.track-info h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.track-info p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Progress Bar (Visual) */
.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-bottom: 30px;
    position: relative;
}

.progress-fill {
    width: 100%; /* Live always full or pulsing */
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #fff);
    border-radius: 2px;
    opacity: 0.8;
    box-shadow: 0 0 10px var(--accent-glow);
}

.progress-handle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translate(50%, -50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

/* Controls */
.controls-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:active {
    transform: scale(0.9);
}

.control-btn.secondary {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.control-btn.primary {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2), inset 0 0 10px rgba(255,255,255,0.1);
    color: #fff;
}

.control-btn.primary svg {
    filter: drop-shadow(0 0 5px var(--accent-glow));
}

/* Playing state - pulsing glow ring */
.control-btn.primary.playing {
    animation: pulse-ring 2s ease-in-out infinite;
}

@keyframes pulse-ring {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(0,0,0,0.2), 
                    inset 0 0 10px rgba(255,255,255,0.1),
                    0 0 0 0 rgba(223, 166, 255, 0.7);
    }
    50% {
        box-shadow: 0 8px 20px rgba(0,0,0,0.2), 
                    inset 0 0 10px rgba(255,255,255,0.1),
                    0 0 0 8px rgba(223, 166, 255, 0);
    }
}

/* Icon container prevents layout jump */
.icon-container {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-container svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hidden {
    display: none !important;
}

/* Volume */
.volume-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding: 0 10px;
}

.slider-container {
    flex: 1;
}

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

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px; /* align with track */
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

#volume-value {
    font-size: 0.8rem;
    font-weight: 500;
    width: 30px;
    text-align: right;
}

.icon-btn.small {
    padding: 0;
    width: 24px;
    height: 24px;
}

/* Cast Overlay (Beautified as per layout2_plan.md) */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 10, 35, 0.45);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* Modal */
.modal {
    width: min(420px, calc(100vw - 48px));
    padding: 22px;
    border-radius: 22px;
    background: rgba(30, 30, 40, 0.82);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    color: #fff;
    animation: pop 0.22s ease;
    -webkit-app-region: no-drag;
}

@keyframes pop {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal h2 {
    margin: 0 0 14px;
    text-align: center;
    font-size: 20px;
}

/* Device list */
.device-list {
    list-style: none;
    padding: 10px 5px;
    margin: 0 0 18px;
    max-height: 360px;
    overflow-y: auto;
}

/* Device row */
.device {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    text-align: left;
}

.device:hover {
    background: rgba(255,255,255,0.10);
    transform: translateY(-1px);
}

.device .device-main {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.device .device-sub {
    margin-top: 3px;
    font-size: 12px;
    opacity: 0.7;
    color: var(--text-muted);
}

/* Selected device */
.device.selected {
    background: linear-gradient(135deg, #c77dff, #8b5cf6);
    box-shadow: 0 0 18px rgba(199,125,255,0.65);
    color: #111;
}

.device.selected .device-main,
.device.selected .device-sub {
    color: #111;
}

.device.selected .device-sub {
    opacity: 0.85;
}

/* Cancel button */
.btn.cancel {
    width: 100%;
    padding: 12px;
    border-radius: 999px;
    border: none;
    background: #d16b7d;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s;
    font-weight: 600;
}

.btn.cancel:hover {
    transform: scale(1.02);
    background: #e17c8d;
}
