/* CSS Variables for Dark Mode */
:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-tertiary: #6c757d;
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --success-color: #28a745;
    --success-hover: #218838;
    --error-color: #dc3545;
    --warn-color: #ffc107;
    --draft-color: var(--text-tertiary);
    --draft-bg: var(--bg-tertiary);
    --modal-overlay: rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e9ecef;
    --text-secondary: #ced4da;
    --text-tertiary: #adb5bd;
    --border-color: #495057;
    --border-light: #3a3a3a;
    --accent-color: #4a9eff;
    --accent-hover: #357abd;
    --success-color: #51cf66;
    --success-hover: #40c057;
    --error-color: #ff6b6b;
    --draft-color: var(--text-tertiary);
    --draft-bg: var(--bg-tertiary);
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 5px 15px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

/* Base App Styles */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
}

/* Version Update Notification Bar */
.update-notification-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 20px;
    background-color: var(--warn-color);
    color: #333;
    font-weight: 600;
    text-align: center;
    z-index: 9998;
    box-shadow: var(--shadow-md);
}
.update-notification-bar.is-visible {
    display: block;
}
body.update-banner-visible {
    padding-top: 45px; /* Adjust body to account for banner height */
}
.update-refresh-btn {
    padding: 4px 12px;
    font-weight: 600;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-left: 15px;
    cursor: pointer;
    transition: all 0.2s;
}
.update-refresh-btn:hover {
    background-color: var(--bg-tertiary);
}


/* --- Toast Notification Styles --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}
body.update-banner-visible .toast-container {
    top: 65px; /* Move toasts down when banner is visible */
}

.toast {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-color);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
}

.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--error-color); }
.toast-icon { font-size: 1.5rem; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.toast-message { font-size: 0.9rem; color: var(--text-secondary); }
.toast-close { cursor: pointer; opacity: 0.5; font-size: 1.2rem; padding: 0; background: none; border: none; color: var(--text-primary); }
.toast-close:hover { opacity: 1; }
@keyframes slideInRight { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(400px); opacity: 0; } }
.toast.hiding { animation: slideOutRight 0.3s ease-out forwards; }

/* --- Login View Styles --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--bg-primary);
}
.auth-box {
    padding: 30px 40px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.auth-box h2 { margin-top: 0; margin-bottom: 10px; color: var(--text-primary); }
.auth-box p { margin-bottom: 25px; color: var(--text-secondary); font-size: 1rem; }
.google-login-button { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 10px 12px; font-size: 1.05rem; font-weight: 600; background-color: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 5px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.google-login-button:hover { background-color: var(--bg-tertiary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.google-login-button svg { margin-right: 12px; }

/* --- Dark Mode Toggle --- */
.theme-toggle { position: fixed; bottom: 20px; right: 20px; width: 50px; height: 50px; border-radius: 50%; background: var(--accent-color); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 1000; transition: all 0.3s ease; }
.theme-toggle:hover { transform: scale(1.1); background: var(--accent-hover); }
.theme-toggle svg { width: 24px; height: 24px; fill: white; }

/* --- Main App Styles --- */
.container {
    display: flex;
    height: 100%;
    position: relative;
    width: 100%;
    max-width: 1536px;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle { display: none; position: fixed; top: 15px; left: 15px; z-index: 1001; width: 44px; height: 44px; background: var(--accent-color); border: none; border-radius: 8px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: var(--shadow-md); }
body.update-banner-visible .mobile-menu-toggle { top: 60px; }
.mobile-menu-toggle span { width: 20px; height: 2px; background: white; transition: all 0.3s ease; }
.mobile-menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.finalist-list { width: 320px; background-color: var(--bg-secondary); border-right: 1px solid var(--border-color); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; flex-shrink: 0; transition: transform 0.3s ease; }
.list-header { padding: 20px; padding-top: 15px; font-size: 1.3rem; font-weight: 600; border-bottom: 1px solid var(--border-color); background-color: var(--bg-tertiary); color: var(--text-primary); text-align: center; position: relative; }
.list-header-title { margin-bottom: 10px; }

/* Progress Indicator */
.progress-indicator { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--border-color); font-size: 0.9rem; color: var(--text-secondary); font-weight: 400; }
.progress-bar-container { margin-top: 8px; height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--success-color), var(--accent-color)); border-radius: 4px; transition: width 0.5s ease; }

/* Sidebar Buttons */
.sidebar-button { display: block; width: 100%; margin: 8px 0 0 0; padding: 8px 12px; font-size: 0.9rem; font-weight: 600; background-color: var(--text-tertiary); color: white; border: none; border-radius: 5px; cursor: pointer; transition: all 0.2s; }
.sidebar-button:hover { background-color: var(--text-secondary); transform: translateY(-1px); }
.logout-button { background-color: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.logout-button:hover { background-color: var(--border-light); }

/* Loading Skeleton */
.skeleton { background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-tertiary) 50%, var(--border-light) 75%); background-size: 200% 100%; animation: loading 1.5s ease-in-out infinite; border-radius: 4px; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-item { padding: 18px 22px; border-bottom: 1px solid var(--border-light); }
.skeleton-text { height: 20px; border-radius: 4px; }

