:root {
    --accent: #ffffff;
    --bg-dark: #050505;
    --bg-card: #0e0e0e;
    --border: #1c1c1c;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    background-color: #050505;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-dark);
    color: var(--accent);
    font-family: ui-monospace, Consolas, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
    overflow-y: auto;
}

body.system-offline .scrollable-list,
body.system-offline #tunerBox,
body.system-offline button[onclick="toggleAddMenu()"],
body.system-offline button[onclick="openSettings()"],
body.system-offline #reorderBtn {
    pointer-events: none !important;
    opacity: 0.3 !important;
    filter: grayscale(100%) !important;
    user-select: none;
}

#mainPowerBtn {
    pointer-events: auto !important;
    opacity: 1 !important;
    filter: none !important;
}

#offlineOverlay {
    pointer-events: auto !important;
    z-index: 9999;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 190;
    display: none;
}

/* Fixes the constantly visible search bar */
.inline-search-bar {
    display: none !important;
    width: 100%;
    margin-bottom: 15px;
}
.inline-search-bar.show {
    display: flex !important;
}

/* Highlights the search button when the bar is open */
.search-btn-active {
    color: var(--accent) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #151515;
    border: 1px solid #333;
    border-radius: 24px;
    width: 85%;
    max-width: 450px;
    display: none;
    flex-direction: column;
    z-index: 200;
    padding: 2rem;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 1);
    max-height: 80vh;
    overflow-y: auto;
}

.card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 1100px;
    height: 95vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.app-layout {
    display: flex;
    flex-direction: row;
    gap: 40px;
    flex-grow: 1;
    overflow: hidden;
    height: 100%;
    transition: all 0.3s;
}

.col-controls {
    flex: 0 0 45%;
    max-width: 45%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    border-right: 1px solid var(--border);
    padding-right: 30px;
}

.col-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    min-width: 0;
}

.scrollable-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.scrollable-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.hybrid-panel {
    display: block;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

#panel-history.hybrid-panel {
    flex-shrink: 1;
    min-height: 0;
}

.ambient-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Sits behind content */
    overflow: hidden;
    opacity: 0; /* Hidden initially, JS will fade it in */
    transition: opacity 1s ease-in-out; /* Smooth 1-second fade */
    pointer-events: none; /* Ignore clicks */
}

.ambient-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.4); /* Scale up to avoid visible edges */
    width: 100%;
    height: 100%;
    object-fit: cover;
    
    /* THE MAGiC: Aggressive blur, boosted colors, slightly dimmed */
    filter: blur(50px) saturate(2.5) brightness(0.6); 
    
    /* Helps smooth out artifacts in some browsers */
    will-change: filter; 
}

/* Force all foreground content to sit ON TOP of the blur */
.shazam-box > :not(.ambient-backdrop) {
    position: relative;
    z-index: 2;
}

/* Ensure the absolute positioned block button is even higher */
.shazam-block-btn {
    z-index: 10 !important;
}

@media (min-width: 901px) {
    #panel-search {
        display: none;
        margin-bottom: 10px;
    }

    #panel-search.show-desktop {
        display: flex;
    }

    #panel-search .panel-header {
        display: none;
    }

    #tunerBoxMobile { display: none !important; }
}  


.panel-header {
    display: none;
}

.mobile-top-nav {
    display: none;
}

.desktop-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(10px, 2vw, 25px);
    flex-shrink: 0;
    padding: 10px 0;
    width: 100%;
}

.btn-nav,
.btn-minimal {
    background: #1a1a1a;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 14px;
    outline: none;
    flex-shrink: 0;
}

.btn-nav {
    width: 45px;
    height: 45px;
    padding: 11px;
}

.btn-minimal {
    width: 55px;
    height: 55px;
    padding: 15px;
}

