:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-color: #e0e0e0;
    --stat-bg: #f8f9fa;
    --muted-text: #6c757d;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --input-bg: #fff;
    --bg-won: #d4edda;
    --bg-lost: #f8d7da;
    --bg-tie: #fff3cd;
}

/* --- Section Tabs (Mobile Hamburger) --- */
.section-tabs-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.section-tabs-wrapper .section-tabs {
    margin-bottom: 0;
}

.section-tabs-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    background-image: none;
    color: var(--text-color);
    font-weight: 600;
    box-shadow: var(--shadow);
    margin-top: 0;
}

.hamburger-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.hamburger-icon span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-color);
    border-radius: 999px;
    opacity: 0.8;
}

.section-tabs.is-open {
    display: flex;
}

@media screen and (max-width: 900px) {
    body {
        font-size: 15px;
    }

    .dashboard-container {
        padding: 18px;
    }

    .dashboard-card {
        padding: 20px;
    }

    .page-hero {
        gap: 20px;
        margin-bottom: 24px;
    }

    .page-hero__content h1 {
        font-size: clamp(1.9rem, 4.5vw, 2.6rem);
    }

    .hero-panel-card {
        max-width: none;
        width: 100%;
    }

    .nav-link {
        font-size: 0.95rem;
    }
}

@media screen and (max-width: 768px) {
    .section-tabs-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .section-tabs-toggle {
        display: flex;
    }

    .section-tabs {
        display: none;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .section-tab {
        width: 100%;
        text-align: left;
    }
}

@media screen and (max-width: 600px) {
    body {
        font-size: 14.5px;
    }

    .navbar {
        padding: 0.75rem 1rem;
    }

    .nav-brand {
        font-size: 1.25rem;
    }

    .hero-content h1 {
        font-size: clamp(1.6rem, 6vw, 2.1rem);
    }

    .hero-content p {
        font-size: 1rem;
    }

    .pill {
        font-size: 0.72rem;
        padding: 5px 10px;
    }
}

[data-theme="dark"] {
    --primary-color: #4dabf7;
    --primary-hover: #339af0;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #333;
    --stat-bg: #2d2d2d;
    --muted-text: #a0a0a0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --input-bg: #2d2d2d;
    --bg-won: #1e3a23;
    --bg-lost: #3a1e1e;
    --bg-tie: #3a3a1e;
    color-scheme: dark;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
}

.container {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    width: 90%;
    max-width: 1200px; /* Increased to allow tables to scale */
    margin: 40px auto;
    transition: max-width 0.3s ease;
}

h1 {
    text-align: center;
    color: #4a4a4a;
    margin-bottom: 30px;
    font-size: 2rem;
}

/* --- Navigation --- */
.navbar {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-toggle {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 0;
    line-height: 0;
}

.nav-toggle .hamburger-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.nav-toggle .hamburger-icon span {
    display: block;
    width: 22px;
    height: 2.4px;
    background: var(--text-color);
    border-radius: 999px;
    opacity: 0.9;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* --- Hero Section (Home Page) --- */
/* To set image: style="background-image: url('your-image.jpg');" inline or in a separate class */
.hero-section {
    background-color: var(--primary-color);
    background-image: linear-gradient(135deg, rgba(0,0,0,0.7), rgba(0,0,0,0.4)); 
    background-size: cover;
    background-position: center;
    color: white;
    padding: 120px 20px;
    text-align: center;
    margin-bottom: 40px;
}

.hero-content h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

/* --- Dashboard Layout --- */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

/* --- Auth Pages (Sign In) --- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto 30px auto; /* Center the form */
}

.input-group {
    display: flex;
    flex-direction: column;
}

.password-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.password-field input {
    flex: 1;
    margin: 0;
}

.password-toggle {
    background: var(--card-bg);
    background-image: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    font-size: 0.85rem;
    border-radius: 10px;
    box-shadow: none;
    margin-top: 0;
}

.password-toggle:hover {
    transform: none;
    box-shadow: none;
    color: var(--primary-color);
    border-color: rgba(76, 201, 240, 0.5);
}

label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

input[type="number"] {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text-color);
}

button {
    background-color: var(--primary-color);
    background-image: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Loading Spinner */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.btn-loading-lite {
    position: relative;
    padding-right: 40px;
}
.btn-loading-lite::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 12px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Area */
#results {
    margin-top: 25px;
}

#results h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.event-summary {
    background-color: var(--stat-bg);
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 500;
    border: 1px solid var(--border-color);
    display: inline-block;
}

