
        :root {
            --bg-color: #121212;
            --card-bg: #1e1e1e;
            --text-main: #ffffff;
            --text-dim: #b3b3b3;
            --accent: #1db954; 
        }

        body {
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-main);
            margin: 0;
            padding: 20px;
        }

        .header-controls {
            position: sticky;
            top: 0;
            background-color: var(--bg-color);
            padding: 10px 0 20px 0;
            z-index: 100;
            text-align: center;
            border-bottom: 1px solid #333;
        }

        input[type="text"], select {
            padding: 12px 20px;
            border-radius: 25px;
            border: 1px solid #444;
            background: var(--card-bg);
            color: white;
            font-size: 15px;
            outline: none;
            margin: 5px;
        }

        input[type="text"] { width: 60%; max-width: 400px; }

        #counter {
            margin-top: 15px;
            color: var(--text-dim);
            font-size: 16px;
        }

        /* THE GRID */
		
		.grid-container, 
#recordGrid {
    border-top: none !important;
    padding-top: 10px; /* Optional: adds a tiny bit of air so records don't touch the letters */
    margin-top: 0 !important;
}
		
   #recordGrid {
    display: grid;
    /* FIX: Changed 1fr to a fixed max size (like 220px) */
    grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
    gap: 25px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    
    /* This centers the group of cards within the 1200px container */
    justify-content: center; 
}

/* Ensure the cards themselves don't exceed their container */
.record-card {
    width: 100%;
    max-width: 220px;
    margin: 0 auto; /* Centers the card if the column is slightly wider */
}

        .record-card {
            background-color: var(--card-bg);
            border-radius: 8px;
            overflow: hidden;
            transition: transform 0.2s;
            cursor: pointer;
            border: none;
            text-align: left;
        }

        .record-card:hover {
            transform: translateY(-5px);
            border-color: #555;
        }

        .record-card img {
            width: 100%;
            aspect-ratio: 1 / 1;
            object-fit: cover;
            display: block;
            background-color: #282828;
        }

        .card-content { padding: 12px; }

        .card-artist {
            display: block;
            font-weight: bold;
            font-size: 14px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .card-title {
            display: block;
            font-size: 12px;
            color: var(--text-dim);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            margin-bottom: 8px;
        }

        .card-meta {
            font-size: 11px;
            color: var(--accent);
            text-transform: uppercase;
        }

        /* MODAL */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0; top: 0; width: 100%; height: 100%;
            background-color: rgba(0,0,0,0.9);
            backdrop-filter: blur(5px);
        }

        .modal-content {
            background-color: #282828;
            margin: 5% auto;
            padding: 20px;
            width: 90%;
            max-width: 800px;
            border-radius: 12px;
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            position: relative;
        }

        .modal-left { flex: 1; min-width: 300px; }
        .modal-left img { width: 100%; border-radius: 4px; }

        .close {
            position: absolute;
            right: 20px; top: 10px;
            color: #aaa;
            font-size: 28px;
            cursor: pointer;
        }
		
		.search-wrapper:hover #clearSearch {
			color: var(--accent);
		}

		/* Ensure the input and select sit nicely together */
		.header-controls {
		    display: flex;
		    flex-direction: column;
		    align-items: center;
		    gap: 10px;
		}

		.controls-row {
		    display: flex;
		    align-items: center;
		    justify-content: center;
		    width: 100%;
		    gap: 10px;
		}
		
		#scrollTopBtn {
			display: none; /* Hidden by default */
			position: fixed;
			bottom: 30px;
			right: 30px;
			z-index: 99;
			border: none;
			outline: none;
			background-color: var(--accent); /* Using your Spotify Green */
			color: black;
			cursor: pointer;
			width: 50px;
			height: 50px;
			border-radius: 50%;
			font-size: 24px;
			font-weight: bold;
			box-shadow: 0 4px 10px rgba(0,0,0,0.5);
			transition: opacity 0.3s, transform 0.2s;
		}

#scrollTopBtn:hover {
    transform: scale(1.1);
    background-color: #fff;
}
		
.alphabet-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 20px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.letter-btn {
    background: none;
    border: none;
    color: #888;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 8px;
    font-size: 19px !important;
    transition: 0.2s;
    border-radius: 4px;
}

.letter-btn:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.letter-btn.active {
    color: #000;
    background: var(--accent);
}

/* Reset the top part so it scrolls normally */
.header-top {
    position: static; 
    padding: 20px;
    text-align: center;
}