.btn-nav svg,
.btn-minimal svg,
.hist-heart svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (hover: hover) {
    /* Stop the main button from scaling */
    .btn-nav:hover, .btn-minimal:hover {
        transform: none !important; 
    }
    /* Scale the SVG inside instead */
    .btn-nav:hover svg, .btn-minimal:hover svg, #reorderBtn:hover svg {
        transform: scale(1.15);
        transition: transform 0.2s ease;
    }
    /* Fix the weird black background on the heart */
    .spotify-heart-main:hover {
        color: var(--accent) !important;
        background: transparent !important;
    }
}

.btn-nav.active {
    background: var(--accent);
    color: #000;
}

button.primary-btn {
    background: var(--accent);
    color: #000;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 15px 25px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

button.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.power-btn-circle {
    width: 100px;
    height: 100px;
    border-radius: 28px;
    background: var(--accent);
    color: #000;
    padding: 25px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.power-btn-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 50px var(--accent);
}

.dial-area {
    flex-shrink: 0;
    text-align: center;
}

.freq {
    font-size: clamp(3.5rem, 10vw, 5rem);
    color: #fff;
    font-weight: bold;
    letter-spacing: -3px;
    line-height: 1;
}

.mhz {
    font-size: 1.2rem;
    color: #555;
    margin-left: 8px;
}

input[type=range]:not(.tuner-slider) {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type=range]:not(.tuner-slider)::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s;
}

input[type=range].tuner-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 45px;
    cursor: pointer;
    background: repeating-linear-gradient(to right, #333 0, #333 2px, transparent 2px, transparent 10%), #111;
    background-size: 10% 100%;
    border: 2px solid #222;
    border-radius: 6px;
    margin-top: 20px;
    outline: none;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.8);
    touch-action: none;
}

input[type=range].tuner-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 6px;
    height: 55px;
    background: #ff2a55;
    border-radius: 3px;
    cursor: ew-resize;
    box-shadow: 0 0 12px rgba(255, 42, 85, 0.8);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    color: #555;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0 5px;
}

