/**
 * SoundMap Styles
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a0f;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Header */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    color: rgb(211, 115, 255);
    text-decoration: none;
    font-weight: bold;
    font-size: 18px;
    font-family: "Audiowide", serif;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(211, 115, 255, 0.4);
}

.logo:hover {
    color: rgb(230, 150, 255);
    text-shadow: 0 0 15px rgba(211, 115, 255, 0.6);
}

#header h1 {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    order: 0; /* Before info-btn */
}

.info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    order: 1; /* After h1 on desktop */
}

.info-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

.info-btn svg {
    display: block;
}

.scope-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px;
}

.scope-toggle button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.scope-toggle button:hover {
    color: #fff;
}

.scope-toggle button.active {
    background: #00d4aa;
    color: #000;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 1;
}

#search-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 16px 8px 34px;
    color: #fff;
    font-size: 14px;
    width: 200px;
    transition: all 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: #00d4aa;
    width: 280px;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#search-results {
    position: absolute;
    top: 100%;
    right: 0;  /* Align to right edge of input */
    min-width: 280px;
    width: max-content;
    max-width: 350px;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Dark theme scrollbar for search results */
#search-results::-webkit-scrollbar {
    width: 6px;
}

#search-results::-webkit-scrollbar-track {
    background: transparent;
}

#search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

#search-results.visible {
    display: block;
}

.search-result-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:hover {
    background: rgba(0, 212, 170, 0.2);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Subgenre search result with multi-location navigation */
.search-result-subgenre {
    background: rgba(255, 255, 255, 0.03);
    font-style: normal;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
}

.search-result-subgenre::before {
    content: none;
}

.subgenre-result-main {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.subgenre-result-main::before {
    content: "#";
    opacity: 0.5;
    flex-shrink: 0;
}

.subgenre-result-main:hover {
    opacity: 0.8;
}

.subgenre-name {
    font-weight: 500;
}

.subgenre-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-left: auto;
}

/* Navigation row for multi-location genres */
.subgenre-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 4px;
}

.subgenre-nav-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.subgenre-nav-btn:hover,
.subgenre-nav-btn:active {
    background: rgba(0, 212, 170, 0.5);
}

.subgenre-nav-counter {
    color: rgba(255, 255, 255, 0.8);
    min-width: 50px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}

/* Larger tap targets on touch devices */
@media (hover: none) and (pointer: coarse) {
    .subgenre-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .subgenre-nav {
        padding: 10px 16px;
        gap: 16px;
    }

    .subgenre-nav-counter {
        font-size: 16px;
        min-width: 60px;
    }
}

/* Search Section Headers */
.search-section-header {
    padding: 8px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Subtle separator between search result sections */
.search-section-separator {
    border-top: 1px dotted rgba(255, 255, 255, 0.2);
    margin: 0 16px;
}

/* Local artist results (on map) */
.search-result-local {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.local-artist-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.local-artist-info .artist-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-artist-info .artist-genre {
    font-size: 11px;
    opacity: 0.7;
}

/* Spotify artist results */
.search-result-spotify {
    padding: 10px 16px;
}

.spotify-artist-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.artist-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
}

.artist-thumbnail-placeholder {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.spotify-artist-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.spotify-artist-info .artist-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotify-artist-info .artist-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status badges */
.status-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

.status-on-map {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.status-in-system {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.status-add {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* No results state */
.search-no-results {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 20px 16px;
}

/* Toast notifications */
.soundmap-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.soundmap-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.soundmap-toast-info {
    border-left: 3px solid #60a5fa;
}

.soundmap-toast-success {
    border-left: 3px solid #4ade80;
}

.soundmap-toast-error {
    border-left: 3px solid #f87171;
}

/* Canvas Container */
#canvas-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 70px;
}

#canvas-container canvas {
    display: block;
}

/* Tooltip */
#tooltip {
    position: fixed;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    pointer-events: auto;
    z-index: 200;
    max-width: 280px;
    transition: opacity 0.15s;
}

#tooltip.hidden {
    opacity: 0;
    visibility: hidden;
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tooltip-actions-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tooltip-library-btn {
    width: 28px;
    height: 28px;
    background: rgba(211, 115, 255, 0.3);
    color: rgb(211, 115, 255);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    text-decoration: none;
}

.tooltip-library-btn:hover {
    background: rgb(211, 115, 255);
    color: #000;
}

.tooltip-play-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0, 212, 170, 0.3);
    color: #00d4aa;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tooltip-play-btn:hover {
    background: #00d4aa;
    color: #000;
}

