:root {
    --heat-red: #D62828;
    --heat-orange: #F77F00;
    --heat-yellow: #E67E22;
    --heat-cream: #FDF0D5;
    --heat-asphalt: #2B2B2B;
    --heat-dark: #1A1A1A;
    --heat-green: #2E7D32;
    --heat-blue: #1565C0;
    --bg-primary: var(--heat-dark);
    --bg-secondary: var(--heat-asphalt);
    --bg-card: #2d2d2d;
    --text-primary: var(--heat-cream);
    --text-secondary: #b8b8b8;
    --border-color: #444;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --font-display: 'Bebas Neue', cursive;
    --font-body: 'Barlow', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* TEMA CHIARO */
[data-theme="light"] {
    --bg-primary: #f5f0eb;
    --bg-secondary: #e8e0d8;
    --bg-card: #ffffff;
    --text-primary: #1A1A1A;
    --text-secondary: #555555;
    --border-color: #cccccc;
}

/* TEMA SCURO (default) */
[data-theme="dark"] {
    --bg-primary: var(--heat-dark);
    --bg-secondary: var(--heat-asphalt);
    --bg-card: #2d2d2d;
    --text-primary: var(--heat-cream);
    --text-secondary: #b8b8b8;
    --border-color: #444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px);
    pointer-events: none;
    z-index: -1;
}
[data-theme="light"] body::before {
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 20px);
}

.header {
    background: linear-gradient(135deg, var(--heat-red) 0%, var(--heat-orange) 100%);
    padding: var(--spacing-sm) var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(214, 40, 40, 0.4);
    border-bottom: 4px solid var(--heat-yellow);
}
.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}
.logo-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    color: white;
    cursor: pointer;
}
.logo-circle {
    width: 56px;
    height: 56px;
    background: var(--heat-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--heat-yellow);
    flex-shrink: 0;
    overflow: hidden;
    padding: 2px;
}
.logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.logo-text .logo-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 var(--heat-dark);
    color: white;
}
.logo-text .logo-subtitle {
    font-size: 0.65rem;
    opacity: 1;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--black);
}
.header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: wrap;
}
.header-btn {
    background: rgba(0,0,0,0.3);
    border: 2px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.header-btn:hover { background: white; color: var(--heat-red); }

/* Pulsanti tema e lingua */
.header-controls {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.header-controls .ctrl-btn {
    background: rgba(0,0,0,0.25);
    border: 2px solid rgba(255,255,255,0.6);
    color: white;
    padding: 0.4rem 0.7rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.header-controls .ctrl-btn:hover {
    background: white;
    color: var(--heat-red);
    border-color: white;
}
.header-controls .ctrl-btn.active {
    background: white;
    color: var(--heat-red);
    border-color: white;
}
.header-controls .ctrl-btn .icon { font-size: 0.9rem; }

.header-counters { display: flex; gap: 0.5rem; align-items: center; }
.header-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
}
.header-counter.active { background: var(--heat-green); color: white; }
.header-counter.completed { background: var(--heat-yellow); color: var(--heat-dark); }
.header-counter .counter-value { font-size: 1rem; font-weight: 900; }
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}
.nav {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    transition: background-color 0.3s;
}
.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-md);
    overflow-x: auto;
}
.nav-item {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.nav-item:hover, .nav-item.active {
    color: var(--heat-yellow);
    border-bottom-color: var(--heat-orange);
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--heat-yellow);
    margin-bottom: var(--spacing-lg);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}
.page-title-with-badge {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}
.page-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}
.page-header-with-actions .page-title {
    margin-bottom: 0;
}
.back-to-dashboard-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--heat-orange);
    color: var(--heat-yellow);
    padding: 0.5rem 1.25rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.9rem;
    font-family: var(--font-body);
}
.back-to-dashboard-btn:hover {
    background: var(--heat-orange);
    color: white;
    transform: translateX(-3px);
    box-shadow: 0 4px 12px rgba(247, 127, 0, 0.3);
}
.back-to-dashboard-btn i {
    transition: transform 0.3s;
}
.back-to-dashboard-btn:hover i {
    transform: translateX(-3px);
}

.year-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--heat-red), var(--heat-orange));
    border-radius: 25px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 2px 8px rgba(214, 40, 40, 0.4);
}
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: var(--spacing-md);
    border-left: 5px solid var(--heat-orange);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
    position: relative;
    overflow: hidden;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(247, 127, 0, 0.2);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}
