: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;
}

.status-indicator-wrap {
    display:flex;
    align-items:center;
    gap:10px;
    justify-content:center;
    margin-top:8px;
    color:var(--text-main);
}

body {
    margin: 0;
    padding: 0;
    min-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-x: hidden;
    overflow-y: auto;
    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%;
    min-height: 100vh;
    position: relative;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    min-height: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(24px);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    padding: 11px 24px 24px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.35);
}

/* web: no drag region needed */

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    -webkit-app-region: drag; /* Draggable area */
    padding: 1px 14px 8px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(60,84,255,0.14), rgba(123,127,216,0.10));
    border: 1px solid rgba(120,130,255,0.12);
    box-shadow: 0 10px 30px rgba(28,25,60,0.35), inset 0 1px 0 rgba(255,255,255,0.03);
    backdrop-filter: blur(8px) saturate(120%);
    position: relative;
    z-index: 3;
}

.header-top {
    display:flex;
    justify-content:space-between;
    align-items:center;
    width:100%;
}


.header-top-row {
    display:flex;
    justify-content:space-between;
    align-items:center;
    width:100%;
}


.header-icons-left { flex: 0 0 auto; display:flex; align-items:center; gap:8px; padding-left:8px; }

.header-center-status { flex:1; display:flex; justify-content:center; align-items:center; }

.header-close { flex:0 0 auto; }

.header-second-row {
    display:flex;
    justify-content:center;
    align-items:center;
    width:100%;
    margin-top:6px;
}

.status-indicator-wrap { display:flex; gap:8px; align-items:center; color:var(--text-main); }

.header-third-row { display:none; }
.header-left {
    justify-content: flex-start;
    flex: 0 0 auto;
}

.header-right {
    justify-content: flex-end;
    flex: 0 0 auto;
}

.app-title { text-align: center; }

.header-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.app-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
    letter-spacing: 0.4px;
}

.status-indicator {
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    opacity: 0.9;
}

.engine-badge svg {
    width: 12px;
    height: 12px;
    display: block;
}

.engine-ffmpeg { border-color: rgba(125,255,179,0.30); box-shadow: 0 0 10px rgba(125,255,179,0.12); }
.engine-cast { border-color: rgba(223,166,255,0.35); box-shadow: 0 0 10px rgba(223,166,255,0.12); }
.engine-html { border-color: rgba(255,255,255,0.22); }

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.icon-btn {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.03);
    color: var(--text-main);
    padding: 8px;
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    -webkit-app-region: no-drag; /* Buttons clickable */
}

.icon-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}

.header-buttons {
    display: flex;
    gap: 8px;
    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-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.artwork-container {
    width: 190px;
    height: 190px;
    border-radius: 24px;
    padding: 6px; /* spacing for ring */
    background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.00));
    box-shadow: 0 12px 40px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(8px) saturate(120%);
    position: relative;
}

.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 30px rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.04);
}

/* glossy inner rim for artwork */
.artwork-container::after {
    content: '';
    position: absolute;
    inset: 6px; /* follows padding to create rim */
    border-radius: 20px;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), inset 0 -20px 40px rgba(255,255,255,0.02);
    mix-blend-mode: overlay;
}

/* Make artwork clickable and give subtle hover feedback */
.artwork-placeholder {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.artwork-placeholder:hover {
    box-shadow: 0 18px 40px rgba(255, 255, 0, 0.45), inset 0 0 28px rgba(255,255,255,0.02);
}

.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);
    position: relative;
    z-index: 3;
}

/* When we don't have an icon, show the station name nicely */
.station-logo-text.logo-name {
    font-size: clamp(1.1rem, 5.5vw, 2.2rem);
    font-weight: 800;
    font-style: normal;
    max-width: 88%;
    text-align: center;
    line-height: 1.12;
    padding: 0 12px;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Artwork coverflow (station carousel inside artwork) */
.artwork-coverflow {
    position: relative;
    width: min(320px, 92vw);
    height: 108px;
    -webkit-app-region: no-drag;
}

.artwork-coverflow-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
    perspective: 900px;
    transform-style: preserve-3d;
    -webkit-app-region: no-drag;
}