.list-items { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex-grow: 1; }
.list-items li { padding: 18px 22px; cursor: pointer; border-bottom: 1px solid var(--border-light); transition: all 0.2s ease-in-out; font-size: 1.05rem; display: flex; align-items: center; justify-content: space-between; }
.list-items li:hover { background-color: var(--bg-tertiary); padding-left: 28px; }
.list-items li.active { background-color: var(--accent-color); color: white; font-weight: 600; border-left: 4px solid var(--accent-hover); }
.list-items li.active:hover { background-color: var(--accent-hover); }

/* Badges */
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 12px; animation: popIn 0.3s ease-out; }
.scored-badge { background: var(--success-color); color: white; }
.draft-badge { background: var(--draft-bg); color: var(--draft-color); border: 1px solid var(--border-color); }
@keyframes popIn { 0% { transform: scale(0); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
.list-items li.active .scored-badge { background: rgba(255, 255, 255, 0.9); color: var(--accent-color); }
.list-items li.active .draft-badge { background: rgba(255, 255, 255, 0.9); color: var(--draft-color); border: 1px solid rgba(255, 255, 255, 0.1); }

.detail-view { flex-grow: 1; padding: 40px 50px; overflow-y: auto; animation: fadeIn 0.3s ease-out; background-color: var(--bg-secondary); display: flex; flex-direction: column; align-items: center; }
.placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: var(--text-tertiary); font-size: 1.4rem; text-align: center; gap: 20px; width: 100%; }
.placeholder-icon { font-size: 4rem; opacity: 0.5; }
.finalist-details { display: none; animation: fadeInUp 0.4s ease-out; width: 100%; max-width: 1100px; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.detail-header { border-bottom: 2px solid var(--border-color); padding-bottom: 20px; margin-bottom: 35px; }
.detail-header h1 { margin: 0; font-size: 2.8rem; color: var(--text-primary); }
.detail-header .business-name { font-size: 1.5rem; color: var(--text-secondary); margin-top: 5px; }
.detail-section { margin-bottom: 40px; }
.detail-section h2 { font-size: 1.6rem; color: var(--accent-color); border-bottom: 1px solid var(--border-light); padding-bottom: 12px; margin-bottom: 20px; }
.detail-section p, .detail-section span, .detail-section a { line-height: 1.7; white-space: pre-wrap; font-size: 1.1rem; color: var(--text-secondary); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; }
.info-item { margin-bottom: 20px; }
.info-item strong { display: block; color: var(--text-primary); margin-bottom: 8px; font-size: 1rem; font-weight: 600; }
.info-item a { color: var(--accent-color); text-decoration: none; transition: color 0.2s; }
.info-item a:hover { text-decoration: underline; color: var(--accent-hover); }

.single-column-section .info-item {
    margin-bottom: 25px;
}
.single-column-section .info-item:last-child {
    margin-bottom: 0;
}


.video-container { position: relative; width: 100%; overflow: hidden; padding-top: 56.25%; background-color: var(--bg-tertiary); border-radius: 8px; }
.video-container iframe { position: absolute; top: 0; left: 0; bottom: 0; right: 0; width: 100%; height: 100%; border: none; }

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    background-color: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}


/* --- Modal (Pop-up) Styles --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--modal-overlay); backdrop-filter: blur(4px); z-index: 1000; justify-content: center; align-items: center; padding: 20px; animation: fadeIn 0.3s ease-out; }
.modal-content { position: relative; background-color: var(--bg-secondary); border-radius: 12px; width: 90%; max-width: 900px; max-height: 90vh; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 20px 25px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; background: var(--bg-tertiary); }
.modal-header h2 { margin: 0; font-size: 1.5rem; color: var(--text-primary); }
.modal-close-btn { font-size: 2rem; font-weight: 300; line-height: 1; color: var(--text-primary); cursor: pointer; border: none; background: transparent; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: all 0.2s; }
.modal-close-btn:hover { background: var(--border-light); }
.form-container { overflow-y: auto; flex-grow: 1; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }

/* --- Score Button Style --- */
.score-button { padding: 12px 24px; font-size: 1.05rem; font-weight: 600; background-color: var(--success-color); color: white; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s; margin-bottom: 25px; box-shadow: var(--shadow-sm); }
.score-button:hover { background-color: var(--success-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.score-button.scored-button { background-color: var(--text-tertiary); cursor: not-allowed; opacity: 0.7; }
.score-button.scored-button:hover { background-color: var(--text-tertiary); transform: none; box-shadow: var(--shadow-sm); }

/* --- Custom Form Styles --- */
.radio-option-label { padding: 10px 12px; border-radius: 6px; transition: all 0.2s ease; cursor: pointer; margin: -10px -12px; }
.radio-option-label:hover { background-color: var(--bg-tertiary); }
.radio-option-label.selected { background-color: rgba(79, 70, 229, 0.08); border: 1px solid var(--accent-color); padding: 9px 11px; }
[data-theme="dark"] .radio-option-label.selected { background-color: rgba(74, 158, 255, 0.12); }
.custom-radio { appearance: none; -webkit-appearance: none; -moz-appearance: none; width: 1.25rem; height: 1.25rem; border: 2px solid var(--border-color); border-radius: 50%; display: inline-block; cursor: pointer; transition: all 0.2s ease-in-out; flex-shrink: 0; position: relative; }
.custom-radio:checked { border-color: var(--accent-color); background-color: var(--accent-color); }
.custom-radio:checked::after { content: ''; display: block; width: 0.5rem; height: 0.5rem; background-color: white; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.custom-radio:focus { outline: 2px solid transparent; outline-offset: 2px; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3); }
[data-theme="dark"] .custom-radio:focus { box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.4); }
.question-card { background-color: var(--bg-secondary); border: 1px solid var(--border-light); border-radius: 8px; padding: 20px; margin-bottom: 20px; transition: all 0.2s ease; }
.question-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-color); }
[data-theme="dark"] .question-card { background-color: rgba(255, 255, 255, 0.03); }
.section-header { margin-top: 30px; margin-bottom: 25px; padding-top: 30px; }
.section-header:first-child { margin-top: 0; padding-top: 0; }
.score-number { font-weight: 600; color: var(--text-primary); }
.form-actions { display: flex; gap: 16px; margin-top: 20px; }
.draft-button, .submit-button { flex: 1; padding: 12px 20px; font-size: 1.05rem; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; box-shadow: var(--shadow-sm); }
.draft-button { background-color: var(--text-tertiary); color: white; }
.draft-button:hover { background-color: var(--text-secondary); transform: translateY(-1px); }
.submit-button { background-color: var(--accent-color); color: white; }
.submit-button:hover { background-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.submit-button:disabled, .draft-button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
input[type="text"], select, textarea { background-color: var(--bg-secondary); color: var(--text-primary); border-color: var(--border-color); }
input[type="text"]:focus, select:focus, textarea:focus { border-color: var(--accent-color); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
[data-theme="dark"] input[type="text"]:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2); }
.loader { border: 4px solid var(--border-light); border-top: 4px solid var(--accent-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.9); display: flex; align-items: center; justify-content: center; z-index: 50; }
[data-theme="dark"] .loader-overlay { background-color: rgba(0, 0, 0, 0.8); }