.card-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--heat-yellow);
    letter-spacing: 1px;
}
.action-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--border-color);
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
}
.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--heat-orange);
    box-shadow: 0 8px 25px rgba(247, 127, 0, 0.3);
}
.action-card-icon { font-size: 3.5rem; margin-bottom: var(--spacing-xs); }
.action-card-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--heat-yellow);
    letter-spacing: 2px;
}
.action-card-desc { color: var(--text-secondary); font-size: 0.95rem; }
.action-card.disabled { opacity: 0.5; cursor: not-allowed; }
.action-card.disabled:hover { transform: none; border-color: var(--border-color); box-shadow: none; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}
.stat-box {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--spacing-md);
    text-align: center;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}
.stat-box:hover {
    border-color: var(--heat-orange);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(247, 127, 0, 0.2);
}
.stat-box-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--heat-orange);
    line-height: 1;
}
.stat-box-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-size: 1rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--heat-red), var(--heat-orange));
    color: white;
    box-shadow: 0 4px 15px rgba(214, 40, 40, 0.4);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(214, 40, 40, 0.6);
}
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--heat-orange);
    color: var(--heat-yellow);
}
.btn-danger { background: var(--heat-red); color: white; }
.btn-danger:hover:not(:disabled) { background: #a01f1f; }
.btn-success { background: var(--heat-green); color: white; }
.btn-success:hover:not(:disabled) { background: #1e5e26; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.form-group { margin-bottom: var(--spacing-md); }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--heat-yellow);
}
.form-input, .form-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s, background-color 0.3s;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--heat-orange); }
.form-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }
.form-error { color: var(--heat-red); font-size: 0.85rem; margin-top: 0.5rem; display: none; }
.form-error.show { display: block; }
.grid { display: grid; gap: var(--spacing-lg); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    flex-wrap: wrap;
}
.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tab:hover { color: var(--heat-yellow); }
.tab.active { color: var(--heat-yellow); border-bottom-color: var(--heat-orange); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-md);
}
.car-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--spacing-md);
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
}
.car-card:hover { border-color: var(--heat-orange); transform: translateY(-3px); }
.car-card-badge {
    position: absolute;
    top: 8px; right: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.car-card-badge.base { background: var(--heat-yellow); color: var(--heat-dark); }
.car-card-badge.expansion { background: var(--heat-blue); color: white; }
.car-card-badge.custom { background: #FFFFFF; color: var(--heat-dark); }
.car-card-preview { width: 60px; height: 110px; margin: 0 auto var(--spacing-sm); }
.car-card-preview svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); }
.car-card-name { font-weight: 700; font-size: 1.3rem; margin-bottom: 0.25rem; }
.car-card-actions { display: flex; gap: 0.5rem; justify-content: center; }
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}
.player-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}
.player-card:hover { border-color: var(--heat-orange); transform: translateY(-3px); }
.player-card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}
.player-avatar {
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2rem;
    color: white;
    border: 3px solid white;
    flex-shrink: 0;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    overflow: hidden;
    background: #888;
}
.player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-name { font-weight: 700; font-size: 1.2rem; margin-bottom: 0.25rem; }
.player-since { font-size: 0.8rem; color: var(--text-secondary); }
.player-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: var(--spacing-sm);
}
.player-stat {
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
}
.player-stat-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--heat-yellow);
    line-height: 1;
}
.player-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.player-stat.highlight {
    background: linear-gradient(135deg, rgba(214, 40, 40, 0.2), rgba(247, 127, 0, 0.2));
    border: 1px solid var(--heat-orange);
}
.player-percentages {
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: var(--spacing-sm);
    font-size: 0.85rem;
}
.player-percentages-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
}
.player-percentages-row:last-child { border-bottom: none; }
.player-percentages-row .pct {
    font-family: var(--font-mono);
    color: var(--heat-yellow);
    font-weight: 700;
}
.player-actions { display: flex; gap: 0.5rem; }
.empty-state { text-align: center; padding: var(--spacing-lg); color: var(--text-secondary); }
.empty-state-icon { font-size: 4rem; margin-bottom: var(--spacing-sm); opacity: 0.3; }
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: var(--spacing-lg);
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    border: 3px solid var(--heat-orange);
    transition: background-color 0.3s;
}
.modal-content.large { max-width: 900px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    padding-bottom: var(--spacing-sm);
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
    transition: background-color 0.3s;
}
.modal-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--heat-yellow);
    letter-spacing: 1px;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}
