/*
* =============================================================================
* TABLE OF CONTENTS
* =============================================================================
*
* 1.  GLOBAL SETUP & THEMES
* - Theme Color Variables
* - Base & Typography Styles
* - Scrollbar Styles
*
* 2.  OVERLAYS (LOADING, AUTH, TUTORIAL)
* - Loading Overlay & Animations
* - Auth Overlay
* - Interactive Tutorial
*
* 3.  LAYOUT (HEADER, MAIN, SIDEBARS)
* - Header & Sidebars
* - Details Panel
* - Resize Handle
*
* 4.  GRID & INTERACTION
* - Grid Wrapper & Sizing
* - Grid Background & Layers
* - Placed Items (Buildings, Roads)
* - Grid Controls (Biome, Rotate, etc.)
* - Grid Overlays (Highlighter, Marquee, Effects)
*
* 5.  UI COMPONENTS
* - Buttons & Links
* - Forms (Inputs, Selects, Checkboxes)
* - Item Palette & Previews
* - Cards & Info Boxes (NFTs, Crafts)
* - Tags & Badges (Time, Status, Keys)
* - History & Favorites
* - Toast Notifications
* - Totals Tab Hover
*
* 6.  SIDEBAR PANELS (LEFT & RIGHT)
* - Left Sidebar (Calculator, Prediction, Tabs)
* - Right Sidebar (Tabs, Filters, Details Panels)
*
* 7.  MODALS (GENERAL THEMING)
* - General Modal Styles & Colors
*
* 8.  MODALS (SPECIFIC LAYOUTS)
* - Account & Profile (#profile-modal, #pfp-selector-modal, #access-request-modal, #gc-verify-modal, #account-success-modal)
* - Core UI (#settings-modal, #controls-modal)
* - Build Manager (#notes-modal, #effects-set-modal, #clear-slot-modal, #group-list-modal)
* - Build Sharing (#search-builds-modal, #upload-builds-modal, #edit-build-modal, #build-details-modal)
* - Calculator & Data (#simulation-modal, #estimate-modal, #diagram-modal, #diagnostics-modal, #quick-apply-modal, #quick-buff-modal, #effect-links-modal)
* - Articles & Guides (#articles-list-modal, #article-details-modal, #edit-article-modal)
* - Admin Modals (#super-user-modal, #keys-list-modal, #edit-supporter-modal)
*
* 9.  PAGE-SPECIFIC (LEADERBOARDS)
*
* 10. SPECIAL MODES & UTILITIES
*
* 11. RESPONSIVE SCALING
*
* 12. NEW: DESIGN COMPETITIONS
*
* =============================================================================
*/

/* ========================================================================== */
/* 1. GLOBAL SETUP & THEMES                                                   */
/* ========================================================================== */

/* --- Theme Color Variables --- */
:root {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-accent: #06b6d4;
    --border-color: #4a5568;
    --button-primary-bg: #06b6d4;
    --button-primary-hover: #0891b2;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #718096;
	--delete-red-hover: #ef4444;
}

body.theme-dark {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-accent: #06b6d4;
    --border-color: #6b7280;
    --button-primary-bg: #06b6d4;
    --button-primary-hover: #0891b2;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #718096;
	--delete-red-hover: #ef4444;
}

body.theme-light {
    --bg-primary: #f3f4f6;
    --bg-secondary: #e5e7eb;
    --bg-tertiary: #d1d5db;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-accent: #d97706;
    --border-color: #9ca3af;
    --button-primary-bg: #f59e0b;
    --button-primary-hover: #d97706;
    --status-green: #16a34a;
    --status-yellow: #ca8a04;
    --status-orange: #ea580c;
    --status-red: #dc2626;
    --checkbox-unchecked-bg: #4a5568;
	--delete-red-hover: #ef4444;
}

body.theme-sky {
    --bg-primary: #e0f2fe;
    --bg-secondary: #bae6fd;
    --bg-tertiary: #7dd3fc;
    --text-primary: #0c4a6e;
    --text-secondary: #0369a1;
    --text-accent: #0284c7;
    --border-color: #38bdf8;
    --button-primary-bg: #0ea5e9;
    --button-primary-hover: #0284c7;
    --status-green: #16a34a;
    --status-yellow: #ca8a04;
    --status-orange: #ea580c;
    --status-red: #dc2626;
    --checkbox-unchecked-bg: #4a5568;
	--delete-red-hover: #ef4444;
}

body.theme-leaf {
    --bg-primary: #f0fdf4;
    --bg-secondary: #dcfce7;
    --bg-tertiary: #bbf7d0;
    --text-primary: #14532d;
    --text-secondary: #166534;
    --text-accent: #15803d;
    --border-color: #86efac;
    --button-primary-bg: #22c55e;
    --button-primary-hover: #16a34a;
    --status-green: #16a34a;
    --status-yellow: #ca8a04;
    --status-orange: #ea580c;
    --status-red: #dc2626;
    --checkbox-unchecked-bg: #4a5568;
	--delete-red-hover: #ef4444;
}

body.theme-pink {
    --bg-primary: #fdf2f8;
    --bg-secondary: #fce7f3;
    --bg-tertiary: #fbcfe8;
    --text-primary: #831843;
    --text-secondary: #9d174d;
    --text-accent: #be185d;
    --border-color: #f9a8d4;
    --button-primary-bg: #ec4899;
    --button-primary-hover: #db2777;
    --status-green: #16a34a;
    --status-yellow: #ca8a04;
    --status-orange: #ea580c;
    --status-red: #dc2626;
    --checkbox-unchecked-bg: #4a5568;
	--delete-red-hover: #ef4444;
}

body.theme-sunset {
    --bg-primary: #fff7ed;
    --bg-secondary: #ffedd5;
    --bg-tertiary: #fed7aa;
    --text-primary: #7c2d12;
    --text-secondary: #9a3412;
    --text-accent: #c2410c;
    --border-color: #fbbf24;
    --button-primary-bg: #f97316;
    --button-primary-hover: #ea580c;
    --status-green: #16a34a;
    --status-yellow: #ca8a04;
    --status-orange: #ea580c;
    --status-red: #dc2626;
    --checkbox-unchecked-bg: #4a5568;
	--delete-red-hover: #ef4444;
}

body.theme-midnight {
    --bg-primary: #000000;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --text-primary: #d1d5db;
    --text-secondary: #9ca3af;
    --text-accent: #7c3aed;
    --border-color: #4b5563;
    --button-primary-bg: #7c3aed;
    --button-primary-hover: #6d28d9;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #718096;
	--delete-red-hover: #ef4444;
}

body.theme-shadow {
    --bg-primary: #18181b;
    --bg-secondary: #27272a;
    --bg-tertiary: #3f3f46;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-accent: #eab308;
    --border-color: #52525b;
    --button-primary-bg: #eab308;
    --button-primary-hover: #ca8a04;
    --button-text: #18181b;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #718096;
    --delete-red-hover: #ef4444;
}

body.theme-volcanic {
    --bg-primary: #1c1917;
    --bg-secondary: #292524;
    --bg-tertiary: #44403c;
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-accent: #ef4444;
    --border-color: #57534e;
    --button-primary-bg: #dc2626;
    --button-primary-hover: #b91c1c;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #78716c;
    --delete-red-hover: #ef4444;
}

body.theme-ocean {
    --bg-primary: #0c1929;
    --bg-secondary: #132f4c;
    --bg-tertiary: #1e4976;
    --text-primary: #e3f2fd;
    --text-secondary: #90caf9;
    --text-accent: #29b6f6;
    --border-color: #1e4976;
    --button-primary-bg: #0288d1;
    --button-primary-hover: #0277bd;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #4a6fa5;
    --delete-red-hover: #ef4444;
}

body.theme-aurora {
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-tertiary: #262626;
    --text-primary: #f0fdf4;
    --text-secondary: #86efac;
    --text-accent: #22c55e;
    --border-color: #404040;
    --button-primary-bg: #22c55e;
    --button-primary-hover: #16a34a;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-orange: #fb923c;
    --status-red: #f87171;
    --checkbox-unchecked-bg: #64748b;
    --delete-red-hover: #ef4444;
}

/* --- Base & Typography Styles --- */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

body[class*="theme-"] .text-gray-300,
body[class*="theme-"] .text-gray-400,
body[class*="theme-"] .text-gray-500 {
    color: var(--text-secondary);
}

body[class*="theme-"] .text-white {
    color: var(--text-primary);
}

#simulation-log-container {
    font-family: 'Courier New', Courier, monospace;
}

/* --- Scrollbar Styles --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================================================== */
/* GOLD / PRIZE THEME STYLES                                                  */
/* ========================================================================== */

/* --- BASE STYLES (Light / Sky / Leaf / Pink / Sunset) --- */
/* Darker Gold for contrast on light backgrounds */
.text-gold {
    color: #d97706 !important; /* Amber-600 */
}

.border-gold {
    border-color: #d97706 !important;
}

.text-gold-light {
    color: #f59e0b !important; /* Amber-500 */
}

/* Gold Button (Light Themes): Solid Darker Gold */
.themed-button-gold {
    background-color: #d97706; /* Amber-600 */
    color: #ffffff !important;
    border: 1px solid #b45309; /* Amber-700 */
    transition: all 0.2s;
}

.themed-button-gold:hover {
    background-color: #b45309; /* Amber-700 */
    box-shadow: 0 0 5px rgba(217, 119, 6, 0.4);
}

.themed-button-gold i {
    color: #ffffff !important;
}

/* --- DARK & MIDNIGHT OVERRIDES --- */
/* Brighter, Glowing Gold for dark backgrounds */
body.theme-dark .text-gold,
body.theme-midnight .text-gold {
    color: #fbbf24 !important; /* Amber-400: Brighter, shiny gold */
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.25); /* Subtle glow */
}

body.theme-dark .border-gold,
body.theme-midnight .border-gold {
    border-color: #fbbf24 !important;
}

body.theme-dark .themed-button-gold,
body.theme-midnight .themed-button-gold {
    background-color: #f59e0b; /* Amber-500: Matches Light Theme accents */
    border: 1px solid #d97706; /* Amber-600 border */
}

body.theme-dark .themed-button-gold:hover,
body.theme-midnight .themed-button-gold:hover {
    background-color: #d97706; /* Amber-600 on hover */
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* ========================================================================== */
/* 2. OVERLAYS (LOADING, AUTH, TUTORIAL)                                      */
/* ========================================================================== */

/* --- Loading Overlay & Animations --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(26, 32, 44, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
    opacity: 1;
}

#auth-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-welcome {
    color: var(--text-accent, #06b6d4);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.loading-welcome.visible {
    opacity: 1;
}

.loading-text {
    margin-top: 0;
    margin-bottom: 20px;
    color: #e2e8f0;
    font-size: 1.2rem;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-bar-container {
    width: 300px;
    height: 12px;
    background-color: #2d3748;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--button-primary-bg, #06b6d4), var(--button-primary-bg-hover, #0891b2));
    border-radius: 6px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px var(--button-primary-bg, #06b6d4);
}

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

/* --- Auth Overlay --- */
.auth-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--button-primary-bg-hover);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
    margin-top: 1rem;
}
.auth-toggle-btn:hover {
    color: var(--button-primary-bg);
}

/* --- Interactive Tutorial --- */
#tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
}

#tutorial-highlight-box {
    position: absolute;
    border: 3px solid var(--button-primary-bg);
    border-radius: 8px;
    box-shadow: 0 0 20px var(--button-primary-bg), 0 0 0 9999px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease-in-out;
    pointer-events: none;
}

#tutorial-text-box {
    position: absolute;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 1rem;
    width: 350px;
    max-width: 90vw;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease-in-out;
    pointer-events: auto;
    z-index: 10002;
}

#tutorial-text-box h3 {
    color: var(--text-accent);
}

.tutorial-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    cursor: pointer;
}