/* "My Scores" Modal Styles */
#my-scores-table-container { padding: 10px; }
.scores-table { width: 100%; border-collapse: collapse; }
.scores-table th, .scores-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; }
.scores-table th { font-weight: 600; color: var(--text-primary); }
.scores-table td { color: var(--text-secondary); }
.scores-table td strong { font-weight: 600; color: var(--text-primary); }
.scores-table .status-badge { padding: 4px 8px; font-size: 0.75rem; }
.scores-table .status-completed { background-color: var(--success-color); color: white; }
.scores-table .status-draft { background-color: var(--draft-bg); color: var(--draft-color); border: 1px solid var(--border-color); }
.scores-table .recommend-yes { color: var(--success-color); font-weight: 700; }
.scores-table .recommend-maybe { color: var(--warn-color); font-weight: 700; }
.scores-table .recommend-no { color: var(--error-color); font-weight: 700; }
.scores-table .action-btn { padding: 4px 10px; font-size: 0.85rem; font-weight: 600; border-radius: 5px; cursor: pointer; transition: all 0.2s; background-color: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.scores-table .action-btn:hover { background-color: var(--border-light); }
.scores-table .edit-btn { background-color: var(--accent-color); color: white; border-color: var(--accent-color); }
.scores-table .edit-btn:hover { background-color: var(--accent-hover); }

/* Make "My Scores" table header sticky */
#my-scores-table-container {
    overflow-y: auto;
    max-height: 70vh; /* Ensure the container scrolls, not the modal body */
}

.scores-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--bg-tertiary); /* Match modal header bg */
    border-bottom-width: 2px; /* Make it look more prominent */
}

