/* ================================================
   TSILIS F1 PREDICTIONS - PROFESSIONAL STYLING
   ================================================ */

:root {
    /* F1 Brand Colors */
    --f1-red: #E10600;
    --f1-dark: #15151E;
    --f1-light: #FFFFFF;
    --f1-grey: #38383F;
    --f1-silver: #949498;
    
    /* Team Colors */
    --red-bull: #0600EF;
    --ferrari: #DC0000;
    --mercedes: #00D2BE;
    --mclaren: #FF8700;
    --aston: #006F62;
    --alpine: #0090FF;
    --williams: #005AFF;
    --rb: #2B4562;
    --haas: #FFFFFF;
    --sauber: #00E701;
    
    /* Status Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    background: linear-gradient(135deg, #15151E 0%, #2D2D3A 100%);
    color: var(--f1-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* ================================================
   NAVIGATION BAR
   ================================================ */
nav {
    background: rgba(21, 21, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(225, 6, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--f1-red);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

nav a {
    color: var(--f1-light);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
}

nav a:hover {
    background: var(--f1-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.4);
}

nav a.active {
    background: var(--f1-red);
}

/* NAV LINKS CONTAINER */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1rem;
    flex: 1;
    justify-content: flex-end;
}

/* Profile link */
.profile-link {
    display: inline-flex;
    align-items: center;
}

/* Hamburger button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: auto;
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ================================================
   CONTAINER & LAYOUT
   ================================================ */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--f1-red) 0%, #B00500 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(225, 6, 0, 0.3);
}

.page-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.page-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ================================================
   HOME PAGE HERO
   ================================================ */