.tutorial-btn.btn-primary {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
    border: none;
}
.tutorial-btn.btn-primary:hover {
    background-color: var(--button-primary-hover);
}

.tutorial-btn.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.tutorial-btn.btn-secondary:hover {
    background-color: var(--border-color);
}


/* ========================================================================== */
/* 3. LAYOUT (HEADER, MAIN, SIDEBARS)                                         */
/* ========================================================================== */

/* --- Header & Sidebars --- */
header, #left-sidebar, #right-sidebar {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

#right-sidebar {
    width: 720px;
    transition: width 0.3s ease-in-out;
}

.flex-1.flex.flex-col.min-w-0 {
    min-width: 0;
}

#left-sidebar {
    transition: width 0.3s ease-in-out, padding 0.3s ease-in-out;
    overflow: hidden;
}

#show-sidebar-btn {
    transition: opacity 0.3s ease-in-out;
    background-color: var(--bg-secondary) !important;
}

#show-sidebar-btn:hover {
    background-color: var(--button-primary-hover) !important;
}

/* --- Details Panel --- */
#details-panel {
    transition: width 0.3s ease-in-out;
}

#details-panel.collapsed #grid-selection-details,
#details-panel.collapsed .details-panel-title {
    display: none;
}

#details-panel.collapsed .justify-between {
    justify-content: center;
}

#details-panel.collapsed #pin-details-btn {
    display: none;
}

#pin-details-btn {
    background-color: var(--bg-tertiary);
    transition: background-color 0.2s;
}

#pin-details-btn:hover {
    background-color: var(--border-color);
}

#pin-details-btn.active {
    background-color: var(--status-green) !important;
    color: var(--bg-primary) !important;
}

#lock-details-btn.locked {
    color: #dc2626;
}

#lock-details-btn.locked:hover {
    color: white !important;
}

/* --- Resize Handle --- */
#resize-handle {
    height: 8px;
    background-color: var(--bg-tertiary); /* <-- ADDED THIS */
    cursor: row-resize;
    flex-shrink: 0;
    position: relative;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color); /* <-- ADDED THIS */
}

#resize-handle::after {
    content: '...';
    position: absolute;
    top: 50%; /* <-- CORRECTED */
    left: 50%;
    transform: translate(-50%, -50%); /* <-- CORRECTED */
    color: var(--text-secondary);
    font-weight: bold;
    letter-spacing: 2px;
    line-height: 1; /* <-- ADDED THIS */
}

/* ========================================================================== */
/* 4. GRID & INTERACTION                                                      */
/* ========================================================================== */

/* --- Grid Wrapper & Sizing --- */
.grid-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 2px solid #6a8213;
    box-sizing: border-box;
}

.grid-wrapper.copy-flash {
    border-color: var(--button-primary-bg) !important;
    transition: border-color 0.15s ease-in-out;
}

.grid-size-compact {
    width: 70vh; height: 70vh;
    max-width: 80vw; max-height: 80vw;
}
.grid-size-cozy {
    width: 75vh; height: 75vh;
    max-width: 85vw; max-height: 85vw;
}
.grid-size-standard {
    width: 80vh; height: 80vh;
    max-width: 90vw; max-height: 90vw;
}
.grid-size-large {
    width: 85vh; height: 85vh;
    max-width: 95vw; max-height: 95vw;
}
.grid-size-full {
    width: 90vh; height: 90vh;
    max-width: 100vw; max-height: 100vw;
}

/* --- Grid Background & Layers --- */
#grid-background-cells {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: grid;
    grid-template-columns: repeat(64, 1fr);
    grid-template-rows: repeat(64, 1fr);
    box-sizing: border-box;
}

