/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1DA1F2;
    --primary-dark: #0d8bd9;
    --primary-light: #4db8f7;
    --accent: #D4AF37;
    --accent-light: #f0d060;
    --bg: #e8f4fc;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f8ff;
    --bg-input: #f0f6fb;
    --text: #1a2b3c;
    --text-muted: #6b8299;
    --border: #c8ddef;
    --success: #2ecc71;
    --danger: #e74c3c;
    --draw: #f39c12;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,80,160,0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.hidden { display: none !important; }

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #d6eefb 0%, #1DA1F2 40%, #4db8f7 70%, #1DA1F2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

.loading-screen.loading-fade {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    position: relative;
}

.tui-logo-loading {
    width: 80px;
    height: auto;
    display: block;
    margin: 0 auto 16px;
    animation: bounce 1.2s ease infinite;
}

.tui-logo-login {
    width: 100px;
    height: auto;
    display: block;
    margin: 0 auto 12px;
}

.tui-logo-header {
    height: 32px;
    width: auto;
}

.loading-spinner {
    width: 100px;
    height: 100px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top: 3px solid #fff;
    border-radius: 50%;
    margin: 0 auto 0;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loading-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
    animation: bounce 1.2s ease infinite;
}

.loading-text {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.loading-sub {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    letter-spacing: 2px;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===== LOGIN ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8f4fc 0%, #d0eafb 50%, #e8f4fc 100%);
    padding: 20px;
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,53,128,0.4);
}

.login-error {
    color: var(--danger);
    text-align: center;
    font-size: 13px;
    margin-top: 14px;
    min-height: 20px;
}

.login-toggle {
    text-align: center;
    font-size: 13px;
    margin-top: 12px;
    color: var(--text-muted);
}

.toggle-link {
    color: var(--primary);
    cursor: pointer;
    transition: color 0.2s;
}

.toggle-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}


