/* =========================================
   1. BASE LAYOUT & CORE UI
   ========================================= */
body { 
    margin: 0; 
    padding: 50px 20px 20px 20px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    min-height: 100vh; 
    overflow-x: hidden; 
    transition: background 0.3s, color 0.3s; 
    font-family: 'Inter', sans-serif; 
    background-color: #0B0F19; 
    background-image: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%), 
                      radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 25%); 
    color: #f8fafc; 
}

button, input, select, textarea {
    font-family: inherit;
}

body::-webkit-scrollbar { width: 10px; height: 10px; } 
body::-webkit-scrollbar-track { background: #0B0F19; } 
body::-webkit-scrollbar-thumb { background: #334155; border-radius: 5px; }

/* --- EARLY ACCESS BANNER --- */
.alpha-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    text-align: center;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 9999;
    box-sizing: border-box;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

.alpha-banner strong {
    font-weight: 800;
}

h1 { 
    text-align: center; 
    margin-bottom: 20px; 
    font-family: 'Poppins', sans-serif; 
    font-weight: 800; 
    background: linear-gradient(135deg, #fff, #94a3b8); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
}

.header-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%; 
    max-width: 1200px; 
    margin-bottom: 20px; 
    flex-wrap: wrap; 
    gap: 10px; 
}

.categories { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
}

.settings-group { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    width: 100%; /* Ensures it spans the full width for left/right alignment */
}

/* --- Main Layout Modes --- */
.main-container { 
    display: flex; 
    width: 100%; 
    max-width: 1200px; 
    gap: 20px; 
    transition: all 0.3s ease; 
}

.main-container.layout-bottom { 
    flex-direction: column; 
    align-items: center; 
}

.main-container.layout-bottom .tier-board, 
.main-container.layout-bottom .controls { 
    width: 100%; 
    max-width: 1200px; 
}

.main-container.layout-right { 
    flex-direction: row; 
    align-items: flex-start; 
    justify-content: center; 
}

.main-container.layout-right .tier-board { 
    flex: 3; 
    min-width: 600px; 
}

.main-container.layout-right .controls { 
    flex: 1; 
    min-width: 300px; 
    position: sticky; 
    top: 20px; 
    margin-top: 0; 
    max-height: calc(100vh - 40px); 
    overflow-y: auto; 
}

/* --- Buttons & Hover States --- */
.category-btn { 
    background: rgba(255, 255, 255, 0.05); 
    color: #94a3b8; 
    border: 1px solid rgba(255,255,255,0.08); 
    border-radius: 30px; 
    padding: 10px 20px;
    font-family: 'Inter', sans-serif; 
    font-weight: bold;
    backdrop-filter: blur(10px); 
    transition: all 0.3s ease;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.category-btn.active { 
    background: linear-gradient(135deg, #6366f1, #8b5cf6); 
    color: white; 
    border: none; 
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.5); 
}

.settings-btn { 
    background: rgba(30, 41, 59, 0.7); 
    color: white;
    border: 1px solid rgba(255,255,255,0.08); 
    border-radius: 8px; 
    padding: 0 15px; /* Adjusted to match action buttons */
    height: 38px; /* Locks it to the exact same height as the Share button */
    font-weight: 500; 
    font-size: 0.85rem; 
    width: auto; /* Removes the hardcoded width! */
    white-space: nowrap; /* Prevents text from ever wrapping to a second line */
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button.action-btn { 
    padding: 10px 15px; 
    height: 38px;
    color: white;
    font-weight: bold;
    background: linear-gradient(135deg, #10b981, #059669); 
    border: none;
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); 
    transition: all 0.3s ease;
}

button.action-btn:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

/* --- New Share Button Styling (Glowing Purple) --- */
.share-action-btn { 
    padding: 10px 15px; 
    height: 38px;
    color: white;
    font-weight: bold;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); 
    border: none;
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); 
    transition: all 0.3s ease;
    cursor: pointer;
}

.share-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.6); 
}