.grid-background-cell {
    box-sizing: border-box;
}
.line-right-64 { border-right: 1px solid #b6d449; }
.line-bottom-64 { border-bottom: 1px solid #b6d449; }
.line-right-32 { border-right: 1px solid #84a215; }
.line-bottom-32 { border-bottom: 1px solid #84a215; }
.line-right-16 { border-right: 2px solid #6a8213; }
.line-bottom-16 { border-bottom: 2px solid #6a8213; }

.grid-background-cell.plains { background-color: #a3c428; }
.grid-background-cell.forest { background-color: #6B8E23; }
.grid-background-cell.desert { background-color: #D2B48C; }

.grid-items-container, .grid-overlay-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: grid;
    grid-template-columns: repeat(64, 1fr);
    grid-template-rows: repeat(64, 1fr);
}

.grid-overlay-container {
    pointer-events: none;
}

#grid-ground-effects-container { z-index: 10; }
.grid-items-container { z-index: 20; }


/* --- Placed Items (Buildings, Roads) --- */
.placed-item {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    background-color: #c7e155;
    border: 2px solid #6a8213;
    border-radius: 8px;
    box-shadow: inset 0px 3px 2px rgba(255, 255, 255, 0.5), inset 0px -3px 2px rgba(0, 0, 0, 0.1), 2px 2px 5px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    position: relative;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.placed-item.invalid-placement {
    background-color: #ef4444;
    border-color: #b91c1c;
}
.placed-item.selected-on-grid {
    outline: 3px solid var(--selection-color, #facc15);
    outline-offset: 1px;
}

.placed-item.dirt-road, .placed-item.paved-road {
    box-shadow: none !important;
    background-image: none !important;
}
.placed-item.dirt-road {
    background-color: #ab987a !important;
    border-color: #8a785a !important;
}
.placed-item.paved-road {
    background-color: #6c757d !important;
    border-color: #495057 !important;
}

.placed-item.door-n, .building-preview.door-n { border-top-color: #b45309 !important; border-top-width: 4px !important; }
.placed-item.door-e, .building-preview.door-e { border-right-color: #b45309 !important; border-right-width: 4px !important; }
.placed-item.door-s, .building-preview.door-s { border-bottom-color: #b45309 !important; border-bottom-width: 4px !important; }
.placed-item.door-w, .building-preview.door-w { border-left-color: #b45309 !important; border-left-width: 4px !important; }

body.hide-doors .placed-item.door-n,
body.hide-doors .placed-item.door-e,
body.hide-doors .placed-item.door-s,
body.hide-doors .placed-item.door-w,
body.hide-doors .building-preview.door-n,
body.hide-doors .building-preview.door-e,
body.hide-doors .building-preview.door-s,
body.hide-doors .building-preview.door-w {
    border-top-color: #6a8213 !important;
    border-right-color: #6a8213 !important;
    border-bottom-color: #6a8213 !important;
    border-left-color: #6a8213 !important;
    border-width: 2px !important;
}

.craft-icon-on-grid {
    position: absolute;
    width: 60%;
    height: 60%;
    left: 2px;
    bottom: 2px;
    z-index: 25;
    pointer-events: none;
}

.placed-item img {
    pointer-events: none;
}

/* --- Grid Controls (Biome, Rotate, etc.) --- */
#biome-switcher {
    position: absolute;
    bottom: 100%;
    right: 100%;
    width: 28px;
    height: 28px;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    z-index: 40;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* --- Grid Tool Buttons (Rotate, Mirror) --- */
.grid-tool-btn {
    position: absolute;
    width: 28px;
    height: 28px;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    z-index: 40;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: background-color 0.2s, color 0.2s;
}

.grid-tool-btn:hover {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
}

.grid-tool-btn.active {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
}

/* Position the main buttons outside the grid */
#mirror-btn { top: 100%; right: 100%; } /* Bottom-left corner */
#rotate-btn { top: 100%; left: 100%; } /* Bottom-right corner */

/* --- Grid Tool Panels (inside grid) --- */
.grid-tool-panel {
    position: absolute;
    bottom: 8px;
    display: flex;
    gap: 8px;
    padding: 8px;
    background-color: rgba(45, 55, 72, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 45;
    border: 1px solid var(--border-color);
}

.grid-tool-panel.hidden {
    display: none;
}

/* Mirror panel on the left, Rotate panel on the right */
#mirror-panel { left: 8px; }
#rotate-panel { right: 8px; }

.panel-tool-btn {
    width: 36px;
    height: 36px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
}

.panel-tool-btn:hover {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
    transform: scale(1.05);
}

.panel-tool-btn:active {
    transform: scale(0.95);
}

.biome-edge {
    position: absolute;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.biome-edge:hover {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
}

.biome-edge.top { bottom: 100%; left: 0; width: 100%; height: 28px; }
.biome-edge.right { left: 100%; top: 0; height: 100%; width: 28px; writing-mode: vertical-rl; transform: rotate(180deg); }
.biome-edge.bottom { top: 100%; left: 0; width: 100%; height: 28px; }
.biome-edge.left { right: 100%; top: 0; height: 100%; width: 28px; writing-mode: vertical-rl; }

.biome-edge.number-mode {
    font-weight: 700;
    justify-content: space-around;
    font-size: 0.6rem;
    line-height: 1rem;
    letter-spacing: 0.05em;
}

/* --- Grid Overlays (Highlighter, Marquee, Effects) --- */
#grid-highlighter {
    position: absolute;
    display: none;
    box-sizing: border-box;
    pointer-events: none;
    transition: background-color 0.1s ease;
    z-index: 30;
}

#highlighter-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.grid-background-cell.unutilized-highlight {
    opacity: 1.0 !important;
    box-shadow: 0 0 6px 1px var(--status-green);
    z-index: 98;
    position: relative;
}

#marquee {
    position: absolute;
    display: none;
    border: 2px dashed #ffffff;
    background-color: rgba(99, 102, 241, 0.2);
    z-index: 100;
    pointer-events: none;
}

.received-effect-overlay {
    position: absolute;
    top: 2px;
    left: 2px;
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    border-radius: 9999px;
    font-size: 0.875rem;
    background-color: #6d28d9;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    pointer-events: none;
    z-index: 50;
    opacity: 0.95;
}

/* --- Proximity Tag Sizing for 2x2 Buildings --- */
.placed-item[data-size="2"] .received-effect-overlay {
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    line-height: 1rem;
    top: 1px;
    left: 1px;
}

/* --- Proximity Tag Sizing for 1x1 Buildings --- */
.placed-item[data-size="1"] .received-effect-overlay {
    min-width: 14px;
    height: 16px;
    font-size: 0.6rem;
    line-height: 0.8rem;
    top: 1px;
    left: 1px;
    border-width: 1px;
    padding: 0 2px;
}

.ground-effect {
    position: static;
    border: none;
    font-size: 1.25rem;
    opacity: 0.6;
    border-radius: 0;
    width: 100%;
    height: 100%;
}

.effect-shade { background-color: rgba(0, 0, 0, 0.6); color: white; text-shadow: 1px 1px 3px black; }
.effect-dirty { background-color: rgba(139, 69, 19, 0.6); color: white; text-shadow: 1px 1px 3px #441c03; }
.effect-salty { background-color: rgba(255, 255, 255, 0.7); color: #4b5563; text-shadow: 1px 1px 3px white; }
.effect-cold { background-color: rgba(56, 189, 248, 0.7); color: white; text-shadow: 1px 1px 3px #0369a1; }
.effect-water, .effect-water-drum { background-color: rgba(37, 99, 235, 0.7); color: white; text-shadow: 1px 1px 3px #1e40af; }
.effect-energy { background-color: rgba(253, 224, 71, 0.7); color: #422006; text-shadow: 1px 1px 3px #fde047; }
.effect-crude-oil { background-color: rgba(31, 41, 55, 0.8); color: #f3f4f6; text-shadow: 1px 1px 3px black; }
.effect-sandy { background-color: rgba(210, 180, 140, 0.7); color: #5d4037; text-shadow: 1px 1px 3px #f5e1cb; }


/* ========================================================================== */
/* 5. UI COMPONENTS                                                           */
/* ========================================================================== */

/* --- Buttons & Links --- */
.tab-button.active, .bg-indigo-600, .save-button, .add-stage-button, #see-simulation-btn, #search-builds-btn, #upload-builds-btn, .build-manager-btn.active, .needs-refresh, .themed-button-primary {
    background-color: var(--button-primary-bg) !important;
}

.hover\:bg-indigo-700:hover, .save-button:hover, .add-stage-button:hover, #see-simulation-btn:hover, #search-builds-btn:hover, #upload-builds-btn:hover, .needs-refresh:hover, .themed-button-primary:hover {
    background-color: var(--button-primary-hover) !important;
}

.themed-button-primary {
    color: var(--text-primary) !important;
    transition: background-color 0.2s;
}

/* Shadow theme needs dark text on yellow buttons */
body.theme-shadow .themed-button-primary,
body.theme-shadow .tab-button.active,
body.theme-shadow .bg-indigo-600,
body.theme-shadow .save-button,
body.theme-shadow .add-stage-button,
body.theme-shadow #see-simulation-btn,
body.theme-shadow #search-builds-btn,
body.theme-shadow #upload-builds-btn,
body.theme-shadow .build-manager-btn.active,
body.theme-shadow .needs-refresh,
body.theme-shadow #right-sidebar .tab-button.active,
body.theme-shadow .favorite-setter-btn.assigned,
body.theme-shadow .btn-primary,
body.theme-shadow #theme-apply-btn {
    color: #18181b !important;
}

.themed-button-secondary {
    background-color: var(--bg-tertiary);
}
.themed-button-secondary:hover {
    background-color: var(--button-primary-hover);
}

.themed-button-danger {
    background-color: #dc2626; /* red-600 */
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.themed-button-danger:hover {
    background-color: #b91c1c; /* red-700 */
}

.item-link {
    color: var(--text-accent);
    background: none;
    border: none;
    padding: 0;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}
.item-link:hover {
    text-decoration: underline;
}

.clear-slot-btn:hover,
.stage-delete-btn:hover {
    color: #ef4444 !important;
}

.needs-refresh {
    color: var(--text-primary) !important;
}

.door-selector {
    color: #e5e7eb; /* A light gray that works on all themes */
}

.vote-btn.upvoted i {
    color: var(--status-green);
}
.vote-btn.downvoted i {
    color: var(--status-red);
}

#details-delete-btn:hover,
.delete-comment-btn:hover {
    color: var(--delete-red-hover) !important;
}

.edit-comment-btn:hover {
    color: var(--button-primary-bg) !important;
}

/* --- Forms (Inputs, Selects, Checkboxes) --- */
select, input[type="text"], input[type="number"], textarea {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Override Tailwind focus ring colors to use theme accent */
select:focus, 
input[type="text"]:focus, 
input[type="number"]:focus, 
textarea:focus {
    outline: none !important;
    border-color: var(--button-primary-bg) !important;
    box-shadow: 0 0 0 2px var(--button-primary-bg) !important;
}

/* Glowing focus ring when glow feature is enabled */
body.custom-glow-enabled select:focus,
body.custom-glow-enabled input[type="text"]:focus,
body.custom-glow-enabled input[type="number"]:focus,
body.custom-glow-enabled textarea:focus,
body.theme-volcanic select:focus,
body.theme-volcanic input[type="text"]:focus,
body.theme-volcanic input[type="number"]:focus,
body.theme-volcanic textarea:focus,
body.theme-ocean select:focus,
body.theme-ocean input[type="text"]:focus,
body.theme-ocean input[type="number"]:focus,
body.theme-ocean textarea:focus,
body.theme-aurora select:focus,
body.theme-aurora input[type="text"]:focus,
body.theme-aurora input[type="number"]:focus,
body.theme-aurora textarea:focus {
    box-shadow: 0 0 0 2px var(--button-primary-bg),
                0 0 10px var(--button-primary-bg),
                0 0 20px rgba(var(--button-primary-bg-rgb, 6, 182, 212), 0.3) !important;
}

.themed-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0;
    -webkit-print-color-adjust: exact;
    color-adjust: exact;
    display: inline-block;
    vertical-align: middle;
    background-origin: border-box;
    user-select: none;
    flex-shrink: 0;
    height: 1rem;
    width: 1rem;
    border-radius: 0.25rem;
    border-width: 1px;
    border-color: var(--checkbox-unchecked-bg);
    background-color: var(--checkbox-unchecked-bg);
}
.themed-checkbox:checked {
    border-color: transparent;
    background-color: var(--button-primary-bg);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}
.themed-checkbox:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    --tw-ring-color: var(--button-primary-bg);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--tw-ring-color);
}
body.theme-light .themed-checkbox:not(:checked),
body.theme-sky .themed-checkbox:not(:checked),
body.theme-leaf .themed-checkbox:not(:checked),
body.theme-pink .themed-checkbox:not(:checked),
body.theme-sunset .themed-checkbox:not(:checked) {
    background-color: #4a5568 !important;
}


/* --- Item Palette & Previews --- */
.palette-item {
    position: relative;
    background-color: var(--bg-tertiary) !important;
    cursor: pointer;
    transition: box-shadow 0.2s;
    border: 2px solid transparent;
    padding: 2px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.palette-item.selected-item {
    border-color: transparent !important;
    box-shadow: 0 0 0 3px var(--selection-color, #facc15) !important;
}
.palette-item span {
    pointer-events: none;
}
.palette-item img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}
.palette-item.dimmed-secondary {
    opacity: 0.5;
    transition: opacity 0.2s ease-in-out;
}
.palette-item.dimmed-secondary:hover {
    opacity: 1.0; /* Fades in on hover */
}

.disabled-ui {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(1);
}

#selected-item-preview {
    position: absolute;
    bottom: 100%;
    left: 100%;
    width: 28px;
    height: 28px;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}
#selected-item-preview.hidden {
    display: none;
}

#preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

#preview-deselect-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(239, 68, 68, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    border-radius: 6px;
}
#selected-item-preview:hover #preview-deselect-overlay {
    opacity: 1;
}

.craft-icon-on-preview {
    position: absolute;
    width: 60%;
    height: 60%;
    left: 2px;
    bottom: 2px;
    z-index: 41;
    pointer-events: none;
    display: none;
}

/* --- Cards & Info Boxes (NFTs, Crafts) --- */
.nft-details-box {
    background-color: rgba(167, 139, 250, 0.1);
    border: 1px solid #6d28d9;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
}
.nft-badge-container {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}
.nft-icon-left {
    height: 4rem;
    width: 4rem;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: contain;
    margin-right: 0.75rem;
}
.nft-links-list {
    list-style-type: none;
    padding-left: 0;
    font-size: 0.875rem;
}
.nft-details-box .nft-links-list {
    margin-top: 0.75rem;
}
.nft-links-list a {
    color: #a78bfa;
    text-decoration: none;
    transition: color 0.2s;
}
.nft-links-list a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

.craft-card-header {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.craft-card-body {
    padding-left: 0rem;
}

.produced-item-card .pl-10 {
    padding-left: 0.5rem;
}
.produced-item-card > .flex.items-center {
    cursor: pointer;
}
.produced-item-card .pl-12 {
    padding-left: 0rem;
}

.build-slot.border-indigo-600 {
    border-color: #facc15 !important;
}

/* --- NFT Rarity Badge Colors --- */
.nft-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    color: #ffffff;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.nft-badge-common {
    background-color: #6b7280; /* Gray */
}
.nft-badge-uncommon {
    background-color: #22c55e; /* Green */
}
.nft-badge-rare {
    background-color: #3b82f6; /* Blue */
}
.nft-badge-epic {
    background-color: #a855f7; /* Purple */
}
.nft-badge-legendary {
    background-color: #eab308; /* Yellow/Gold */
}
.nft-badge-ancient {
    background-color: #ec4899; /* Pink */
}

/* --- NFT Details Box Styling --- */
.nft-details-box {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nft-details-box .nft-icon-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.nft-details-box .nft-icon-left {
    width: 3rem; /* Larger icon in details */
    height: 3rem;
    margin-right: 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nft-details-box .nft-badge {
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    color: #ffffff;
    background-color: rgba(0,0,0,0.3); /* Semi-transparent black for the 'NFT' text badge */
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Ensure text is readable over colored backgrounds */
.nft-details-box p,
.nft-details-box .nft-links-list li,
.nft-details-box .nft-links-list a {
    color: #ffffff !important; /* White text for better contrast */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7); /* Stronger shadow for readability */
}

.nft-details-box .nft-links-list {
    list-style: none;
    padding-left: 0;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.75rem;
}

.nft-details-box .nft-links-list li {
    margin-bottom: 0.25rem;
}

.nft-details-box .nft-links-list a {
    color: #a7f3d0; /* Light green for links */
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.nft-details-box .nft-links-list a:hover {
    text-decoration: underline;
}

.nft-details-box .nft-links-list a .fa-external-link-alt {
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

/* Background colors for the NFT details box itself */
.nft-details-box.nft-badge-common {
    background-color: rgba(75, 85, 99, 0.5); /* Darker Gray w/ opacity */
}
.nft-details-box.nft-badge-uncommon {
    background-color: rgba(21, 128, 61, 0.5); /* Darker Green w/ opacity */
}
.nft-details-box.nft-badge-rare {
    background-color: rgba(37, 99, 235, 0.5); /* Darker Blue w/ opacity */
}
.nft-details-box.nft-badge-epic {
    background-color: rgba(147, 51, 234, 0.5); /* Darker Purple w/ opacity */
}
.nft-details-box.nft-badge-legendary {
    background-color: rgba(180, 83, 9, 0.5); /* Darker Orange/Gold w/ opacity */
}
.nft-details-box.nft-badge-ancient {
    background-color: rgba(190, 24, 93, 0.5); /* Darker Pink w/ opacity */
}

body.theme-light .nft-details-box p,
body.theme-sky .nft-details-box p,
body.theme-leaf .nft-details-box p,
body.theme-pink .nft-details-box p,
body.theme-sunset .nft-details-box p,
body.theme-light .nft-details-box .nft-links-list li,
body.theme-sky .nft-details-box .nft-links-list li,
body.theme-leaf .nft-details-box .nft-links-list li,
body.theme-pink .nft-details-box .nft-links-list li,
body.theme-sunset .nft-details-box .nft-links-list li {
    color: #1f2937 !important; /* Dark text for light themes */
    text-shadow: none !important; /* Remove shadow on light themes */
}

body.theme-dark .nft-details-box .nft-links-list a,
body.theme-midnight .nft-details-box .nft-links-list a {
    color: #22d3ee !important; /* Light Cyan for links on dark themes */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7) !important;
}

/* Special handling for links on light themes */
body.theme-light .nft-details-box .nft-links-list a,
body.theme-sky .nft-details-box .nft-links-list a,
body.theme-leaf .nft-details-box .nft-links-list a,
body.theme-pink .nft-details-box .nft-links-list a,
body.theme-sunset .nft-details-box .nft-links-list a {
    color: #1e3a8a !important; /* Dark Blue for links on light bg */
    text-shadow: none !important;
}

/* Force the "NFT" badge text itself to be white or black based on theme */
body.theme-light .nft-details-box .nft-badge,
body.theme-sky .nft-details-box .nft-badge,
body.theme-leaf .nft-details-box .nft-badge,
body.theme-pink .nft-details-box .nft-badge,
body.theme-sunset .nft-details-box .nft-badge {
    color: #ffffff !important;
    background-color: rgba(0,0,0,0.4) !important;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.nft-info-top-right {
    position: absolute;
    top: 0.75rem; /* 12px */
    right: 1rem; /* 16px */
    text-align: right;
    pointer-events: none; /* Prevents it from blocking clicks */
}

.nft-info-top-right .info-line {
    font-size: 0.75rem; /* 12px */
    line-height: 1.25; /* Tighter line spacing */
    font-weight: 600;
    color: #ffffff !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Light theme overrides for new info */
body.theme-light .nft-info-top-right .info-line {
    color: #1f2937 !important; /* Dark text */
    text-shadow: none !important;
}

body.theme-sky .nft-info-top-right .info-line,
body.theme-leaf .nft-info-top-right .info-line,
body.theme-pink .nft-info-top-right .info-line,
body.theme-sunset .nft-info-top-right .info-line {
    color: #ffffff !important; /* White text on colored light themes */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7) !important;
}


/* --- Tags & Badges (Time, Status, Keys) --- */
.time-box {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    font-size: 0.75rem;
    margin-right: 4px;
    margin-bottom: 4px;
}
/* Force consistent colors for all themes */
.time-box-fast { background-color: #16a34a !important; }
.time-box-mid-fast { background-color: #facc15 !important; }
.time-box-mid-slow { background-color: #f97316 !important; }
.time-box-slow { background-color: #dc2626 !important; }
.time-box-single { background-color: #2563eb !important; }
.time-box-travel { background-color: #c026d3 !important; }
.time-box-penalty-ignored { background-color: #6b7280 !important; }

.craft-time-unaffected { background-color: #38bdf8 !important; }
.craft-time-fast { background-color: var(--status-green) !important; }
.craft-time-mid-fast { background-color: var(--status-yellow) !important; }
.craft-time-mid-slow { background-color: var(--status-orange) !important; }
.craft-time-slow { background-color: var(--status-red) !important; }

.highlighted-time-box {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
    border-radius: 4px;
}

.ownership-counter {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #e2e8f0;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    z-index: 1;
    border: 1px solid var(--border-color);
}
.ownership-counter.owned {
    background-color: var(--status-green);
    color: #1a202c;
}

.eth-tag {
    position: absolute;
    background-color: #3b82f6;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1;
    pointer-events: none;
}
.palette-item .eth-tag {
    top: 4px;
    left: 4px;
}
.effect-rarity-label .eth-tag {
    bottom: 4px;
    right: 4px;
}
.effect-rarity-item {
    position: relative;
}

.nft-badge-text {
    background-color: #6d28d9;
    color: #ffffff;
    padding: 4px 12px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9999px;
}

.key-box {
    display: inline-block;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    margin: 0 4px;
}

.privacy-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 9999px;
    font-weight: bold;
    margin-left: 8px;
    text-transform: uppercase;
}
.tag-public { background-color: #166534; color: #dcfce7; }
.tag-group { background-color: #1d4ed8; color: #dbeafe; }
.tag-exclusive { background-color: #7e22ce; color: #f3e8ff; }
.tag-private { background-color: #b45309; color: #fef3c7; }
.tag-team-dub { background-color: #1d4ed8; color: #dbeafe; }
.tag-dub-fam { background-color: #7e22ce; color: #f3e8ff; }
.tag-super-dub-club { background-color: #dc2626; color: #fee2e2; }

.tag-fast {
    background-color: #f61d1d; /* Red/Orange to match medal */
    color: white;
    border: 1px solid #b91c1c;
}

.tag-paid {
    background-color: #7c3aed;
    color: white;
    border: 1px solid #6d28d9;
}

.tag-closed {
    background-color: #dc2626;
    color: white;
    border: 1px solid #b91c1c;
}

.themed-button-secondary {
    background-color: var(--bg-tertiary); 
    border: 1px solid var(--border-color);
}
.themed-button-secondary:hover {
    background-color: var(--button-secondary-hover);
}

/* --- History & Favorites --- */
.history-item, .favorite-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.history-item:hover, .favorite-item:hover {
    background-color: var(--button-primary-hover);
}

.favorite-key-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background-color: var(--bg-primary);
}

.favorite-setter-btn {
    width: 2rem;
    height: 2rem;
    font-weight: 700;
    border-radius: 0.375rem;
    background-color: var(--bg-tertiary);
    transition: background-color 0.2s;
}

.favorite-setter-btn:hover {
    background-color: var(--bg-secondary);
}

.favorite-setter-btn.assigned {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* This animation will run once and stay at the end (faded in) */
    animation: toast-fade-in 0.5s ease forwards;
    /* This animation will wait 5s, then run once and stay at the end (faded out) */
    animation: toast-fade-in 0.5s ease forwards, toast-fade-out 0.5s ease 4.5s forwards;
    opacity: 0;
}

.toast.success {
    background-color: #22c55e !important; /* Green-500 */
    color: #ffffff !important;
    border: 1px solid #15803d !important; /* Green-700 Border */
}

.toast.error {
    background-color: #ef4444 !important; /* Red-500 */
    color: #ffffff !important;
    border: 1px solid #b91c1c !important; /* Red-700 Border */
}

.toast.warning {
    background-color: #eab308 !important; /* Yellow-500 */
    color: #ffffff !important;
    border: 1px solid #a16207 !important; /* Yellow-700 Border */
}

.toast.info {
    background-color: #3b82f6 !important; /* Blue-500 */
    color: #ffffff !important;
    border: 1px solid #1d4ed8 !important; /* Blue-700 Border */
}

#profile-token-balance-container {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

@keyframes toast-fade-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* --- Totals Tab Hover --- */
#grid-wrapper.dimmed > #grid-items-container > .placed-item,
#grid-wrapper.dimmed > #grid-background-cells > .grid-background-cell,
#grid-wrapper.dimmed > #grid-ground-effects-container {
    opacity: 0.5; /* Dim all buildings and the background */
    transition: opacity 1s ease-in-out;
}

.placed-item.total-hover-highlight {
    opacity: 1.0 !important; /* !important overrides the rule above, making it full brightness */
    position: relative; /* Lifts the item to a new stacking context */
    z-index: 99 !important;  /* Brings it on top of other dimmed items */
    outline: 3px solid var(--status-green) !important;
    outline-offset: 1px;
    box-shadow: 0 0 12px var(--status-green); /* Optional: Adds a nice glow */
}

.totals-list-item:hover {
    background-color: var(--bg-tertiary);
    cursor: pointer;
}

/* Admin Event Creator Theming */
.admin-creator-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    padding: 1rem;
}

.admin-creator-card label {
    color: var(--text-secondary);
}

.admin-creator-card input, 
.admin-creator-card select {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Save Indicator States */
.save-status-pending {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.save-status-saved {
    color: #4ade80;
    background-color: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.loading-status-active {
    color: #60a5fa; /* Blue-400 */
    background-color: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

/* ========================================================================== */
/* 6. SIDEBAR PANELS (LEFT & RIGHT)                                           */
/* ========================================================================== */

/* --- Left Sidebar (Calculator, Prediction, Tabs) --- */
#left-sidebar .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

#left-sidebar .bg-gray-700 {
    background-color: var(--bg-tertiary) !important;
}

#crafting-prediction-content.layout-reversed {
    flex-direction: column-reverse;
}

/* --- Right Sidebar (Tabs, Filters, Details Panels) --- */
#right-sidebar {
    background-color: var(--bg-primary) !important;
}

#details-panel,
#palette-selection-details {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

#right-sidebar .bg-gray-700 {
    background-color: var(--bg-tertiary) !important;
}

#right-sidebar .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
}

#right-sidebar .tab-button.active {
    background-color: var(--button-primary-bg) !important;
}

#right-sidebar .border-b,
#right-sidebar .border-t,
#right-sidebar .border-gray-700 {
    border-color: var(--border-color) !important;
}

/* --- Palette Layout --- */
/* NEW DEFAULT: 6 columns, text shrinks */
body:not(.legacy-palette-view) .palette-container > .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.25rem;
}

body:not(.legacy-palette-view) #right-sidebar:not(.right-panel-collapsed) .palette-item span {
    display: none;
}

body:not(.legacy-palette-view) #right-sidebar:not(.right-panel-collapsed) .palette-item img {
    width: 3rem;
    height: 3rem;
}

/* NEW OPT-IN: 4 columns, text always visible */
body.legacy-palette-view .palette-container > .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

/* --- Compact Palette Controls When Details Panel is Open --- */
/* This rule makes the container wrap its content */
#right-sidebar:not(.right-panel-collapsed) #building-filters {
    flex-wrap: wrap;
    justify-content: center;
}

/* This rule shrinks the buttons, prevents squishing, and sets the spacing */
#right-sidebar:not(.right-panel-collapsed) #building-filters button {
    width: 28px;
    height: 28px;
    flex-shrink: 0; /* Prevents horizontal squishing */
    margin: 12px !important; /* This is the key fix for spacing */
}

/* This rule shrinks the icons to fit the smaller buttons */
#right-sidebar:not(.right-panel-collapsed) #building-filters button i {
    font-size: 0.85rem;
}


/* ========================================================================== */
/* 7. MODALS (GENERAL THEMING)                                                */
/* ========================================================================== */

.border-gray-600, .border-gray-700 {
    border-color: var(--border-color) !important;
}

#simulation-modal-content,
#controls-modal-content,
#settings-modal-content {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

#settings-modal .bg-gray-800,
#notes-modal .bg-gray-800,
#effects-set-modal .bg-gray-800,
#clear-slot-modal .bg-gray-800,
#estimate-modal .bg-gray-800,
#effect-links-modal .bg-gray-800,
#auth-overlay .bg-gray-800,
#super-user-modal .bg-gray-800,
#keys-list-modal .bg-gray-800,
#search-builds-modal .bg-gray-800,
#upload-builds-modal .bg-gray-800,
#filter-modal .bg-gray-800,
#quick-apply-modal .bg-gray-800,
#name-sets-modal .bg-gray-800,
#profile-modal .bg-gray-800, 
#pfp-selector-modal .bg-gray-800,
#group-list-modal .bg-gray-800,
#edit-build-modal .bg-gray-800,
#build-details-modal .bg-gray-800,
#access-request-modal .bg-gray-800,
#edit-supporter-modal .bg-gray-800,
#articles-list-modal .bg-gray-800,
#article-details-modal .bg-gray-800,
#edit-article-modal .bg-gray-800,
#quick-buff-modal .bg-gray-800,
#diagnostics-modal .bg-gray-800,
#competition-modal .bg-gray-800,
#prize-pool-modal .bg-gray-800,
#join-tier-modal .bg-gray-800,
#leaderboard-modal .bg-gray-800,
#transactions-modal .bg-gray-800,
#withdrawals-list-modal .bg-gray-800,
#comp-rules-modal .bg-gray-800,
#event-details-modal .bg-gray-800,
#changelog-modal .bg-gray-800,
#update-available-modal .bg-gray-800,
#access-upgrade-modal .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

#simulation-modal-content .bg-gray-900,
#simulation-modal-content .bg-gray-700,
#estimate-modal .bg-gray-900,
#effect-links-modal .bg-gray-700,
#effect-links-modal .bg-gray-900,
#super-user-modal .bg-gray-700,
#keys-list-modal .bg-gray-700,
#keys-list-modal .bg-gray-900,
#search-builds-modal .bg-gray-700,
#upload-builds-modal .bg-gray-700,
#effects-set-modal .bg-gray-700,
#filter-modal .bg-gray-700,
#name-sets-modal .bg-gray-700,
#profile-modal .bg-gray-700, 
#pfp-selector-modal .bg-gray-700,
#group-list-modal .bg-gray-700,
#edit-build-modal .bg-gray-700,
#build-details-modal .bg-gray-700,
#build-details-modal .bg-gray-900,
#access-request-modal .bg-gray-700,
#edit-supporter-modal .bg-gray-700,
#articles-list-modal .bg-gray-700,
#articles-list-modal .bg-gray-900,
#article-details-modal .bg-gray-700,
#article-details-modal .bg-gray-900,
#edit-article-modal .bg-gray-700,
#competition-modal .bg-gray-700,
#competition-modal .bg-gray-900,
#prize-pool-modal .bg-gray-900,
#join-tier-modal .bg-gray-900,
#leaderboard-modal .bg-gray-900,
#transactions-modal .bg-gray-900,
#transactions-modal .bg-gray-900 th,
#withdrawals-list-modal .bg-gray-900,
#comp-rules-modal .bg-gray-900,
#event-details-modal .bg-gray-900,
#changelog-modal .bg-gray-700,
#changelog-modal .bg-gray-900,
#update-available-modal .bg-gray-700,
#update-available-modal .bg-gray-900,
#access-upgrade-modal .bg-gray-700,
#access-upgrade-modal .bg-gray-900 {
    background-color: var(--bg-tertiary) !important;
}

#quick-buff-modal .bg-gray-900 {
    background-color: var(--bg-primary) !important;
}

#simulation-modal-content h2,
#notes-modal h2,
#effects-set-modal h2,
#clear-slot-modal h2,
#changelog-modal h2,
#update-available-modal h2,
#access-upgrade-modal h2 {
    color: var(--text-primary) !important;
}

#simulation-log-container .border-gray-700 {
    border-color: var(--bg-secondary) !important;
}


/* ========================================================================== */
/* 8. MODALS (SPECIFIC LAYOUTS)                                               */
/* ========================================================================== */

/* --- Account & Profile Modals --- */
/* (This section includes styles formerly in section 9. PROFILE) */
.pfp-selector-item {
    background-color: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    padding: 0.5rem;
}

.pfp-selector-item:hover {
    background-color: var(--border-color);
}

.pfp-selector-item.selected {
    border-color: var(--button-primary-bg);
    transform: scale(1.05);
}

.pfp-selector-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.375rem;
}

/* --- Fix for Modal Theming on Non-Dark Themes --- */
body:not(.theme-dark) #profile-modal > div,
body:not(.theme-dark) #pfp-selector-modal > div {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

body:not(.theme-dark) #profile-modal .border-b,
body:not(.theme-dark) #pfp-selector-modal .border-b {
    border-color: var(--border-color);
}

body:not(.theme-dark) #profile-modal input,
body:not(.theme-dark) #profile-modal select {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body:not(.theme-dark) #pfp-grid-container {
    background-color: var(--bg-primary);
}

body:not(.theme-dark) .pfp-selector-item {
    background-color: var(--bg-secondary);
    border-color: transparent;
}

body:not(.theme-dark) .pfp-selector-item:hover {
    background-color: var(--bg-tertiary);
}

body:not(.theme-dark) .pfp-selector-item.selected {
    border-color: var(--button-primary-bg);
}

/* --- User Profile Modal Improvements --- */
#profile-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

#profile-modal .modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

#profile-modal .header-right-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#profile-modal .profile-main-info {
    display: flex;
    flex-direction: row; /* Ensure image and details are side-by-side */
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

#profile-modal .profile-details-left {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column; /* Stack username label, input group, and action buttons vertically */
    gap: 0.75rem; /* Space between username group and action buttons */
}

#profile-modal .input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Space between input and favorite item icon */
}

#profile-modal .input-group input {
    flex-grow: 1; /* Input field takes available space */
}

#profile-modal .profile-actions-bottom {
    display: flex; /* Make buttons side-by-side */
    gap: 0.75rem; /* Space between Change Picture and Save Username buttons */
    justify-content: flex-start; /* Align buttons to the left */
}

#profile-modal .input-group #profile-favorite-item-icon {
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

#profile-modal .profile-image-container {
    flex-shrink: 0;
    width: 96px;
    height: 96px;
}

#profile-modal .profile-image {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: contain; /* Prevents cropping */
    background-color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease-in-out;
}

#profile-modal .profile-image:hover {
    transform: scale(1.05);
}

#profile-modal .access-status-regular {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background-color: rgba(250, 204, 21, 0.1);
    color: var(--status-yellow);
    font-weight: 600;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

#profile-modal .access-status-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background-color: rgba(74, 222, 128, 0.1);
    color: var(--status-green);
    font-weight: 600;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Button Styling */
#profile-modal .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    cursor: pointer;
}

#profile-modal .btn-primary {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
    border: none;
}

#profile-modal .btn-primary:hover {
    background-color: var(--button-primary-hover);
}

#profile-modal .btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

#profile-modal .btn-secondary:hover {
    background-color: var(--border-color);
}

#profile-modal input[type="text"],
#profile-modal select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-primary);
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    line-height: 1.25;
}

#profile-modal input[type="text"]:focus,
#profile-modal select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-ring-color);
}

#profile-modal label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* --- Account Success Modal Theme --- */
#account-success-modal .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}
#account-success-modal .bg-gray-700 {
    background-color: var(--bg-tertiary) !important;
}

/* --- GC Verify Modal Theme --- */
#gc-verify-modal .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !Fimportant;
}
#gc-verify-modal .bg-gray-700 {
    background-color: var(--bg-tertiary) !important;
}
#gc-verify-modal .bg-gray-900 {
    background-color: var(--bg-primary) !important;
}
#gc-verify-modal .border-gray-600 {
    border-color: var(--border-color) !important;
}

