:root {
    --bg-color: #121212;
    --sidebar-bg: #1e1e1e;
    --text-color: #f5f5f5;
    --text-muted: #a0a0a0;
    --accent-color: #bb86fc;
    --hover-bg: #2c2c2c;
    --selected-bg: #38255c;

    --font-size-base: 18px;
    --font-size-lyrics: 42px;
    --sidebar-width: 380px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #333;
    transition: transform 0.3s ease;
    z-index: 50;
    position: absolute;
    height: 100%;
}

/* Hidden input — off-screen but still focusable */
.hidden-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
    width: 0;
    height: 0;
}

.song-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.song-item {
    padding: 16px 20px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    max-height: 80px;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease, margin 0.25s ease, background-color 0.2s;
}

.song-item.hidden {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.song-item:hover,
.song-item.focused {
    background-color: var(--hover-bg);
}

.song-item.active {
    background-color: var(--selected-bg);
    border-left: 4px solid var(--accent-color);
}

.song-item-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.song-item-artist {
    font-size: 16px;
    color: var(--text-muted);
}

.empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Catalog Loading Skeleton ===== */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.catalog-loading {
    padding: 10px;
}

.catalog-loading-skeleton {
    height: 62px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: linear-gradient(90deg, #252525 25%, #333 50%, #252525 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
}

/* ===== Sidebar Key Hint ===== */
.sidebar-key-hint {
    position: fixed;
    left: var(--sidebar-width);
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 51;
    margin-left: 16px;
    opacity: 1;
}

body.selection-mode .sidebar-key-hint {
    display: flex;
}

.key-shape {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(60, 60, 60, 0.6);
    border: 1px solid #555;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.key-shape.flash {
    background: var(--accent-color);
    color: white;
}

/* ===== Pull Tab ===== */
.pull-tab {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 80px;
    background: rgba(60, 60, 60, 0.6);
    border: 1px solid #555;
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    z-index: 40;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.pull-tab:hover {
    background: rgba(80, 80, 80, 0.9);
    color: var(--accent-color);
}

/* ===== Mode: Selection (sidebar open) ===== */
body.selection-mode .sidebar {
    transform: translateX(0);
}

body.selection-mode .pull-tab {
    display: none;
}

body.selection-mode .lyrics-overlay {
    display: block;
}

body.selection-mode .controls {
    opacity: 0.1;
    pointer-events: none;
}

/* ===== Mode: Performance (sidebar hidden) ===== */
body.performance-mode .sidebar {
    transform: translateX(-100%);
}

body.performance-mode .pull-tab {
    display: flex;
}

/* main-content is always full width since sidebar is absolute */

/* ===== Lyrics Overlay (selection mode dimming) ===== */
.lyrics-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 1s ease;
}

body.performance-mode .lyrics-overlay {
    opacity: 0;
}

/* ===== Search Overlay (centered to the right of sidebar) ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s ease;
}

body.performance-mode .search-overlay {
    opacity: 0;
}

/* ===== Search Mirror (big floating text on overlay) ===== */
.search-mirror {
    text-align: center;
    padding: 0 40px;
    max-width: 90%;
}

.search-text {
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent-color);
    word-break: break-word;
}

.search-cursor {
    font-size: 4rem;
    font-weight: 300;
    color: var(--accent-color);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.search-placeholder {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: opacity 0.15s;
}

/* ===== Main Content ===== */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ===== Controls ===== */
.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: grid;
    grid-template-columns: auto auto;
    gap: 8px 12px;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.3s;
}

.controls.scrolling {
    opacity: 0.3;
}

.controls-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

body.performance-mode .main-content:hover .controls.scrolling {
    opacity: 1;
}

.controls button {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.controls button:hover {
    background: rgba(80, 80, 80, 0.8);
}

.controls button.flash {
    background: var(--accent-color);
    color: white;
}

.controls-separator {
    width: 1px;
    height: 24px;
    background: #555;
    margin: 0 4px;
}

/* Speed display */
.speed-display {
    display: flex;
    gap: 3px;
    align-items: center;
    padding: 0 6px;
}

.speed-pip {
    width: 8px;
    height: 18px;
    background: #444;
    border-radius: 2px;
    transition: background 0.15s;
}

.speed-pip.active {
    background: var(--accent-color);
}

.speed-arrow-btn {
    font-size: 12px !important;
    padding: 8px 8px !important;
}

.ctrl-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px !important;
    padding: 0 !important;
}

/* Play/Pause button */
.play-pause-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 14px !important;
    width: 100%;
}

.play-icon {
    font-size: 16px;
    line-height: 1;
}

.pause-icon {
    font-size: 16px;
    line-height: 1;
    letter-spacing: 2px;
}

.spacebar-shape {
    display: block;
    width: 100%;
    height: 6px;
    background: #888;
    border-radius: 3px;
}

/* ===== Lyrics Display ===== */
.lyrics-display {
    flex-grow: 1;
    padding: 40px 60px 80px;
    overflow-y: auto;
    text-align: center;
}

#songTitle {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--accent-color);
}

#songArtist {
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

.song-notes {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 50px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
    white-space: pre-line;
    text-align: left;
}


/* When notes are present, remove the bar from artist */
#songArtist:has(+ .song-notes:not(:empty)) {
    border-bottom: none;
    margin-bottom: 10px;
    padding-bottom: 0;
}

.song-notes:empty {
    display: none;
}

.lyrics-body {
    font-size: var(--font-size-lyrics);
    line-height: 1.6;
    white-space: pre-wrap;
    max-width: 1200px;
    margin: 0 auto;
}

/* Verse/Chorus Headers */
.lyrics-body b,
.lyrics-body strong {
    color: var(--accent-color);
    display: block;
    margin-top: 30px;
    margin-bottom: 10px;
}

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

* {
    scrollbar-width: none;
}

/* ===== Top-Left Key Hints ===== */
.top-left-hints {
    position: fixed;
    top: 20px;
    left: 20px;
    display: none;
    gap: 6px;
    z-index: 10;
}

body.performance-mode .top-left-hints {
    display: flex;
}

.hint-btn {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 0 8px;
    width: auto;
    -webkit-user-select: none;
    user-select: none;
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 0 60px rgba(187, 134, 252, 0.3);
    transform: scale(0.92);
    transition: transform 0.25s ease;
}

.lightbox.active .lightbox-img {
    transform: scale(1);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        height: 100%;
        z-index: 50;
    }

    .main-content {
        width: 100%;
    }

    :root {
        --font-size-lyrics: 24px;
    }

    #songTitle {
        font-size: 2rem;
    }

    #songArtist {
        font-size: 1.2rem;
        margin-bottom: 30px;
    }

    .lyrics-display {
        padding: 20px 20px 80px;
    }

    .controls {
        opacity: 1;
        top: auto;
        bottom: 20px;
        right: 20px;
    }

    .controls button {
        padding: 12px 16px;
        font-size: 18px;
    }

    /* Arrow key hints → right side of screen */
    .sidebar-key-hint {
        left: auto;
        right: 16px;
        margin-left: 0;
    }

    /* Search overlay → full width, above everything */
    .search-overlay {
        left: 0;
        z-index: 60;
    }

    .search-text,
    .search-cursor,
    .search-placeholder {
        font-size: 2.5rem;
    }
}