/* --- Layout Group to push buttons to the right --- */
.primary-actions-group {
    margin-left: auto; 
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#exit-screenshot-btn { 
    display: none; 
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    z-index: 1000; 
    background-color: #ff4444; 
    color: white; 
    border: none; 
    padding: 15px 25px; 
    border-radius: 30px; 
    font-weight: bold; 
    cursor: pointer; 
}

body.screenshot-mode #exit-screenshot-btn { display: block; }

/* --- Tier Board Elements --- */
.tier-board { 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    gap: 2px; 
    box-sizing: border-box; 
    background: rgba(20, 25, 35, 0.6); 
    backdrop-filter: blur(12px); 
    border-radius: 16px; 
    border: 1px solid rgba(255,255,255,0.08); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

.tier-row { 
    display: flex; 
    background: rgba(0, 0, 0, 0.2); 
    min-height: 85px; 
}

/* Base styles shared by ALL labels (Strict unified width!) */
.tier-label {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    
    /* The Magic: A single, locked width so the column is perfectly straight */
    width: 100px; 
    min-width: 100px; 
    
    z-index: 2;
    box-sizing: border-box;
    text-align: center;
}

/* Font size for standard 1-3 letters (Your exact original design) */
.short-label {
    font-weight: 800;
    font-size: 1.8rem;
    word-break: break-all; 
    overflow-wrap: break-word;
}

/* Font size and wrapping ONLY for long custom words */
.long-label {
    font-weight: 800;
    font-size: 0.85rem; 
    padding: 5px;
    line-height: 1.2;
    word-break: normal;
    overflow-wrap: anywhere;
}

.tier-items { 
    flex-grow: 1; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    padding: 10px; 
    min-height: 50px; 
}

.S { background: linear-gradient(135deg, #ff4b4b, #ff007f); } 
.A { background: linear-gradient(135deg, #ff8c00, #ff003c); } 
.B { background: linear-gradient(135deg, #ffd700, #ff8c00); } 
.C { background: linear-gradient(135deg, #00b09b, #96c93d); } 
.D { background: linear-gradient(135deg, #2193b0, #6dd5ed); } 
.E { background: linear-gradient(135deg, #8E2DE2, #4A00E0); } 
.F { background: linear-gradient(135deg, #434343, #000000); }

/* --- Individual Items --- */
.item { 
    width: 110px; 
    height: 150px; 
    background-size: cover; 
    background-position: center; 
    display: flex; 
    align-items: flex-end; 
    justify-content: center; 
    user-select: none; 
    position: relative; 
    box-sizing: border-box; 
    cursor: pointer; 
    border-radius: 8px; 
    border: 1px solid #000; 
    background-clip: padding-box; 
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 
                inset 1px 0 0 rgba(255, 255, 255, 0.05), 
                inset -1px 0 0 rgba(255, 255, 255, 0.05), 
                inset 0 -1px 0 #000, 
                0 6px 12px rgba(0, 0, 0, 0.4); 
    transition: top 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s, width 0.2s, height 0.2s; 
    overflow: hidden; 
    background-color: #1e293b; 
    -webkit-mask-image: -webkit-radial-gradient(white, black); 
    backface-visibility: hidden; 
    top: 0; 
}

.item:hover { 
    top: -4px; 
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 
                inset 1px 0 0 rgba(255, 255, 255, 0.1), 
                inset -1px 0 0 rgba(255, 255, 255, 0.1), 
                inset 0 -1px 0 #000, 
                0 10px 25px rgba(0, 0, 0, 0.6); 
}

.item-label { 
    width: 100%; 
    text-align: center; 
    box-sizing: border-box; 
    word-wrap: break-word; 
    pointer-events: none; 
    color: white; 
    font-size: 0.75rem; 
    background: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.8) 40%, transparent 100%); 
    font-weight: 500; 
    padding: 15px 4px 6px 4px; 
    border-radius: 0 0 7px 7px; 
    margin-bottom: -1px; 
    transition: opacity 0.2s ease; 
}

.delete-btn { 
    position: absolute; 
    display: none; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.5); 
    color: white; 
    border-radius: 50%; 
    top: 4px; 
    right: 4px; 
    background: rgba(239, 68, 68, 0.9); 
    opacity: 0; 
    backdrop-filter: blur(4px); 
    font-size: 10px; 
    width: 20px; 
    height: 20px; 
    transition: opacity 0.2s ease;
}

.item:hover .delete-btn { 
    display: flex; 
    opacity: 1; 
}

/* --- Search & Controls --- */
.controls { 
    padding: 20px; 
    background: rgba(20, 25, 35, 0.6); 
    backdrop-filter: blur(12px); 
    border: 1px solid rgba(255,255,255,0.08); 
    border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    box-sizing: border-box; /* THE FIX: Keeps the edges perfectly flush with the board above it! */
}

.controls h3 { 
    font-family: 'Poppins', sans-serif; 
    font-weight: 600; 
    color: #e2e8f0; 
    margin-top: 0; 
}

.controls h4 { 
    font-family: 'Poppins', sans-serif; 
    color: #94a3b8; 
}

.search-bar { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
    align-items: flex-start; 
    flex-wrap: wrap; 
}

.search-wrapper { 
    position: relative; 
    flex-grow: 1; 
    min-width: 200px; 
}

input[type="text"], 
input[type="email"], 
input[type="password"] { 
    width: 100%; 
    padding: 10px; 
    box-sizing: border-box; 
    background: rgba(15, 23, 42, 0.6); 
    border: 1px solid #334155; 
    border-radius: 8px; 
    font-family: 'Inter', sans-serif; 
    outline: none;
    color: white;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus { 
    border-color: #6366f1; 
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); 
}

.autocomplete-dropdown { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    max-height: 300px; 
    overflow-y: auto; 
    z-index: 100; 
    display: none; 
    background: #1e293b; 
    border: 1px solid #334155; 
    border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); 
}

.suggestion-item { 
    display: flex; 
    align-items: center; 
    padding: 10px 15px; 
    cursor: pointer; 
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05); 
}

.suggestion-item:hover { 
    background: #334155; 
}

.suggestion-item img { 
    width: 45px; 
    height: 60px; 
    object-fit: cover; 
    border-radius: 4px; 
    margin: 0; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.suggestion-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.suggestion-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.1;
}

.suggestion-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94a3b8; 
}

.suggestion-badge {
    background: rgba(99, 102, 241, 0.15); 
    color: #818cf8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid rgba(99, 102, 241, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unranked-pool { 
    min-height: 160px; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    align-content: flex-start; 
    border: 2px dashed #475569; 
    border-radius: 12px; 
    background: rgba(0,0,0,0.1); 
    padding: 15px; 
}

/* --- Modals --- */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 10000; 
    display: none; 
    align-items: center; 
    justify-content: center; 
    background: rgba(11, 15, 25, 0.85); 
    backdrop-filter: blur(8px); 
    animation: overlayFadeIn 0.3s ease-out forwards; 
}

.modal-content { 
    display: flex; 
    gap: 30px; 
    max-width: 800px; 
    width: 90%; 
    position: relative; 
    background: rgba(30, 41, 59, 0.95); 
    border: 1px solid rgba(255,255,255,0.08); 
    border-radius: 16px; 
    padding: 35px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.7); 
    animation: modalSpringUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards; 
    
    max-height: 90vh; 
    overflow-y: auto; 
}

.close-modal-btn { 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    font-size: 1.5rem; 
    color: #aaa; 
    cursor: pointer; 
    font-weight: bold; 
    transition: color 0.2s, transform 0.2s;
}

.close-modal-btn:hover {
    color: #ef4444;
    transform: scale(1.2) rotate(90deg);
}

.modal-left img { 
    width: 250px; 
    max-width: 100%; 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.5); 
}

.modal-right { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}

.modal-title { 
    margin: 0 0 10px 0; 
    font-family: 'Poppins', sans-serif; 
    font-size: 2.2rem; 
    font-weight: 800; 
    color: #f8fafc; 
    line-height: 1.1; 
}

.modal-meta { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 20px; 
    color: #ccc; 
    font-size: 0.9rem; 
    flex-wrap: wrap; 
}

.meta-tag { 
    background: #334155; 
    border-radius: 6px; 
    font-weight: 600; 
    color: #e2e8f0; 
    padding: 6px 12px; 
}

.score-tag { 
    color: white; 
    background: linear-gradient(135deg, #10b981, #059669); 
}

.modal-desc { 
    overflow-y: auto; 
    max-height: 35vh; 
    line-height: 1.6; 
    padding-right: 10px; 
    color: #cbd5e1; 
    font-size: 1.05rem; 
}

.modal-desc::-webkit-scrollbar { width: 8px; } 
.modal-desc::-webkit-scrollbar-track { background: #333; border-radius: 4px; } 
.modal-desc::-webkit-scrollbar-thumb { background: #666; border-radius: 4px; }

/* --- Preferences & States --- */
body.size-small .item { width: 80px; height: 80px; }
body.labels-off .item-label { display: none; }
body.labels-hover .item-label { opacity: 0; }
body.labels-hover .item:hover .item-label { opacity: 1; }

body.screenshot-mode { 
    background-color: #0B0F19; 
    padding: 40px 20px; 
    justify-content: flex-start; 
    min-height: 100vh; 
}

body.screenshot-mode .header-bar, 
body.screenshot-mode .controls, 
body.screenshot-mode h1, 
body.screenshot-mode .delete-btn,
body.screenshot-mode .alpha-banner,
body.screenshot-mode .site-header, 
body.screenshot-mode .site-footer { 
    display: none !important; 
}

/* =========================================
   HEADER & NAVIGATION
   ========================================= */
.site-header {
    width: 100%;
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 30px;
    z-index: 100;
}

.header-content {
    max-width: 1200px; 
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    transition: transform 0.2s;
}

.site-logo:hover {
    transform: scale(1.02);
}

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

.nav-link {
    background: none;
    border: none;
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 8px 12px;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #fff;
}

/* Auth Pill Buttons */
.auth-btn {
    background: rgba(30, 41, 59, 0.7);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.auth-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: #818cf8;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.signup-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
}

.signup-btn:hover {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fff;
    border-color: #ef4444;
}

/* =========================================
   FOOTER
   ========================================= */
.site-footer {
    width: 100%;
    margin-top: auto; 
    padding: 40px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

/* =========================================
   ABOUT US MODAL
   ========================================= */
.about-content {
    max-width: 90%; 
    width: 850px; 
    padding: 40px;
    max-height: 85vh;
    overflow-y: auto;
}

.about-content::-webkit-scrollbar { width: 8px; } 
.about-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; } 
.about-content::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

.about-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

@media (min-width: 768px) {
    .about-grid {
        flex-direction: row;
    }
    .about-left {
        flex: 1;
        padding-right: 30px;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }
    .about-right {
        flex: 1;
        padding-left: 10px;
    }
}

.about-text {
    font-size: 1.05rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 15px;
}

.about-subtitle {
    color: #f8fafc;
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-family: 'Poppins', sans-serif;
}

.about-contact-box {
    margin-top: 30px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.about-email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.about-email-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* --- Attribution List --- */
.attribution-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.attr-item {
    background: rgba(15, 23, 42, 0.4);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.attr-header {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.attr-desc {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 10px;
    line-height: 1.4;
}

.attr-link {
    display: inline-block;
    transition: transform 0.2s;
}

.attr-link:hover {
    transform: translateY(-2px);
}

.css-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    font-family: 'Inter', sans-serif;
}

.badge-igdb { background-color: #9146FF; color: white; }
.badge-jikan { background-color: #2e51a2; color: white; }
.badge-google { background-color: #ffffff; color: #5f6368; border: 1px solid #dadce0; font-weight: 600; }

.auth-content { 
    flex-direction: column; 
    max-width: 400px; 
    align-items: center; 
    text-align: center; 
}

.auth-input { 
    width: 100%; 
    padding: 12px; 
    margin-bottom: 15px; 
    box-sizing: border-box; 
    font-size: 1rem; 
}

.auth-submit-btn { 
    width: 100%; 
    height: 45px; 
    font-size: 1.1rem; 
    margin-top: 10px; 
}

.auth-switch { 
    margin-top: 20px; 
    color: #aaa; 
    font-size: 0.9rem; 
}

.auth-switch span { 
    cursor: pointer; 
    font-weight: bold; 
    color: #6366f1; 
}

.auth-switch span:hover { text-decoration: underline; }

.auth-error {
    color: #fca5a5;
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-error::before { content: '⚠️'; }

/* --- SORTABLE JS DRAG FIXES --- */
.item.dragging { 
    border: 2px dashed #6366f1; 
    opacity: 0.6; 
}

.sortable-drag { 
    cursor: grabbing !important; 
    z-index: 9999 !important; 
}

body.is-dragging .item:hover { 
    top: 0 !important; 
    transform: translateY(0px) scale(1) translateZ(0) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 
                inset 1px 0 0 rgba(255, 255, 255, 0.05), 
                inset -1px 0 0 rgba(255, 255, 255, 0.05), 
                inset 0 -1px 0 #000, 
                0 6px 12px rgba(0, 0, 0, 0.4) !important;
}

body.is-dragging .delete-btn { display: none !important; opacity: 0 !important; }

/* --- Animations --- */
@keyframes overlayFadeIn { 
    from { opacity: 0; backdrop-filter: blur(0px); } 
    to { opacity: 1; backdrop-filter: blur(8px); } 
}

@keyframes modalSpringUp { 
    from { transform: scale(0.9) translateY(30px); opacity: 0; } 
    to { transform: scale(1) translateY(0); opacity: 1; } 
}

/* --- DUPLICATE ITEM HIGHLIGHT ANIMATION --- */
@keyframes pulseGlow {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); z-index: 50; }
    100% { transform: scale(1); }
}

.item.highlight-glow {
    animation: pulseGlow 2s ease-out !important;
}

/* =========================================
   2. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    body { padding: 85px 10px 10px 10px; }

    .alpha-banner {
        font-size: 0.75rem;
        padding: 10px;
    }

    h1 { font-size: 2rem; margin-bottom: 15px; }
    
    .header-bar { 
        flex-direction: column; 
        align-items: stretch; 
        margin-bottom: 15px; 
    }
    
    .settings-group { justify-content: center; }
    
    /* Pushes actions to center on mobile so it doesn't break */
    .primary-actions-group {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    #layout-toggle-btn { display: none !important; }
    
    .settings-btn { 
        width: auto; 
        flex-grow: 1; 
    }
    
    .main-container.layout-right { flex-direction: column; }
    
    .main-container.layout-right .tier-board, 
    .main-container.layout-right .controls { 
        min-width: 100%; 
        width: 100%; 
        position: static; 
        max-height: none; 
    }
    
    .item { width: 75px; height: 110px; }
    
    .item-label { 
        font-size: 0.65rem; 
        padding: 10px 2px 4px 2px; 
    }
    
    .tier-label { 
        width: 55px; 
        font-size: 1.2rem; 
    }
    
    .tier-row { min-height: 60px; }
    .tier-items { gap: 8px; padding: 8px; }
    
    .modal-content { 
        padding: 25px 20px;
        flex-direction: column; 
        align-items: center; 
        text-align: center; 
    }

    .top-auth-container {
        position: static;
        justify-content: center;
        margin-bottom: 15px;
    }
}

.disable-transitions,
.disable-transitions * {
    transition: none !important;
}

/* =========================================
   EDIT TIERS MODAL UI
   ========================================= */
.tier-editor-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
}

.tier-edit-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(15, 23, 42, 0.4);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tier-edit-input {
    flex: 1;
    min-width: 120px;
    width: 100%;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid #334155 !important;
    color: white;
    font-weight: bold;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    font-size: 1.1rem;
    padding: 8px !important;
    box-sizing: border-box; 
}

.tier-swatch-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; 
    gap: 10px; 
    padding: 4px; 
    width: 100%;
    box-sizing: border-box; 
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, outline 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    outline: 2px solid transparent; 
    outline-offset: 2px;
}

.color-swatch.active {
    outline-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.color-swatch:hover {
    transform: scale(1.15);
}

.edit-tiers-content {
    display: flex;
    flex-direction: column;
    gap: 10px; 
}

.tier-editor-list::-webkit-scrollbar { width: 6px; } 
.tier-editor-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; } 
.tier-editor-list::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

details.tier-info-banner {
    display: block; 
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 12px 15px;
    margin-top: 15px;
}

details.tier-info-banner summary {
    cursor: pointer;
    font-weight: 600;
    color: #e2e8f0;
    outline: none;
    list-style: none; 
}

details.tier-info-banner summary::-webkit-details-marker { display: none; }

details.tier-info-banner p {
    margin-top: 10px;
    margin-bottom: 0;
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.5;
    padding-left: 25px; 
}

/* =========================================
   SHARE MODAL UI
   ========================================= */
.share-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 450px; 
    width: 90%;
    gap: 15px;
}

.share-modal-content .modal-title {
    margin-bottom: 5px;
    width: 100%;
    text-align: center;
}

.share-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.share-view p {
    color: #cbd5e1;
    margin-bottom: 20px;
    line-height: 1.5;
}

.share-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.visibility-toggle-group {
    display: flex;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.vis-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.vis-btn.active {
    background: #6366f1;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.share-link-box {
    display: flex;
    width: 100%;
    gap: 10px;
    background: rgba(15, 23, 42, 0.6);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

#share-link-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-family: monospace;
    font-size: 0.95rem;
    outline: none;
    min-width: 0; 
}

/* =========================================
   READ-ONLY UI & CTA BANNER
   ========================================= */

/* The new subtitle that replaces the settings row */
.shared-list-title {
    width: 100%;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #f8fafc;
}

.shared-list-title span {
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* The Box-Sizing fix prevents the mobile bleed! */
.shared-cta-banner {
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding: 40px 20px;
    text-align: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: overlayFadeIn 0.8s ease-out forwards;
    box-sizing: border-box; 
}

.cta-banner-title {
    margin: 0 0 10px 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    color: #f8fafc;
}

.cta-banner-text {
    margin: 0 0 20px 0;
    color: #cbd5e1;
    font-size: 1.05rem;
}

.cta-btn-large {
    font-size: 1.1rem;
    padding: 12px 30px;
    height: auto; /* Overrides the standard 38px height for a beefier CTA */
}

@media (max-width: 768px) {
    .shared-cta-banner {
        margin: 20px auto;
        padding: 30px 15px;
    }
    .cta-banner-title {
        font-size: 1.4rem;
    }
    .shared-list-title {
        font-size: 1.3rem;
    }
}

/* =========================================
   LEGAL PAGES (ToS & Privacy)
   ========================================= */
.legal-container {
    width: 100%;
    max-width: 800px; /* Optimal reading width */
    margin: 0 auto 40px auto;
    padding: 40px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    box-sizing: border-box;
    color: #cbd5e1;
    line-height: 1.6;
}

.legal-date {
    color: #94a3b8;
    margin-bottom: 30px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.legal-section {
    margin-bottom: 30px;
}

.legal-section h2 {
    font-family: 'Poppins', sans-serif;
    color: #f8fafc;
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.legal-section ul {
    padding-left: 20px;
    margin-top: 10px;
}

.legal-section li {
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .legal-container {
        padding: 25px 20px;
        margin-top: 20px;
    }
}

/* --- Auth Modal Legal Text --- */
.auth-legal-text {
    font-size: 0.8rem;
    color: #94a3b8;
    /* Changed from: margin: 5px 0 20px 0; */
    /* Negative top margin pulls it closer to the title. 12px bottom leaves just enough room for the first input. */
    margin: -25px 0 0px 0; 
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

/* Keep the link styles exactly as they are */
.auth-legal-text a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-legal-text a:hover {
    color: #a78bfa;
    text-decoration: underline;
}