/* --- Build Sharing & Manager Modals --- */
.privacy-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}
.privacy-btn:hover {
    background-color: var(--bg-secondary);
}
.privacy-btn.active {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
    border-color: var(--text-accent);
}

#upload-build-submit-btn.disabled,
#save-privacy-btn.disabled {
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    cursor: not-allowed;
    color: var(--text-secondary);
}
#upload-build-submit-btn.enabled,
#save-privacy-btn.enabled {
    background-color: #16a34a; /* green-600 */
    border: 2px solid #15803d;  /* green-700 */
    color: white;
}
#upload-build-submit-btn.enabled:hover,
#save-privacy-btn.enabled:hover {
    background-color: #15803d; /* green-700 */
}

.privacy-description {
    font-size: 0.875rem; /* text-sm */
    color: var(--text-secondary);
    min-height: 2.5rem; /* Prevents layout shift when text changes */
    padding: 0.5rem;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}

.comment-item {
    background-color: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 0.5rem;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.comment-body {
    padding-left: 2.5rem; /* Aligns with author name */
}

.build-notes-container h4 {
    color: var(--text-primary);
}

.build-notes-content {
    background-color: var(--bg-primary); /* Darker inlay */
    border: 1px solid var(--border-color);
    max-height: 150px; /* Gives it a max height and scrollbar */
    overflow-y: auto;
    white-space: pre-wrap; /* Respects newlines and wraps text */
    word-wrap: break-word;
    line-height: 1.5;
    color: var(--text-secondary);
}

.privacy-filter-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}
.privacy-filter-btn:hover {
    background-color: var(--bg-secondary);
}
.privacy-filter-btn.active {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
    border-color: var(--text-accent);
}