/* ===== HEADER ===== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon-sm { font-size: 28px; }

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 14px;
    color: var(--text-muted);
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== NAV TABS ===== */
.nav-tabs {
    padding: 16px 32px 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 56px;
    z-index: 99;
    background: var(--bg);
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.nav-tabs::-webkit-scrollbar { height: 0; }

.tab {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab:hover { color: var(--text); }

.tab.active {
    background: var(--bg-card);
    border-color: var(--border);
    border-bottom-color: var(--bg-card);
    color: var(--primary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 24px 32px;
}

/* ===== GROUP SECTION ===== */
.group-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.group-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.group-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.group-teams {
    padding: 4px 20px 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.group-team-tag {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
}

.match-list {
    padding: 0 16px 16px;
}

.match-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.match-row:last-child { border-bottom: none; }

.match-date {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 70px;
}

.match-teams {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.team-flag {
    font-size: 18px;
    line-height: 1;
}

.flag-img {
    display: inline-block;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.team-name {
    min-width: 60px;
}

.team-home { text-align: right; flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.team-away { text-align: left; flex: 1; display: flex; align-items: center; gap: 6px; }

.vs {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

.score-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.score-input {
    width: 40px;
    height: 36px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    transition: border-color 0.2s;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary);
}

.score-sep {
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== KNOCKOUT MATCHES ===== */
.knockout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.knockout-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
}

.knockout-card:hover {
    border-color: var(--primary);
}

.knockout-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.knockout-match {
    display: flex;
    align-items: center;
    gap: 12px;
}

.knockout-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.knockout-team.home { justify-content: flex-end; }

/* ===== SAVE BUTTON ===== */
.save-bar {
    text-align: center;
    margin-top: 32px;
}

.btn-save {
    padding: 14px 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(29,161,242,0.3);
}

/* ===== TOAST ===== */
.save-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: #fff;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 8px 30px rgba(46,204,113,0.3);
    z-index: 999;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== STANDINGS ===== */
.standings-section {
    margin-bottom: 32px;
}

.standings-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary);
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.standings-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}

.standings-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.standings-table tr:last-child td { border-bottom: none; }

.standings-table tr.qualified td {
    background: rgba(46,204,113,0.08);
}

.rank-num {
    font-weight: 700;
    color: var(--primary);
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .group-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .login-container { padding: 36px 24px; }
    .nav-tabs { padding: 12px 16px 0; }
    .main-content { padding: 16px; }
    .group-grid { grid-template-columns: repeat(2, 1fr); }
    .knockout-grid { grid-template-columns: 1fr; }
    .header-inner { padding: 12px 16px; }
    .header-left h1 { font-size: 16px; }
    .match-teams { font-size: 12px; }
    .team-name { min-width: 45px; }
}

@media (max-width: 480px) {
    .group-grid { grid-template-columns: 1fr; }
    .tab { padding: 8px 12px; font-size: 12px; }
    .score-input { width: 34px; height: 32px; font-size: 14px; }
}

/* ===== ADMIN STYLES ===== */
.admin-page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
}

.admin-section-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.admin-group-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.admin-lock-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.locks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.lock-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.lock-round-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.lock-dates {
    display: flex;
    gap: 12px;
}

.lock-field {
    flex: 1;
}

.lock-field label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lock-date-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.2s;
}

.lock-date-input:focus {
    outline: none;
    border-color: var(--primary);
}

.lock-status {
    margin-top: 12px;
}

.lock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.lock-badge.lock-open {
    background: rgba(46,204,113,0.15);
    color: var(--success);
}

.lock-badge.lock-closed {
    background: rgba(231,76,60,0.15);
    color: var(--danger);
}

/* Locked input styling */
.score-input.locked {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border);
}

.round-locked-banner {
    background: rgba(231,76,60,0.12);
    border: 1px solid rgba(231,76,60,0.3);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    margin-bottom: 20px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.admin-link {
    text-align: center;
    margin-top: 16px;
}

.admin-link a {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.admin-link a:hover {
    color: var(--primary);
}

@media (max-width: 1200px) {
    .admin-group-grid { grid-template-columns: repeat(2, 1fr); }
    .locks-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .admin-group-grid { grid-template-columns: repeat(2, 1fr); }
    .locks-grid { grid-template-columns: 1fr; }
    .lock-dates { flex-direction: column; }
}

@media (max-width: 480px) {
    .admin-group-grid { grid-template-columns: 1fr; }
}

/* ===== DATA EXPORT / IMPORT ===== */
.data-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 160px;
}

.stat-num {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.export-grid, .import-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.export-card, .import-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.export-card h4, .import-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.export-card p, .import-card p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.4;
}

.export-card-full {
    grid-column: span 3;
}

.btn-export {
    padding: 10px 20px;
    font-size: 13px;
}

.file-input {
    display: none;
}

.btn-import {
    display: inline-block;
    padding: 10px 20px;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-import:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.import-status {
    text-align: center;
    margin-top: 16px;
    min-height: 24px;
}

.import-success {
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
}

.import-error {
    color: var(--danger);
    font-weight: 600;
    font-size: 14px;
}

@media (max-width: 768px) {
    .export-grid, .import-grid { grid-template-columns: 1fr; }
    .export-card-full { grid-column: span 1; }
    .data-stats { flex-direction: column; }
}

/* ===== REAL SCORE DISPLAY ===== */
.real-score {
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    background: rgba(46,204,113,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.pts-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.pts-exact {
    background: rgba(46,204,113,0.2);
    color: var(--success);
}

.pts-outcome {
    background: rgba(243,156,18,0.2);
    color: var(--draw);
}

.pts-wrong {
    background: rgba(231,76,60,0.15);
    color: var(--danger);
}

.user-points {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(29,161,242,0.1);
    padding: 4px 12px;
    border-radius: 6px;
}

/* ===== SCOREBOARD ===== */
.scoreboard-table {
    width: 100%;
}

.scoreboard-table th,
.scoreboard-table td {
    text-align: center;
}

.scoreboard-table th:nth-child(2),
.scoreboard-table td:nth-child(2) {
    text-align: left;
}

.scoreboard-total {
    font-size: 18px;
    color: var(--primary);
}

/* ===== LEADERBOARD CURRENT USER ===== */
.leaderboard-me td {
    background: rgba(29,161,242,0.08) !important;
    font-weight: 600;
}

/* ===== MICROSOFT SSO ===== */
.sso-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.sso-divider::before,
.sso-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.sso-divider::before { left: 0; }
.sso-divider::after { right: 0; }

.sso-divider span {
    background: var(--bg-card);
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.btn-microsoft {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #1a1a1a;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-microsoft:hover {
    background: #f5f5f5;
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== INFO PAGE ===== */
.info-page {
    max-width: 800px;
    margin: 0 auto;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}

.info-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
}

.info-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

.info-rules {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-rule {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.info-rule-pts {
    font-size: 16px;
    font-weight: 800;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}

.info-rule strong {
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

.info-rule p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.info-table th,
.info-table td {
    text-align: center;
    font-size: 13px;
}

.info-table td:first-child {
    text-align: left;
}

.info-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.info-step {
    display: flex;
    align-items: center;
    gap: 14px;
}

.step-num {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.info-step p {
    font-size: 14px;
    color: var(--text);
}

@media (max-width: 768px) {
    .info-card { padding: 20px; }
}

/* ===== STATS CHART ===== */
.stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 160px;
    padding: 10px 0;
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.chart-bar {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.chart-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ===== STATS FILTER ===== */
.stats-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.stats-filter-btns {
    display: flex;
    gap: 6px;
}

.stats-filter-btn {
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.stats-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.stats-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ===== COUNTRY SELECT ===== */
.country-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
    appearance: auto;
}

.country-select:focus {
    outline: none;
    border-color: var(--primary);
}

.leaderboard-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.leaderboard-filter label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.country-filter-select {
    width: auto;
    min-width: 220px;
    padding: 8px 12px;
    font-size: 13px;
}

/* ===== FOOTER ===== */
.site-footer {
    text-align: center;
    padding: 28px 16px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer-fancy {
    font-size: 13px;
    font-weight: 500;
    background: linear-gradient(135deg, var(--primary), #d4af37, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.footer-fancy strong {
    font-weight: 800;
}

/* ===== RESET PASSCODE ===== */
.reset-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 20px;
}

.reset-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}

.reset-input:focus {
    outline: none;
    border-color: var(--primary);
}

.reset-input:disabled {
    opacity: 0.5;
}

.reset-user-name {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
    margin-bottom: 14px;
    text-align: center;
}

.reset-success {
    color: var(--success);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    min-height: 20px;
}

.reset-message {
    text-align: center;
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 20px;
}

.reset-email-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.reset-email-link:hover {
    text-decoration: underline;
}

/* ===== USER MANAGEMENT ===== */
.btn-reset-user {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-user:hover {
    background: var(--primary);
    color: #fff;
}

.user-pass-display {
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* ===== RESET MODAL ===== */
.reset-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.reset-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.reset-modal-user {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
}

/* ===== PROFILE MODAL COMPACT ===== */
#profile-modal .reset-modal-content {
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 24px;
}
#profile-modal .reset-title { font-size: 18px; margin-bottom: 12px; }
#profile-modal .form-group { margin-bottom: 10px; }
#profile-modal .form-group label { margin-bottom: 3px; font-size: 12px; }
#profile-modal .form-group input,
#profile-modal .form-group select { padding: 10px 12px; font-size: 13px; }
#profile-modal hr { margin: 10px 0; }
#profile-modal h4 { margin-bottom: 8px; }

/* ===== SQUAD / PITCH ===== */
.squad-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.squad-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.squad-formation {
    background: var(--primary);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.pitch {
    background: linear-gradient(180deg, #2d8a4e 0%, #34a058 20%, #2d8a4e 40%, #34a058 60%, #2d8a4e 80%, #34a058 100%);
    border-radius: var(--radius);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    border: 2px solid #fff3;
    min-height: 320px;
}

.pitch::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: rgba(255,255,255,0.25);
}

.pitch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
}

.pitch-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.pitch-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 64px;
}

.pitch-player-name {
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.pitch-player-pos {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    color: #fff;
}

.pitch-player.pos-gk .pitch-player-pos { background: #f39c12; }
.pitch-player.pos-df .pitch-player-pos { background: #3498db; }
.pitch-player.pos-mf .pitch-player-pos { background: #2ecc71; }
.pitch-player.pos-st .pitch-player-pos { background: #e74c3c; }

.pos-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.pos-gk { background: #f39c12; }
.pos-df { background: #3498db; }
.pos-mf { background: #2ecc71; }
.pos-st { background: #e74c3c; }

.pos-legend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 14px;
    font-size: 12px;
}

.squad-list {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.squad-player {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 480px) {
    .pitch { padding: 16px 8px; gap: 14px; }
    .pitch-player { min-width: 50px; }
    .pitch-player-name { font-size: 9px; padding: 3px 5px; }
}

/* ===== PLAYER CLUB TOOLTIP ===== */
.pitch-player {
    position: relative;
    cursor: pointer;
}

.pitch-player-club {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    margin-bottom: 4px;
    z-index: 10;
    pointer-events: none;
}

.pitch-player:hover .pitch-player-club {
    display: block;
}

.squad-club {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== PASSCODE HOVER REVEAL ===== */
.user-pass-hover {
    position: relative;
    cursor: pointer;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.pass-reveal {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    white-space: nowrap;
    margin-bottom: 4px;
    z-index: 10;
}

.user-pass-hover:hover .pass-reveal {
    display: block;
}

/* ===== USER ACTIONS ===== */
.user-actions {
    display: flex;
    gap: 6px;
}

.btn-delete-user {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: 6px;
    color: var(--danger);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-user:hover {
    background: var(--danger);
    color: #fff;
}

.email-cell {
    font-size: 12px;
    color: var(--text-muted);
}

.squad-country-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== TEAM CLICKABLE ===== */
.team-clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.team-clickable:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== SQUAD POPUP MODAL ===== */
.squad-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    position: relative;
}

.squad-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.squad-modal-close:hover {
    background: var(--bg-input);
    color: var(--text);
}

.group-header-teams {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== DARK MODE TOGGLE ===== */
.btn-darkmode {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.btn-darkmode:hover {
    background: var(--bg-input);
}

/* ===== DARK THEME ===== */
body.dark-mode {
    --primary: #4db8f7;
    --primary-dark: #1DA1F2;
    --primary-light: #7ccbfa;
    --bg: #0a0a0f;
    --bg-card: #141419;
    --bg-card-hover: #1c1c24;
    --bg-input: #1a1a22;
    --text: #e8e8f0;
    --text-muted: #e0e0ec;
    --border: #2a2a38;
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
}

body.dark-mode .login-screen {
    background: linear-gradient(135deg, #0a0a0f 0%, #12121a 50%, #0a0a0f 100%);
}

body.dark-mode .btn-login {
    background: linear-gradient(135deg, #1DA1F2, #4db8f7);
}

body.dark-mode .btn-save {
    background: linear-gradient(135deg, #1DA1F2, #4db8f7);
}

body.dark-mode .btn-microsoft {
    background: #1a1a22;
    color: #e8e8f0;
    border-color: #2a2a38;
}

body.dark-mode .sso-divider span {
    background: #141419;
}

body.dark-mode .group-header {
    background: linear-gradient(135deg, #1a1a2e, #2a2a4a);
}

body.dark-mode .save-toast {
    background: var(--success);
}

body.dark-mode .score-input {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode .country-select {
    background: var(--bg-input);
    color: var(--text);
}

body.dark-mode .lock-date-input {
    background: var(--bg-input);
    color: var(--text);
}

body.dark-mode .reset-input {
    background: var(--bg-input);
    color: var(--text);
}

/* ===== MATCH TIME ===== */
.match-time {
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
}

/* ===== SAVE TOP BUTTON ===== */
.btn-save-top {
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.btn-save-top:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29,161,242,0.3);
}

/* ===== CHECK MISSING ===== */
.score-input.missing {
    border-color: var(--danger) !important;
    animation: blink-red 0.8s ease infinite;
}

@keyframes blink-red {
    0%, 100% { border-color: var(--danger); box-shadow: 0 0 0 rgba(231,76,60,0); }
    50% { border-color: var(--danger); box-shadow: 0 0 8px rgba(231,76,60,0.5); }
}

.btn-check {
    background: linear-gradient(135deg, #f39c12, #e67e22) !important;
    color: #fff !important;
}

.btn-check-top {
    padding: 6px 16px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.btn-check-top:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243,156,18,0.3);
}

.save-toast.toast-warning {
    background: var(--draw);
}

/* ===== MATCH EDITOR ===== */
.match-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.match-editor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.match-editor-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.match-editor-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.match-editor-field {
    flex: 1;
}

.match-editor-field label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.match-editor-default {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-style: italic;
}

.match-editor-select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
}

.match-editor-select:focus {
    outline: none;
    border-color: var(--primary);
}

.match-editor-vs {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding-top: 28px;
}

@media (max-width: 768px) {
    .match-editor-grid { grid-template-columns: 1fr; }
}

/* ===== DUPLICATE TEAM WARNING ===== */
.match-override.duplicate {
    border-color: var(--danger) !important;
    animation: blink-red 0.8s ease infinite;
}

/* ===== MATCH CITY ===== */
.match-city {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== ANNOUNCEMENT BANNER ===== */
.announcement-banner {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.announce-info {
    background: linear-gradient(135deg, #d0eafb, #b8dcf5);
    color: #0d6ebd;
    border-bottom: 2px solid #1DA1F2;
}

.announce-warning {
    background: linear-gradient(135deg, #fff3cd, #ffe69c);
    color: #856404;
    border-bottom: 2px solid #f39c12;
}

.announce-success {
    background: linear-gradient(135deg, #d4edda, #b7dfbf);
    color: #155724;
    border-bottom: 2px solid #2ecc71;
}

.announce-urgent {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-bottom: 2px solid #e74c3c;
    animation: slideDown 0.3s ease, pulse-urgent 2s ease infinite;
}

@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Admin announcement form */
.announce-textarea {
    width: 100%;
    min-height: 80px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.announce-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.announce-styles {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.announce-style-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

.announce-preview {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.announce-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.announce-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===== ANNOUNCEMENT BLINK ===== */
.announce-blink {
    animation: slideDown 0.3s ease, announce-blink-anim 1.2s ease-in-out infinite !important;
}

@keyframes announce-blink-anim {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== VENUES ===== */
.venues-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.venue-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.venue-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.venue-header:hover {
    background: var(--bg-card-hover);
}

.venue-city {
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.venue-stadium {
    font-size: 11px;
    color: var(--text-muted);
}

.venue-count {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}

.venue-matches {
    display: none;
    padding: 0 16px 12px;
    border-top: 1px solid var(--border);
}

.venue-open .venue-matches {
    display: block;
}

.venue-open .venue-count {
    transform: rotate(180deg);
}

.venue-match {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.venue-match:last-child {
    border-bottom: none;
}

.venue-match-date {
    color: var(--text-muted);
    min-width: 50px;
    font-size: 11px;
}

.venue-match-round {
    color: var(--primary);
    font-weight: 600;
    min-width: 90px;
    font-size: 11px;
}

.venue-match-teams {
    font-weight: 500;
}

@media (max-width: 768px) {
    .venues-grid { grid-template-columns: 1fr; }
}

/* ===== VENUE IMAGE ===== */
.venue-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ===== CITY CLICKABLE ===== */
.city-clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.city-clickable:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== VENUE POPUP ===== */
.venue-popup-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.venue-popup-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.venue-popup-stadium {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.venue-popup-detail {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.venue-popup-matches-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.venue-popup-matches {
    max-height: 240px;
    overflow-y: auto;
}

/* ===== VENUE DESCRIPTION ===== */
.venue-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.venue-popup-desc {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* ===== DASHBOARD ===== */
.dashboard {
    display: flex;
    gap: 20px;
    min-height: 70vh;
    align-items: flex-start;
}

.dash-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-center {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 0;
}

.dash-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.dash-trophy {
    margin-bottom: 6px;
}

.dash-trophy-img {
    height: 120px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.dash-subtitle {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(29,161,242,0.1);
    padding: 6px 20px;
    border-radius: 20px;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.dash-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dash-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

.dash-group-right {
    border-left: 1px solid var(--border);
    border-right-width: 4px;
    flex-direction: row;
}

.dash-letter {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
}

.dash-teams {
    flex: 1;
    padding: 8px 12px;
}

.dash-team {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.dash-team:hover {
    color: var(--primary);
}

.dash-team-right {
    justify-content: flex-end;
}

.dash-team span {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
    }
    .dash-center {
        flex: none;
        order: -1;
    }
    .dash-col {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-group-right {
        border-right-width: 1px;
        border-left-width: 4px;
        flex-direction: row-reverse;
    }
    .dash-team-right {
        justify-content: flex-start;
        flex-direction: row-reverse;
    }
}

@media (max-width: 480px) {
    .dash-col {
        grid-template-columns: 1fr;
    }
    .dash-trophy { font-size: 60px; }
    .dash-title { font-size: 18px; }
}

/* Dark mode dashboard */
body.dark-mode .dash-group {
    background: var(--bg-card);
}

/* ===== MOBILE IMPROVEMENTS ===== */

/* Scrollable tabs with no wrap */
.nav-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Header mobile */
@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .header-left h1 { font-size: 14px; }
    .header-right {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .user-name { font-size: 12px; }
    .user-points { font-size: 12px; padding: 3px 8px; }
    .btn-save-top, .btn-check-top { font-size: 11px; padding: 5px 10px; }
    .btn-logout { font-size: 11px; padding: 6px 10px; }
    .btn-darkmode { font-size: 14px; padding: 5px 8px; }
    .tui-logo-header { height: 24px; }

    /* Tabs */
    .nav-tabs { padding: 8px 8px 0; gap: 4px; }
    .tab { padding: 7px 10px; font-size: 11px; }

    /* Main content */
    .main-content { padding: 12px 8px; }

    /* Group cards */
    .group-grid { grid-template-columns: 1fr !important; gap: 12px; }
    .group-header { padding: 10px 14px; flex-wrap: wrap; gap: 4px; }
    .group-header h3 { font-size: 14px; }
    .group-header-teams { font-size: 10px; }

    /* Match rows */
    .match-row { flex-wrap: wrap; gap: 4px; padding: 8px 0; }
    .match-date { min-width: auto; font-size: 10px; width: 100%; }
    .match-teams { font-size: 11px; gap: 4px; }
    .team-name { min-width: 35px; font-size: 11px; }
    .score-input { width: 32px; height: 30px; font-size: 13px; }
    .score-sep { font-size: 11px; }
    .match-time { font-size: 9px; }
    .match-city { font-size: 8px; }

    /* Knockout */
    .knockout-grid { grid-template-columns: 1fr !important; gap: 10px; }
    .knockout-card { padding: 12px; }
    .knockout-label { font-size: 10px; }
    .knockout-team { font-size: 12px; }

    /* Standings */
    .standings-table th, .standings-table td { padding: 6px 8px; font-size: 11px; }
    .scoreboard-table th, .scoreboard-table td { font-size: 10px; padding: 6px; }

    /* Save bar */
    .save-bar { gap: 8px; display: flex; flex-wrap: wrap; justify-content: center; }
    .btn-save { padding: 10px 24px; font-size: 13px; }
    .btn-check { padding: 10px 24px; font-size: 13px; }

    /* Login */
    .login-container { padding: 28px 20px; margin: 10px; }
    .logo-icon { font-size: 40px; }
    .login-logo h1 { font-size: 22px; }
    .tui-logo-login { width: 70px; }

    /* Modals */
    .squad-modal-content { padding: 16px; max-width: 95vw; margin: 10px; }
    .reset-modal-content { padding: 20px; max-width: 95vw; margin: 10px; }
    .venue-popup-img { height: 120px; }
    .pitch { padding: 12px 6px; gap: 10px; min-height: 240px; }
    .pitch-player-name { font-size: 8px; padding: 2px 4px; }
    .pitch-player-pos { font-size: 7px; }
    .pitch-player { min-width: 40px; }
    .squad-list { gap: 4px; }
    .squad-player { font-size: 10px; padding: 3px 6px; }

    /* Dashboard */
    .dash-title { font-size: 16px; }
    .dash-subtitle { font-size: 13px; padding: 4px 14px; }
    .dash-info { font-size: 11px; }
    .dash-team { font-size: 11px; gap: 5px; }
    .dash-team span { font-size: 11px; }
    .dash-letter { font-size: 18px; min-width: 32px; }

    /* Info page */
    .info-page { max-width: 100%; }
    .info-card { padding: 16px; }
    .info-rule { gap: 10px; }
    .info-rule-pts { font-size: 14px; padding: 6px 10px; min-width: 40px; }
    .info-table th, .info-table td { font-size: 11px; padding: 6px; }
    .venues-grid { grid-template-columns: 1fr !important; }
    .venue-img { height: 100px; }

    /* Leaderboard filter */
    .leaderboard-filter { flex-direction: column; align-items: flex-start; gap: 6px; }
    .country-filter-select { min-width: 100%; }

    /* Announcement */
    .announcement-banner { font-size: 12px; padding: 8px 12px; }

    /* Footer */
    .site-footer { font-size: 10px; padding: 16px 10px; }

    /* Toast */
    .save-toast { font-size: 12px; padding: 10px 16px; bottom: 16px; }

    /* Points badges */
    .pts-badge { font-size: 9px; padding: 2px 4px; }
    .real-score { font-size: 10px; padding: 2px 6px; }
}

/* Small tablets */
@media (min-width: 601px) and (max-width: 768px) {
    .group-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .knockout-grid { grid-template-columns: repeat(2, 1fr); }
    .venues-grid { grid-template-columns: 1fr !important; }
}

/* Prevent horizontal overflow — only on body to preserve sticky */
body {
    overflow-x: clip;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* Better touch targets */
@media (pointer: coarse) {
    .tab { min-height: 40px; }
    .score-input { min-height: 36px; }
    .btn-save, .btn-check, .btn-login { min-height: 44px; }
    .team-clickable, .city-clickable { padding: 2px 0; }
}

/* ===== FORCE MOBILE LAYOUT ===== */
body.force-mobile .header-inner { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
body.force-mobile .header-left h1 { font-size: 14px; }
body.force-mobile .header-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
body.force-mobile .user-name { font-size: 12px; }
body.force-mobile .user-points { font-size: 12px; padding: 3px 8px; }
body.force-mobile .btn-save-top, body.force-mobile .btn-check-top { font-size: 11px; padding: 5px 10px; }
body.force-mobile .btn-logout { font-size: 11px; padding: 6px 10px; }
body.force-mobile .tui-logo-header { height: 24px; }
body.force-mobile .nav-tabs { padding: 8px 8px 0; gap: 4px; }
body.force-mobile .tab { padding: 7px 10px; font-size: 11px; }
body.force-mobile .main-content { padding: 12px 8px; }
body.force-mobile .group-grid { grid-template-columns: 1fr !important; gap: 12px; }
body.force-mobile .admin-group-grid { grid-template-columns: 1fr !important; }
body.force-mobile .knockout-grid { grid-template-columns: 1fr !important; }
body.force-mobile .group-header { padding: 10px 14px; flex-wrap: wrap; gap: 4px; }
body.force-mobile .group-header h3 { font-size: 14px; }
body.force-mobile .group-header-teams { font-size: 10px; }
body.force-mobile .match-row { flex-wrap: wrap; gap: 4px; padding: 8px 0; }
body.force-mobile .match-date { min-width: auto; font-size: 10px; width: 100%; }
body.force-mobile .match-teams { font-size: 11px; gap: 4px; }
body.force-mobile .team-name { min-width: 35px; font-size: 11px; }
body.force-mobile .score-input { width: 32px; height: 30px; font-size: 13px; }
body.force-mobile .knockout-card { padding: 12px; }
body.force-mobile .knockout-label { font-size: 10px; }
body.force-mobile .standings-table th, body.force-mobile .standings-table td { padding: 6px 8px; font-size: 11px; }
body.force-mobile .scoreboard-table th, body.force-mobile .scoreboard-table td { font-size: 10px; padding: 6px; }
body.force-mobile .info-page { max-width: 100%; }
body.force-mobile .info-card { padding: 16px; }
body.force-mobile .venues-grid { grid-template-columns: 1fr !important; }
body.force-mobile .locks-grid { grid-template-columns: 1fr !important; }
body.force-mobile .export-grid, body.force-mobile .import-grid { grid-template-columns: 1fr !important; }
body.force-mobile .export-card-full { grid-column: span 1; }
body.force-mobile .data-stats { flex-wrap: wrap; }
body.force-mobile .leaderboard-filter { flex-direction: column; align-items: flex-start; }
body.force-mobile .country-filter-select { min-width: 100%; }
body.force-mobile .dashboard { flex-direction: column; }
body.force-mobile .dash-center { flex: none; order: -1; }
body.force-mobile .dash-col { display: grid; grid-template-columns: repeat(2, 1fr); }
body.force-mobile .dash-trophy-img { height: 120px; }
body.force-mobile .dash-title { font-size: 16px; }
body.force-mobile .announcement-banner { font-size: 12px; padding: 8px 12px; }
body.force-mobile .site-footer { font-size: 10px; }
body.force-mobile .match-editor-grid { grid-template-columns: 1fr !important; }

/* ===== MOBILE TAB MENU (hamburger) ===== */
.tab-menu-toggle {
    display: none;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    margin: 8px;
}
.tab-menu-items { display: contents; }

body.force-mobile .tab-menu-toggle { display: block; }
body.force-mobile .tab-menu-items {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 0 8px 8px;
    gap: 4px;
}
body.force-mobile .tab-menu-items.open {
    display: flex;
}
body.force-mobile .nav-tabs {
    flex-wrap: wrap;
    padding: 0;
    gap: 0;
}
body.force-mobile .tab-menu-items .tab {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 8px;
    border-bottom: 1px solid var(--border);
}
body.force-mobile .tab-menu-items .tab.active {
    background: var(--primary);
    color: #fff;
}
body.force-mobile .app-container,
body.force-mobile .main-content {
    max-width: 420px;
    margin: 0 auto;
}
body.force-mobile .admin-group-grid { grid-template-columns: 1fr !important; }
body.force-mobile .knockout-grid { grid-template-columns: 1fr !important; }
body.force-mobile .data-stats { grid-template-columns: 1fr 1fr !important; }
body.force-mobile .leaderboard-filter { flex-wrap: wrap; gap: 6px; }
body.force-mobile .scoreboard-table { font-size: 11px; }
body.force-mobile .scoreboard-table th,
body.force-mobile .scoreboard-table td { padding: 6px 4px; }

@media (max-width: 768px) {
    .tab-menu-toggle { display: block; }
    .tab-menu-items {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0 8px 8px;
        gap: 4px;
    }
    .tab-menu-items.open { display: flex; }
    .nav-tabs { flex-wrap: wrap; padding: 0; gap: 0; }
    .tab-menu-items .tab {
        width: 100%;
        text-align: left;
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 8px;
        border-bottom: 1px solid var(--border);
    }
    .tab-menu-items .tab.active { background: var(--primary); color: #fff; }
}

/* ===== PROFILE CLICKABLE NAME ===== */
.user-name-clickable {
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 1px dashed var(--text-muted);
    padding-bottom: 1px;
}

.user-name-clickable:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== PER-MATCH LOCK ===== */
.match-locked-tag {
    font-size: 11px;
}

.knockout-card-locked {
    opacity: 0.7;
}

.lock-mode {
    margin-bottom: 12px;
}

.lock-custom-dates {
    transition: all 0.2s;
}

/* ===== DRAW BLINK (pick winner manually) ===== */
.match-override.draw-blink {
    border-color: var(--draw) !important;
    animation: blink-draw 1s ease-in-out infinite;
}

@keyframes blink-draw {
    0%, 100% { border-color: var(--draw); box-shadow: 0 0 0 rgba(243,156,18,0); }
    50% { border-color: var(--draw); box-shadow: 0 0 10px rgba(243,156,18,0.5); }
}

/* ===== CHAMPION PICK ===== */
.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.champion-pick {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(212,175,55,0.1), rgba(212,175,55,0.05));
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 6px 16px;
}

.champion-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.champion-select {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-width: 160px;
}

.champion-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.champion-select:focus {
    outline: none;
    border-color: var(--primary);
}

@media (max-width: 600px) {
    .header-center { width: 100%; order: 3; }
    .champion-pick { width: 100%; justify-content: center; padding: 4px 10px; }
    .champion-label { font-size: 12px; }
    .champion-select { font-size: 12px; min-width: 120px; }
}

body.force-mobile .header-center { width: 100%; order: 3; }
body.force-mobile .champion-pick { width: 100%; justify-content: center; padding: 4px 10px; }
body.force-mobile .champion-label { font-size: 12px; }
body.force-mobile .champion-select { font-size: 12px; min-width: 120px; }

/* ===== OVERVIEW SCHEDULE ===== */
.overview-schedule {
    margin-top: 32px;
}

.overview-schedule-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    text-align: center;
}

.schedule-day {
    margin-bottom: 12px;
}

.schedule-day-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    background: var(--bg-input);
    padding: 8px 16px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
}

.schedule-match {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    font-size: 12px;
}

.schedule-match:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.schedule-played {
    background: rgba(46,204,113,0.04);
}

.schedule-time {
    min-width: 50px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
}

.schedule-round {
    min-width: 80px;
    color: var(--text-muted);
    font-size: 10px;
}

.schedule-home {
    flex: 1;
    text-align: right;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.schedule-score {
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 13px;
}

.schedule-away {
    flex: 1;
    text-align: left;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.schedule-city {
    min-width: 80px;
    text-align: right;
    color: var(--text-muted);
    font-size: 10px;
}

@media (max-width: 600px) {
    .schedule-match { flex-wrap: wrap; gap: 4px; padding: 6px 10px; font-size: 11px; }
    .schedule-time { min-width: 40px; }
    .schedule-round { display: none; }
    .schedule-city { display: none; }
    .schedule-score { min-width: 40px; font-size: 12px; }
}

body.force-mobile .schedule-round { display: none; }
body.force-mobile .schedule-city { display: none; }

/* ===== USER LOOKUP ===== */
.lookup-search {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.lookup-search input {
    flex: 1;
    max-width: 400px;
}

.lookup-user-info {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text);
}

.lookup-pred {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    min-width: 50px;
    text-align: center;
}

/* ===== RESET ROUNDS BAR ===== */
.reset-rounds-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.reset-rounds-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 4px;
}

.btn-reset-round {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: 6px;
    color: var(--danger);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-round:hover {
    background: var(--danger);
    color: #fff;
}

.btn-fill-round {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--success);
    border-radius: 6px;
    color: var(--success);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-fill-round:hover {
    background: var(--success);
    color: #fff;
}

.champion-save-btn {
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.champion-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(29,161,242,0.3);
}

/* ===== CHAMPION PICKS CHART ===== */
.champ-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.champ-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.champ-team {
    min-width: 120px;
    font-size: 13px;
    font-weight: 600;
}

.champ-bar-wrap {
    flex: 1;
    height: 20px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.champ-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.3s ease;
}

.champ-pct {
    min-width: 70px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

/* ===== MATCH EVENTS ===== */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.event-match-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    transition: transform 0.15s;
}
.event-match-card.event-played { border-left: 3px solid var(--success); }
.event-match-card.event-played:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.event-match-card.event-unplayed { opacity: 0.4; }
.event-match-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.event-match-label { font-size: 11px; color: var(--text-muted); }
.event-match-score { font-weight: 700; font-size: 16px; }
.event-match-teams { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.event-match-stats { font-size: 12px; color: var(--text-muted); }

/* ===== MATCH TIMELINE ===== */
.match-timeline { padding: 8px 0; }
.timeline-event { display: flex; align-items: center; gap: 8px; padding: 6px 12px; margin: 2px 0; border-radius: 6px; font-size: 13px; }
.timeline-left { background: rgba(29,161,242,0.08); }
.timeline-right { background: rgba(231,76,60,0.08); flex-direction: row-reverse; text-align: right; }
.timeline-min { font-weight: 700; font-size: 12px; color: var(--text-muted); min-width: 30px; }
.timeline-icon { font-size: 16px; }
.timeline-player { font-weight: 500; }
.timeline-player small { font-weight: 400; color: var(--text-muted); }

/* ===== COUNTDOWN ===== */
.countdown {
    margin: 16px 0 20px;
    min-height: 80px;
}

.countdown-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.countdown-boxes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.countdown-box {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 64px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(29,161,242,0.15);
}

.countdown-num {
    display: block;
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.countdown-unit {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 1px;
    font-weight: 600;
}

.countdown-sep {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.countdown-live {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
    animation: pulse-urgent 1.5s ease infinite;
}

@media (max-width: 600px) {
    .countdown-box { padding: 6px 8px; min-width: 44px; }
    .countdown-num { font-size: 20px; }
    .countdown-sep { font-size: 16px; }
}

body.force-mobile .countdown-box { padding: 6px 8px; min-width: 44px; }
body.force-mobile .countdown-num { font-size: 20px; }

.footer-email {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.footer-email:hover {
    text-decoration: underline;
}

.tui-email-notice {
    font-size: 11px;
    color: var(--draw);
    margin-top: 6px;
    font-weight: 500;
}

/* ===== BACK TO TOP BUTTON ===== */
.btn-back-to-top, .btn-go-to-bottom {
    position: fixed;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.btn-back-to-top { bottom: 76px; }
.btn-go-to-bottom { bottom: 24px; }
.btn-back-to-top.visible, .btn-go-to-bottom.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.btn-back-to-top:hover, .btn-go-to-bottom:hover {
    background: var(--primary-dark, #1580d0);
    transform: translateY(-2px);
}