.tooltip-icon-pause {
    font-size: 9px;
    transform: scaleX(0.6);
    letter-spacing: 1px;
}

.tooltip-icon-play.hidden,
.tooltip-icon-pause.hidden {
    display: none;
}

.tooltip-close {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tooltip-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tooltip-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.tooltip-genre {
    font-size: 12px;
    color: #00d4aa;
    margin-bottom: 4px;
}

.tooltip-tags {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.tooltip-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tooltip-similar-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 8px;
    height: 24px;
    background: rgba(0, 212, 170, 0.3);
    border: none;
    border-radius: 12px;
    color: #00d4aa;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.tooltip-similar-btn svg {
    width: 12px;
    height: 12px;
}

.tooltip-similar-btn:hover {
    background: rgba(0, 212, 170, 0.4);
}

.tooltip-similar-list {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-similar-list.hidden {
    display: none;
}

.tooltip-similar-heading {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.tooltip-similar-loading {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    text-align: center;
    padding: 8px 0;
}

.tooltip-similar-items-wrapper {
    position: relative;
    max-height: 200px;
    overflow: hidden;
}

.tooltip-similar-items {
    max-height: 200px;
    overflow-y: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Dark theme scrollbar for similar artists list */
.tooltip-similar-items::-webkit-scrollbar {
    width: 6px;
}

.tooltip-similar-items::-webkit-scrollbar-track {
    background: transparent;
}

.tooltip-similar-items::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.tooltip-similar-items::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tooltip-similar-items-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(20, 20, 30, 0.98));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s;
    z-index: 1;
}

.tooltip-similar-items-wrapper.scrolled-bottom::after {
    opacity: 0;
}

.similar-artist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s;
}

.similar-artist-item:last-child {
    border-bottom: none;
}

.similar-artist-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.similar-artist-play {
    width: 24px;
    height: 24px;
    background: rgba(0, 212, 170, 0.3);
    border: none;
    border-radius: 50%;
    color: #00d4aa;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.similar-artist-play:hover {
    background: #00d4aa;
    color: #000;
}

.similar-artist-play.playing {
    background: #00d4aa;
    color: #000;
}

.similar-artist-play .icon-play,
.similar-artist-play .icon-pause {
    display: none;
}

.similar-artist-play .icon-play:not(.hidden) {
    display: inline;
}

.similar-artist-play .icon-pause:not(.hidden) {
    display: inline;
    font-size: 8px;
    transform: scaleX(0.6);
    letter-spacing: 1px;
}

.similar-artist-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.similar-artist-library {
    width: 24px;
    height: 24px;
    background: rgba(211, 115, 255, 0.3);
    border-radius: 50%;
    color: rgb(211, 115, 255);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.15s;
}

.similar-artist-library:hover {
    background: rgb(211, 115, 255);
    color: #000;
}

.similar-artist-info {
    flex: 1;
    min-width: 0;
}

.similar-artist-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.similar-artist-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.similar-artist-genre {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    flex-shrink: 0;
}

.similar-artist-song {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.similar-artist-show {
    font-size: 10px;
    color: #FFB300;
}

/* Share Link */
.tooltip-share-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 8px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.tooltip-share-btn svg {
    width: 12px;
    height: 12px;
}

.tooltip-share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tooltip-share-btn.hidden {
    display: none;
}

.tooltip-share-result {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.tooltip-share-result.hidden {
    display: none;
}

.tooltip-share-url {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-family: monospace;
    min-width: 0;
}

.tooltip-share-url:focus {
    outline: none;
    border-color: #00d4aa;
}

.tooltip-share-copied {
    color: #00d4aa;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

/* Player Bar */
#player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s;
}

#player-bar.hidden {
    transform: translateY(100%);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 250px;
}

#player-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

.player-text {
    overflow: hidden;
}

#player-artist {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-song {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-song:empty {
    display: none;
}

#player-show {
    font-size: 11px;
    color: #FFB300;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-show:empty {
    display: none;
}