.hero-section {
    background: linear-gradient(135deg, var(--f1-red) 0%, #B00500 100%);
    border-radius: 20px;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
    box-shadow: 0 10px 40px rgba(225, 6, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.hero-logo img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.hero-section::before {
    content: '🏁';
    position: absolute;
    font-size: 15rem;
    right: -2rem;
    top: -2rem;
    opacity: 0.1;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.next-race-info {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.next-race-info h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.race-countdown {
    display: inline-block;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    text-align: center;
}

.btn-primary {
    background: var(--f1-red);
    color: white;
    box-shadow: 0 4px 15px rgba(225, 6, 0, 0.3);
}

.btn-primary:hover {
    background: #B00500;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 6, 0, 0.5);
}

.btn-secondary {
    background: var(--f1-grey);
    color: white;
}

.btn-secondary:hover {
    background: #4A4A52;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-lg {
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
}

/* ================================================
   RACE CALENDAR CARDS
   ================================================ */
.race-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.race-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(225, 6, 0, 0.3);
    border-color: var(--f1-red);
}

.race-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(225, 6, 0, 0.3);
}

.race-title {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.race-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-next {
    background: var(--success);
    animation: pulse 2s infinite;
}

.badge-sprint {
    background: var(--f1-red);
}

.badge-completed {
    background: var(--f1-grey);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.race-location {
    color: var(--f1-silver);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.session-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid;
}

.session-box.practice { border-color: var(--f1-grey); }
.session-box.qualifying { border-color: var(--success); }
.session-box.sprint { border-color: var(--f1-red); }
.session-box.race { border-color: var(--info); }

.session-type {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--f1-silver);
    margin-bottom: 0.25rem;
}

.session-time {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ================================================
   PREDICTION FORM
   ================================================ */
.prediction-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover { background: rgba(255, 255, 255, 0.1); }
.tab-btn.active {
    background: var(--f1-red);
    border-color: var(--f1-red);
}

.countdown-banner {
    background: linear-gradient(135deg, var(--info) 0%, #2563EB 100%);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.prediction-grid {
    display: grid;
    gap: 1rem;
}

.position-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    gap: 2rem;
}

.position-label {
    background: var(--f1-grey);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    min-width: 120px;
}

.position-label.p1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
}
.position-label.p2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: #000;
}
.position-label.p3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B8732D 100%);
    color: #fff;
}

.driver-select {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 2.5rem;
    font-size: 2.5rem;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.driver-select:hover,
.driver-select:focus {
    border-color: var(--f1-red);
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

/* ================================================
   LEADERBOARD
   ================================================ */
.podium-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
    align-items: flex-end;
}

.podium-position {
    text-align: center;
    padding: 2rem 1rem;
    border-radius: 16px;
    position: relative;
    transition: all 0.3s ease;
}
.podium-position:hover { transform: translateY(-10px); }

.podium-position.first {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    order: 2;
    padding: 3rem 1rem;
}

.podium-position.second {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: #000;
    order: 1;
}

.podium-position.third {
    background: linear-gradient(135deg, #CD7F32 0%, #B8732D 100%);
    order: 3;
}

.podium-rank {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.podium-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.podium-points {
    font-size: 2rem;
    font-weight: 600;
}

.leaderboard-table {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

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

.leaderboard-table th {
    background: var(--f1-red);
    padding: 1.5rem;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
}

.leaderboard-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-table tr:hover {
    background: rgba(225, 6, 0, 0.1);
}

.rank-cell {
    font-weight: 700;
    font-size: 1.3rem;
    width: 80px;
}

.rank-cell.top3 { color: #FFD700; }

.points-cell {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--f1-red);
}

/* ================================================
   MY PREDICTIONS PAGE
   ================================================ */
.predictions-container {
    display: grid;
    gap: 2rem;
}

.prediction-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
}

.prediction-section h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.predictions-table {
    width: 100%;
    border-collapse: collapse;
}

.predictions-table th {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--f1-red);
}

.predictions-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.driver-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.driver-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 4px solid;
    font-weight: 600;
}

.toggle-details {
    color: var(--f1-red);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-details:hover { color: #B00500; }

/* ================================================
   CARDS & BOXES
   ================================================ */
.card {
    background: rgba(30, 30, 40, 0.8) !important;
    border: 2px solid rgba(225, 6, 0, 0.4) !important;
    box-shadow: 0 4px 20px rgba(225, 6, 0, 0.2) !important;
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.card:hover {
    border-color: rgba(225, 6, 0, 0.8) !important;
    box-shadow: 0 6px 30px rgba(225, 6, 0, 0.4) !important;
}

.card-header {
    border-bottom: 2px solid rgba(225, 6, 0, 0.3);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.info-box {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--info);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.warning-box {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.success-box {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* ================================================
   FOOTER
   ================================================ */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    color: var(--f1-silver);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ================================================
   UTILITIES
   ================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ================================================
   DESKTOP ENHANCEMENTS
   ================================================ */
.prediction-grid {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.position-row {
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

form p {
    text-align: center;
    font-size: 1.5rem !important;
    margin-bottom: 2rem;
}

.driver-select option {
    font-size: 1.8rem !important;
    padding: 1.5rem !important;
    background: rgba(30, 30, 40, 0.95);
    color: white;
    line-height: 2.5rem;
}

.quali-select,
.race-select,
.sprint-select {
    font-size: 1.4rem;
    padding: 0.5rem 0.75rem;
    max-width: 400px;
}

/* ============================================
   Logo Styling
   ============================================ */
.logo-link {
    display: inline-flex;
    align-items: center;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.site-logo {
    height: 30px;
    width: auto;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.logo-link:hover .site-logo {
    transform: scale(1.1);
    opacity: 0.8;
}

/* ============================================
   Login Link Styling
   ============================================ */
.login-link {
    color: #e10600;
    font-weight: 600;
    text-decoration: underline;
    transition: all 0.3s ease;
}

.login-link:hover {
    color: #ff1e1e;
    text-decoration: none;
    transform: translateX(3px);
}

/* ================================================
   RESPONSIVE DESIGN - ALL MOBILE RULES COMBINED
   ================================================ */
@media (max-width: 768px) {

    /* --- NAV --- */
    nav {
        padding: 0.75rem 1rem;
        position: relative;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    #navToggle.nav-toggle {
        display: inline-flex !important;
        margin-left: auto !important;
        z-index: 1100 !important;
    }

    #navLinks.nav-links {
        position: absolute !important;
        top: 60px;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 0.75rem 1rem 1rem !important;
        background: rgba(21, 21, 30, 0.98) !important;
        border-bottom: 2px solid var(--f1-red) !important;
        flex: 0 !important;
    }

    #navLinks.nav-links.open {
        display: flex !important;
    }

    #navLinks.nav-links a {
        width: 100% !important;
        margin: 0.15rem 0 !important;
        padding: 0.5rem 0.5rem !important;
    }

    a.profile-link {
        align-self: stretch !important;
        justify-content: flex-start !important;
    }

    a.profile-link img {
        width: 28px !important;
        height: 28px !important;
    }

    /* --- CONTAINER --- */
    .container {
        padding: 1rem;
    }

    /* --- HERO --- */
    .hero-section {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }

    .hero-section::before {
        font-size: 8rem;
    }

    .hero-content h1 {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem;
    }

    .hero-content p {
        font-size: 1rem !important;
        margin-bottom: 1rem;
    }

    .hero-logo img {
        max-width: 80%;
    }

    /* --- NEXT RACE BOX --- */
    .next-race-info {
        padding: 1rem;
        margin-top: 1rem;
    }

    .next-race-info h2 {
        font-size: 1.2rem;
    }

    .race-countdown {
        font-size: 0.95rem;
        padding: 0.4rem 1rem;
    }

    /* --- BUTTONS --- */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* --- PAGE HEADER --- */
    .page-header {
        padding: 1rem;
        margin-bottom: 1.5rem;
        border-radius: 10px;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }

    .page-header p {
        font-size: 0.95rem;
    }

    /* --- CARDS --- */
    .card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 10px !important;
    }

    /* --- RACE CARDS --- */
    .race-card {
        padding: 1rem;
        border-radius: 10px;
    }

    .race-title {
        font-size: 1.2rem;
    }

    .race-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* --- LEADERBOARD --- */
    .podium-display {
        grid-template-columns: 1fr;
    }

    .podium-position {
        order: unset !important;
    }

    .podium-rank { font-size: 2.5rem; }
    .podium-name { font-size: 1.2rem; }
    .podium-points { font-size: 1.5rem; }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* --- SESSION GRID --- */
    .session-grid {
        grid-template-columns: 1fr;
    }

    /* --- PREDICTION FORM --- */
    .position-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .position-label {
        min-width: unset;
        width: 100%;
        font-size: 1.2rem;
        padding: 0.75rem;
    }

    .driver-select {
        font-size: 1.2rem !important;
        padding: 0.75rem !important;
        width: 100%;
    }

    .prediction-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .countdown-banner {
        font-size: 0.95rem;
        padding: 1rem;
    }

    /* --- LOGO --- */
    .site-logo {
        height: 26px;
    }

    .logo-link {
        margin-right: 0.3rem;
    }

    /* --- GENERAL TYPOGRAPHY --- */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.1rem; }

    .prediction-section h2 {
        font-size: 1.3rem;
    }
    
    /* --- PREDICTIONS TABLE --- */
    .predictions-table th,
    .predictions-table td {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    .driver-badges {
        gap: 0.3rem;
    }

    .driver-badge {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }

    /* --- FOOTER --- */
    footer {
        margin-top: 2rem;
        padding: 1rem;
        font-size: 0.9rem;
    }

    /* --- MISC --- */
    .flex-between {
        flex-direction: column;
        gap: 0.75rem;
    }

    .tab-btn {
        font-size: 0.95rem;
        padding: 0.75rem;
    }

    .quali-select,
    .race-select,
    .sprint-select {
        font-size: 1rem;
        padding: 0.5rem;
        max-width: 100%;
        width: 100%;
    }

    .info-box,
    .warning-box,
    .success-box {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .card-header h2 {
        font-size: 1.3rem;
    }

    .prediction-section {
        padding: 1rem;
    }

    .predictions-container {
        gap: 1rem;
    }
}

/* ================================================
   MY PREDICTIONS MOBILE FIX
   ================================================ */
@media (max-width: 768px) {

    /* Prevent the whole page from expanding wider than screen */
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Make prediction sections not overflow */
    .prediction-section {
        overflow-x: hidden;
        padding: 0.75rem;
    }

    /* Make tables scroll horizontally instead of pushing page wide */
    .predictions-table,
    .leaderboard-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        width: 100%;
    }

    .predictions-table table,
    .leaderboard-table table {
        min-width: 100%;
    }

    /* ================================================
       LEADERBOARD MOBILE FIX - stack columns better
       ================================================ */
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Make rank column smaller */
    .rank-cell {
        width: 40px;
        font-size: 0.85rem;
    }

    /* Make points stand out but smaller */
    .points-cell {
        font-size: 0.95rem;
    }

    /* Leaderboard table wrapper scrollable */
    .leaderboard-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    /* My predictions table fixes */
    .predictions-table th,
    .predictions-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Driver badges wrap properly */
    .driver-badges {
        flex-wrap: wrap;
        white-space: normal;
        max-width: 200px;
    }

    .driver-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        white-space: nowrap;
    }
}

/* ================================================
   MY PREDICTIONS OVERFLOW FIX
   ================================================ */
@media (max-width: 768px) {

    /* Lock the entire page width */
    html {
        overflow-x: hidden;
        width: 100%;
    }

    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    /* Lock main content area */
    main {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* Lock container */
    .container {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        box-sizing: border-box;
    }

    /* Lock predictions wrapper */
    .predictions-container {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    /* Lock each section */
    .prediction-section {
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        box-sizing: border-box;
    }

    /* Make the table scroll inside its box, not push the page */
    .prediction-section .predictions-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .prediction-section .predictions-table table {
        width: 100%;
        min-width: 500px; /* allows scroll if needed but won't push page */
    }

    .predictions-table th,
    .predictions-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Driver badges wrap properly */
    .driver-badges {
        flex-wrap: wrap;
        white-space: normal;
        max-width: 150px;
    }

    .driver-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        white-space: nowrap;
    }

    /* Page header inside predictions */
    .page-header h1 {
        font-size: 1.4rem;
        word-break: break-word;
    }

    /* Section headings */
    .prediction-section h2 {
        font-size: 1.1rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

/* ================================================
   FINAL MOBILE FIXES - HERO + PODIUM
   ================================================ */
@media (max-width: 768px) {

    /* --- HERO TEXT SIZE --- */
    .hero-section {
        padding: 1.25rem 1rem !important;
        margin-bottom: 1.25rem !important;
    }

    .hero-content h1 {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.5rem !important;
    }

    .hero-content p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin-bottom: 0.75rem !important;
    }

    .next-race-info {
        padding: 0.75rem !important;
        margin-top: 0.75rem !important;
    }

    .next-race-info h2 {
        font-size: 1rem !important;
        flex-wrap: wrap !important;
    }

    /* --- PODIUM CORRECT ORDER --- */
    /* Switch from grid to flex so order property works properly */
    .podium-display {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }

    /* Force correct visual order: 1st, 2nd, 3rd */
    .podium-position.first  { order: 1 !important; padding: 1.5rem 1rem !important; }
    .podium-position.second { order: 2 !important; padding: 1.25rem 1rem !important; }
    .podium-position.third  { order: 3 !important; padding: 1.25rem 1rem !important; }

    .podium-rank   { font-size: 2.5rem !important; }
    .podium-name   { font-size: 1.1rem !important; }
    .podium-points { font-size: 1.3rem !important; }
}



.profile-actions {
    margin-top: 20px;
}

.profile-actions .btn {
    min-width: 190px;
    margin-right: 10px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .profile-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .profile-actions .btn {
        flex: 1 1 calc(50% - 8px); /* δύο κουμπιά επάνω */
        margin-right: 0;
        margin-bottom: 0;
        text-align: center;
    }
}


/* ================================================
   HOW TO PLAY - SCORING TABLE MOBILE FIX
   ================================================ */
@media (max-width: 768px) {

    /* Override the global overflow:hidden on leaderboard-table */
    .scoring-table .leaderboard-table {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        border-radius: 10px;
    }

    .scoring-table .leaderboard-table table {
        min-width: 320px;
        width: 100%;
        font-size: 0.85rem;
    }

    .scoring-table .leaderboard-table th,
    .scoring-table .leaderboard-table td {
        padding: 0.75rem 0.75rem;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    /* Wrapper also scrollable */
    .scoring-table {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}