
        :root {
            --primary: #6366f1;
            --primary-hover: #818cf8;
            --success: #10b981;
            --success-hover: #34d399;
            --bg: #000000;
            --surface: #0a0a0a;
            --input-bg: #121212;
            --text-main: #f1f5f9;
            --text-muted: #94a3b8;
            --border: #27272a;
            --border-focus: #818cf8;
            --radius: 12px;
            --radius-sm: 8px;
            --shadow-md: 0 4px 24px -1px rgba(0, 0, 0, 0.8);
        }

        body { 
            font-family: 'Inter', system-ui, -apple-system, sans-serif; 
            padding: 2rem; 
            max-width: 1200px; 
            margin: 0 auto; 
            line-height: 1.6; 
            background: var(--bg); 
            color: var(--text-main); 
        }

        /* Custom Scrollbar for Dark Mode */
        ::-webkit-scrollbar { width: 8px; height: 8px; }
        ::-webkit-scrollbar-track { background: var(--bg); }
        ::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: #52525b; }

        h2, h3 { color: var(--text-main); margin-top: 0; font-weight: 600; letter-spacing: -0.025em; }
        h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
        h3 { font-size: 1.25rem; margin-bottom: 1rem; }

        .card { 
            background: var(--surface); 
            padding: 2rem; 
            border-radius: var(--radius); 
            box-shadow: var(--shadow-md); 
            margin-bottom: 2rem; 
            border: 1px solid var(--border);
        }

        .form-group { margin-bottom: 1.5rem; }
        
        label { 
            display: block; 
            font-weight: 500; 
            margin-bottom: 0.5rem; 
            color: var(--text-main);
            font-size: 0.95rem;
        }

        input[type="text"], input[type="file"], textarea { 
            width: 100%; 
            padding: 0.75rem 1rem; 
            border: 1px solid var(--border); 
            border-radius: var(--radius-sm); 
            box-sizing: border-box; 
            font-family: inherit;
            font-size: 0.95rem;
            transition: all 0.2s ease;
            background-color: var(--input-bg);
            color: var(--text-main);
        }

        input[type="text"]:focus, textarea:focus {
            outline: none;
            border-color: var(--border-focus);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        }

        input[type="file"]::file-selector-button {
            background: #18181b;
            border: 1px solid var(--border);
            padding: 0.5rem 1rem;
            border-radius: var(--radius-sm);
            color: var(--text-main);
            cursor: pointer;
            font-weight: 500;
            margin-right: 1rem;
            transition: background 0.2s;
        }

        input[type="file"]::file-selector-button:hover { background: #27272a; }

        .or-divider { 
            display: flex; 
            align-items: center; 
            text-align: center; 
            color: var(--text-muted); 
            font-size: 0.875rem; 
            font-weight: 500; 
            margin: 1.5rem 0; 
        }
        
        .or-divider::before, .or-divider::after {
            content: '';
            flex: 1;
            border-bottom: 1px solid var(--border);
        }
        
        .or-divider:not(:empty)::before { margin-right: 1rem; }
        .or-divider:not(:empty)::after { margin-left: 1rem; }

        button { 
            background: var(--primary); 
            color: white; 
            border: none; 
            padding: 0.75rem 1.5rem; 
            border-radius: var(--radius-sm); 
            cursor: pointer; 
            font-weight: 600; 
            font-size: 0.95rem;
            margin-right: 0.75rem; 
            margin-bottom: 0.75rem;
            transition: background 0.2s, transform 0.1s;
        }

        button:hover { background: var(--primary-hover); transform: translateY(-1px); }
        button:active { transform: translateY(0); }
        button:disabled { background: #3f3f46; color: #a1a1aa; cursor: not-allowed; transform: none; }
        
        #downloadBtn { background: var(--success); display: none; }
        #downloadBtn:hover { background: var(--success-hover); }
        
        .btn-sort {
            background: var(--input-bg);
            color: var(--text-main);
            border: 1px solid var(--border);
            padding: 0.5rem 1rem;
            font-size: 0.875rem;
            margin-bottom: 1rem;
        }
        .btn-sort:hover { background: #27272a; border-color: #3f3f46; }

        #log { 
            background: #050505; 
            color: #34d399; 
            padding: 1rem; 
            border-radius: var(--radius-sm); 
            height: 120px; 
            overflow-y: auto; 
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; 
            font-size: 0.875rem; 
            margin-top: 1.5rem;
            border: 1px solid #18181b;
        }

        .table-container { 
            overflow-x: auto; 
            margin-bottom: 2rem; 
            background: var(--surface); 
            border-radius: var(--radius); 
            box-shadow: var(--shadow-md); 
            max-height: 500px;
            border: 1px solid var(--border);
        }

        table { 
            width: 100%; 
            border-collapse: collapse; 
            font-size: 0.875rem; 
            white-space: nowrap; 
        }

        th, td { 
            border-bottom: 1px solid var(--border); 
            padding: 0.75rem 1rem; 
            text-align: left; 
        }

        th { 
            background-color: #111111; 
            font-weight: 600; 
            color: var(--text-main);
            position: sticky; 
            top: 0; 
            z-index: 10;
            box-shadow: 0 1px 0 var(--border);
        }

        tr:last-child td { border-bottom: none; }
        tr:hover td { background-color: #18181b; }

        .diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
        @media(max-width: 800px) { .diff-grid { grid-template-columns: 1fr; } }
        
        .diff-positive { color: #34d399; font-weight: 600; }
        .diff-negative { color: #f87171; font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
        .stats-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin-bottom: 1.5rem; }
        .stats-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 1.5rem; }
        @media(max-width: 800px) { 
            .stats-grid, .stats-grid-2, .stats-grid-3 { grid-template-columns: 1fr; } 
        }

        .stat-list { list-style: none; padding: 0; margin: 0; }
        .stat-list li {
            display: flex;
            justify-content: space-between;
            padding: 0.5rem 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.9rem;
        }
        .stat-list li:last-child { border-bottom: none; }
        .stat-list li span:first-child { color: var(--text-main); }
        .stat-list li span:last-child { color: var(--text-muted); font-weight: 600; }
        .stat-list li[title] { cursor: help; }

.hist-container { display: flex; align-items: flex-end; gap: 0.25rem; height: 140px; margin-top: 1rem; padding-bottom: 1.5rem; justify-content: space-between; }
                .hist-col { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; height: 100%; justify-content: flex-end; position: relative; }
.hist-bar-track { width: 100%; max-width: 20px; background: var(--input-bg); border-radius: 4px; display: flex; align-items: flex-end; overflow: hidden; border: 1px solid var(--border); height: 100%; }
        .hist-container-decade .hist-bar-track { max-width: 34px; }
        .hist-bar-fill { width: 100%; background: var(--primary); transition: height 0.3s ease; }
        .hist-label { font-size: 0.65rem; color: var(--text-main); position: absolute; bottom: -1.25rem; white-space: nowrap; transform: translateX(-50%); left: 50%; }
        .hist-count { font-size: 0.7rem; color: var(--text-main); margin-bottom: 0.2rem; }

        .search-grid {
            display: grid; 
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
            gap: 1.5rem; 
            margin-bottom: 1.5rem; 
        }

        .search-hint { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; margin-top: -1rem; }

        .checkbox-group { 
            display: flex; 
            align-items: center; 
            gap: 0.75rem; 
            background: var(--input-bg);
            padding: 0.75rem 1rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            width: fit-content;
        }

                .checkbox-group label { margin: 0; font-weight: 500; cursor: pointer; color: var(--text-main); }
        .checkbox-group input[type="checkbox"] { 
            width: 1.25rem; 
            height: 1.25rem; 
            accent-color: var(--primary);
            cursor: pointer;
            background-color: var(--input-bg);
            border: 1px solid var(--border);
        }

        select#searchYearFrom, select#searchYearTo {
            width: 100%;
            padding: 0.75rem 1rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            box-sizing: border-box;
            font-family: inherit;
            font-size: 0.95rem;
            background-color: var(--input-bg);
            color: var(--text-main);
        }

        .year-range-row { display: flex; gap: 0.5rem; align-items: center; }
        .year-range-row span { color: var(--text-muted); }

        .field-exact-row { margin-top: 0.5rem; }

        .genre-field {
            width: 100%;
            min-height: 2.75rem;
            padding: 0.5rem 0.75rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            box-sizing: border-box;
            background-color: var(--input-bg);
            color: var(--text-main);
            cursor: pointer;
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            align-items: center;
        }

        .genre-dropdown {
            display: none;
            position: absolute;
            z-index: 20;
            left: 0;
            right: 0;
            margin-top: 0.5rem;
            background: var(--input-bg);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 0.75rem;
            max-height: 220px;
            overflow-y: auto;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .genre-chip {
            padding: 0.35rem 0.75rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: #18181b;
            color: var(--text-main);
            font-size: 0.85rem;
            cursor: pointer;
            user-select: none;
        }
        .genre-chip.selected { background: var(--primary); border-color: var(--primary); color: white; }

        .genre-tag {
            padding: 0.25rem 0.6rem;
            border-radius: 999px;
            background: var(--primary);
            color: white;
            font-size: 0.8rem;
            cursor: pointer;
        }

        #resultCount { font-weight: 600; color: var(--text-main); margin-top: 1rem; }

        .paste-field {
            padding: 0.3rem 0.65rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: #18181b;
            color: var(--text-main);
            font-size: 0.8rem;
            cursor: pointer;
            user-select: none;
        }
        .paste-field.active { background: var(--primary); border-color: var(--primary); color: white; }
        .paste-field.inactive { text-decoration: line-through; opacity: 0.5; }
        .paste-field.locked { cursor: default; opacity: 0.85; }

        .stat-block-head { display: flex; align-items: center; justify-content: space-between; margin: 1.25rem 0 0.5rem; }
        .stat-block-head h3 { margin: 0; }
        .stat-view-toggle { padding: 0.2rem 0.55rem; font-size: 0.75rem; }
        .stat-pie-wrap { display: flex; align-items: center; gap: 1rem; }
        .stat-pie { width: 110px; height: 110px; border-radius: 50%; flex-shrink: 0; }
        .stat-pie path, .stat-pie circle { cursor: help; }
        .stat-pie-legend { list-style: none; padding: 0; margin: 0; font-size: 0.8rem; }
        .stat-pie-legend li { display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0; color: var(--text-main); }
.stat-pie-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
        
        /* Auth & Modal Styles */
        .auth-header { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 15px; align-items: center; }
        .auth-btn { padding: 8px 16px; border: none; border-radius: var(--radius-sm); font-weight: bold; cursor: pointer; font-size: 0.9rem;}
        .btn-login { background: var(--primary); color: white; }
        .btn-signup { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
        .btn-logout { background: #d32f2f; color: white; display: none; }
        #user-email-display { color: var(--primary); font-weight: bold; margin-right: 15px; display: none; }

        .modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
        .modal-backdrop.active { opacity: 1; pointer-events: auto; }
        .modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 400px; padding: 30px; box-sizing: border-box; box-shadow: var(--shadow-md); transform: scale(0.9); transition: transform 0.3s ease; position: relative; }
        .modal-backdrop.active .modal-card { transform: scale(1); }
        .close-modal { position: absolute; top: 15px; right: 20px; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; padding: 0; margin: 0; }
        .close-modal:hover { color: var(--text-main); }
        .modal-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 25px; }
        .tab-btn { flex: 1; background: none; border: none; color: var(--text-muted); padding: 12px; font-size: 1rem; font-weight: bold; cursor: pointer; border-bottom: 2px solid transparent; margin: 0; }
        .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
        .input-group { margin-bottom: 20px; text-align: left; }
        .input-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-muted); }
        .input-group input { width: 100%; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--input-bg); color: var(--text-main); box-sizing: border-box; font-size: 1rem; }
        .input-group input:focus { outline: none; border-color: var(--border-focus); }
        .modal-submit-btn { width: 100%; margin-top: 10px; background: var(--primary); color: white; padding: 12px; border: none; border-radius: var(--radius-sm); font-weight: bold; cursor: pointer; }
        .auth-message { margin-top: 20px; font-size: 0.9rem; min-height: 20px; text-align: center; }
        .error { color: #f87171; }
        .success { color: #34d399; }
        .kofi-footer { text-align: center; margin: 2rem 0 1rem 0; padding-top: 1.5rem; border-top: 1px solid var(--border); }
        .kofi-footer img { height: 108px; border: none; vertical-align: middle; border:1px solid #008000}