/* Make ONLY the Alphabet Bar stick to the top */
.alphabet-bar {
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 10px;                   /* Stick to the very top edge */
    z-index: 1000;            /* Stay on top of the record cards */
    background-color: #121212; /* MUST match your page background to hide cards behind it */
    padding: 10px 0;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}



/* This makes the A-Z bar stay at the VERY TOP of the screen */
.sticky-nav {
    position: -webkit-sticky; /* Support for Safari */
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #121212; /* Must be solid so records don't overlap text */
    border-bottom: 1px solid #333;
    padding: 5px 0;
}

#counter {
    display: block !important;
    text-align: center !important;
    width: 100%;
    font-family: sans-serif;
    font-size: 14px;
}

.header-controls {
    padding: 10px 20px 5px 20px; /* Top, Right, Bottom, Left */
    text-align: center;
}

.header-controls h1 {
    margin: 0 0 10px 0; /* Only 10px of space below the title */
    font-size: 1.8rem;   /* Slightly smaller title saves vertical space */
}

/* This targets the flex row containing search/selects */
.header-controls > div[style*="display: flex"] {
    padding-bottom: 5px !important; /* Reduced from 20px */
}

#counter {
    margin: 5px 0 !important; /* Reduced from 15px */
    padding-bottom: 0px !important; /* Reduced from 10px */
}

.sticky-nav {
    padding: 2px 0; /* Minimal padding inside the sticky bar */
}


.alphabet-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    padding-top: 0px !important; /* Added a tiny bit of breathing room since lines are gone */
	padding-bottom: 10px !important;
}

.letter-btn, 
.alphabet-bar button {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 6px 2px 6px !important; /* Tightens box around text */
    margin: 0;
    line-height: 1; /* Removes text-buffer space */
    height: auto !important; /* Overrides global button heights */
    display: inline-block;
    transition: color 0.2s;
}

.letter-btn:hover {
    color: var(--accent, #1DB954);
}




/* 1. Remove the line above the A-Z bar */
.header-controls {
    position: relative;
    background-color: #121212;
    padding-top: 0px;
    border-bottom: none !important; /* Removes the line above */
}

/* 2. Remove the line below the A-Z bar */
.sticky-nav {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #121212;
    border-top: none !important;    /* Ensures no top line */
    border-bottom: none !important; /* Removes the line below */
    padding: 0 !important;
    margin: 0;
}

/* 3. Optional: Add a subtle shadow instead */
/* This keeps the bar distinct from the records without using a harsh line */
.sticky-nav {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); 
}


/* Mobile Styles (Screens smaller than 768px) */
/* --- 1. THE PARENT CONTAINER (The "Traffic Controller") --- */
.header-controls > div {
    display: flex !important;
    flex-wrap: wrap !important;      /* Allow wrapping for tablets */
    flex-direction: row !important;  /* Start as a row */
    justify-content: center !important;
    align-items: center !important;  /* CRITICAL: Prevents "stupidly tall" boxes */
    gap: 10px !important;
    width: 100% !important;
    height: auto !important;         /* Let the container grow, not the boxes */
}

/* --- 2. THE BOXES (Search, Format, Sort) --- */
.search-wrapper, 
#formatInput, 
#sortInput {
    /* Force them to be the same size on tablets */
    flex: 1 1 250px !important; 
    max-width: 350px !important; 
    
    /* Hard-lock the height so they can't stretch */
    height: 45px !important; 
    min-height: 45px !important;
    max-height: 45px !important;
    
    box-sizing: border-box !important;
    margin: 5px !important;
}

/* --- 3. THE INPUTS INSIDE --- */
#searchInput, #formatInput, #sortInput {
    width: 100% !important;
    height: 100% !important; /* Fills the 45px wrapper exactly */
    font-size: 16px !important;
    border: 1px solid #444 !important;
    border-radius: 4px !important;
    background-color: #222 !important;
    color: white !important;
    padding: 0 10px !important;
}

/* --- 4. PHONE SPECIFIC (The "Snap") --- */
@media screen and (max-width: 600px) {
    .header-controls > div {
        flex-direction: column !important; /* Stack perfectly on phones */
    }
    
    .search-wrapper, 
    #formatInput, 
    #sortInput {
        width: 100% !important;
        max-width: 100% !important; /* Use full phone width */
        height: 50px !important;     /* Slightly taller for thumbs */
        min-height: 50px !important;
        max-height: 50px !important;
    }
}