/* --- Fixes #2: Neutral Edit Button --- */
.edit-btn {
    background: transparent;
    border: none;
    color: #666;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 5px;
    flex-shrink: 0;
    outline: none;
}
.edit-btn:hover {
    color: #fff; /* Neutral white/accent hover instead of red */
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* --- Fixes #1: Filter Badge Overlay --- */
.filter-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff2a55;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    transform: scale(0.8);
}
.filter-badge.show {
    opacity: 1;
    transform: scale(1);
}
/* Highlight the filter button when active */
.btn-minimal.filter-active {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.search\-filter-bar {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    width: 100%;
}

.search-filter-bar input {
    background: #151515;
    border: 1px solid #222;
    color: #fff;
    padding: 12px 15px;
    border-radius: 12px;
    font-family: inherit;
    outline: none;
    font-size: 0.9rem;
}

.search-filter-bar input {
    flex-grow: 1;
    transition: border-color 0.2s;
}

.search-filter-bar input:focus {
    border-color: var(--accent);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

.section-title {
    font-size: 1rem;
    color: #777575;
    text-transform: none; 
    letter-spacing: normal;
    font-weight: bold;
    margin-bottom: 10px; /* Increased padding for desktop */
    text-align: left;
}

.preset-item:has(.trash-btn) .list-eq {
    display: none !important;
}

.text-btn {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 0.2s;
    padding: 5px;
    outline: none;
}

.text-btn:hover {
    color: #fff;
}

.text-btn.active {
    color: var(--accent);
}

/* --- Fixes #10: Depth Shadows on Tuner Boxes --- */
#tunerBoxTitleDesktop, #tunerBoxSloganDesktop,
#tunerBoxTitleMobile, #tunerBoxSloganMobile,
#tunerBoxTitleHistory, #tunerBoxSloganHistory {
    text-shadow: 0px 4px 15px rgba(0, 0, 0, 0.8), 0px 2px 5px rgba(0, 0, 0, 0.5);
}

.shazam-box {
    background: #111;
    border: 1px solid #222;
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.song-info .title-wrapper {
    /* Gives the text-shadow room to breathe without hitting the hidden overflow walls */
    padding-top: 15px;
    padding-bottom: 20px;
    margin-top: -15px;
    margin-bottom: -15px;
}

.album-art {
    width: 220px;
    height: 220px;
    min-height: 220px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: none;
    object-fit: contain;
    background: #0a0a0a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.song-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.title-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-bottom: 4px; /* Restored to normal spacing */
    text-align: center;
}

.song-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
    display: inline-flex;
    white-space: nowrap;
    transition: color 0.2s;
    margin-bottom: 2px !important; /* Reduced from 8px */
}

@keyframes bounce {
    0% {
        height: 30%;
    }

    100% {
        height: 100%;
    }
}

@keyframes infiniteScroll {
    0%, 15% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.song-title.marquee,
.song-artist.marquee,
.preset-title.marquee,
.preset-slogan.marquee {
    display: inline-flex;
    white-space: nowrap;
    width: max-content;
    animation: infiniteScroll 10s linear infinite; 
    /* NEW: Forces GPU to render it smoothly */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0); 
}

.eq-bar {
    height: 4px;
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    transition: height 0.3s ease;
}

@keyframes eq1 {
    0% {
        height: 20%;
    }

    25% {
        height: 90%;
    }

    50% {
        height: 40%;
    }

    75% {
        height: 100%;
    }

    100% {
        height: 30%;
    }
}

@keyframes eq2 {
    0% {
        height: 80%;
    }

    25% {
        height: 30%;
    }

    50% {
        height: 100%;
    }

    75% {
        height: 20%;
    }

    100% {
        height: 70%;
    }
}

@keyframes eq3 {
    0% {
        height: 40%;
    }

    25% {
        height: 100%;
    }

    50% {
        height: 20%;
    }

    75% {
        height: 80%;
    }

    100% {
        height: 50%;
    }
}

body.is-playing-audio .eq-bar:nth-child(1) { animation: eq1 1.1s ease-in-out infinite alternate; }
body.is-playing-audio .eq-bar:nth-child(2) { animation: eq2 1.2s ease-in-out infinite alternate; }
body.is-playing-audio .eq-bar:nth-child(3) { animation: eq3 1.3s ease-in-out infinite alternate; }

/* Let the marquee animation apply to the Now Playing box too */

/* The new gray-to-red hover trash button */
.trash-btn {
    background: transparent;
    border: none;
    color: #666;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
    flex-shrink: 0;
    outline: none;
}

.trash-btn:hover {
    color: #ff2a55;
    background: rgba(255, 42, 85, 0.1);
    transform: scale(1.1);
}

.sort-btn {
    flex: 1;
    background: #222;
    border: 1px solid #333;
    color: #888;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
}
.sort-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* Force the Shazam Block button to be Red with a White icon on hover */
.btn-block-main:hover {
    background: #ff2a55 !important;
    color: #fff !important;
    opacity: 1 !important;
    transform: scale(1.1);
}

/* 2. Text Shadows for Depth */
.song-title, .song-artist, .progress-time-inline, #fallbackSpacer {
    text-shadow: 0px 4px 15px rgba(0, 0, 0, 0.8), 0px 2px 5px rgba(0, 0, 0, 0.5);
}

/* 3. Button Icon Drop Shadows */
.compact-player .btn-minimal svg, .spotify-heart-main svg {
    filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.6));
}

/* 4. Progress Bar Shadow */
.progress-bar-bg {
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.6);
}

.song-artist {
    font-size: 1.2rem;
    color: #d4d4d4; /* Much lighter gray */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    display: block;
}

#sTitleLink:hover .song-title {
    color: var(--accent);
}

.compact-player {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 25px;
    width: 100%;
    gap: 10px;
}

.player-left {
    justify-self: start;
}

.player-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.player-right {
    justify-self: end;
}

.spotify-heart-main {
    color: #fff;
    transition: all 0.2s;
    padding: 14px;
}

.spotify-heart-main:hover {
    color: #000;
    background: var(--accent);
}

.spotify-heart-main.liked {
    color: #1DB954;
}

.spotify-heart-main.liked:hover {
    color: #1ed760;
    background: #1a1a1a;
}

.btn-block-hover {
    opacity: 0;
    background: transparent;
    color: #666;
    transition: all 0.2s;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
}