/* Feedback Modal Styles */
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 15px 25px; background-color: var(--bg-tertiary); border-top: 1px solid var(--border-color); }
.cancel-button { flex: 1; background-color: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); padding: 10px 16px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.cancel-button:hover { background-color: var(--border-light); }
.feedback-text-view { background-color: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 6px; padding: 12px; min-height: 150px; white-space: pre-wrap; color: var(--text-secondary); }

/* NEW: Round 1 Scores Table & Modal Styles */
.table-container { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: var(--shadow-sm); overflow-x: auto; }
.first-round-table { width: 100%; border-collapse: collapse; }
.first-round-table th, .first-round-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-light); font-size: 0.95rem; }
.first-round-table th { background-color: var(--bg-tertiary); font-weight: 600; color: var(--text-primary); }
.first-round-table td { color: var(--text-secondary); }
.first-round-table .action-btn { padding: 4px 10px; font-size: 0.85rem; font-weight: 600; border-radius: 5px; cursor: pointer; transition: all 0.2s; background-color: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.first-round-table .action-btn:hover { background-color: var(--border-light); }
.round-1-comment-block { margin-bottom: 15px; }
.round-1-comment-block strong { font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 5px; }
.round-1-comment-block p { font-size: 0.95rem; color: var(--text-secondary); white-space: pre-wrap; background-color: var(--bg-tertiary); padding: 10px; border-radius: 5px; border: 1px solid var(--border-light); }


/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .detail-view { padding: 30px 35px; }
    .detail-header h1 { font-size: 2.2rem; }
    .info-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
}
@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    .finalist-list { position: fixed; left: 0; top: 0; height: 100%; z-index: 999; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .finalist-list.mobile-open { transform: translateX(0); }
    .detail-view { padding: 80px 20px 20px 20px; width: 100%; }
    body.update-banner-visible .detail-view { padding-top: 125px; }
    .detail-header h1 { font-size: 1.8rem; }
    .detail-header .business-name { font-size: 1.2rem; }
    .info-grid { grid-template-columns: 1fr; gap: 15px; }
    .modal-content { width: 95%; max-height: 95vh; }
    .toast-container { right: 10px; left: 10px; top: 70px; }
    body.update-banner-visible .toast-container { top: 115px; }
    .toast { min-width: auto; width: 100%; }
    .theme-toggle { bottom: 80px; right: 15px; width: 44px; height: 44px; }
    .sidebar-button { width: 100%; margin-top: 10px; }
}
@media (max-width: 480px) {
    .auth-box { padding: 25px 20px; }
    .detail-view { padding: 70px 15px 15px 15px; }
    body.update-banner-visible .detail-view { padding-top: 115px; }
    .detail-header h1 { font-size: 1.5rem; }
    .score-button { width: 100%; }
}

/* Custom scrollbar */
.list-items::-webkit-scrollbar, .detail-view::-webkit-scrollbar, .form-container::-webkit-scrollbar { width: 8px; }
.list-items::-webkit-scrollbar-track, .detail-view::-webkit-scrollbar-track, .form-container::-webkit-scrollbar-track { background: var(--bg-tertiary); }
.list-items::-webkit-scrollbar-thumb, .detail-view::-webkit-scrollbar-thumb, .form-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.list-items::-webkit-scrollbar-thumb:hover, .detail-view::-webkit-scrollbar-thumb:hover, .form-container::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* User Profile Display */
.user-profile { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background-color: var(--bg-tertiary); border-radius: 6px; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 8px; }
.user-profile-icon { width: 24px; height: 24px; border-radius: 50%; background-color: var(--accent-color); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.75rem; }
.user-profile-email { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Custom Instant Tooltip Styles --- */
.scores-table [data-tooltip] {
    position: relative;
    cursor: help;
}

/* The tooltip box */
.scores-table [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%; /* Position above the text */
    left: 50%;
    transform: translateX(-50%);
    
    /* Styling */
    background-color: var(--text-primary);
    color: var(--bg-secondary);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 10;
    
    /* Hide it by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none; /* Don't let the tooltip block mouse events */
}

/* Show on hover */
.scores-table [data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s; /* Show instantly */
}

/* --- NEW RULES TO FIX HEADER TOOLTIPS --- */

/* Apply cursor to the <th> itself */
.scores-table th[data-tooltip] {
    cursor: help;
}

/* Style the tooltip for the <th> */
.scores-table th[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%; /* Position above the header */
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px; /* Add space */
    
    /* Copied styles from .scores-table [data-tooltip]::after */
    background-color: var(--text-primary);
    color: var(--bg-secondary);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 10; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

/* Show the <th> tooltip on hover */
.scores-table th[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

/* * THE FIX: 
 * When hovering the <th>, raise its z-index from 1 to 2.
 * This lifts the *entire cell* (and its tooltip) 
 * above the other sticky headers.
*/
.scores-table th[data-tooltip]:hover {
    z-index: 2; 
}