.build-upload-date {
    font-size: 0.7rem; /* text-xs */
    color: var(--text-secondary);
    opacity: 0.7;
}

.group-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-primary); /* Darker background for the item */
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.build-preview-container-inner {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

#build-preview-grid {
    display: grid;
    grid-template-columns: repeat(64, 1fr);
    grid-template-rows: repeat(64, 1fr);
    border: 2px solid var(--border-color);
    aspect-ratio: 1 / 1;
    position: relative;
    user-select: none; /* FIX: Prevents text/image selection */
    -webkit-user-select: none; /* Safari */
}

/* Biome background colors */
#build-preview-grid.plains { background-color: #a3c428; }
#build-preview-grid.forest { background-color: #6B8E23; }
#build-preview-grid.desert { background-color: #D2B48C; }

/* Grid Lines (Lowest layer) */
#build-preview-grid::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, #84a215 1px, transparent 1px),
        linear-gradient(to bottom, #84a215 1px, transparent 1px),
        linear-gradient(to right, #6a8213 2px, transparent 2px),
        linear-gradient(to bottom, #6a8213 2px, transparent 2px);
    background-size:
        calc(100% / 32) 100%,
        100% calc(100% / 32),
        calc(100% / 16) 100%,
        100% calc(100% / 16);
    z-index: 1; /* Grid lines at z-index 1 */
}

/* Building Preview Style (Green Blocks) */
.building-preview {
    width: 100%;
    height: 100%;
    background-color: #c7e155;
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #6a8213;
    box-sizing: border-box;
    grid-column: var(--grid-x) / span var(--grid-size);
    grid-row: var(--grid-y) / span var(--grid-size);
    position: relative;
    z-index: 3; /* Buildings are on top */
    pointer-events: auto; /* FIX: Re-enable pointer events for tooltips */
}

/* Craft Icon on Preview */
.building-preview .preview-craft-icon {
    position: absolute;
    width: 60%;
    height: 60%;
    left: 2px;
    bottom: 2px;
    z-index: 4; /* On top of the building image */
    pointer-events: none;
    -webkit-user-drag: none;
    image-rendering: pixelated;
}

/* Road Preview Style */
#build-preview-grid .road-preview {
    grid-column: var(--grid-x) / span var(--grid-size);
    grid-row: var(--grid-y) / span var(--grid-size);
    position: relative;
    box-sizing: border-box;
    z-index: 2; /* Roads are above grid lines, below buildings */
    pointer-events: none; /* FIX: Disable pointer events on roads */
}

#build-preview-grid .dirt-road {
    background-color: #ab987a;
    border-width: 2px;
    border-style: solid;
    border-color: #8a785a;
}

#build-preview-grid .paved-road {
    background-color: #6c757d;
    border-width: 2px;
    border-style: solid;
    border-color: #495057;
}

/* FIX: Road Connection Styles (Added specificity) */
#build-preview-grid .road-preview.no-t-border { border-top-width: 0; }
#build-preview-grid .road-preview.no-b-border { border-bottom-width: 0; }
#build-preview-grid .road-preview.no-l-border { border-left-width: 0; }
#build-preview-grid .road-preview.no-r-border { border-right-width: 0; }
#build-preview-grid .road-preview.no-tl-radius { border-top-left-radius: 0; }
#build-preview-grid .road-preview.no-tr-radius { border-top-right-radius: 0; }
#build-preview-grid .road-preview.no-bl-radius { border-bottom-left-radius: 0; }
#build-preview-grid .road-preview.no-br-radius { border-bottom-right-radius: 0; }


/* Biome Edge Preview Styles */
.biome-edge-preview {
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.7rem;
    border-radius: 4px;
    box-sizing: border-box;
}
.biome-edge-preview.top {
    top: 0;
    left: 20px;
    right: 20px;
    height: 20px;
}
.biome-edge-preview.bottom {
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 20px;
}
.biome-edge-preview.left {
    left: 0;
    top: 20px;
    bottom: 20px;
    width: 20px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}
.biome-edge-preview.right {
    right: 0;
    top: 20px;
    bottom: 20px;
    width: 20px;
    writing-mode: vertical-rl;
}

/* --- Build Preview Stage Navigation --- */
#build-preview-header button {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

#build-preview-header button:hover {
    background-color: var(--border-color);
}

#build-preview-header button:disabled {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

#preview-stage-name {
    color: var(--text-primary);
}

/* --- Calculator & Data Modals --- */
#quick-apply-modal .border-gray-700 {
    border-color: var(--border-color) !important;
}

#estimate-buildings-btn {
    background-color: var(--button-primary-bg);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background-color 0.2s;
}
#estimate-buildings-btn:hover {
    background-color: var(--button-primary-hover);
}
.estimate-table-header {
    display: grid;
    grid-template-columns: 2.5fr repeat(8, 1fr);
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}
.estimate-table-row {
    display: grid;
    grid-template-columns: 2.5fr repeat(8, 1fr);
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}
.estimate-table-row:last-child {
    border-bottom: none;
}
.estimate-table-row .font-semibold {
    text-align: right;
}
.estimate-table-row .time-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.estimate-table-row .time-tag.selected {
    border-color: var(--text-accent);
    box-shadow: 0 0 10px var(--text-accent);
}
.estimate-table-row .time-tag:not(.selected):hover {
    filter: brightness(120%);
}

.effect-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    align-items: center;
}
.effect-links-group {
    background-color: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 0.5rem;
}