.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}
.archive-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}
.archive-stat {
    background: var(--bg-card);
    padding: var(--spacing-sm);
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border-color);
}
.archive-stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--heat-orange);
    line-height: 1;
}
.archive-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}
.progress-bar-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    height: 30px;
    margin: var(--spacing-md) 0;
    border: 2px solid var(--border-color);
}
.progress-bar {
    background: linear-gradient(90deg, var(--heat-red), var(--heat-orange));
    height: 100%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}
.sync-log {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: var(--spacing-sm);
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-md);
}
.sync-log-entry { padding: 0.25rem 0; border-bottom: 1px solid var(--border-color); }
.sync-log-entry.success { color: var(--heat-green); }
.sync-log-entry.error { color: var(--heat-red); }
.sync-log-entry.info { color: var(--heat-yellow); }
.wizard-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}
.wizard-step {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
}
.wizard-step.active {
    background: linear-gradient(135deg, var(--heat-red), var(--heat-orange));
    border-color: var(--heat-yellow);
    color: white;
}
.wizard-step.done {
    background: var(--heat-green);
    border-color: var(--heat-green);
    color: white;
}
.wizard-step-number {
    font-family: var(--font-display);
    font-size: 1.5rem;
    display: block;
    line-height: 1;
}
.wizard-step-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-sm);
    max-height: 500px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: 8px;
}
.year-item {
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
}
.year-item:hover { border-color: var(--heat-orange); transform: translateY(-2px); }
.year-item.selected {
    background: var(--heat-orange);
    border-color: var(--heat-yellow);
    color: var(--heat-dark);
}
.race-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-sm);
    max-height: 600px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: 8px;
}
.race-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    text-align: center;
}
.race-card:hover { border-color: var(--heat-orange); transform: translateY(-2px); }
.race-card.selected {
    border-color: var(--heat-yellow);
    background: rgba(252, 191, 73, 0.1);
}
.race-card.selected::before {
    content: attr(data-order);
    position: absolute;
    top: -10px; right: -10px;
    width: 32px; height: 32px;
    background: var(--heat-yellow);
    color: var(--heat-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    border: 3px solid var(--heat-dark);
    z-index: 2;
    font-family: var(--font-display);
}
.race-card-circuit-svg {
    width: 100%;
    max-width: 140px;
    height: 100px;
    margin: 0 auto var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}
.race-card-circuit-svg img { max-width: 100%; max-height: 100%; object-fit: contain; }
.race-card-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--heat-yellow);
    margin-bottom: 0.25rem;
    letter-spacing: 1px;
}
.race-card-circuit { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.race-card-flag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.driver-setup-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}
.driver-setup-section h3 {
    font-family: var(--font-display);
    color: var(--heat-yellow);
    font-size: 1.3rem;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.driver-row {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    gap: var(--spacing-sm);
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    align-items: center;
    margin-bottom: 0.5rem;
    border: 2px solid var(--border-color);
}
.driver-row-avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.3s;
    background: #888;
}
.driver-row-avatar img { width: 100%; height: 100%; object-fit: cover; }
.driver-row-avatar:hover { border-color: var(--heat-orange); transform: scale(1.05); }
.driver-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.driver-row-name { font-weight: 600; font-size: 1rem; }
.driver-row-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color 0.2s;
}
.driver-row-meta:hover { color: var(--heat-yellow); }
.driver-row-meta.has-f1-driver { color: var(--heat-yellow); font-weight: 600; }
.color-picker-row { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.color-pick {
    width: 28px; height: 48px;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
    padding: 2px;
    background: rgba(255,255,255,0.03);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}
.color-pick:hover:not(.disabled) {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.08);
}
.color-pick.selected {
    border-color: white;
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 12px currentColor;
    transform: translateY(-3px);
}
.color-pick.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    filter: grayscale(70%);
}
.color-pick svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.color-pick.selected svg {
    filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.driver-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-sm);
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--spacing-sm);
}
.driver-pick {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}
.driver-pick:hover:not(.disabled) { border-color: var(--heat-orange); transform: translateY(-2px); }
.driver-pick.selected { border-color: var(--heat-yellow); background: rgba(252, 191, 73, 0.1); }
.driver-pick.disabled { opacity: 0.3; cursor: not-allowed; }
.driver-pick-avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    margin: 0 auto var(--spacing-xs);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 2px solid var(--border-color);
    overflow: hidden;
}
.driver-pick-avatar img { width: 100%; height: 100%; object-fit: cover; }
.driver-pick-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.driver-pick-meta { font-size: 0.75rem; color: var(--text-secondary); }
.driver-pick-points { font-family: var(--font-mono); color: var(--heat-yellow); font-size: 0.75rem; margin-top: 0.25rem; }
.search-box { position: relative; margin-bottom: var(--spacing-sm); }
.search-box input { padding-left: 2.5rem; }
.search-box i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.summary-card {
    background: linear-gradient(135deg, rgba(214, 40, 40, 0.1), rgba(247, 127, 0, 0.1));
    border: 2px solid var(--heat-orange);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}
