@import url('https://fonts.googleapis.com/css2?family=Chivo:wght@400;500;600;700;800;900&family=Manrope:wght@400;500;600;700&display=swap');

:root {
    --f1-red: #e10600;
    --f1-red-dark: #b30500;
    --f1-red-light: #ff1a14;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Chivo', sans-serif;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Dark Theme */
body.dark {
    --bg-primary: #0a0a0b;
    --bg-secondary: #141416;
    --bg-card: #1a1a1d;
    --bg-hover: #242428;
    --text-primary: #f5f5f7;
    --text-secondary: #b0b0b5;
    --text-muted: #8a8a90;
    --border-color: #2a2a2e;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Light Theme */
body.light {
    --bg-primary: #f0f0f2;
    --bg-secondary: #e5e5e8;
    --bg-card: #f8f8fa;
    --bg-hover: #dcdce0;
    --text-primary: #1a1a1d;
    --text-secondary: #4a4a50;
    --text-muted: #6a6a70;
    --border-color: #c8c8cc;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--f1-red);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text {
    font-family: 'Chivo', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-year {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--f1-red);
    border-radius: 1px;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: 'Chivo', sans-serif;
}

.btn-primary {
    background: var(--f1-red);
    color: white;
}

.btn-primary:hover {
    background: var(--f1-red-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--f1-red);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(225, 6, 0, 0.15);
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-card);
    border-radius: 16px;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--f1-red);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pool-won {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1d;
}

.status-open {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

.status-closed {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
}

.status-pending {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.status-completed {
    background: #6b7280;
    color: white;
}

/* Position Badges */
.position-badge {
    font-family: 'Chivo', sans-serif;
    font-weight: 800;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.875rem;
}

.position-1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1d;
}

.position-2 {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: #1a1a1d;
}

.position-3 {
    background: linear-gradient(135deg, #cd7c2f, #a15c1d);
    color: white;
}

/* Stars */
.star {
    color: #fbbf24;
    animation: star-pulse 2s ease-in-out infinite;
}

@keyframes star-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Perfect Bet Glow */
.perfect-bet {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
    border-color: #fbbf24 !important;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--f1-red);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.2);
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Homepage grid layout */
.homepage-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.homepage-grid .races-section {
    order: 1;
}

.homepage-grid .leaderboard-section {
    order: 2;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Collapsible leaderboard header for mobile */
.leaderboard-collapse-header {
    display: none;
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .homepage-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Leaderboard first on mobile */
    .homepage-grid .leaderboard-section {
        order: 1;
    }
    
    .homepage-grid .races-section {
        order: 2;
    }
    
    /* Hide rows after top 3 on mobile */
    .homepage-grid .desktop-only-row {
        display: none;
    }
    
    /* Collapsible leaderboard on mobile */
    .leaderboard-collapse-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        padding: 1rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 0;
    }
    
    .leaderboard-collapse-header h2 {
        margin: 0;
        font-size: 1.1rem;
    }
    
    .leaderboard-collapse-header .toggle-icon {
        transition: transform 0.3s ease;
    }
    
    .leaderboard-collapse-header.expanded .toggle-icon {
        transform: rotate(180deg);
    }
    
    .leaderboard-section .desktop-header {
        display: none;
    }
    
    .leaderboard-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .leaderboard-content.expanded {
        max-height: 500px;
    }
    
    .leaderboard-content .card {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        margin-top: -1px;
    }
}

/* Race Card */
.race-card {
    padding: 1.5rem;
}

.race-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.race-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.race-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.race-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Quali/Results Row */
.quali-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.quali-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Bets Section */
.bets-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.bets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.bet-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.bet-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bet-avatar {
    width: 32px;
    height: 32px;
    background: var(--f1-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.bet-predictions {
    display: flex;
    gap: 0.5rem;
}

.bet-pred {
    padding: 0.25rem 0.5rem;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Leaderboard */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.leaderboard-table tr:hover {
    background: var(--bg-hover);
}

.leaderboard-table tr.top-3 {
    background: linear-gradient(90deg, rgba(225, 6, 0, 0.1), transparent);
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--f1-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--f1-red);
    border-bottom-color: var(--f1-red);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(5, 150, 105, 0.2);
    border: 1px solid #059669;
    color: #10b981;
}

.alert-error {
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid #dc2626;
    color: #ef4444;
}

.alert-warning {
    background: rgba(217, 119, 6, 0.2);
    border: 1px solid #d97706;
    color: #f59e0b;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--f1-red); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none; }

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        margin-top: 1rem;
    }
    
    .bet-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* Dark mode date/time inputs */
body.dark input[type="date"],
body.dark input[type="time"] {
    color-scheme: dark;
}

body.dark input[type="date"]::-webkit-calendar-picker-indicator,
body.dark input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    background: var(--f1-red);
}

/* Light mode picker indicator styling */
body.light input[type="date"]::-webkit-calendar-picker-indicator,
body.light input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    background: var(--f1-red);
    filter: invert(1);
}

/* User's own bet highlight in all bets */
.bet-item.my-bet {
    background: linear-gradient(90deg, rgba(225, 6, 0, 0.15), var(--bg-secondary));
    border-color: var(--f1-red);
    border-width: 2px;
}

.bet-item.my-bet .bet-avatar {
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.3);
}

/* Collapsible forms */
.collapsible-form {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.collapsible-form.expanded {
    max-height: 1000px;
}

.collapsible-form .card-body {
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-form.expanded .card-body {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:hover {
    background: var(--bg-hover);
}

.collapsible-header .toggle-icon {
    transition: transform 0.3s ease;
}

.collapsible-header.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Edit form highlight */
.edit-form-active {
    border: 2px solid var(--f1-red);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(225, 6, 0, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(225, 6, 0, 0); }
}

/* Scroll margin for anchors - increased for sticky header */
[id^="race-"], [id^="driver-"], [id^="edit-"] {
    scroll-margin-top: 200px;
}

/* Admin section title always visible */
.card.edit-form-active {
    scroll-margin-top: 220px;
}

/* Tab count badge */
.tab-count {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 4px;
}

/* CET timezone label */
.timezone-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Countdown timer */
.countdown-timer {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.countdown-timer .countdown-value {
    font-weight: 600;
    color: var(--f1-red);
}

.countdown-timer.betting-open .countdown-value {
    color: #10b981;
}

/*Pool size highlight*/
.bettingpool_size {
    color: #b98f10;
}
/* Logo image fix */
.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Theme-specific logo visibility - hide by default */
.logo-dark,
.logo-light {
    display: none;
}

/* Show correct logo for each theme */
body.dark .logo-dark { display: block; }
body.light .logo-light { display: block; }

/* Betting Modal */
.bet-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bet-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bet-modal {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.bet-modal-overlay.active .bet-modal {
    transform: scale(1);
}

.bet-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.bet-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.bet-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.bet-modal-close:hover {
    color: var(--text-primary);
}

.bet-modal-body {
    padding: 1.5rem;
}

.bet-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.bet-modal-footer .btn {
    flex: 1;
}

/* Rules page styles */
.rules-container {
    max-width: 800px;
    margin: 0 auto;
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
}

.rules-table th,
.rules-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.rules-table th {
    background: var(--bg-hover);
    font-weight: 600;
}

.rules-table tr:last-child td {
    border-bottom: none;
}

.rules-table td:first-child {
    width: 40%;
    white-space: nowrap;
}

.example-box {
    background: var(--bg-hover);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--f1-red);
}

.example-scenario {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.example-scenario h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.example-calc {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.example-calc li {
    padding: 0.25rem 0;
}

.example-calc li.total {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 1.1rem;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

/* Mobile nav extras (profile, logout, theme/lang in mobile menu) */
.mobile-nav-extras {
    display: none;
}

/* Desktop only elements */
.desktop-only {
    display: flex;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: block;
    }
    
    /* Hide desktop controls */
    .desktop-only {
        display: none !important;
    }
    
    /* Mobile navigation - opens from right */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        left: auto;
        width: 280px;
        height: 100vh;
        background: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 5rem 0 2rem 0;
        transition: right 0.3s ease;
        z-index: 100;
        box-shadow: -2px 0 20px rgba(0,0,0,0.3);
        overflow-y: auto;
    }
    
    .nav.active {
        right: 0;
    }
    
    .nav-link {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    
    .nav-link i {
        width: 20px;
        text-align: center;
    }
    
    .nav-link.active::after {
        display: none;
    }
    
    .nav-link.active {
        background: var(--bg-hover);
        border-right: 3px solid var(--f1-red);
    }
    
    /* Mobile nav extras */
    .mobile-nav-extras {
        display: block;
        margin-top: 1rem;
        border-top: 2px solid var(--border-color);
        padding-top: 1rem;
    }
    
    .mobile-nav-extras .nav-link {
        color: var(--text-secondary);
    }
    
    .mobile-controls {
        padding: 1rem 1.5rem;
        display: flex;
        gap: 1rem;
    }
    
    .mobile-controls .btn {
        flex: 1;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }
    
    .mobile-controls .btn span {
        margin-left: 0.5rem;
    }
    
    /* Mobile overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Header adjustments */
    .header-content {
        padding: 0;
    }
    
    .logo {
        flex: 1;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .logo-year {
        display: none;
    }
    
    /* Hero section */
    .hero {
        padding: 2rem 0 !important;
    }
    
    .hero h1 {
        font-size: 1.75rem !important;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    /* Cards */
    .card {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
    }
    
    .card-header, .card-body {
        padding: 1rem;
    }
    
    /* Grid layouts */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    /* Race cards */
    .race-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .race-header .badge {
        align-self: flex-start;
    }
    
    .race-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    /* Race card actions - make bet buttons more prominent on mobile */
    .race-card > .flex.items-center.justify-between {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .race-card > .flex.items-center.justify-between > .flex.gap-1 {
        display: flex;
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 0.5rem;
    }
    
    .race-card > .flex.items-center.justify-between > .flex.gap-1 > .btn {
        flex: 1;
        min-width: 45%;
        text-align: center;
        justify-content: center;
    }
    
    .race-card > .flex.items-center.justify-between > .flex.gap-1 > .btn-primary {
        flex: 1 1 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Bet predictions */
    .bet-predictions {
        flex-wrap: wrap;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
    
    /* User bet section */
    .user-bet-section {
        padding: 0.75rem !important;
    }
    
    .user-bet-section .flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    /* Tables */
    .rules-table td:first-child {
        width: auto;
        white-space: normal;
    }
    
    .rules-table th,
    .rules-table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Hide podium on mobile */
    .podium-section {
        display: none !important;
    }
    
    /* Leaderboard */
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .leaderboard-table .user-name {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Admin tabs */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        padding-bottom: 0.5rem;
    }
    
    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .tab-count {
        display: none;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-input, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Collapsible forms in admin */
    .collapsible-header {
        padding: 1rem;
    }
    
    /* Betting modal */
    .bet-modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .bet-modal-header,
    .bet-modal-body,
    .bet-modal-footer {
        padding: 1rem;
    }
    
    /* Page headers */
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    /* Footer */
    .footer {
        padding: 1rem 0;
        font-size: 0.75rem;
    }
    
    /* Countdown timer */
    .countdown-timer {
        font-size: 0.8rem;
    }
    
    /* All bets toggle */
    .all-bets {
        padding: 0.75rem;
    }
    
    .bet-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .bet-item > .flex {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Hide user name in controls on small screens */
    .user-name {
        display: none;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .logo-text {
        font-size: 0.9rem;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .hero h1 {
        font-size: 1.5rem !important;
    }
    
    .position-badge {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
    }
}