#player-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: center;
}

#player-play-pause {
    background: #00d4aa;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 14px;
}

#player-play-pause:hover {
    transform: scale(1.05);
}

.player-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

#player-progress-bar {
    height: 100%;
    background: #00d4aa;
    width: 0%;
    transition: width 0.1s linear;
}

#player-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    min-width: 70px;
}

.icon-pause {
    font-size: 10px;
    transform: scaleX(0.6);
    letter-spacing: 1px;
}

#player-play-pause .icon-play.hidden,
#player-play-pause .icon-pause.hidden {
    display: none;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0a0a0f;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00d4aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Genre Labels (rendered in canvas, but style reference) */
.genre-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Zoom Controls */
#zoom-controls {
    position: fixed;
    bottom: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 50;
    /* Invisible hit area to prevent tooltips from triggering nearby */
    padding: 20px;
    margin: -20px;
    /* Capture all pointer events in this area */
    pointer-events: auto;
}

#zoom-slider-container {
    width: 40px;
    height: 120px;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

#zoom-slider-track {
    width: 6px;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

#zoom-slider-handle {
    width: 18px;
    height: 18px;
    background: #00d4aa;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#zoom-slider-handle:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 2px 10px rgba(0, 212, 170, 0.5);
}

#zoom-slider-handle:active {
    cursor: grabbing;
}

#zoom-controls button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(20, 20, 30, 0.9);
    color: #fff;
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#zoom-controls button:hover {
    background: rgba(0, 212, 170, 0.3);
    border-color: #00d4aa;
}

#zoom-controls button:active {
    transform: scale(0.95);
}

/* Stagemuse branding text */
.stagemuse-text {
    font-family: "Audiowide", serif;
    color: rgb(211, 115, 255);
    letter-spacing: 1px;
}

/* CTA Bar */
#cta-bar {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(90deg, rgba(211, 115, 255, 0.15) 0%, rgba(0, 212, 170, 0.15) 100%);
    border-bottom: 1px solid rgba(211, 115, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 99;
    padding: 0 20px;
}

#cta-bar.hidden {
    display: none;
}

.cta-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.cta-text .mobile-break {
    display: none;
}

.cta-button {
    background: rgb(211, 115, 255);
    color: #000;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.cta-button:hover {
    background: rgb(230, 150, 255);
    transform: scale(1.02);
}

.cta-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.cta-close:hover {
    color: #fff;
}

/* Welcome Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: #fff;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.modal-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

.modal-description {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 16px;
}

.modal-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.modal-features li {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 0 6px 24px;
    position: relative;
}

.modal-features li::before {
    content: "•";
    color: #00d4aa;
    position: absolute;
    left: 8px;
}

.modal-instructions {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    font-style: italic;
}

.modal-stagemuse {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.modal-stats {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    line-height: 1.6;
}

.modal-stat-sep {
    margin: 0 6px;
    opacity: 0.5;
}

.btn-primary {
    background: #00d4aa;
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #00e9bc;
    transform: scale(1.02);
}

.btn-secondary {
    background: transparent;
    color: rgb(211, 115, 255);
    border: 1px solid rgba(211, 115, 255, 0.4);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(211, 115, 255, 0.1);
    border-color: rgb(211, 115, 255);
}

/* Add Artist Confirmation Modal */
.add-artist-modal-content {
    max-width: 420px;
    text-align: center;
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.modal-artist-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.modal-artist-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

.modal-artist-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.modal-info-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    text-align: left;
}

.modal-info-list li {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 0 6px 24px;
    position: relative;
}

.modal-info-list li::before {
    content: "•";
    color: #00d4aa;
    position: absolute;
    left: 8px;
}

/* Ensure buttons stay side-by-side in add artist modal */
.add-artist-modal-content .modal-buttons {
    flex-direction: row;
    justify-content: center;
}

.add-artist-modal-content .btn-primary,
.add-artist-modal-content .btn-secondary {
    flex: 1;
    max-width: 140px;
}

/* Non-blocking Progress Indicator */
.processing-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 280px;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 500;
    overflow: hidden;
    animation: slideInUp 0.3s ease;
}