.summary-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--heat-yellow);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 1px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: var(--text-secondary); }
.summary-row .value { font-weight: 700; color: var(--heat-yellow); font-family: var(--font-mono); }
.flag-with-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.race-list {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: 8px;
}
.race-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
    border-radius: 6px;
    border-left: 3px solid var(--border-color);
}
.race-item.completed { border-left-color: var(--heat-green); }
.race-item.pending { border-left-color: var(--heat-yellow); }
.race-item-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}
.race-item-name { font-weight: 600; }
.race-item-circuit { font-size: 0.8rem; color: var(--text-secondary); }
.race-item-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}
.race-item-status.completed { background: var(--heat-green); color: white; }
.race-item-status.pending { background: var(--heat-yellow); color: var(--heat-dark); }

/* CHAMPIONSHIP VIEW */
.championship-view-header {
    background: linear-gradient(135deg, var(--heat-red), var(--heat-orange));
    padding: var(--spacing-lg);
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
    color: white;
}
.championship-view-header .page-title { color: white; margin-bottom: var(--spacing-sm); }
.championship-view-meta {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    font-size: 0.95rem;
}
.championship-view-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.gp-card.locked {
    opacity: 0.7;
    border-left-color: var(--text-secondary);
}
.gp-card.locked .gp-card-title {
    color: var(--text-secondary);
}
.gp-lock-icon {
    font-size: 1.2rem;
    margin-left: 0.5rem;
    color: var(--text-secondary);
}
.gp-card.locked .gp-card-body {
    filter: grayscale(0.5);
}

.gp-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    border-left: 5px solid var(--heat-orange);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s;
}
.gp-card.completed { border-left-color: var(--heat-green); }
.gp-card.pending { border-left-color: var(--heat-yellow); }
.gp-card.locked { border-left-color: var(--text-secondary); opacity: 0.7; }
.gp-card.locked .gp-card-title { color: var(--text-secondary); }
.gp-card.locked .gp-card-body { filter: grayscale(0.5); }
.gp-card.locked .gp-card-footer .weather-selector { opacity: 0.5; pointer-events: none; }

.gp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}
.gp-card-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--heat-yellow);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.gp-status-badge {
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.gp-status-badge.completed { background: var(--heat-green); color: white; }
.gp-status-badge.pending { background: var(--heat-yellow); color: var(--heat-dark); }
.gp-status-badge.locked { background: var(--text-secondary); color: var(--heat-dark); }
.gp-card-body {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-sm);
}
.gp-circuit-image {
    width: 80px; height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: var(--spacing-xs);
}
.gp-circuit-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gp-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}
.gp-circuit-name { font-weight: 600; font-size: 0.9rem; }
.gp-country {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.gp-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    padding-top: var(--spacing-xs);
    border-top: 1px solid var(--border-color);
}
.weather-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}
.weather-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.weather-options { display: flex; gap: 0.2rem; }
.weather-option {
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s;
}
.weather-option:hover { border-color: var(--heat-orange); transform: scale(1.1); }
.weather-option.selected {
    border-color: var(--heat-yellow);
    background: rgba(252, 191, 73, 0.2);
    box-shadow: 0 0 10px rgba(252, 191, 73, 0.3);
}