.blacklist-item-row:hover .btn-block-hover {
    opacity: 1;
}

/* Turns red on hover to indicate blocking */
.btn-block-hover:hover {
    color: #ff2a55 !important;
    background: rgba(255, 42, 85, 0.1) !important;
    transform: translateY(-50%) scale(1.1);
}

.blacklist-item-row {
    position: relative;
    padding-right: 50px !important;
}

.btn-delete-hover {
    opacity: 0;
    background: transparent;
    color: #666;
    transition: all 0.2s;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
}

.blacklist-item-row:hover .btn-delete-hover {
    opacity: 1;
}

.btn-delete-hover:hover {
    color: #ff2a55 !important;
    background: rgba(255, 42, 85, 0.1) !important;
    transform: translateY(-50%) scale(1.1);
}

.progress-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.progress-time-inline {
    font-size: 0.8rem;
    color: #e0e0e0; /* Very light gray for readability */
    font-weight: bold;
    min-width: 35px;
    text-align: center;
}

/* Translucent Progress Bar Background */
.progress-bar-bg {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.15); /* Swapped solid gray for 15% opacity white */
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    background: var(--accent);
    width: 0%;
    height: 100%;
    transition: width 0.1s linear;
    position: absolute;
    top: 0;
    left: 0;
}

.preset-item,
.history-item {
    display: flex;
    align-items: center;
    background: #151515;
    padding: 12px;
    border: 1px solid #222;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, background-color 0.2s;
    flex-shrink: 0;
    position: relative;
}

.history-item {
    background: transparent;
    padding: 5px;
    border: none;
}

.preset-item {
    border: 2px solid transparent !important; /* Default invisible border */
    transition: background-color 0.2s, border-color 0.2s;
}

.preset-item:hover {
    border-color: #444;
}

.preset-item:hover:not(.is-playing) {
    background: rgba(255, 255, 255, 0.08) !important; /* Clean glowing hover */
    border-color: transparent !important;
}

.preset-item.is-playing {
    /* Uses the dynamic color, falls back to accent if missing */
    border-color: var(--dynamic-color, var(--accent)) !important;
    background: color-mix(in srgb, var(--dynamic-color, var(--accent)) 15%, transparent) !important;
}

.preset-item.placeholder {
    background: transparent !important;
    border: 2px dashed var(--accent) !important;
    opacity: 0.3;
}

.preset-logo,
.history-art {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: contain;
    margin-right: 15px;
    background: #0a0a0a;
    flex-shrink: 0;
}

.history-art {
    width: 35px;
    height: 35px;
    margin-right: 12px;
}

.preset-text,
.history-text {
    flex-grow: 1;
    overflow: hidden;
    min-width: 0;
}