/* When player bar is visible, move indicator up */
body.player-visible .processing-indicator {
    bottom: 90px;
}

.processing-indicator.hidden {
    display: none;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.indicator-state {
    display: block;
}

.indicator-state.hidden {
    display: none;
}

.indicator-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.indicator-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 212, 170, 0.3);
    border-top-color: #00d4aa;
    border-radius: 50%;
    animation: indicatorSpin 0.8s linear infinite;
}

@keyframes indicatorSpin {
    to { transform: rotate(360deg); }
}

.indicator-check {
    color: #4ade80;
    font-size: 16px;
}

.indicator-warning {
    color: #f87171;
    font-size: 16px;
}

.indicator-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.indicator-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.indicator-dismiss:hover {
    color: #fff;
}

.indicator-body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.indicator-artist-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.indicator-info {
    flex: 1;
    min-width: 0;
}

.indicator-artist-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.indicator-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.indicator-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.indicator-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4aa, #00e9bc);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 5%;
}

.indicator-percent {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    min-width: 32px;
    text-align: right;
}

.indicator-view-btn {
    background: #00d4aa;
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.indicator-view-btn:hover {
    background: #00e9bc;
    transform: scale(1.02);
}

.indicator-error-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.indicator-error-msg {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.indicator-retry-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.indicator-retry-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Adjust canvas when CTA bar is visible */
body.cta-visible #canvas-container {
    top: 100px; /* 60px header + 40px CTA bar */
}

/* Responsive */
@media (max-width: 768px) {
    #header {
        height: 44px;
        padding: 0 8px;
        gap: 6px;
    }

    #header h1 {
        display: none;
    }

    .header-left {
        gap: 8px;
    }

    .header-right {
        gap: 8px;
    }

    .logo {
        font-size: 14px;
    }

    .info-btn {
        padding: 2px;
    }

    .info-btn svg {
        width: 16px;
        height: 16px;
    }

    .scope-toggle {
        padding: 2px;
        border-radius: 6px;
    }

    .scope-toggle button {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 4px;
    }

    #search-input {
        width: 100px;
        padding: 5px 8px 5px 28px;
        font-size: 12px;
    }

    .search-icon {
        left: 8px;
        font-size: 12px;
    }

    #search-input::placeholder {
        font-size: 10px;
    }

    #search-input:focus {
        width: 150px;
    }

    /* Player bar mobile - completely restructured */
    #player-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        padding: 10px 12px 6px 12px;
        flex-wrap: wrap;
    }

    .player-info {
        flex: 1;
        min-width: 0;
        gap: 10px;
    }

    #player-image {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .player-text {
        flex: 1;
        min-width: 0;
    }

    #player-artist {
        font-size: 13px;
    }

    #player-song {
        font-size: 12px;
        white-space: normal;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #player-status {
        display: none;
    }

    .player-controls {
        flex: 0 0 auto;
        gap: 0;
        justify-content: flex-end;
    }

    #player-play-pause {
        width: 38px;
        height: 38px;
        font-size: 19px;
    }

    #player-play-pause .icon-play,
    #player-play-pause .icon-pause {
        font-size: 18px;
    }

    /* Hide time and inline progress on mobile */
    #player-time {
        display: none;
    }

    .player-progress {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 3px;
        border-radius: 0;
        background: rgba(255, 255, 255, 0.15);
    }

    #player-progress-bar {
        border-radius: 0;
    }

    /* CTA Bar mobile */
    #cta-bar {
        height: auto;
        padding: 10px 12px;
        flex-wrap: nowrap;
        gap: 10px;
        align-items: center;
    }

    .cta-text {
        font-size: 11px;
        text-align: left;
        flex: 1;
        line-height: 1.4;
    }

    .cta-text .mobile-break {
        display: block;
    }

    .cta-button {
        flex-shrink: 0;
    }

    .cta-close {
        flex-shrink: 0;
    }

    /* Modal mobile */
    .modal-content {
        padding: 24px 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-title {
        font-size: 20px;
    }

    .modal-features li {
        font-size: 13px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        text-align: center;
    }

    /* Keep add-artist modal buttons side-by-side on mobile */
    .add-artist-modal-content .modal-buttons {
        flex-direction: row;
    }

    .add-artist-modal-content .btn-primary,
    .add-artist-modal-content .btn-secondary {
        width: auto;
        flex: 1;
        padding: 12px 16px;
    }

    .add-artist-modal-content .modal-description {
        font-size: 14px;
    }

    .add-artist-modal-content .modal-info-list li {
        font-size: 13px;
    }

    /* Tooltip as bottom sheet on mobile */
    #tooltip {
        position: fixed;
        top: auto !important;
        left: 0 !important;
        right: 0;
        bottom: 0;
        max-width: none;
        width: 100%;
        border-radius: 12px 12px 0 0;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        padding: 10px 12px;
        max-height: 50vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease, opacity 0.2s, bottom 0.2s ease;
    }

    /* Adjust tooltip position based on what's below it */
    body.player-visible #tooltip {
        bottom: 56px;
    }

    body.indicator-visible #tooltip {
        bottom: 44px;
    }

    body.player-visible.indicator-visible #tooltip {
        bottom: 100px;
    }

    #tooltip:not(.hidden) {
        transform: translateY(0);
    }

    #tooltip.hidden {
        transform: translateY(100%);
    }

    .tooltip-name {
        font-size: 16px;
    }

    .tooltip-similar-btn,
    .tooltip-share-btn {
        height: 28px;
        padding: 0 10px;
        font-size: 11px;
    }

    .tooltip-similar-btn svg,
    .tooltip-share-btn svg {
        width: 14px;
        height: 14px;
    }

    .tooltip-similar-items-wrapper {
        max-height: 150px;
    }

    .tooltip-similar-items {
        max-height: 150px;
    }

    /* Zoom controls below CTA bar on mobile */
    #zoom-controls {
        bottom: auto;
        top: 120px; /* Below header (60px) + CTA bar (~60px) */
        right: 10px;
        z-index: 201; /* Above tooltip */
        transition: top 0.2s;
        /* Larger hit area on mobile for easier tapping */
        padding: 15px;
        margin: -15px;
    }

    /* When CTA is dismissed, zoom controls move up */
    body:not(.cta-visible) #zoom-controls {
        top: 70px;
    }

    #zoom-slider-container {
        height: 80px;
    }

    #zoom-controls button {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    /* Processing Indicator - Mobile: Compact single-line banner */
    .processing-indicator {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        animation: slideInUpMobile 0.2s ease;
    }

    /* When player bar is visible on mobile, move indicator up */
    body.player-visible .processing-indicator {
        bottom: 70px;
    }

    @keyframes slideInUpMobile {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .indicator-header {
        padding: 8px 12px;
    }

    .indicator-body {
        display: none; /* Hide full body on mobile */
    }

    /* Mobile: Show artist name inline in header */
    .indicator-header::after {
        content: attr(data-artist);
        font-size: 13px;
        font-weight: 500;
        color: #fff;
        margin-right: auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 45%;
    }

    .indicator-title {
        display: none; /* Hide "Adding to SoundMap" text on mobile */
    }

    /* Mobile: Show percent inline */
    .indicator-header::before {
        content: attr(data-percent);
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
        margin-left: auto;
        order: 2;
        margin-right: 8px;
    }

    .indicator-spinner {
        order: -1;
    }

    .indicator-dismiss {
        order: 3;
    }

    /* Mobile success state - single row layout */
    #indicator-success .indicator-header {
        border-bottom: none;
    }

    #indicator-success .indicator-header::after {
        content: attr(data-artist);
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: none;
        margin-right: 8px;
    }

    #indicator-success .indicator-body {
        position: absolute;
        top: 0;
        right: 28px; /* Space for dismiss button */
        bottom: 0;
        display: flex;
        align-items: center;
        padding: 0;
        background: none;
    }

    #indicator-success .indicator-artist-img {
        display: none;
    }

    #indicator-success .indicator-info {
        display: flex;
        align-items: center;
    }

    #indicator-success .indicator-artist-name {
        display: none;
    }

    #indicator-success {
        position: relative;
    }

    #indicator-success .indicator-view-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .indicator-view-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* Mobile error state */
    #indicator-error .indicator-body {
        display: flex;
        padding: 8px 12px;
    }

    #indicator-error .indicator-error-body {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
}