.coverflow-item {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 66px;
    height: 66px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 10px 26px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform-style: preserve-3d;
    z-index: 1;
    -webkit-app-region: no-drag;
}

.coverflow-item.selected {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.18);
}

.coverflow-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.coverflow-item.fallback {
    color: rgba(255,255,255,0.92);
    text-shadow: 0 2px 10px rgba(0,0,0,0.35);
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.2px;
    text-align: center;
    padding: 10px;
    line-height: 1.08;
}

.coverflow-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30, 30, 40, 0.35);
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    -webkit-app-region: no-drag;
}

.coverflow-arrow.left { left: 10px; }
.coverflow-arrow.right { right: 10px; }

.station-logo-img {
    /* Fill the artwork placeholder while keeping aspect ratio and inner padding */
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 12px; /* inner spacing from rounded edges */
    box-sizing: border-box;
    border-radius: 12px;
    /*box-shadow: 0 8px 20px rgba(0,0,0,0.35);*/
    position: relative;
    z-index: 3;
    margin-left:1rem;
}

/* Logo blobs container sits behind logo but inside artwork placeholder */
.logo-blobs {
    position: absolute;
    inset: 0;
    filter: url(#goo);
    z-index: 1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    /* more transparent overall */
    opacity: 0.18;
    /* slightly smaller blur for subtle definition */
    filter: blur(6px);
}

.b1 { width: 110px; height: 110px; left: 8%; top: 20%; background: radial-gradient(circle at 30% 30%, #c77dff, #8b5cf6); animation: float1 6s ease-in-out infinite; }
.b2 { width: 85px; height: 85px; right: 6%; top: 10%; background: radial-gradient(circle at 30% 30%, #7bffd1, #7dffb3); animation: float2 5.5s ease-in-out infinite; }
.b3 { width: 95px; height: 95px; left: 20%; bottom: 12%; background: radial-gradient(circle at 20% 20%, #ffd07a, #ff6bf0); animation: float3 7s ease-in-out infinite; }
.b4 { width: 70px; height: 70px; right: 24%; bottom: 18%; background: radial-gradient(circle at 30% 30%, #6bd3ff, #4ea8de); animation: float4 6.5s ease-in-out infinite; }
.b5 { width: 50px; height: 50px; left: 46%; top: 36%; background: radial-gradient(circle at 40% 40%, #ffa6d6, #c77dff); animation: float5 8s ease-in-out infinite; }

/* Additional blobs */
.b6 { width: 75px; height: 75px; left: 12%; top: 48%; background: radial-gradient(circle at 30% 30%, #bde7ff, #6bd3ff); animation: float6 6.8s ease-in-out infinite; }
.b7 { width: 42px; height: 42px; right: 10%; top: 42%; background: radial-gradient(circle at 40% 40%, #ffd9b3, #ffd07a); animation: float7 7.2s ease-in-out infinite; }
.b8 { width: 70px; height: 70px; left: 34%; bottom: 8%; background: radial-gradient(circle at 30% 30%, #e3b6ff, #c77dff); animation: float8 6.4s ease-in-out infinite; }
.b9 { width: 36px; height: 36px; right: 34%; bottom: 6%; background: radial-gradient(circle at 30% 30%, #9ef7d3, #7bffd1); animation: float9 8.4s ease-in-out infinite; }
.b10 { width: 30px; height: 30px; left: 52%; bottom: 28%; background: radial-gradient(circle at 30% 30%, #ffd0f0, #ffa6d6); animation: float10 5.8s ease-in-out infinite; }

@keyframes float1 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(12px) translateX(8px) scale(1.06); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float2 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-10px) translateX(-6px) scale(1.04); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float3 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(8px) translateX(-10px) scale(1.05); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float4 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-6px) translateX(10px) scale(1.03); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float5 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-12px) translateX(4px) scale(1.07); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float6 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-8px) translateX(6px) scale(1.05); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float7 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(10px) translateX(-6px) scale(1.04); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float8 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-6px) translateX(10px) scale(1.03); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float9 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(12px) translateX(-4px) scale(1.06); } 100% { transform: translateY(0) translateX(0) scale(1); } }
@keyframes float10 { 0% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-10px) translateX(2px) scale(1.04); } 100% { transform: translateY(0) translateX(0) scale(1); } }

/* Slightly darken backdrop gradient so blobs read better */
.artwork-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.12));
    z-index: 0;
}

/* Make artwork/logo clickable: show pointer cursor */
.artwork-placeholder,
.artwork-placeholder:hover,
.station-logo-img,
.station-logo-text {
    cursor: pointer;
}

/* Track Info */
.track-info {
    text-align: center;
    margin-bottom: 20px;
    /* Reserve fixed space for station name, artist and title to avoid layout jumps */
    min-height: 5.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.track-info h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Now playing container: artist and title on separate lines */
#now-playing {
    margin: 6px 0 0;
    width: 100%;
    /* Reserve two lines so content changes don't shift layout */
    height: 2.6rem;
    display: block;
}

#now-playing .now-artist,
#now-playing .now-title {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide visually but keep layout space */
#now-playing.hidden {
    visibility: hidden;
}

.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-top: 12px;
    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;
}

/* web: no drag region needed */

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;
}

/* Stations grid to show cards (used for stations overlay) */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    padding: 8px;
}

.station-card {
    list-style: none;
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 12px;
    align-items: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
}

.station-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

.station-card.selected {
    background: linear-gradient(135deg, #c77dff, #8b5cf6);
    color: #111;
    box-shadow: 0 10px 30px rgba(199,125,255,0.22);
}

.station-card-left {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.station-card-logo {
    width: 56px;
    height: 56px;
    object-fit:contain;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    background: rgba(255,255,255,0.02);
}

.station-card-fallback {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:800;
    font-size:1.2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    color: var(--text-main);
}

.station-card-body {
    display:flex;
    flex-direction:column;
    gap:3px;
    overflow:hidden;
}

.station-card-title {
    font-weight:700;
    font-size:0.95rem;
    line-height:1.1;
}

.station-card-sub {
    font-size:0.8rem;
    color: rgba(255,255,255,0.7);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* 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;
}

/* Editor specific tweaks */
.modal form input {
    outline: none;
}

/* Ensure editor overlay input fields look consistent */
#editor-list .device {
    display: block;
}

.btn.edit-btn, .btn.delete-btn {
    padding: 8px 10px;
    border-radius: 10px;
    border: none;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

#add-station-form button.btn {
    border-radius: 10px;
}

/* Make modal form inputs visible on dark translucent background */
.modal input,
.modal textarea,
.modal select {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.modal input::placeholder,
.modal textarea::placeholder {
    color: rgba(255,255,255,0.55);
}

.btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

/* ── Cast output toggle pill ────────────────────────────────────────────────── */
.cast-output-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cast-output-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.cast-output-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    letter-spacing: 0.3px;
}

.cast-output-toggle:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.22);
}

.cast-output-toggle[aria-pressed="true"] {
    background: linear-gradient(135deg, rgba(125,255,179,0.18), rgba(125,255,179,0.08));
    border-color: rgba(125,255,179,0.35);
    box-shadow: 0 0 12px rgba(125,255,179,0.10);
    color: var(--success);
}

.cast-output-toggle svg {
    flex-shrink: 0;
}

/* ── Google Cast launcher button ───────────────────────────────────────────── */
/* The <google-cast-launcher> custom element is hidden until Cast devices are  */
/* available on the LAN; the SDK toggles visibility automatically.             */
google-cast-launcher {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    /* Match icon-btn look */
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 10px;
    padding: 8px;
    box-sizing: content-box;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    --connected-color: var(--success);
    --disconnected-color: var(--text-main);
    --icon-size: 20px;
}

google-cast-launcher:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}
