:root {
    --motogp-red: #e11b22;
    --f1-red: #e10600;
    --bg: #0a0a0a;
    --card-bg: #1a1a1a;
    --accent: #ffcc00;
    --white: #ffffff;
}

html { background-color: var(--bg) !important; }

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--white);
    margin: 0; padding: 20px;
    min-height: 100vh;
}

body.bg-motogp { background: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)), url('motogpsfondo.png') center/cover fixed no-repeat; }
body.bg-f1 { background: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)), url('f1sfodno.png') center/cover fixed no-repeat; }

h1 { text-align: center; margin-bottom: 40px; text-transform: uppercase; color: var(--motogp-red); }

.category-selector { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 25px; padding: 20px; min-height: 60vh; }
@media (min-width: 768px) { .category-selector { flex-direction: row; gap: 40px; } }

.choice-card {
    background: var(--card-bg); width: 100%; max-width: 350px; padding: 40px 20px;
    border-radius: 20px; text-align: center; cursor: pointer; border: 1px solid #333;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.3s ease;
}

.choice-card:hover { border-color: var(--white); transform: scale(1.05); }

.logo-wrapper { height: 100px; width: 100%; display: flex; justify-content: center; align-items: center; margin-bottom: 20px; }
.logo-wrapper img { max-height: 100%; max-width: 90%; object-fit: contain; }

.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; max-width: 1200px; margin: auto; }

.gp-box { background: var(--card-bg); padding: 20px; border-radius: 15px; text-align: center; cursor: pointer; border: 1px solid #333; transition: 0.3s; }
.gp-box:hover { border-color: var(--motogp-red); transform: translateY(-5px); }

.numero { font-size: 0.7rem; color: var(--motogp-red); font-weight: bold; }
.nome { font-size: 1.1rem; font-weight: bold; margin: 5px 0; }
.data { font-size: 0.75rem; color: #888; }

.modal { display: none; position: fixed; z-index: 2000; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); justify-content: center; align-items: center; }
.modal-content { background: #1e1e1e; padding: 25px; border-radius: 20px; width: 95%; max-width: 500px; position: relative; }
.close { float: right; cursor: pointer; font-size: 2rem; color: #555; }

/* Loghi cliccabili */
.logo-link { display: inline-block; transition: transform 0.2s ease; vertical-align: middle; }
.logo-link:hover { transform: scale(1.15); }
.logo-tv { height: 25px; width: auto; max-width: 60px; object-fit: contain; cursor: pointer; }

.tabella-orari { width: 100%; border-collapse: collapse; margin-top: 15px; }
.tabella-orari td, .tabella-orari th { padding: 12px 8px; text-align: center; border-bottom: 1px solid #333; font-size: 0.85rem; }
.ora-gara { color: var(--accent); font-weight: bold; font-size: 1.1rem; }
.evidenza-gara { background: rgba(255,255,255,0.05); }

#backBtn { display: none; background: #333; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; margin: 0 auto 20px; }