.record-text { color: var(--primary-color); font-weight: bold; }
.rank-text { color: var(--text-color); font-weight: bold; }
.separator { 
    margin: 0 10px; 
    color: var(--muted-text); 
}

/* Table Styles */
.table-wrapper {
    overflow-x: auto; /* Allows table to scroll on small screens */
    margin-bottom: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Ensures table doesn't get too squished */
}

.schedule-table th,
.schedule-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.schedule-table th {
    background-color: var(--stat-bg);
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.match-won { background-color: var(--bg-won); }
.match-lost { background-color: var(--bg-lost); }
.match-tie { background-color: var(--bg-tie); }

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table tr:hover td {
    background-color: rgba(0,0,0,0.02);
}


.match-cell {
    font-weight: 500;
    width: 12%;
}

.alliance-cell {
    width: 8%;
    font-weight: bold;
}

.prob-cell {
    width: 9%;
    font-weight: bold;
}

.pred-score-cell {
    width: 16%;
    min-width: 150px;
    font-weight: 600;
}

.pred-score-main {
    font-weight: 700;
    font-size: 1rem;
}

.pred-score-meta {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--muted-text);
    line-height: 1.2;
}

.team-cell {
    width: 27%;
}

/* Team Card Styles */
.team-card {
    background-color: var(--stat-bg);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.team-card.clickable {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.team-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.team-card:last-child {
    margin-bottom: 0;
}

.team-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.team-name {
    font-size: 0.85em;
    color: var(--muted-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.team-page-header .team-name {
    font-size: 1rem;
    margin-left: 8px;
    max-width: none;
    white-space: normal;
}

.team-search-results {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.team-search-results button {
    width: 100%;
    text-align: left;
}

/* Strategy Badges */
.strategy-badge {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    margin-left: auto; /* Push to right */
}

.strategy-offensive { background-color: #d4edda; color: #155724; }
.strategy-defensive { background-color: #f8d7da; color: #721c24; }
.strategy-mixed { background-color: #d1ecf1; color: #0c5460; }
.strategy-balanced { background-color: #e2e3e5; color: #383d41; }
.strategy-none { display: none; }

.team-stats {
    display: flex;
    gap: 8px;
    font-size: 0.8em;
    color: var(--text-color);
    flex-wrap: wrap;
}

.stat {
    background: var(--card-bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #eee;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.text-muted {
    color: var(--muted-text);
    font-style: italic;
}

.custom-desc {
    font-size: 0.75em;
    color: var(--primary-color);
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 6px;
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
}

.modal-content {
    background-color: var(--card-bg);
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 400px;
    border-radius: 10px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Team Page Styles */
.team-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.team-detail-section {
    background: var(--stat-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.team-detail-section h4 {
    margin-top: 0;
    color: var(--primary-color);
    margin-bottom: 8px;
}

/* Profile Image / Avatar */
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Top Right Profile */
.profile-corner {
    position: absolute;
    top: 20px;
    right: 20px;
}

.dashboard-btn {
    background-color: #17a2b8;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    margin-top: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dashboard-btn:hover {
    background-color: #138496;
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    margin-top: 0;
}

.theme-toggle:hover {
    background-color: var(--stat-bg);
}

.edit-btn {
    background-color: #6c757d;
    margin: 0;
    padding: 8px 16px;
}

.share-btn {
    background-color: #17a2b8;
    margin: 0;
    padding: 8px 16px;
}
.share-btn:hover {
    background-color: #138496;
}

.edit-form-container {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stats Grid */
.stats-container {
    margin-top: 20px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--stat-bg);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.stat-label { font-size: 0.9em; color: var(--muted-text); }
.stat-value { font-size: 1.5em; font-weight: bold; color: var(--primary-color); }
.stat-rank { font-size: 0.8em; color: var(--text-color); }

/* Gallery */
.gallery-section {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}
.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}
.report-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 0.7em;
    padding: 4px 8px;
    background: rgba(220, 53, 69, 0.8);
    margin: 0;
}

/* Specific Button Overrides */
#loginBtn {
    background-image: linear-gradient(135deg, #28a745, #218838);
}

#getTeamInfo {
    background-image: linear-gradient(135deg, #007bff, #0056b3);
}

/* Character Count */
.char-count {
    text-align: right;
    font-size: 0.75em;
    color: var(--muted-text);
    margin-top: 4px;
}

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

.toast {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary-color);
    position: relative;
    overflow: hidden;
    min-width: 250px;
    animation: slideIn 0.3s ease;
}

.toast.error { border-left-color: #dc3545; }
.toast.success { border-left-color: #28a745; }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0,0,0,0.1);
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 100%;
    animation: progress 3s linear forwards;
}

.toast.error .toast-progress-bar { background: #dc3545; }
.toast.success .toast-progress-bar { background: #28a745; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes progress { to { width: 0; } }

/* QR Code */
.qr-code-img {
    display: block;
    margin: 0 auto 20px auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: white;
}

/* --- Mobile Responsiveness --- */
@media screen and (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    /* Card View for Tables */
    .schedule-table {
        min-width: 100%;
        display: block;
    }

    .schedule-table thead {
        display: none;
    }

    .schedule-table tbody, .schedule-table tr, .schedule-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .schedule-table tr {
        margin-bottom: 15px;
        background-color: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: var(--shadow);
        padding: 10px;
    }
    .schedule-table tr.match-won { background-color: var(--bg-won); }
    .schedule-table tr.match-lost { background-color: var(--bg-lost); }
    .schedule-table tr.match-tie { background-color: var(--bg-tie); }

    .schedule-table td {
        text-align: right;
        padding: 10px 5px;
        position: relative;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .schedule-table td:last-child {
        border-bottom: none;
    }

    /* Add labels via CSS for known columns */
    .match-cell::before { content: "Match"; font-weight: bold; color: var(--muted-text); }
    .alliance-cell::before { content: "Alliance"; font-weight: bold; color: var(--muted-text); }
    .prob-cell::before { content: "Win Prob"; font-weight: bold; color: var(--muted-text); }
    .pred-score-cell::before { content: "Pred Score"; font-weight: bold; color: var(--muted-text); }
    .team-cell::before { content: "Teams"; font-weight: bold; color: var(--muted-text); align-self: flex-start; }
    
    .team-cell {
        flex-direction: column;
        align-items: flex-end;
        gap: 5px;
    }

    .pred-score-cell {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
}

/* =========================
   Modern Refresh Theme
   ========================= */
:root {
    --font-display: 'Sora', sans-serif;
    --font-body: 'Manrope', sans-serif;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #ff8a3d;
    --bg-color: #f5f7fb;
    --card-bg: #ffffff;
    --text-color: #0f172a;
    --border-color: #e2e8f0;
    --stat-bg: #f1f5f9;
    --muted-text: #6b7280;
    --shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    --input-bg: #ffffff;
    --bg-won: #dcfce7;
    --bg-lost: #fee2e2;
    --bg-tie: #fef3c7;
}

[data-theme="dark"] {
    --primary-color: #4cc9f0;
    --primary-hover: #22a2d8;
    --accent-color: #ff8a3d;
    --bg-color: #0b1220;
    --card-bg: #111827;
    --text-color: #e5e7eb;
    --border-color: #1f2a3a;
    --stat-bg: #0f1a2b;
    --muted-text: #9ca3af;
    --shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
    --input-bg: #0f172a;
    --bg-won: #1f3d2d;
    --bg-lost: #3a1f25;
    --bg-tie: #3b3320;
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
    width: 100%;
}

body > .dashboard-container,
body > .admin-wrapper,
body > .container,
body > .auth-page {
    flex: 1 0 auto;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(76, 201, 240, 0.15), transparent 45%),
        radial-gradient(circle at 90% 10%, rgba(255, 138, 61, 0.12), transparent 40%),
        radial-gradient(circle at 30% 90%, rgba(37, 99, 235, 0.12), transparent 45%);
    z-index: -1;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--text-color);
}

p {
    line-height: 1.6;
}

a {
    color: inherit;
}

.navbar {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2.5rem;
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--text-color);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #0b1220;
}

.brand-text {
    font-size: 1.15rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.nav-link {
    color: var(--muted-text);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-color);
    background: rgba(76, 201, 240, 0.15);
}

.theme-toggle {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    box-shadow: var(--shadow);
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.search-card {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group label {
    font-weight: 600;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--primary-color);
    background-image: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(2, 6, 23, 0.2);
    margin-top: 0;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(2, 6, 23, 0.25);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-primary {
    background-image: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
}

.btn {
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
}

input[type="number"],
input[type="text"],
input[type="password"],
textarea {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

select {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.2);
    outline: none;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.checkbox-row input {
    width: auto;
}

.section-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.section-tab {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--muted-text);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.section-tab:hover,
.section-tab.active {
    color: var(--text-color);
    background: rgba(76, 201, 240, 0.15);
    border-color: rgba(76, 201, 240, 0.4);
}

input:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.2);
    outline: none;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(76, 201, 240, 0.6);
    outline-offset: 2px;
}

.page-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
    align-items: center;
    margin-bottom: 32px;
}

.page-hero__content h1 {
    font-size: clamp(2rem, 2.6vw, 3rem);
    margin-bottom: 12px;
}

.page-hero__panel {
    display: flex;
    justify-content: flex-end;
}

.hero-panel-card {
    background: linear-gradient(135deg, rgba(76, 201, 240, 0.18), rgba(255, 138, 61, 0.12));
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    max-width: 320px;
}

.hero-panel-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
    font-size: 0.9rem;
}

.meta-label {
    display: block;
    color: var(--muted-text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.meta-value {
    font-weight: 600;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(76, 201, 240, 0.15);
    color: var(--primary-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--muted-text);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
}

.hero-section {
    padding: 80px 20px 40px;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    margin-bottom: 0;
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
    align-items: center;
}

.hero-content h1 {
    font-size: clamp(2.2rem, 3vw, 3.4rem);
    margin-bottom: 12px;
    color: var(--text-color);
}

.hero-content p {
    color: var(--muted-text);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 10px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.hero-stat {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-stat__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-text);
}

.hero-stat strong {
    font-size: 1.3rem;
    color: var(--text-color);
}

.hero-stat__meta {
    font-size: 0.75rem;
    color: var(--muted-text);
}

.hero-visual {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    min-height: 360px;
    animation: riseIn 0.8s ease both;
}

.hero-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11, 18, 32, 0.05), rgba(11, 18, 32, 0.35));
    z-index: 1;
    pointer-events: none;
}

.hero-illustration {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    display: block;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    object-fit: cover;
    background: var(--card-bg);
    z-index: 0;
}

.hero-visual-cards {
    display: grid;
    gap: 10px;
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 2;
}

.mini-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.85rem;
    min-width: 160px;
}

[data-theme="light"] .mini-card {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color);
}

.mini-label {
    display: block;
    font-size: 0.7rem;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 32px;
    padding: 40px;
    align-items: stretch;
    min-height: 100vh;
}

.auth-panel {
    background: linear-gradient(135deg, rgba(76, 201, 240, 0.2), rgba(255, 138, 61, 0.15));
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 36px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: riseIn 0.8s ease both;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.auth-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-illustration {
    width: 100%;
    max-width: none;
    margin-top: auto;
    border-radius: 20px;
    box-shadow: var(--shadow);
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--card-bg);
}

.manual-chat-page .page-hero {
    margin-bottom: 32px;
}

.manual-chat-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.manual-chat__messages {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 18px;
    max-height: min(65vh, 720px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.manual-chat__message {
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.5;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

.manual-chat__message-text {
    white-space: inherit;
}

.manual-chat__message-text--formatted {
    white-space: normal;
}

.manual-chat__message-text--formatted p {
    margin: 0 0 0.6rem;
}

.manual-chat__message-text--formatted p:last-child {
    margin-bottom: 0;
}

.manual-chat__message-text--formatted h1,
.manual-chat__message-text--formatted h2,
.manual-chat__message-text--formatted h3,
.manual-chat__message-text--formatted h4,
.manual-chat__message-text--formatted h5,
.manual-chat__message-text--formatted h6 {
    margin: 0.6rem 0 0.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.manual-chat__message-text--formatted h1 { font-size: 1.2rem; }
.manual-chat__message-text--formatted h2 { font-size: 1.12rem; }
.manual-chat__message-text--formatted h3 { font-size: 1.05rem; }
.manual-chat__message-text--formatted h4 { font-size: 1rem; }
.manual-chat__message-text--formatted h5,
.manual-chat__message-text--formatted h6 { font-size: 0.95rem; }

.manual-chat__message-text--formatted ul,
.manual-chat__message-text--formatted ol {
    margin: 0.4rem 0 0.6rem 1.2rem;
    padding: 0;
}

.manual-chat__message-text--formatted li {
    margin: 0.2rem 0;
}

.manual-chat__message-text--formatted code {
    font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", monospace;
    font-size: 0.85em;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    padding: 2px 6px;
}

.manual-chat__message-text--formatted pre {
    margin: 0.6rem 0;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow-x: auto;
}

.manual-chat__message-text--formatted pre code {
    background: transparent;
    padding: 0;
    font-size: 0.85rem;
}

.manual-chat__message-text--formatted blockquote {
    margin: 0.6rem 0;
    padding: 8px 12px;
    border-left: 3px solid rgba(76, 201, 240, 0.6);
    background: rgba(15, 23, 42, 0.35);
    border-radius: 8px;
    color: var(--text-color);
}

.manual-chat__message-text--formatted hr {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 0.6rem 0;
}

.manual-chat__message-text--formatted a {
    color: var(--primary-color);
    text-decoration: underline;
}

.manual-chat__message--assistant {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.manual-chat__message-note {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--muted-text);
}

.manual-chat__message--thinking {
    display: inline-flex;
    align-self: flex-start;
    padding: 10px 14px;
}

.manual-chat__dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.manual-chat__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted-text);
    opacity: 0.4;
    animation: manualChatDot 1s ease-in-out infinite;
}

.manual-chat__dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.manual-chat__dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes manualChatDot {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.manual-chat__message--user {
    background: rgba(76, 201, 240, 0.15);
    border: 1px solid rgba(76, 201, 240, 0.4);
    color: var(--text-color);
    align-self: flex-end;
}

.manual-chat__sources {
    display: grid;
    gap: 8px;
    margin: 4px 0 10px;
    font-size: 0.85rem;
}

.manual-chat__citation-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.manual-chat__citation {
    background: rgba(76, 201, 240, 0.18);
    border: 1px solid rgba(76, 201, 240, 0.45);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.4;
}

.manual-chat__citation.is-disabled,
.manual-chat__citation:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.manual-chat__sources-toggle {
    align-self: flex-start;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8rem;
}

.manual-chat__source-list {
    display: none;
    gap: 8px;
}

.manual-chat__source-list.is-open {
    display: grid;
}

.manual-chat__source {
    background: rgba(15, 23, 42, 0.35);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    max-height: 180px;
    overflow: hidden;
}

.manual-chat__source.is-highlighted {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.25);
}

.manual-chat__source summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
}

.manual-chat__source-meta {
    font-size: 0.75rem;
    color: var(--muted-text);
    margin: 6px 0;
}

.manual-chat__source-preview {
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 110px;
    overflow-y: auto;
}

.manual-chat__composer {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.manual-chat__controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.manual-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.manual-toggle__label {
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--stat-bg);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    border-radius: 999px;
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    top: 2px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.switch input:checked + .switch-slider {
    background: rgba(76, 201, 240, 0.35);
    border-color: rgba(76, 201, 240, 0.6);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
    background: #0b1220;
    border-color: rgba(76, 201, 240, 0.6);
}

[data-theme="light"] .switch input:checked + .switch-slider::before {
    background: #ffffff;
}

.manual-chat__composer input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
}

.manual-chat__hint {
    margin: 0;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    padding: 36px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.notes-section {
    margin-top: 24px;
    background: var(--stat-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 20px;
}

.notes-page .notes-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.notes-layout {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr);
    gap: 20px;
    margin-bottom: 32px;
}

.notes-list-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notes-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.notes-team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 560px;
    overflow: auto;
    padding-right: 4px;
}

.notes-team-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.notes-team-item:hover {
    transform: translateY(-1px);
    border-color: rgba(76, 201, 240, 0.4);
}

.notes-team-item.active {
    border-color: var(--primary-color);
    background: rgba(76, 201, 240, 0.12);
}

.notes-team-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.notes-team-name {
    color: var(--muted-text);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-pill {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(76, 201, 240, 0.4);
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.notes-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notes-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: end;
}

.align-end {
    display: flex;
    align-items: flex-end;
}

.inline-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.checkbox-inline input {
    accent-color: var(--primary-color);
}

.alliance-setup .form-grid .input-group {
    margin-bottom: 0;
}

@media screen and (max-width: 900px) {
    .notes-layout {
        grid-template-columns: 1fr;
    }
}

.notes-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.notes-status {
    font-size: 0.85rem;
    color: var(--muted-text);
}

.notes-locked {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.notes-editor textarea {
    width: 100%;
    resize: vertical;
}

.notes-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.team-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.team-detail-section {
    background: var(--stat-bg);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 14px;
}

.team-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

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

.callout {
    background: rgba(255, 138, 61, 0.15);
    border: 1px solid rgba(255, 138, 61, 0.35);
    padding: 12px;
    border-radius: 12px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

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

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
    background-color: var(--stat-bg);
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table tbody tr:hover td {
    background-color: rgba(0,0,0,0.02);
}

.leaderboard-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.leaderboard-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.info-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.info-button:hover {
    color: var(--primary-color);
}

.stat-box {
    background: var(--stat-bg);
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.gallery-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.alliance-selector-container {
    margin-top: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
}

.site-footer {
    margin-top: auto;
    padding: 24px 20px;
    border-top: 1px solid var(--border-color);
    color: var(--muted-text);
    background: rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] .site-footer {
    background: rgba(15, 23, 42, 0.4);
}

.site-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.site-footer__credit {
    font-weight: 600;
}

.site-footer__credit a {
    color: inherit;
    text-decoration: none;
}

.site-footer__credit a:hover {
    color: var(--primary-color);
}

.site-footer__links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.site-footer__links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
}

.site-footer__links a:hover {
    color: var(--primary-color);
}

.site-footer__links .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    box-shadow: none;
}

.site-footer__links .btn:hover {
    box-shadow: none;
}

.about-page .page-hero__panel {
    justify-content: center;
}

.about-media-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-media-image {
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: #0b1220;
}

.about-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.about-info-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.about-project-grid {
    margin-top: 20px;
}

.about-project-image {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    margin-bottom: 14px;
    background: #0b1220;
}

.upload-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.modal-content {
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.toast {
    border-radius: 14px;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media screen and (max-width: 900px) {
    .auth-page {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .auth-container {
        max-width: 100%;
    }

    .hero-visual-cards {
        position: static;
    }

    .notes-page .notes-toolbar {
        grid-template-columns: 1fr;
    }

    .support-layout,
    .support-shell {
        grid-template-columns: 1fr;
    }

    .hero-visual {
        min-height: 280px;
    }

    .auth-illustration {
        max-height: 320px;
    }

    .team-page-header {
        align-items: flex-start;
    }
}

@media screen and (max-width: 600px) {
    .navbar {
        padding: 1rem;
    }

    .hero-section {
        padding-top: 40px;
    }

    .dashboard-card {
        padding: 20px;
    }

    .site-footer__inner {
        align-items: flex-start;
    }

    .dashboard-container {
        padding: 24px 16px 60px;
    }

    .hero-visual {
        min-height: 220px;
    }

    .hero-illustration {
        border-radius: 0;
    }

    .notes-footer,
    .notes-actions,
    .button-row,
    .team-actions {
        width: 100%;
    }

    .notes-actions,
    .button-row,
    .team-actions {
        justify-content: stretch;
    }

    .notes-actions button,
    .button-row button,
    .team-actions button {
        width: 100%;
    }

    .table {
        display: block;
        overflow-x: auto;
        width: 100%;
    }
}

/* --- Mobile Nav overhaul --- */
@media screen and (max-width: 900px) {
    .navbar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0.75rem 1rem;
        align-items: center;
    }
    .brand-text {
        display: none;
    }
    .nav-brand {
        order: 1;
        gap: 10px;
    }
    .nav-actions {
        order: 2;
        margin-left: auto;
    }
    .nav-links {
        order: 3;
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 8px 12px;
        box-shadow: var(--shadow);
    }
    .nav-links.open {
        display: flex;
    }
    .nav-link {
        width: 100%;
        text-align: left;
        padding: 10px 0;
    }
    #topRightProfile {
        width: 100%;
    }
    .nav-toggle {
        display: inline-flex;
        margin-left: 0;
        order: 3;
    }
    #themeToggle {
        order: 2;
    }
    /* tighten hero/page padding on mobile */
    .page-hero {
        margin-top: 6px;
        padding: 10px 0;
    }
    .section-tabs-wrapper {
        margin-top: 0;
        display: none; /* hide duplicate in-page nav on mobile; rely on main hamburger */
    }
}