#name-sets-modal .border-gray-700 {
    border-color: var(--border-color) !important;
}
#name-sets-modal input[type="text"] {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
#name-sets-modal #save-new-set-btn {
    background-color: var(--button-primary-bg) !important;
    color: var(--text-primary) !important;
}
#name-sets-modal #save-new-set-btn:hover {
    background-color: var(--button-primary-hover) !important;
}
#name-sets-list .name-set-item {
    background-color: var(--bg-primary) !important;
}
#name-sets-list .name-set-item.active {
    background-color: var(--button-primary-bg) !important;
    border-color: var(--text-accent) !important;
}
#name-sets-list .name-set-item.active span {
    color: var(--text-primary) !important;
}

/* --- Crafting Diagram --- */
#diagram-modal-content {
    background-color: var(--bg-secondary);
}
.diagram-container {
    display: inline-block;
    position: relative;
    padding: 2rem;
    white-space: nowrap;
}
.diagram-root {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}
.diagram-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    vertical-align: top;
    position: relative;
    padding: 0 0.5rem;
}
.diagram-children {
    display: flex;
    align-items: flex-start;
    padding-top: 3rem;
}
.diagram-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    min-width: 160px;
    z-index: 10;
    position: relative;
}
.diagram-node.is-leaf .diagram-item,
.diagram-node.is-duplicate .diagram-item {
    background-color: var(--bg-tertiary);
}
.diagram-node.is-duplicate .diagram-item {
    opacity: 0.7;
}
.item-main-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.item-quantity {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.item-icon-main {
    width: 32px;
    height: 32px;
}
.item-name {
    font-weight: 600;
    white-space: nowrap;
}
.item-building-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    height: 22px;
}
.item-building-info .time-tag {
    padding: 2px 6px;
    font-size: 0.7rem;
}
.item-building-info .building-icon {
    width: 20px;
    height: 20px;
}
.item-primary-resources {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 0.25rem;
    margin-top: 0.25rem;
    min-height: 24px;
}
.primary-resource {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.primary-resource-icon {
    width: 16px;
    height: 16px;
}
.primary-resource span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.diagram-svg-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}
.diagram-svg-overlay path {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 2px;
    stroke-linecap: round;
}

.diagram-item[data-category="Farm"] { border-color: #65a30d; }
.diagram-item[data-category="Ranch"] { border-color: #c2410c; }
.diagram-item[data-category="Industrial"] { border-color: #0369a1; }
.diagram-item[data-category="Terrain"] { border-color: #ca8a04; }
.diagram-item[data-category="Fishing"] { border-color: #0ea5e9; }
.diagram-item[data-category="Jewelry"] { border-color: #a21caf; }

body.theme-light .diagram-item[data-category="Farm"], body.theme-sky .diagram-item[data-category="Farm"], body.theme-leaf .diagram-item[data-category="Farm"], body.theme-pink .diagram-item[data-category="Farm"], body.theme-sunset .diagram-item[data-category="Farm"] { background-color: #f7fee7; }
body.theme-light .diagram-item[data-category="Ranch"], body.theme-sky .diagram-item[data-category="Ranch"], body.theme-leaf .diagram-item[data-category="Ranch"], body.theme-pink .diagram-item[data-category="Ranch"], body.theme-sunset .diagram-item[data-category="Ranch"] { background-color: #fff7ed; }
body.theme-light .diagram-item[data-category="Industrial"], body.theme-sky .diagram-item[data-category="Industrial"], body.theme-leaf .diagram-item[data-category="Industrial"], body.theme-pink .diagram-item[data-category="Industrial"], body.theme-sunset .diagram-item[data-category="Industrial"] { background-color: #f0f9ff; }
body.theme-light .diagram-item[data-category="Terrain"], body.theme-sky .diagram-item[data-category="Terrain"], body.theme-leaf .diagram-item[data-category="Terrain"], body.theme-pink .diagram-item[data-category="Terrain"], body.theme-sunset .diagram-item[data-category="Terrain"] { background-color: #fefce8; }
body.theme-light .diagram-item[data-category="Fishing"], body.theme-sky .diagram-item[data-category="Fishing"], body.theme-leaf .diagram-item[data-category="Fishing"], body.theme-pink .diagram-item[data-category="Fishing"], body.theme-sunset .diagram-item[data-category="Fishing"] { background-color: #eff6ff; }
body.theme-light .diagram-item[data-category="Jewelry"], body.theme-sky .diagram-item[data-category="Jewelry"], body.theme-leaf .diagram-item[data-category="Jewelry"], body.theme-pink .diagram-item[data-category="Jewelry"], body.theme-sunset .diagram-item[data-category="Jewelry"] { background-color: #fdf4ff; }

.diagram-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}
.legend-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-primary);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.legend-color-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* --- Article Modals --- */
.article-item.dynamic-article {
    border-left: 4px solid var(--button-primary-bg);
    transition: background-color 0.2s ease-in-out;
}
.article-item.dynamic-article:hover {
    background-color: var(--bg-secondary) !important;
}

#article-comments-header {
    transition: background-color 0.2s ease-in-out;
}
#article-comments-header:hover {
    background-color: var(--bg-tertiary) !important;
}

/* --- Admin Modals --- */
#super-user-modal { z-index: 60 !important; }
#keys-list-modal { z-index: 70 !important; }
#edit-supporter-modal { z-index: 80 !important; }

.toggle-access-btn {
    width: 80px; /* Fixed width */
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem; /* text-xs */
    padding: 4px 8px;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.toggle-access-btn.full {
    background-color: var(--status-green);
    color: var(--bg-primary); /* Dark text on light green */
    border: 1px solid #15803d; /* green-700 */
}

.toggle-access-btn.regular {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.toggle-access-btn:hover {
    filter: brightness(1.2);
}

.status-toggle-btn {
    width: 80px;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}
.status-toggle-btn.active {
    background-color: var(--status-green);
    color: var(--bg-primary);  
    border: 1px solid #15803d;
}
.status-toggle-btn.disabled {
    background-color: var(--status-red);
    color: white;
    border: 1px solid #991b1b;
}
.status-toggle-btn:hover {
    filter: brightness(1.2);
}

.new-request-tag {
    background-color: var(--status-green);
    color: var(--bg-primary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

#new-requests-toggle-btn.active {
    background-color: var(--button-primary-bg) !important;
    border-color: var(--button-primary-bg) !important;
}

/* --- Quick Buff Modal --- */
.quick-buff-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background-color: var(--bg-tertiary);
    border-radius: 0.375rem;
}
.quick-buff-item img {
    width: 2rem;
    height: 2rem;
    margin-right: 0.75rem;
}
.quick-buff-item .item-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    flex-grow: 1;
}
.quick-buff-item .item-count {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-primary);
    border-radius: 0.375rem;
}

/* --- Diagnostics Modal --- */
.diagnostic-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border-radius: 0.375rem; /* rounded-md */
    border-left-width: 4px;
    font-size: 0.875rem; /* text-sm */
}
.diagnostic-item .icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    margin-right: 12px;
    margin-top: 2px;
}
.diagnostic-item p {
    margin: 0;
    line-height: 1.4;
}

/* Critical (Red) */
.diagnostic-item.critical {
    background-color: rgba(239, 68, 68, 0.1); /* red-500/10 */
    border-left-color: var(--status-red);
}
.diagnostic-item.critical .icon {
    color: var(--status-red);
}

/* Warning (Yellow) */
.diagnostic-item.warning {
    background-color: rgba(234, 179, 8, 0.1); /* yellow-500/10 */
    border-left-color: var(--status-yellow);
}
.diagnostic-item.warning .icon {
    color: var(--status-yellow);
}

/* Recommendation (Green) */
.diagnostic-item.recommendation {
    background-color: rgba(34, 197, 94, 0.1); /* green-500/10 */
    border-left-color: var(--status-green);
}
.diagnostic-item.recommendation .icon {
    color: var(--status-green);
}

/* ========================================================================== */
/* 9. PAGE-SPECIFIC (LEADERBOARDS)                                            */
/* ========================================================================== */

#formatter-tool,
#my-rankings-tool,
#rankings-container .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
}

#my-rankings-tool h2,
#my-rankings-tool h3,
#my-rankings-tool .text-2xl {
    color: var(--text-accent);
}

#my-rankings-tool input[type="text"],
#rankings-container input[type="text"] {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

#my-rankings-tool #add-player-name-btn {
    background-color: var(--button-primary-bg) !important;
}

#my-rankings-tool #add-player-name-btn:hover {
    background-color: var(--button-primary-hover) !important;
}

#my-rankings-tool .bg-gray-800 {
    background-color: var(--bg-tertiary) !important;
}

#rankings-container h2,
#my-rankings-tool .font-semibold,
#my-rankings-tool .font-bold.text-lg {
    color: var(--text-primary);
}

#my-rankings-tool .text-gray-400 {
    color: var(--text-secondary) !important;
}

#rankings-container .border-gray-700,
#my-rankings-tool .border-gray-700 {
    border-color: var(--border-color) !important;
}

#formatter-tool input,
#formatter-tool textarea {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

#formatter-tool #convert-btn {
    background-color: var(--button-primary-bg) !important;
}
#formatter-tool #convert-btn:hover {
    background-color: var(--button-primary-hover) !important;
}
#formatter-tool pre {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
}

#competition-search-results {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color);
}
#competition-search-results .search-result {
    color: var(--text-primary);
}
#competition-search-results .search-result .text-gray-400 {
    color: var(--text-secondary);
}
#competition-search-results .search-result:hover {
    background-color: var(--button-primary-bg) !important;
    color: var(--text-primary);
}

#rankings-container table {
    border-collapse: collapse;
}
#rankings-container table th {
    color: var(--text-secondary);
    border-bottom-width: 2px;
    border-style: solid;
    border-color: var(--border-color);
}
#rankings-container table td {
    color: var(--text-primary);
    border-bottom-width: 1px;
    border-style: solid;
    border-color: var(--border-color);
}
#rankings-container table tbody tr:nth-child(even) {
    background-color: var(--bg-primary) !important;
}
body.theme-light #rankings-container table th, body.theme-light #rankings-container table td,
body.theme-sky #rankings-container table th, body.theme-sky #rankings-container table td,
body.theme-leaf #rankings-container table th, body.theme-leaf #rankings-container table td,
body.theme-pink #rankings-container table th, body.theme-pink #rankings-container table td,
body.theme-sunset #rankings-container table th, body.theme-sunset #rankings-container table td {
    border-color: #d1d5db !important;
}

.trend-arrow {
    font-weight: bold;
    margin-left: 8px;
}
.trend-up { color: var(--status-green); }
.trend-down { color: var(--status-red); }
.trend-same { color: var(--text-secondary); }