@media screen and (max-width: 600px) {
    /* 1. Target the container that holds all your record cards */
    /* Replace '.record-grid' with the actual class name of your container */
    .recordGrid, #recordGrid, .grid-container {
        display: grid !important;
        /* This creates 3 equal columns, making the images much smaller */
        grid-template-columns: repeat(3, 1fr) !important; 
        gap: 8px !important; /* Tighter gaps look better with smaller images */
        padding: 10px !important;
    }

    /* 2. Ensure the images inside the cards scale down correctly */
    .record-card img, .album-art, .grid-item img {
        width: 100% !important;
        height: auto !important;
        border-radius: 4px !important; /* Slightly rounder corners look better when small */
    }

    /* 3. Optional: Hide or shrink text if it's taking up too much space */
    .record-info {
        font-size: 11px !important; /* Smaller text for smaller cards */
        line-height: 1.2 !important;
    }

    @media screen and (max-width: 600px) {
    .modal-content {
        margin-top: 8px !important; /* This pulls the whole box up */
        padding: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important; 
    }
}

    /* Target EVERY direct child of the modal to strip their margins */
    .modal-content > * {
        margin-top: 0 !important;
        margin-bottom: 2px !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Shrink the headers (Artist/Title) */
    .modal-content h2, 
    .modal-content h3, 
    .modal-content p {
        font-size: 16px !important;
        line-height: 1.1 !important;
    }

    /* Shrink the labels (Notes, Value, etc) */
    .modal-content label {
        font-size: 12px !important;
        font-weight: bold;
        text-transform: uppercase;
        margin-top: 5px !important; 
    }

    /* Shrink the input boxes and the textarea */
    .modal-content input, 
    .modal-content textarea, 
    .modal-content select {
        font-size: 14px !important;
        padding: 4px !important;
        margin-bottom: 5px !important;
    }

    /* Specifically make the notes box smaller to save huge space */
    #notes, .notes-field {
        height: 50px !important;
        min-height: 50px !important;
    }

@media screen and (max-width: 600px) {
    /* 1. Force the Title to have zero bottom margin */
    /* Target whatever holds your Title (h2, h3, or a specific ID) */
    .modal-content h2, 
    .modal-content h3,
    #modalTitle {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        line-height: 1.5 !important; /* Reduces vertical height of the text line itself */
		margin-top: -10 !important;
    }
	
	.modal-content h2, 
    .modal-content h3,
    #modalArtist {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        line-height: 1.5 !important; /* Reduces vertical height of the text line itself */
    }

    /* 2. Target the Format field/label specifically to pull it UP */
    /* We use a negative margin to 'suck' it toward the title */
    .modal-content label[for="format"],
    .format-field-container,
    .modal-content select#format {
        margin-top: -10 !important; 
    }

    /* 3. If you have an Artist/Title container, let's shrink its height */
    .modal-header, .info-section {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* 4. Make the labels "inline" or smaller to save a whole line of space */
    .modal-content label {
        display: inline-block !important;
        margin-right: 10px;
        margin-bottom: 2px !important;
    }
@media screen and (max-width: 600px) {
    .close-modal, .close {
        font-size: 28px !important;    /* Slightly smaller X often centers better */
        font-weight: bold !important;
        position: absolute !important;
        top: 12px !important;
        right: 25px !important;
        z-index: 1000 !important;
        
        background: rgba(255, 255, 255, 0.8) !important; 
        color: #000 !important;
        width: 40px !important;
        height: 40px !important;
        
        /* THE FIX: */
        display: flex !important;
        align-items: center !important;    /* Centers vertically */
        justify-content: center !important;  /* Centers horizontally */
        line-height: 0 !important;         /* Removes the 'text baseline' extra space */
        padding-bottom: 4px !important;    /* This 'nudges' the X UP by pushing from the bottom */
        
        border-radius: 50% !important; 
        box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Makes it pop off the image */
    }

@media screen and (max-width: 600px) {
    /* 1. Reset the container */
    #recordModal .modal-content {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px !important;
    }

    /* --- 1. GLOBAL SPACING (Works everywhere) --- */
#modalArtist, #modalTitle {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1 !important;
    display: block !important;
}

/* The 25px gap between Title and Details */
.details-list-wrapper {
    margin-top: 25px !important;
    display: block !important;
}


/* ==========================================
   1. GLOBAL & DESKTOP STYLES (Default)
   ========================================== */
.modal-content {
    display: flex !important;
    flex-direction: row !important; /* Side-by-side on desktop */
    flex-wrap: wrap !important;     /* Allows notes to wrap under image */
    position: relative;
    padding: 20px;
    background-color: #1a1a1a;
    border-radius: 12px;
}

.modal-left {
    flex: 1;
    min-width: 300px;
    padding: 20px;
}

.modal-right {
    flex: 1.5;
    min-width: 300px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* DESKTOP VIEW */
#modalImg {
    /* This overrides the 250px mobile height limit */
    max-height: none !important; 
    
    /* Set your desired desktop width here */
    width: 450px !important; 
    height: 450px !important; /* Keep it square */
    
    object-fit: cover; /* Ensures the image doesn't stretch weirdly */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    
    /* Center it within the flex container if needed */
    margin: 0 auto !important; 
}

/* Style for the Notes block */
#modalNotesLeft {
    width: 100%; 
    margin-top: 25px !important;
    border-top: 1px solid #444 !important;
    padding: 20px !important;
}