.history-title {
    font-size: 1rem;
    font-weight: bold;
    color: #b1b1b1;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-title {
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-title {
    font-size: 0.9rem;
    color: #ccc;
    text-decoration: none;
    display: block;
}

.history-title:hover {
    color: var(--accent);
}

.history-artist {
    color: #716c6c; /* Matches the song artist text */
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-slogan {
    color: #d4d4d4; /* Matches the song artist text */
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.history-artist {
    display: block;
}

.history-controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-left: 10px;
}

.history-time {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0.6;
}

.hist-heart {
    background: transparent;
    border: none;
    color: #fff;
    width: 35px;
    height: 35px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.hist-heart:hover {
    transform: scale(1.2);
}

.hist-heart.liked {
    color: #1DB954;
}

.hist-heart.liked:hover {
    color: #1ed760;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-right: 10px;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.volume-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.volume-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 15px);
    background: #161616;
    border: 1px solid #333;
    padding: 15px 20px;
    border-radius: 16px;
    z-index: 50;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.volume-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.setting-group {
    margin-bottom: 25px;
    width: 100%;
    max-width: 400px;
}

.setting-group label {
    color: #888;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
}

input[type="color"] {
    border: none;
    width: 100%;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.btn-delete {
    background: #ff2a55;
    border: none;
    color: #fff;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s;
    margin-left: 10px;
}

.btn-delete:hover {
    opacity: 1;
    transform: scale(1.1);
}

.btn-add {
    background: var(--accent);
    border: none;
    color: #000;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-add:hover {
    transform: scale(1.05);
}

/* Block Button Styles */
.btn-block {
    background: transparent;
    border: none;
    color: #666;
    width: 35px;
    height: 35px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-block:hover {
    color: #ff2a55;
    transform: scale(1.1);
    background: rgba(255, 42, 85, 0.1);
}

.shazam-block-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

/* Floating Context Menu Styles */
.block-dropdown {
    position: fixed;
    background: #161616;
    border: 1px solid #333;
    border-radius: 12px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    overflow: hidden;
    min-width: 150px;
}

#tunerBoxDesktop .preset-text,
#tunerBoxHistory .preset-text,
#tunerBoxMobile .preset-text {
    text-align: left !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

#tunerBoxDesktop .title-wrapper,
#tunerBoxHistory .title-wrapper,
#tunerBoxMobile .title-wrapper {
    text-align: left !important;
    justify-content: flex-start !important;
}

.block-dropdown.show {
    display: flex;
    animation: slideDown 0.1s ease-out;
}

.block-dropdown button {
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px 20px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
    border-bottom: 1px solid #222;
}

.block-dropdown button:last-child {
    border-bottom: none;
}

.block-dropdown button:hover {
    background: #222;
    color: #ff2a55;
}


#addIheartDesktop {
    display: flex;
}

#addIheartMobile {
    display: none;
}

#favIconMobile {
    display: none;
}

/* Horizontal Flip for Album Art / Station Changes */
.flip-horizontal {
    animation: flipH 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}

@keyframes flipH {
    0% { transform: rotateY(0deg); opacity: 1; }
    50% { transform: rotateY(90deg); opacity: 0.5; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

/* Translucent Glass Buttons for Shazam Box (All Buttons) */
.shazam-box .btn-minimal {
    background: transparent !important;
    border: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

/* Edit Station & Filter Modal Styles */
.tag-pill {
    display: inline-flex;
    align-items: center;
    background: #222;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #fff;
    margin: 4px;
}
.tag-pill .remove-tag {
    margin-left: 8px;
    color: #ff2a55;
    cursor: pointer;
    font-weight: bold;
}
.tag-pill .remove-tag:hover {
    color: #ff5e7e;
}
.filter-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #222;
    cursor: pointer;
}
.filter-row:last-child {
    border-bottom: none;
}
.filter-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}
#inlineSearchBar {
    width: 100%;
    box-sizing: border-box;
}
#inlineStationSearch {
    width: 100%;
    box-sizing: border-box;
}
.inline-search-bar.show {
    display: block;
}

/* 2. Enlarge the SVGs inside those buttons for better touch targets */
.shazam-box .btn-minimal svg {
    width: 32px !important; 
    height: 32px !important;
    transition: transform 0.2s ease;
}

.preset-item.is-playing .list-eq { display: flex !important; }

.preset-item.is-playing .iheart-badge {
    display: none !important;
}

/* 3. Scale the icon on hover instead of creating a background */
.shazam-box .btn-minimal:hover svg {
    transform: scale(1.15);
}

/* Match Tuner Box slogan to the Shazam artist text */
#tunerBoxSlogan {
    color: #d4d4d4 !important;
}

#tunerBox > :not(.ambient-backdrop) {
    position: relative;
    z-index: 2;
}

@media (max-width: 900px) {
    #favIconMobile {
        display: block;
    }
}


@media (max-height: 500px) and (orientation: landscape) {
    html {
        font-size: 10px;
    }

    .card {
        height: 100vh;
        height: 100dvh;
        padding: 10px;
        padding-left: max(env(safe-area-inset-left), 20px);
        padding-right: max(env(safe-area-inset-right), 20px);
    }

    .app-layout {
        gap: 20px;
    }

    .col-controls {
        padding-right: 15px;
    }

    .btn-nav,
    .btn-minimal {
        width: 38px;
        height: 38px;
        padding: 8px;
    }

    .album-art {
        width: 140px;
        height: 140px;
        min-height: 140px;
    }

    .shazam-box {
        padding: 1rem;
    }

    .song-title {
        font-size: 1.2rem;
    }
}