.activity-bar {
    display: inline-block;
    width: 40px;
    height: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-primary);
    margin-left: 8px;
    vertical-align: middle;
}
.activity-bar-fill {
    height: 100%;
    border-radius: 3px;
}
.activity-new { background-color: #f87171; }
.activity-novice { background-color: #f97316; }
.activity-active { background-color: #facc15; }
.activity-veteran { background-color: #4ade80; }
.activity-master { background-color: #3b82f6; }


/* ========================================================================== */
/* 10. SPECIAL MODES & UTILITIES                                              */
/* ========================================================================== */

/* --- "All Squares" Mode --- */
body.all-squares .placed-item,
body.all-squares .biome-edge,
body.all-squares #selected-item-preview,
body.all-squares #preview-deselect-overlay,
body.all-squares .grid-tool-btn,
body.all-squares .panel-tool-btn,
body.all-squares .grid-tool-panel,
body.all-squares .build-slot,
body.all-squares .bg-gray-800,
body.all-squares .tab-button,
body.all-squares .time-box,
body.all-squares .nft-badge,
body.all-squares .nft-details-box,
body.all-squares .build-manager-btn,
body.all-squares #biome-switcher {
    border-radius: 0 !important;
}
body.all-squares .received-effect-overlay {
    border-radius: 4px !important;
}

/* --- Collapsed Sidebars Mode --- */
body.sidebars-collapsed .received-effect-overlay,
body.sidebars-collapsed .ground-effect {
    opacity: 0.35;
    transition: opacity 0.3s ease-in-out;
}

/* --- Utility Classes --- */
.flex-grow {
    flex-grow: 1;
}
#calculator-results-container li {
    display: flex;
    align-items: center;
}
.text-theme-accent {
    color: var(--text-accent);
}
/* ========================================================================== */
/* ADAPTIVE STATUS COLORS (Fixes invisible text on Light Themes)              */
/* ========================================================================== */

/* --- BASE STYLES (Light / Sky / Leaf / Pink / Sunset) --- */
/* Use DARKER shades so they show up against white/light backgrounds */

.text-status-green {
    color: #15803d !important; /* Green-700 */
}
.text-status-red {
    color: #b91c1c !important; /* Red-700 */
}
.text-status-orange {
    color: #c2410c !important; /* Orange-700 */
}
.text-status-yellow {
    color: #a16207 !important; /* Yellow-700 (Dark Gold) */
}

/* --- DARK & MIDNIGHT OVERRIDES --- */
/* Use BRIGHTER shades so they pop against dark backgrounds */

body.theme-dark .text-status-green,
body.theme-midnight .text-status-green,
body.theme-shadow .text-status-green,
body.theme-volcanic .text-status-green,
body.theme-ocean .text-status-green,
body.theme-aurora .text-status-green {
    color: #4ade80 !important; /* Green-400 */
}

body.theme-dark .text-status-red,
body.theme-midnight .text-status-red,
body.theme-shadow .text-status-red,
body.theme-volcanic .text-status-red,
body.theme-ocean .text-status-red,
body.theme-aurora .text-status-red {
    color: #f87171 !important; /* Red-400 */
}

body.theme-dark .text-status-orange,
body.theme-midnight .text-status-orange,
body.theme-shadow .text-status-orange,
body.theme-volcanic .text-status-orange,
body.theme-ocean .text-status-orange,
body.theme-aurora .text-status-orange {
    color: #fb923c !important; /* Orange-400 */
}

body.theme-dark .text-status-yellow,
body.theme-midnight .text-status-yellow,
body.theme-shadow .text-status-yellow,
body.theme-volcanic .text-status-yellow,
body.theme-ocean .text-status-yellow,
body.theme-aurora .text-status-yellow {
    color: #facc15 !important; /* Yellow-400 */
}

.check-mode-percent {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border-width: 2px;
    border-style: solid;
    border-color: transparent;
}
.border-highlight-red { border-color: var(--status-red) !important; }
.border-highlight-green { border-color: var(--status-green) !important; }
.border-highlight-orange { border-color: var(--status-orange) !important; }
.border-highlight-yellow { border-color: var(--status-yellow) !important; }

/* --- Shortcode Images --- */
.inline-sc {
    display: inline-block;
    width: 1.25em; /* Scales with the font size of the text */
    height: 1.25em; /* Scales with the font size of the text */
    margin: 0 0.1em;
    vertical-align: text-bottom; /* Aligns the image with the bottom of the text */
}

/* --- Premium Feature Promo Block --- */
.full-access-feature-promo {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.full-access-feature-promo > div {
    display: flex;
    flex-direction: column;
}

.full-access-feature-promo h3 {
    color: var(--text-accent);
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-align: center;
}
.full-access-feature-promo p {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.4;
}
.full-access-feature-promo p:last-of-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}


/* ========================================================================== */
/* 11. RESPONSIVE SCALING                                                     */
/* ========================================================================== */

/* --- Header Breakpoints --- */
@media (max-width: 1300px) {
    .header-craft-time-colors-container {
        display: none;
    }
}
@media (max-width: 1150px) {
    .header-theme-selector-container {
        display: none;
    }
}
@media (max-width: 900px) {
    .header-overlay-selector-container {
        display: none;
    }
}
@media (max-width: 700px) {
    .header-view-size-container {
        display: none;
    }
}

/* --- Main UI Scaling Block --- */

/* Base states & transitions */
html {
    font-size: 16px;
}

#left-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* --- Right Sidebar Flex Layout & Base Sizes --- */
#right-sidebar {
    display: flex;
    transition: width 0.3s ease-in-out;
    width: 720px !important;
}

#palette-selection-container {
    flex-grow: 1; /* Allows this container to grow to fill space */
    min-width: 0; /* Prevents content overflow in flex items */
    display: flex;
    flex-direction: column;
}

#details-panel {
    flex-shrink: 0; /* Prevents this panel from shrinking when it's visible */
    transition: width 0.3s ease-in-out, padding 0.3s ease-in-out, border 0.3s ease-in-out;
}

/* Base rule for collapsed panel */
#details-panel.collapsed {
    width: 16px !important;
    padding-left: 0;
    padding-right: 0;
    border-left: none;
}

/* --- Responsive Sizing Rules --- */

/* Automatic Scaling */
@media (max-width: 2000px) {
    html:not([data-text-size]) { font-size: 15.5px; }
    html:not([data-text-size]) #left-sidebar:not(.collapsed) { width: 420px !important; }
    html:not([data-text-size]) #right-sidebar { width: 680px !important; }
    html:not([data-text-size]) #details-panel:not(.collapsed) { width: 260px !important; }
}
@media (max-width: 1800px) {
    html:not([data-text-size]) { font-size: 15px; }
    html:not([data-text-size]) #left-sidebar:not(.collapsed) { width: 410px !important; }
    html:not([data-text-size]) #right-sidebar { width: 640px !important; }
    html:not([data-text-size]) #details-panel:not(.collapsed) { width: 250px !important; }
}
@media (max-width: 1600px) {
    html:not([data-text-size]) { font-size: 14.5px; }
    html:not([data-text-size]) #left-sidebar:not(.collapsed) { width: 390px !important; }
    html:not([data-text-size]) #right-sidebar { width: 600px !important; }
    html:not([data-text-size]) #details-panel:not(.collapsed) { width: 240px !important; }
}
@media (max-width: 1440px) {
    html:not([data-text-size]) { font-size: 14px; }
    html:not([data-text-size]) #left-sidebar:not(.collapsed) { width: 380px !important; }
    html:not([data-text-size]) #right-sidebar { width: 570px !important; }
    html:not([data-text-size]) #details-panel:not(.collapsed) { width: 230px !important; }
}
@media (max-width: 1280px) {
    html:not([data-text-size]) { font-size: 13.5px; }
    html:not([data-text-size]) #left-sidebar:not(.collapsed) { width: 370px !important; }
    html:not([data-text-size]) #right-sidebar { width: 540px !important; }
    html:not([data-text-size]) #details-panel:not(.collapsed) { width: 220px !important; }
}
@media (max-width: 1120px) {
    html:not([data-text-size]) { font-size: 13px; }
    html:not([data-text-size]) #left-sidebar:not(.collapsed) { width: 360px !important; }
    html:not([data-text-size]) #right-sidebar { width: 510px !important; }
    html:not([data-text-size]) #details-panel:not(.collapsed) { width: 210px !important; }
}

/* Fixed Size Scaling */
html[data-text-size="16px"] { font-size: 16px; }

html[data-text-size="15.5px"] { font-size: 15.5px; }
html[data-text-size="15.5px"] #left-sidebar:not(.collapsed) { width: 420px !important; }
html[data-text-size="15.5px"] #right-sidebar { width: 680px !important; }
html[data-text-size="15.5px"] #details-panel:not(.collapsed) { width: 260px !important; }

html[data-text-size="15px"] { font-size: 15px; }
html[data-text-size="15px"] #left-sidebar:not(.collapsed) { width: 410px !important; }
html[data-text-size="15px"] #right-sidebar { width: 640px !important; }
html[data-text-size="15px"] #details-panel:not(.collapsed) { width: 250px !important; }

html[data-text-size="14.5px"] { font-size: 14.5px; }
html[data-text-size="14.5px"] #left-sidebar:not(.collapsed) { width: 390px !important; }
html[data-text-size="14.5px"] #right-sidebar { width: 600px !important; }
html[data-text-size="14.5px"] #details-panel:not(.collapsed) { width: 240px !important; }

html[data-text-size="14px"] { font-size: 14px; }
html[data-text-size="14px"] #left-sidebar:not(.collapsed) { width: 380px !important; }
html[data-text-size="14px"] #right-sidebar { width: 570px !important; }
html[data-text-size="14px"] #details-panel:not(.collapsed) { width: 230px !important; }

html[data-text-size="13.5px"] { font-size: 13.5px; }
html[data-text-size="13.5px"] #left-sidebar:not(.collapsed) { width: 370px !important; }
html[data-text-size="13.5px"] #right-sidebar { width: 540px !important; }
html[data-text-size="13.5px"] #details-panel:not(.collapsed) { width: 220px !important; }

html[data-text-size="13px"] { font-size: 13px; }
html[data-text-size="13px"] #left-sidebar:not(.collapsed) { width: 360px !important; }
html[data-text-size="13px"] #right-sidebar { width: 510px !important; }
html[data-text-size="13px"] #details-panel:not(.collapsed) { width: 210px !important; }

/* ========================================================================== */
/* 12. DESIGN COMPETITIONS                                                  */
/* ========================================================================== */

/* Competition Specific Styles */

/* The card for an individual event in the list */
.event-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: transform 0.2s;
}
.event-card:hover {
    border-color: var(--button-primary-bg);
}

/* Tier buttons inside the event card */
.tier-btn {
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    padding: 0.5rem;
    border-radius: 0.375rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.tier-btn:hover:not(:disabled) {
    background-color: var(--bg-secondary);
    border-color: var(--text-accent);
}
.tier-btn.joined {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: var(--status-green);
    color: var(--status-green);
    cursor: default;
}
.tier-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* HUD Styling */
#competition-hud {
    background: linear-gradient(to bottom, #1e1b4b, #111827);
}

/* Palette dimming for illegal items in competition */
.palette-item.comp-banned {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(100%);
}

/* Competition Mode Overrides */
.biome-edge.disabled-ui,
#biome-switcher.disabled-ui {
    filter: none !important;
    opacity: 1 !important;
    cursor: default !important;
    pointer-events: none !important;
    box-shadow: none;
}

