body { min-height: 100vh; display: flex; flex-direction: column; }
.muted { color: var(--muted); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px max(16px, 5vw);
  border-bottom: 1px solid var(--line);
}
.top nav { display: flex; gap: 22px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.top nav a:hover { color: var(--text); }

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 64px max(16px, 5vw) 48px;
}
.kicker { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: 13px; margin: 0 0 12px; }
.hero h1 { font-size: clamp(44px, 6vw, 82px); line-height: .95; text-transform: uppercase; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 18px; color: #c4c9d2; max-width: 34em; margin: 22px 0 30px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.cta span.btn { cursor: default; color: var(--muted); }

.hero-map {
  aspect-ratio: 1;
  max-height: 460px;
  justify-self: center;
  width: 100%;
  max-width: 460px;
  border-radius: 50%;
  overflow: hidden;
  border: 6px solid #e8e8e8;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px var(--line);
  background: #1c2026;
}
.hero-map img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-map svg { width: 100%; height: 100%; display: block; background: #1d2a1c; }
.hero-map svg path { fill: none; stroke: #ffd23f; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 0 max(16px, 5vw) 56px;
}
.how div { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.how b { font: 700 34px/1 var(--display); color: var(--accent); }
.how h3 { font-size: 24px; text-transform: uppercase; margin: 8px 0 6px; }
.how p { margin: 0; color: var(--muted); }

.tracks, .board { padding: 0 max(16px, 5vw) 64px; flex: 1; }
.tracks h2 { font-size: 40px; text-transform: uppercase; margin-bottom: 8px; }
.city { font-size: 22px; color: var(--muted); text-transform: uppercase; margin: 22px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.card {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card h4 { margin: 0; font: 700 22px var(--display); text-transform: uppercase; }
.card p { margin: 4px 0 12px; font-size: 13px; }
.tag { font-size: 12px; font-weight: 600; color: var(--accent-2); white-space: nowrap; }

.podium { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.podium li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.pos {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--bg-3); font-weight: 700; font-size: 12px;
}
.pos.p1 { background: #e7b416; color: #111; }
.pos.p2 { background: #b9c0c9; color: #111; }
.pos.p3 { background: #c47a3f; color: #111; }
.time { font-variant-numeric: tabular-nums; font-weight: 600; }

.board h1 { font-size: clamp(40px, 5vw, 64px); text-transform: uppercase; }
.board table { width: 100%; max-width: 760px; border-collapse: collapse; margin-top: 24px; }
.board th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.board td { padding: 10px; border-bottom: 1px solid var(--line); }

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px max(16px, 5vw);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .hero-map { max-width: 320px; }
  .how { grid-template-columns: 1fr; }
}

/* carta del tracciato: il riquadro va ai record, sotto i link alla guida e all'editor 3D */
.card-link { color: inherit; text-decoration: none; display: block; }
.card-city { margin: 0 0 2px !important; font-size: 12px !important; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.card { padding: 12px 12px 14px; overflow: hidden; }
.card canvas.trackmap { display: block; width: 100%; height: 170px; margin: 0 0 12px; border-radius: 10px; background: #1d2a1c; }
.links3d { margin: 10px 0 0; font-size: 14px; font-weight: 600; }

.podium-h { margin: 10px 0 4px; font: 600 12px Inter, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: #8a93a3; }
.podium li.muted { display: block; font-size: 13px; }

/* home: schede Formula / Rally / Cittadini, nazioni con bandiera, miniature dei tracciati (data/thumbs) */
.tracks .tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 18px; border-bottom: 2px solid var(--line); }
.tracks .tabs a {
  padding: 10px 20px 8px; margin-bottom: -2px; border-bottom: 3px solid transparent;
  font: 700 26px/1 var(--display); text-transform: uppercase; color: var(--muted); text-decoration: none;
}
.tracks .tabs a small { font: 600 13px var(--body); color: var(--muted); margin-left: 4px; vertical-align: 3px; }
.tracks .tabs a:hover { color: var(--text); }
.tracks .tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tracks .tabs a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.tabpanel[hidden] { display: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.chips button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text); font: 500 13px var(--body);
}
.chips button:hover { border-color: var(--accent); }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips button[aria-pressed="true"] small { color: rgba(255, 255, 255, .85); }
.chips button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.chips small, h3.group small { color: var(--muted); font-weight: 500; }
.card[hidden] { display: none; }
.card-city img { margin-right: 2px; }
h3.group {
  display: flex; align-items: center; gap: 10px; margin: 30px 0 12px; padding-bottom: 6px;
  font: 700 28px/1.1 var(--display); text-transform: uppercase; border-bottom: 1px solid var(--line);
  scroll-margin-top: 16px;
}
h3.group small { font: 500 14px var(--body); text-transform: none; }
h3.group img { border-radius: 3px !important; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.event {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.event:hover { border-color: var(--accent); }
.event b { font: 700 22px/1.1 var(--display); text-transform: uppercase; }
.event .flags { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 0; }
.card .thumb {
  position: relative; aspect-ratio: 16 / 9; margin: 0 0 12px; border-radius: 10px; overflow: hidden; background: #1d2a1c;
}
.card .thumb img, .card .thumb svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.card .thumb svg path { fill: none; stroke: #ffd23f; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.card .badge {
  position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .65);
  color: var(--accent-2); font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .05em;
}
@media (max-width: 520px) {
  .tracks .tabs a { padding: 8px 12px 6px; font-size: 22px; }
  h3.group { font-size: 24px; }
}