/* --- NEW MOBILE UI & TAB SYSTEM --- */
.mobile-bottom-bar { display: none; }

@media (max-width: 900px) {
    /* 1. Web App Fullscreen Setup */
    html, body {
        overflow: hidden;
        width: 100vw;
        height: 100dvh; 
        padding: 0;
        margin: 0;
        background: var(--bg-card);
        touch-action: none;
    }

    #tunerBoxDesktop { display: none !important; }
    #tunerBoxMobile { display: flex !important; order: 3; }

    .card {
        height: 100dvh;
        width: 100vw;
        border-radius: 0;
        border: none;
        background: var(--bg-card) !important;
        box-shadow: none;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        padding: 0 !important; 
    }

    .app-layout {
        position: relative;
        flex: 1;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0 !important;
        overflow: hidden;
    }

    /* 2. Bottom Menu Bar */
    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0; 
        left: 0; 
        width: 100%;
        height: calc(65px + env(safe-area-inset-bottom)); 
        background: rgba(14, 14, 14, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-top: 1px solid #222;
        justify-content: space-around;
        align-items: center; 
        padding-bottom: env(safe-area-inset-bottom) !important;
        box-sizing: border-box;
        z-index: 1000;
    }

    .nav-tab {
        background: transparent; 
        border: none; 
        color: #666;
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        justify-content: center;
        gap: 5px; 
        font-size: 0.75rem; 
        cursor: pointer; 
        transition: color 0.2s; 
        flex: 1;
        height: 100%; 
    }
    .nav-tab svg { width: 24px; height: 24px; }
    .nav-tab.active { color: var(--accent); }

    /* 3. Absolute Tab Layout - Shared Base */
    .col-controls, .col-player, #settingsModal {
        position: absolute !important;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100% !important; max-width: 100% !important; height: 100% !important;
        background: var(--bg-card) !important;
        transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
        opacity: 0; pointer-events: none; transform: translateX(100%); 
        z-index: 10; 
        margin: 0 !important; 
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        box-sizing: border-box;
    }

    /* Active & Slide States */
    .col-controls.active-tab, .col-player.active-tab, #settingsModal.active-tab {
        opacity: 1; pointer-events: auto; transform: translateX(0);
    }
    .col-controls.slide-left, .col-player.slide-left, #settingsModal.slide-left {
        transform: translateX(-100%); 
    }

    /* 4. Tab 1: Favorites Layout */
    .col-controls { 
        display: flex; 
        flex-direction: column; 
        min-height: 0; 
        overflow: hidden; 
        /* Added 95px to clear the floating tuner box */
        padding: calc(max(env(safe-area-inset-top), 25px) + 10px) 15px calc(160px + env(safe-area-inset-bottom)) 15px !important;
    }
    .scrollable-section {
        background: transparent !important; 
        border: none !important;
        padding: 0 !important; 
        flex: 1; 
        display: flex; 
        flex-direction: column; 
        min-height: 0;
    }
    #mobileFavoritesHeader { display: none !important; }
    #panel-history { order: 4 !important; }

    /* 5. Tab 2: Now Playing Layout */
    .col-player {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important; 
        /* Drops all the way to the nav bar */
        padding: 0 0 calc(65px + env(safe-area-inset-bottom)) 0 !important;
        gap: 0 !important;
    }
    
    .shazam-box {
        flex-grow: 1; 
        background: transparent !important; 
        border-radius: 0 !important; border: none !important; box-shadow: none !important;
        margin: 0 !important; 
        /* Keeps padding at the bottom so content clears the Tuner Box */
        padding: calc(max(env(safe-area-inset-top), 25px) + 20px) 15px calc(110px) 15px !important;
        justify-content: center !important; 
        align-items: center;
        display: flex; flex-direction: column; flex-shrink: 1; min-height: 0;
    }
    
    .album-art {
        width: 100% !important; 
        max-width: 100% !important; /* Removed the restriction so it stretches! */
        height: auto !important; 
        aspect-ratio: 1 / 1 !important; 
        object-fit: contain !important; 
        background: #0a0a0a !important; 
        border-radius: 16px !important; 
        margin-top: 0 !important; 
        margin-bottom: 20px !important; 
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6) !important; 
        flex-shrink: 0 !important; 
    }

    .song-title {
        font-size: 1.6rem;
        font-weight: bold;
        color: #fff;
        display: inline-flex;
        white-space: nowrap;
        transition: color 0.2s;
        margin-bottom: 8px; /* Adds the padding below the song title */
    }
    
    #historyModal {
        top: 45% !important; /* Centers it slightly higher */
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-height: 60vh !important; /* Smaller overall box */
        border-radius: 24px !important;
    }

    /* 6. Tab 3: Settings Layout */
    #settingsModal {
        display: flex !important; 
        flex-direction: column;
        /* Kept the 85px bottom padding here because you said it looked great */
        padding: calc(max(env(safe-area-inset-top), 25px) + 10px) 15px calc(85px + env(safe-area-inset-bottom)) 15px !important;
    }
    #settingsModal .btn-nav { display: none; } 
    #settingsModal .top-bar h2 { text-align: center; width: 100%; }

    /* 7. Hide Desktop Elements & Minor Tweaks */
    #mainPowerBtn, .desktop-top-nav, .mobile-top-nav, .volume-wrapper, #addIheartDesktop { display: none !important; }
    .btn-delete-hover, .history-actions, .btn-block-hover { opacity: 1; }
    .title-wrapper { margin-bottom: 2px; }
    .compact-player { gap: 15px; margin-top: 15px; width: 100%; flex-shrink: 0; }
    .section-title { margin-top: 0; margin-bottom: 10px; text-align: center; }
    .scrollable-list { padding-bottom: 10px; }
    
    input[type=range].tuner-slider { height: 60px; margin-top: 10px; border-radius: 12px; }
    input[type=range].tuner-slider::-webkit-slider-thumb { width: 12px; height: 75px; border-radius: 6px; }
    
    .hybrid-panel {
        display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
        width: 90%; max-width: 400px; background: #151515; border: 1px solid #333;
        border-radius: 24px; padding: 1.5rem; z-index: 200; box-shadow: 0 20px 80px rgba(0, 0, 0, 1);
        flex-direction: column;
    }
    .hybrid-panel.show { display: flex; animation: slideDown 0.2s ease-out; }
    .panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-shrink: 0; }
    .panel-header h2 { color: #fff; font-size: 1.2rem; margin: 0; }
    #panel-history .scrollable-list { max-height: 40vh; }
    #addIheartMobile { display: flex; }
    #favIconMobile { display: block; }

    /* Force Left-Justification on Mobile Tuner Box */
    #tunerBoxMobile .preset-text {
        text-align: left !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* --- Fixes #2: Mobile Tuner Box Background --- */
    #tunerBoxMobile {
    background: rgba(0, 0, 0, 0.30) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: none !important; /* Forces ONLY the bottom border to disappear */
}

    #tunerBoxMobile .title-wrapper {
        text-align: left !important;
        justify-content: flex-start !important;
    }
    
    /* Disable sticky hovers on iOS */
    .btn-minimal:hover, .btn-nav:hover, .power-btn-circle:hover, .trash-btn:hover {
        transform: none !important;
        background: transparent !important; /* Forces the box to disappear */
    }
    
    /* Add quick tap expansion instead */
    .btn-minimal:active, .btn-nav:active, .power-btn-circle:active, .trash-btn:active {
        transform: scale(1.05) !important;
        background: transparent !important; /* Keeps it totally clean when pressed */
        transition: transform 0.1s ease !important;
    }
}
/* Remove mobile tap highlight boxes globally */
* {
    -webkit-tap-highlight-color: transparent !important;
}

button:focus, input:focus {
    outline: none !important;
}