.biome-edge.disabled-ui {
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Event Manager Theming */
.event-manager-card {
    background-color: var(--bg-secondary);
    border: 2px solid var(--button-primary-bg);
    color: var(--text-primary);
}

.event-manager-stat-box {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.themed-button-success {
    background-color: #16a34a;
    color: #ffffff !important;
    transition: background-color 0.2s;
}
.themed-button-success:hover {
    background-color: #15803d;
}

.themed-button-danger {
    background-color: #dc2626;
    color: #ffffff !important;
}
.themed-button-danger:hover {
    background-color: #b91c1c;
}

/* Competition Modal Styles */
.comp-address-box {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: monospace;
    padding: 0.5rem;
    border-radius: 0.375rem;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comp-header-balance {
    display: flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
}

/* Cost Badge for Competition NFTs */
.nft-cost-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 9999px;
    border: 1px solid #7f1d1d;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Gold "Prize" Button */
.themed-button-gold {
    background-color: #d97706;
    color: #ffffff !important;
    border: 1px solid #b45309;
    transition: background-color 0.2s;
}
.themed-button-gold:hover {
    background-color: #b45309;
}

.themed-button-gold i {
    color: #ffffff !important;
}

/* Transaction Amount Colors (Adaptive) */
.tx-amount-pos {
    color: #15803d !important;
    font-weight: 800;
}
.tx-amount-neg {
    color: #b91c1c !important;
    font-weight: 800;
}

body.theme-dark .tx-amount-pos,
body.theme-midnight .tx-amount-pos,
body.theme-shadow .tx-amount-pos,
body.theme-volcanic .tx-amount-pos,
body.theme-ocean .tx-amount-pos,
body.theme-aurora .tx-amount-pos {
    color: #4ade80 !important;
}
body.theme-dark .tx-amount-neg,
body.theme-midnight .tx-amount-neg,
body.theme-shadow .tx-amount-neg,
body.theme-volcanic .tx-amount-neg,
body.theme-ocean .tx-amount-neg,
body.theme-aurora .tx-amount-neg {
    color: #f87171 !important;
}

/* --- Medal Hall of Fame Overrides --- */
#medal-leaderboard-modal .bg-gray-900 {
    background-color: #111827 !important;
    border-color: #374151 !important;
}

.medal-tab-btn {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #374151 !important;
    transition: all 0.2s ease-in-out;
}

.medal-tab-btn:hover {
    background-color: #1f2937 !important;
    cursor: pointer;
}

.medal-tab-btn.active {
    background-color: #374151 !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

#medal-leaderboard-modal .bg-gray-800 {
    background-color: var(--bg-secondary) !important;
}

/* ========================================================================== */
/* 13. BIOME GRID LINE CORRECTIONS (Subtle Fix)                               */
/* ========================================================================== */

/* --- PLAINS BIOME (Standard Green) --- */
/* Force 64x64 lines to match the 32x32 color style for uniformity */
.grid-background-cell.plains.line-right-64 {
    border-right-color: rgba(0, 0, 0, 0.2) !important;
}
.grid-background-cell.plains.line-bottom-64 {
    border-bottom-color: rgba(0, 0, 0, 0.2) !important;
}


/* --- FOREST BIOME (Dark Green) --- */

/* 1. Base 16x16 Lines: DARKER Black (Stronger structure) */
.grid-background-cell.forest.line-right-16 {
    border-right-color: rgba(0, 0, 0, 0.6) !important;
}
.grid-background-cell.forest.line-bottom-16 {
    border-bottom-color: rgba(0, 0, 0, 0.6) !important;
}

/* 2. Sub-grid Lines (32/64): LIGHTER Black (Subtle detail) */
.grid-background-cell.forest.line-right-32,
.grid-background-cell.forest.line-right-64 {
    border-right-color: rgba(0, 0, 0, 0.25) !important;
}
.grid-background-cell.forest.line-bottom-32,
.grid-background-cell.forest.line-bottom-64 {
    border-bottom-color: rgba(0, 0, 0, 0.25) !important;
}


/* --- DESERT BIOME (Bright Yellow) --- */

/* 1. Base 16x16 Lines: DARKER Brown (Stronger structure) */
.grid-background-cell.desert.line-right-16 {
    border-right-color: rgba(80, 50, 20, 0.45) !important;
}
.grid-background-cell.desert.line-bottom-16 {
    border-bottom-color: rgba(80, 50, 20, 0.45) !important;
}

/* 2. Sub-grid Lines (32/64): LIGHTER Brown (Subtle detail) */
.grid-background-cell.desert.line-right-32,
.grid-background-cell.desert.line-right-64 {
    border-right-color: rgba(80, 50, 20, 0.15) !important;
}
.grid-background-cell.desert.line-bottom-32,
.grid-background-cell.desert.line-bottom-64 {
    border-bottom-color: rgba(80, 50, 20, 0.15) !important;
}

/* ========================================================================== */
/* 14. MAIN BIOME SELECTION PANEL                                             */
/* ========================================================================== */

.biome-main-option-btn {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    border: 2px solid transparent;
}

.biome-main-option-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.biome-main-option-btn.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* ========================================================================== */
/* 15. THEME SELECTION PANEL                                                  */
/* ========================================================================== */

.theme-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px;
    border-radius: 8px;
    border: 2px solid transparent;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-preset-btn:hover {
    border-color: var(--text-accent);
    transform: scale(1.05);
}

.theme-preset-btn.selected {
    border-color: var(--button-primary-bg);
    box-shadow: 0 0 12px var(--button-primary-bg);
}

.preset-swatch {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    margin-bottom: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* Add a subtle shine effect */
.preset-swatch::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.preset-swatch.custom-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(from 0deg, #f87171, #fbbf24, #34d399, #22d3ee, #818cf8, #e879f9, #f87171);
    color: white;
    font-size: 1.2rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.preset-swatch.custom-indicator::after {
    display: none;
}

/* Pulsing glow animation for premium themes */
@keyframes premium-glow {
    0%, 100% { 
        box-shadow: 
            0 4px 6px rgba(0, 0, 0, 0.3),
            0 1px 3px rgba(0, 0, 0, 0.2),
            inset 0 2px 4px rgba(255, 255, 255, 0.1),
            0 0 8px var(--glow-color, rgba(251, 191, 36, 0.4));
    }
    50% { 
        box-shadow: 
            0 4px 6px rgba(0, 0, 0, 0.3),
            0 1px 3px rgba(0, 0, 0, 0.2),
            inset 0 2px 4px rgba(255, 255, 255, 0.1),
            0 0 20px var(--glow-color, rgba(251, 191, 36, 0.7)),
            0 0 30px var(--glow-color, rgba(251, 191, 36, 0.4));
    }
}

.theme-preset-btn.premium .preset-swatch {
    animation: premium-glow 2s ease-in-out infinite;
}

/* Volcanic - red/orange glow */
.theme-preset-btn.premium .volcanic-swatch {
    --glow-color: rgba(239, 68, 68, 0.5);
}

/* Ocean - blue glow */
.theme-preset-btn.premium .ocean-swatch {
    --glow-color: rgba(56, 189, 248, 0.5);
}

/* Aurora/Night Glow - green glow */
.theme-preset-btn.premium .nightglow-swatch {
    --glow-color: rgba(34, 197, 94, 0.5);
}

/* Custom - rainbow glow */
.theme-preset-btn.premium .custom-indicator {
    --glow-color: rgba(168, 85, 247, 0.5);
}

/* Custom theme glow effect on modals */
@keyframes modal-glow-pulse {
    0%, 100% { 
        box-shadow: 0 0 15px var(--button-primary-bg),
                    0 0 30px rgba(var(--button-primary-bg-rgb, 6, 182, 212), 0.3);
    }
    50% { 
        box-shadow: 0 0 25px var(--button-primary-bg),
                    0 0 50px var(--button-primary-bg),
                    0 0 70px rgba(var(--button-primary-bg-rgb, 6, 182, 212), 0.4);
    }
}

/* Apply glow to all modal content divs when custom glow is enabled */
/* Targets direct children of modal overlays that have rounded-lg class */
body.custom-glow-enabled [id$="-modal"]:not(.hidden) > .rounded-lg,
body.custom-glow-enabled [id$="-modal"]:not(.hidden) > [id$="-content"],
body.custom-glow-enabled #theme-panel:not(.hidden) {
    animation: modal-glow-pulse 2.5s ease-in-out infinite;
}

/* Premium themes get modal glow by default */
body.theme-volcanic [id$="-modal"]:not(.hidden) > .rounded-lg,
body.theme-volcanic [id$="-modal"]:not(.hidden) > [id$="-content"],
body.theme-volcanic #theme-panel:not(.hidden),
body.theme-ocean [id$="-modal"]:not(.hidden) > .rounded-lg,
body.theme-ocean [id$="-modal"]:not(.hidden) > [id$="-content"],
body.theme-ocean #theme-panel:not(.hidden),
body.theme-aurora [id$="-modal"]:not(.hidden) > .rounded-lg,
body.theme-aurora [id$="-modal"]:not(.hidden) > [id$="-content"],
body.theme-aurora #theme-panel:not(.hidden) {
    animation: modal-glow-pulse 2.5s ease-in-out infinite;
}

/* Set selection color to theme color when glow is enabled */
body.custom-glow-enabled,
body.theme-volcanic,
body.theme-ocean,
body.theme-aurora {
    --selection-color: var(--button-primary-bg);
}

/* Selected item glow - applies to palette and grid selections */
@keyframes selection-glow-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 3px var(--button-primary-bg),
                    0 0 8px var(--button-primary-bg);
    }
    50% { 
        box-shadow: 0 0 0 3px var(--button-primary-bg),
                    0 0 15px var(--button-primary-bg),
                    0 0 25px rgba(var(--button-primary-bg-rgb, 6, 182, 212), 0.5);
    }
}

/* Glowing selection for palette items */
body.custom-glow-enabled .palette-item.selected-item,
body.theme-volcanic .palette-item.selected-item,
body.theme-ocean .palette-item.selected-item,
body.theme-aurora .palette-item.selected-item {
    border-color: transparent !important;
    animation: selection-glow-pulse 2s ease-in-out infinite;
}

/* Glowing selection for grid items */
body.custom-glow-enabled .placed-item.selected-on-grid,
body.theme-volcanic .placed-item.selected-on-grid,
body.theme-ocean .placed-item.selected-on-grid,
body.theme-aurora .placed-item.selected-on-grid {
    outline: none;
    animation: selection-glow-pulse 2s ease-in-out infinite;
}

/* body.theme-custom base - variables set via JS */
body.theme-custom {
    /* Variables are applied via JavaScript */
}

/* Disable transitions during theme switching to prevent lag */
body.theme-switching,
body.theme-switching * {
    transition: none !important;
}

/* Hover helper class for close buttons */
.hover-text-primary:hover {
    color: var(--text-primary) !important;
}

/* Custom Tooltip Styles */
#custom-tooltip {
    position: fixed;
    z-index: 10000;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
    max-width: 300px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: pre-wrap;
}

#custom-tooltip.visible {
    opacity: 1;
}

#custom-tooltip::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    transform: rotate(45deg);
}

#custom-tooltip.tooltip-bottom::before {
    top: -5px;
    left: 50%;
    margin-left: -4px;
}

#custom-tooltip.tooltip-top::before {
    bottom: -5px;
    left: 50%;
    margin-left: -4px;
    transform: rotate(225deg);
}

#custom-tooltip.tooltip-left::before {
    right: -5px;
    top: 50%;
    margin-top: -4px;
    transform: rotate(135deg);
}

#custom-tooltip.tooltip-right::before {
    left: -5px;
    top: 50%;
    margin-top: -4px;
    transform: rotate(-45deg);
}

.preset-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

/* Premium theme button styling */
.theme-preset-btn.premium {
    position: relative;
}

.theme-preset-btn.premium.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.theme-preset-btn.premium.locked::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    color: #f59e0b;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 4px;
    border-radius: 3px;
}

.theme-preset-btn.premium.locked:hover {
    transform: none;
    box-shadow: none;
}

.theme-preset-btn.premium .preset-swatch {
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(251, 191, 36, 0.2);
}

/* Theme option btn (alternative class) */
.theme-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    background-color: var(--bg-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-option-btn:hover {
    border-color: var(--border-color);
    transform: scale(1.03);
}

.theme-option-btn.selected {
    border-color: var(--button-primary-bg);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.theme-swatch {
    width: 100%;
    height: 32px;
    border-radius: 0.375rem;
    margin-bottom: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================================
   RECENT COMPETITION BUTTONS (Leaderboards Page)
   ========================================================================== */

.recent-comp-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.recent-comp-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-accent);
}

.recent-comp-btn span:last-child {
    color: var(--text-secondary);
}

/* ==========================================================================
   LEADERBOARD ROW STYLING (Leaderboards Page)
   ========================================================================== */

.leaderboard-row {
    color: var(--text-primary);
}

.leaderboard-row:hover {
    background-color: var(--bg-tertiary) !important;
}

/* Current user highlighting */
.leaderboard-row.current-user-row {
    background-color: var(--button-primary-bg);
    border-left: 3px solid var(--text-accent);
    position: relative;
}

.leaderboard-row.current-user-row::before {
    content: '\f005';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-accent);
}

.leaderboard-row.current-user-row:hover {
    background-color: var(--button-primary-hover) !important;
}