/* Race Editor */
.race-editor-header {
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
}
.race-editor-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}
.race-editor-instructions {
    background: rgba(252, 191, 73, 0.1);
    border-left: 4px solid var(--heat-yellow);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.race-driver-row {
    display: grid;
    grid-template-columns: 50px 50px 1fr 50px auto;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    align-items: center;
    border-left: 4px solid var(--border-color);
    transition: all 0.3s;
}
.race-driver-row:hover { border-left-color: var(--heat-orange); }
.race-driver-position {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-secondary);
    text-align: center;
}
.race-driver-position.top-1 { color: #E67E22; }
.race-driver-position.top-2 { color: #C0C0C0; }
.race-driver-position.top-3 { color: #CD7F32; }
.race-driver-position.points { color: var(--heat-green); }
.race-driver-car { width: 40px; height: 70px; display: flex; align-items: center; justify-content: center; }
.race-driver-car svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.race-driver-name { font-weight: 600; font-size: 0.95rem; }
.race-driver-type { font-size: 0.75rem; color: var(--text-secondary); }
.race-driver-points {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    color: var(--heat-yellow);
}
.race-driver-points.zero { color: var(--text-secondary); }
.race-driver-arrows {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.race-driver-arrows button {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.race-driver-arrows button:hover:not(:disabled) {
    background: var(--heat-orange);
    color: white;
}
.race-driver-arrows button:disabled { opacity: 0.3; cursor: not-allowed; }

/* Standings */
.standings-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}
.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: var(--spacing-sm);
    border-radius: 8px;
    min-width: 100px;
    text-align: center;
}
.podium-item .podium-position {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
}
.podium-item .podium-position.gold { color: #E67E22; }
.podium-item .podium-position.silver { color: #C0C0C0; }
.podium-item .podium-position.bronze { color: #CD7F32; }
.podium-item .podium-car { width: 50px; height: 90px; }
.podium-item .podium-car svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.podium-item .podium-name { font-weight: 700; font-size: 1.1rem; }
.podium-item .podium-points { font-family: var(--font-mono); color: var(--heat-yellow); font-size: 0.9rem; }
.podium-item .podium-flag { font-size: 1.2rem; }
.podium-item .podium-medal { font-size: 2.5rem; }
.standings-table-wrapper { overflow-x: auto; margin-top: var(--spacing-md); }
.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px;
}
.standings-table th {
    background: var(--heat-orange);
    color: var(--heat-dark);
    padding: 0.6rem 0.4rem;
    text-align: center;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
}
.standings-table td {
    padding: 0.5rem 0.4rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
.standings-table tr:hover td { background: rgba(252, 191, 73, 0.05); }
.standings-table .pos-cell { font-weight: 700; font-size: 1rem; }
.standings-table .pos-cell.gold { color: #E67E22; }
.standings-table .pos-cell.silver { color: #C0C0C0; }
.standings-table .pos-cell.bronze { color: #CD7F32; }
.standings-table .pos-cell.tied { color: var(--heat-yellow); }
.standings-table .driver-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    white-space: nowrap;
}
.standings-table .driver-info .car-mini { width: 20px; height: 35px; flex-shrink: 0; }
.standings-table .driver-info .car-mini svg { width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.standings-table .driver-info .flag-wrapper { font-size: 0.85rem; }
.standings-table .driver-info .driver-name { font-weight: 600; }
.standings-table .driver-info .driver-type { font-size: 0.75rem; color: var(--text-secondary); font-weight: 400; }
.standings-table .driver-info .driver-constructor {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 0.25rem;
}
.standings-table .points-cell { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; }
.standings-table .wins-cell { font-family: var(--font-mono); }

/* Progression */
.progression-chart-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
}
.progression-chart-container svg {
    display: block;
    width: 100%;
    min-width: 600px;
    height: auto;
}
.progression-chart-container .chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-sm);
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}
.chart-legend-item:hover { background: rgba(255,255,255,0.05); }
.chart-legend-item .color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
}
.chart-legend-item .driver-name { color: var(--text-primary); }
.chart-legend-item .driver-points {
    font-family: var(--font-mono);
    color: var(--heat-yellow);
    font-weight: 700;
    font-size: 0.8rem;
}
.progression-table-wrapper { overflow-x: auto; margin-top: var(--spacing-md); }
.progression-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 500px;
}
.progression-table th {
    background: var(--heat-orange);
    color: var(--heat-dark);
    padding: 0.6rem 0.4rem;
    text-align: center;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
}
.progression-table td {
    padding: 0.5rem 0.4rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
.progression-table tr:hover td { background: rgba(252, 191, 73, 0.05); }
.progression-table .driver-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    white-space: nowrap;
}
.progression-table .driver-cell .car-mini { width: 20px; height: 35px; flex-shrink: 0; }
.progression-table .driver-cell .car-mini svg { width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.progression-table .driver-cell .flag-wrapper { font-size: 0.85rem; }
.progression-table .pos-cell { font-weight: 600; font-size: 0.9rem; }
.progression-table .pos-cell.pos-1 { color: #E67E22; }
.progression-table .pos-cell.pos-2 { color: #C0C0C0; }
.progression-table .pos-cell.pos-3 { color: #CD7F32; }
.progression-table .points-cell { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; }
.progression-table .points-cell.total { color: var(--heat-yellow); font-size: 1.1rem; }
.progression-table .points-cell.zero { color: var(--text-secondary); }
.progression-table .rank-change { font-size: 0.75rem; font-weight: 700; }
.progression-table .rank-change.up { color: #2ECC71; }
.progression-table .rank-change.down { color: var(--heat-red); }

.key-moments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}
.moment-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: var(--spacing-md);
    border-left: 4px solid var(--heat-yellow);
}
.moment-card .moment-icon { font-size: 1.8rem; margin-bottom: var(--spacing-xs); }
.moment-card .moment-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--heat-yellow);
    margin-bottom: 0.25rem;
}
.moment-card .moment-desc { font-size: 0.9rem; color: var(--text-secondary); }
.moment-card .moment-detail { font-family: var(--font-mono); font-weight: 700; color: var(--text-primary); }

/* Report */
.report-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    border: 2px solid var(--heat-yellow);
    min-height: 220px;
}
.report-podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: var(--spacing-xs);
    text-align: center;
}
.report-podium-item .medal { font-size: 1.8rem; }
.report-podium-item .position { font-family: var(--font-display); font-size: 1.5rem; }
.report-podium-item .position.gold { color: #E67E22; }
.report-podium-item .position.silver { color: #C0C0C0; }
.report-podium-item .position.bronze { color: #CD7F32; }
.report-podium-item .driver-car { width: 60px; height: 105px; }
.report-podium-item .driver-car svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.report-podium-item .driver-name { font-weight: 700; font-size: 0.95rem; }
.report-podium-item .driver-points { font-family: var(--font-mono); color: var(--heat-yellow); font-size: 0.75rem; }
.report-podium-item .driver-flag { font-size: 1.2rem; }
.report-awards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}
.report-award-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: var(--spacing-md);
    border-left: 4px solid var(--heat-yellow);
    text-align: center;
}
.report-award-card .award-icon { font-size: 2.5rem; margin-bottom: var(--spacing-xs); }
.report-award-card .award-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--heat-yellow);
}
.report-award-card .award-winner { font-weight: 700; font-size: 1.1rem; margin-top: 0.25rem; }
.report-award-card .award-detail { font-size: 0.85rem; color: var(--text-secondary); }

/* Sezioni collassabili */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: var(--spacing-sm);
    transition: all 0.3s;
    user-select: none;
}
.section-header:hover {
    background: var(--bg-card);
    border-color: var(--heat-orange);
}
.section-header .section-icon {
    font-size: 1.5rem;
}
.section-header .section-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
}
.section-header .section-count {
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.section-header .section-count.active {
    background: var(--heat-green);
    color: white;
}
.section-header .section-count.completed {
    background: var(--heat-yellow);
    color: var(--heat-dark);
}
.section-header .section-toggle {
    margin-left: auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}
.section-header .section-toggle.expanded {
    transform: rotate(180deg);
}
.section-content {
    display: none;
}
.section-content.visible {
    display: block;
}

/* HowTo - Manuale */
.howto-index {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}
.howto-index-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.howto-index-item:hover {
    border-color: var(--heat-orange);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(247, 127, 0, 0.2);
}
.howto-index-item .icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
}
.howto-index-item .title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--heat-yellow);
}
.howto-index-item .desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.howto-section {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 4px solid var(--heat-yellow);
}
.howto-section h3 {
    font-family: var(--font-display);
    color: var(--heat-yellow);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 1px;
}
.howto-section p, .howto-section li {
    color: var(--text-secondary);
    line-height: 1.8;
}
.howto-section ul, .howto-section ol {
    padding-left: 1.5rem;
    margin-bottom: var(--spacing-sm);
}
.howto-section .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--heat-yellow);
    cursor: pointer;
    font-weight: 600;
    margin-top: var(--spacing-sm);
    transition: all 0.3s;
}
.howto-section .back-link:hover {
    color: white;
    transform: translateX(-4px);
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .header-controls .ctrl-btn span.label { display: none; }
    .header-controls .ctrl-btn { padding: 0.3rem 0.5rem; }
    .nav {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--bg-secondary);
        border-bottom: 2px solid var(--heat-orange);
    }
    .nav.active { display: block; }
    .nav-content { flex-direction: column; padding: var(--spacing-sm); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-title { font-size: 2rem; }
    .header-btn { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
    .header-counter { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
    .header-counter .counter-value { font-size: 0.85rem; }
    .driver-row { grid-template-columns: 45px 1fr; }
    .color-picker-row { grid-column: 1 / -1; justify-content: center; }
    .color-pick { width: 24px; height: 42px; }
    .wizard-step { min-width: 80px; padding: 0.5rem; }
    .wizard-step-number { font-size: 1.2rem; }
    .wizard-step-label { font-size: 0.7rem; }
    .championship-view-meta { flex-direction: column; gap: 0.5rem; }
    .gp-card-body { grid-template-columns: 1fr; }
    .gp-circuit-image { width: 100%; height: 100px; }
    .gp-card-footer { flex-direction: column; align-items: stretch; }
    .weather-selector { justify-content: center; }
    .race-driver-row { grid-template-columns: 40px 40px 1fr 40px; }
    .race-driver-arrows { display: none; }
    .progression-table { font-size: 0.75rem; }
    .progression-table .driver-cell .car-mini { width: 15px; height: 26px; }
    .standings-table { font-size: 0.75rem; min-width: 400px; }
    .standings-table .driver-info .car-mini { width: 15px; height: 26px; }
    .report-podium { gap: var(--spacing-sm); padding: var(--spacing-sm); }
    .report-podium-item { min-width: 80px; padding: var(--spacing-sm); }
    .podium-item { min-width: 70px; }
    .howto-index { grid-template-columns: 1fr 1fr; }
    .logo-text .logo-title { font-size: 1.2rem; }
    .logo-circle { width: 44px; height: 44px; }
}
.mt-2 { margin-top: var(--spacing-md); }
.mb-2 { margin-bottom: var(--spacing-md); }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }

/* ============================================
   AUTH0 UI STATES
   ============================================ */
.auth-hidden {
  display: none !important;
}

.auth-visible {
  display: inline-flex !important;
}

/* ============================================
   DRAG & DROP PER MOBILE (Race Editor)
   ============================================ */

.race-driver-row {
    touch-action: none;
    cursor: grab;
    transition: opacity 0.2s, transform 0.2s;
}

.race-driver-row:active {
    cursor: grabbing;
}

/* Versione mobile */
@media (max-width: 768px) {
    .race-driver-row {
        padding: 0.6rem 0.4rem;
        font-size: 0.75rem;
        border-radius: 8px;
        margin-bottom: 0.3rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
    }
    
    .race-driver-row .race-driver-arrows button {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
}
/* Animazione pulsazione per bottone Gioca */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 15px rgba(204, 255, 0, 0.4), 0 0 30px rgba(139, 0, 255, 0.2); }
    50% { box-shadow: 0 0 25px rgba(204, 255, 0, 0.7), 0 0 50px rgba(139, 0, 255, 0.4); }
    100% { box-shadow: 0 0 15px rgba(204, 255, 0, 0.4), 0 0 30px rgba(139, 0, 255, 0.2); }
}
/* Animazione pulsazione per bottone Gioca - arancione */
@keyframes pulse-glow-orange {
    0% { box-shadow: 0 0 10px rgba(255, 107, 0, 0.3), 0 0 20px rgba(255, 107, 0, 0.1); }
    50% { box-shadow: 0 0 20px rgba(255, 107, 0, 0.6), 0 0 40px rgba(255, 107, 0, 0.2); }
    100% { box-shadow: 0 0 10px rgba(255, 107, 0, 0.3), 0 0 20px rgba(255, 107, 0, 0.1); }
}