/* The Close Button */
.close {
    position: absolute !important;
    top: 15px !important;
    right: 25px !important;
    z-index: 1002 !important;
    width: 42px !important;
    height: 42px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: black !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 30px !important;
    font-weight: bold !important;
    cursor: pointer;
}

/* ==========================================
   2. MOBILE STYLES (Under 600px)
   ========================================== */
@media screen and (max-width: 600px) {
    .modal-content {
        flex-direction: column !important; /* Stack vertically */
        padding: 10px !important;
    }

    /* Force the order: 1. Image, 2. Text, 3. Notes */
    .modal-left { 
        order: 1 !important; 
        width: 100% !important; 
        padding: 10px !important;
    }
    
    .modal-right { 
        order: 2 !important; 
        width: 100% !important; 
        padding: 10px !important;
    }
    
    #modalNotesLeft { 
        order: 3 !important; 
        width: 100% !important; 
        padding: 15px !important;
    }

    @media screen and (max-width: 600px) {
    /* ... your other mobile rules ... */

   #modalImg {
    /* 1. Reduce the height to save vertical space */
    max-height: 250px !important; 
    
    /* 2. Keep width proportional */
    width: auto !important;
    max-width: 100% !important;

    /* 3. Center Justification */
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    
    /* 4. Creates a 25px gap between the image and the buttons below */
    margin-bottom: 25px !important; 
}

.action-group {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 15px 0 !important;
}


/* --- 2. GLOBAL MODAL SPACING (Works on Desktop AND Mobile) --- */

/* Tighten Artist & Title together at the very top */
#modalArtist, #modalTitle {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1 !important;
    display: block !important;
}

/* Create the 25px gap between the Title and the technical fields */
.details-list-wrapper {
    margin-top: 25px !important;
    display: block !important;
    padding: 0 !important;
}



/* Color the counts/values in the UI */
#recordCount, #totalValue, #lastUpdated {
    color: #1db954 !important; 
    font-weight: bold;
}


/* 1. THE PARENT CONTAINER (The Room) */
.modal-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;    /* Centers the image and the wrapper */
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}



/* 3. BASE BUTTON STYLE */
.modal-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 140px !important;           /* Fixed width for symmetry */
    height: 40px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    margin: 0 !important;              /* Remove all margins to stay centered */
}

/* The "Pressed" Animation */
/* Ensure the button is prepared to move */
#recordModal .modal-btn {
    position: relative !important;
    top: 0 !important;
    transition: all 0.05s ease-in-out !important;
}

/* The Click State */
/* This doesn't move the button, it just 'flashes' it */
.modal-btn:active {
    filter: invert(1) !important; /* Inverts colors: white becomes black, black becomes white */
    opacity: 0.7 !important;
}



/* This targets the buttons inside the NEW container to force them to the middle */
#masterCenterContainer #itunesBtnWrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    float: none !important;
    position: static !important;
    margin: 0 auto !important;
}

/* This strips any 'ghost' margins from the buttons themselves */
#masterCenterContainer .modal-btn {
    margin: 0 5px !important; /* ONLY a small side gap */
    float: none !important;
    display: inline-flex !important;
    position: static !important;
}

.grid-img {
    pointer-events: none; /* This is the magic line */
    display: block;
    width: 100%;
}

/* This stops the "broken icon" from showing while loading */
.grid-img {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

/* This fades the image in once it's actually there */
.grid-img[src] {
    opacity: 1;
}