/* Home system extensions for Ranking, History, Gallery and the upcoming-season page. */
body[data-page="ranking"],
body[data-page="historico"],
body[data-page="galeria"] {
  color: #edf4ff;
  background:
    radial-gradient(circle at 7% 12%, rgba(27, 104, 190, 0.18), transparent 34rem),
    radial-gradient(circle at 92% 42%, rgba(165, 38, 64, 0.11), transparent 31rem),
    #061426;
}

body[data-page="ranking"] #site-shell > .ranking-page-frame,
body[data-page="historico"] #site-shell > .history-page-frame,
body[data-page="galeria"] #site-shell > .gallery-page-frame {
  position: relative;
  isolation: isolate;
  width: calc(100% - clamp(20px, 3vw, 48px));
  min-width: 0;
  margin: clamp(12px, 2vw, 26px) auto 30px;
  padding: 8px 8px 14px;
  overflow: clip;
  border: 1px solid rgba(44, 145, 226, 0.55);
  border-radius: clamp(18px, 2vw, 28px);
  background:
    radial-gradient(circle at 8% 27%, rgba(22, 84, 148, 0.14), transparent 35rem),
    linear-gradient(145deg, rgba(6, 22, 41, 0.98), rgba(4, 13, 26, 0.99) 72%),
    #061426;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.018);
}

body[data-page="ranking"] .ranking-page-frame > .site-header,
body[data-page="historico"] .history-page-frame > .site-header,
body[data-page="galeria"] .gallery-page-frame > .site-header {
  position: sticky;
  top: 6px;
  z-index: 30;
  padding: 0 clamp(8px, 1.15vw, 16px);
  background: transparent;
  backdrop-filter: none;
}

body[data-page="ranking"] .ranking-page-frame > .site-header .topbar,
body[data-page="historico"] .history-page-frame > .site-header .topbar,
body[data-page="galeria"] .gallery-page-frame > .site-header .topbar {
  top: 10px;
  min-height: 90px;
  margin-top: 0;
  gap: clamp(12px, 1.6vw, 26px);
  padding: 10px clamp(14px, 2vw, 28px);
  border: 1px solid rgba(47, 143, 255, 0.42);
  border-radius: 20px;
  background: rgba(3, 16, 33, 0.92);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

body[data-page="ranking"] .ranking-page-frame .topbar .brand,
body[data-page="historico"] .history-page-frame .topbar .brand,
body[data-page="galeria"] .gallery-page-frame .topbar .brand {
  flex: 0 0 auto;
  gap: 11px;
  padding-inline: 0;
  text-decoration: none;
}

body[data-page="ranking"] .ranking-page-frame .topbar .brand-logo,
body[data-page="historico"] .history-page-frame .topbar .brand-logo,
body[data-page="galeria"] .gallery-page-frame .topbar .brand-logo {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
}

body[data-page="ranking"] .ranking-page-frame .topbar .topbar-actions,
body[data-page="historico"] .history-page-frame .topbar .topbar-actions,
body[data-page="galeria"] .gallery-page-frame .topbar .topbar-actions {
  flex-wrap: nowrap;
  gap: clamp(12px, 1.6vw, 26px);
}

body[data-page="ranking"] .ranking-page-frame .topbar .season-switcher,
body[data-page="historico"] .history-page-frame .topbar .season-switcher,
body[data-page="galeria"] .gallery-page-frame .topbar .season-switcher {
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border-color: rgba(88, 147, 220, 0.38);
  border-radius: 13px;
  background: rgba(7, 23, 45, 0.88);
}

body[data-page="ranking"] .ranking-page-frame .topbar .season-chip,
body[data-page="historico"] .history-page-frame .topbar .season-chip,
body[data-page="galeria"] .gallery-page-frame .topbar .season-chip {
  min-height: 40px;
  padding-inline: 15px;
  border-radius: 10px;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

body[data-page="ranking"] .ranking-page-frame .topbar .season-chip.is-active,
body[data-page="historico"] .history-page-frame .topbar .season-chip.is-active,
body[data-page="galeria"] .gallery-page-frame .topbar .season-chip.is-active {
  background: linear-gradient(115deg, #087ff4, #1457d4);
  box-shadow: 0 8px 20px rgba(0, 77, 196, 0.28);
}

body[data-page="ranking"] .ranking-page-frame .topbar .nav-links,
body[data-page="historico"] .history-page-frame .topbar .nav-links,
body[data-page="galeria"] .gallery-page-frame .topbar .nav-links {
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(8px, 1.15vw, 20px);
  color: #e2edff;
  font-size: clamp(0.68rem, 0.78vw, 0.82rem);
}

body[data-page="ranking"] .ranking-page-frame .topbar .nav-links a,
body[data-page="historico"] .history-page-frame .topbar .nav-links a,
body[data-page="galeria"] .gallery-page-frame .topbar .nav-links a {
  padding: 7px 0;
  white-space: nowrap;
}

body[data-page="ranking"] .ranking-page-frame .topbar .nav-links a.is-current,
body[data-page="historico"] .history-page-frame .topbar .nav-links a.is-current,
body[data-page="galeria"] .gallery-page-frame .topbar .nav-links a.is-current {
  color: #63b8ff;
}

body[data-page="ranking"] .ranking-page-frame > .page-main,
body[data-page="historico"] .history-page-frame > .page-main,
body[data-page="galeria"] .gallery-page-frame > .page-main {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: clamp(16px, 1.8vw, 24px);
  min-width: 0;
  overflow: clip;
  padding: 0 clamp(8px, 1.1vw, 16px) 14px;
}

body[data-page="ranking"] .ranking-page-frame > .page-main > *,
body[data-page="historico"] .history-page-frame > .page-main > *,
body[data-page="galeria"] .gallery-page-frame > .page-main > * {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin-inline: 0;
}

body[data-page="ranking"] #site-shell > .ranking-page-frame > .page-main > .page-hero,
body[data-page="historico"] #site-shell > .history-page-frame > .page-main > .page-hero,
body[data-page="galeria"] #site-shell > .gallery-page-frame > .page-main > .page-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.68fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  min-height: clamp(250px, 22vw, 320px);
  margin: 0;
  padding: clamp(24px, 3.2vw, 48px);
  overflow: hidden;
  border: 1px solid rgba(47, 143, 255, 0.36);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 5% 8%, rgba(13, 102, 191, 0.22), transparent 48%),
    radial-gradient(ellipse at 96% 94%, rgba(185, 42, 68, 0.14), transparent 40%),
    linear-gradient(112deg, rgba(3, 16, 33, 0.99), rgba(5, 24, 46, 0.95) 55%, rgba(6, 21, 39, 0.96));
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.21), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

body[data-page="ranking"] #site-shell > .ranking-page-frame > .page-main > .page-hero::before,
body[data-page="ranking"] #site-shell > .ranking-page-frame > .page-main > .page-hero::after,
body[data-page="historico"] #site-shell > .history-page-frame > .page-main > .page-hero::before,
body[data-page="historico"] #site-shell > .history-page-frame > .page-main > .page-hero::after,
body[data-page="galeria"] #site-shell > .gallery-page-frame > .page-main > .page-hero::before,
body[data-page="galeria"] #site-shell > .gallery-page-frame > .page-main > .page-hero::after {
  display: none;
  content: none;
}

body[data-page="ranking"] .ranking-hero-copy,
body[data-page="historico"] .history-hero-copy,
body[data-page="galeria"] .gallery-hero-copy,
body[data-page="ranking"] .ranking-hero-summary,
body[data-page="historico"] .history-hero-summary,
body[data-page="galeria"] .gallery-hero-summary {
  position: relative;
  z-index: 1;
  min-width: 0;
}

body[data-page="ranking"] .ranking-hero-copy .eyebrow,
body[data-page="historico"] .history-hero-copy .eyebrow,
body[data-page="galeria"] .gallery-hero-copy .eyebrow {
  margin: 0;
  color: #35b9ff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

body[data-page="ranking"] .ranking-page-hero h1,
body[data-page="historico"] .history-page-hero h1,
body[data-page="galeria"] .gallery-page-hero h1 {
  max-width: 13ch;
  margin: 10px 0 0;
  color: #f5f7fb;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(2.8rem, 5.2vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.99;
  text-wrap: balance;
}

body[data-page="ranking"] .ranking-page-hero .hero-text,
body[data-page="historico"] .history-page-hero .hero-text,
body[data-page="galeria"] .gallery-page-hero .hero-text {
  max-width: 42rem;
  margin: 17px 0 0;
  color: #c2d5ed;
  font-size: clamp(0.9rem, 1.05vw, 1.05rem);
  line-height: 1.55;
}

body[data-page="ranking"] .ranking-hero-summary,
body[data-page="galeria"] .gallery-hero-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-self: end;
  width: fit-content;
  min-width: min(100%, 380px);
  max-width: 100%;
  gap: 0;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid rgba(0, 168, 255, 0.48);
  border-radius: 17px;
  background: linear-gradient(112deg, rgba(2, 16, 33, 0.87), rgba(5, 27, 52, 0.84));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.21), inset 0 0 25px rgba(3, 55, 96, 0.1);
  backdrop-filter: blur(8px);
}

body[data-page="ranking"] .ranking-hero-summary > div,
body[data-page="galeria"] .gallery-hero-summary > div {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding-inline: 14px;
  text-align: center;
}

body[data-page="ranking"] .ranking-hero-summary > div + div,
body[data-page="galeria"] .gallery-hero-summary > div + div {
  border-left: 1px solid rgba(106, 158, 210, 0.22);
}

body[data-page="ranking"] .ranking-hero-summary span,
body[data-page="galeria"] .gallery-hero-summary span {
  color: #9fb8d5;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  line-height: 1.35;
  text-transform: uppercase;
}

body[data-page="ranking"] .ranking-hero-summary strong,
body[data-page="galeria"] .gallery-hero-summary strong {
  color: #f5f7fb;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(2rem, 4vw, 3.7rem);
  letter-spacing: -0.07em;
  line-height: 1;
}

body[data-page="historico"] .history-hero-summary {
  display: grid;
  align-content: center;
  justify-items: center;
  justify-self: end;
  width: fit-content;
  min-width: min(100%, 230px);
  max-width: 100%;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid rgba(0, 168, 255, 0.48);
  border-radius: 17px;
  background: linear-gradient(112deg, rgba(2, 16, 33, 0.87), rgba(5, 27, 52, 0.84));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.21), inset 0 0 25px rgba(3, 55, 96, 0.1);
  backdrop-filter: blur(8px);
  text-align: center;
}

body[data-page="historico"] .history-hero-summary > span,
body[data-page="historico"] .history-hero-summary > small {
  color: #9fb8d5;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

body[data-page="historico"] .history-hero-summary > strong {
  color: #f5f7fb;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(2.8rem, 5vw, 4.3rem);
  letter-spacing: -0.07em;
  line-height: 1.1;
}

body[data-page="historico"] .history-hero-summary > small {
  color: #63b8ff;
}

body[data-page="etapas"] #site-shell > .stages-page-frame > .page-main.stages-page > .stages-page-hero .stages-page-hero-actions {
  justify-self: end;
  justify-items: center;
  width: fit-content;
  max-width: 100%;
  text-align: center;
}

body[data-page="etapas"] #site-shell > .stages-page-frame > .page-main.stages-page > .stages-page-hero .stages-page-count {
  justify-self: center;
  justify-content: center;
  text-align: center;
}

body[data-page="etapas"] #site-shell > .stages-page-frame > .page-main.stages-page > .stages-page-hero .stages-page-hero-actions .report-link {
  justify-content: center;
  max-width: 100%;
  text-align: center;
}

body[data-page="ranking"] .ranking-page-content.section,
body[data-page="galeria"] .gallery-page-content.section {
  min-width: 0;
  margin: 0;
  padding: clamp(16px, 2.2vw, 28px);
  border: 1px solid rgba(47, 143, 255, 0.24);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(9, 27, 50, 0.92), rgba(5, 17, 33, 0.96));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

body[data-page="ranking"] .ranking-filter-bar {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(71, 126, 188, 0.25);
  border-radius: 15px;
  background: rgba(3, 15, 30, 0.62);
}

body[data-page="ranking"] .ranking-series-switcher-shell,
body[data-page="historico"] .history-scope-switcher-shell {
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
}

body[data-page="ranking"] .ranking-series-switcher,
body[data-page="historico"] .history-scope-switcher-shell .ranking-series-switcher {
  width: min(100%, 680px);
  max-width: 100%;
  padding: 5px;
  border-color: rgba(72, 126, 185, 0.32);
  border-radius: 17px;
  background: rgba(3, 15, 30, 0.78);
}

body[data-page="ranking"] .ranking-series-button,
body[data-page="historico"] .history-scope-switcher-shell .ranking-series-button {
  min-height: 44px;
  border-radius: 12px;
  color: #a9bfd9;
  letter-spacing: 0.05em;
}

body[data-page="ranking"] .ranking-series-button.is-active,
body[data-page="historico"] .history-scope-switcher-shell .ranking-series-button.is-active {
  border-color: rgba(64, 159, 255, 0.46);
  background: linear-gradient(115deg, #087ff4, #1457d4);
  color: #f7fbff;
  box-shadow: 0 8px 20px rgba(0, 77, 196, 0.28);
}

body[data-page="ranking"] .ranking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-width: 0;
}

body[data-page="ranking"] .ranking-card.ranking-card-wide {
  grid-column: auto;
  min-width: 0;
  padding: clamp(14px, 2vw, 24px);
  border: 1px solid rgba(47, 143, 255, 0.3);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(11, 31, 57, 0.98), rgba(5, 18, 35, 0.98));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.21), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body[data-page="ranking"] .ranking-card-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

body[data-page="ranking"] .ranking-card-head h3 {
  margin: 0;
  color: #f4f7fc;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.25;
}

body[data-page="ranking"] .ranking-card-context {
  max-width: 690px;
  margin-top: 7px;
  color: #9fb8d5;
}

body[data-page="ranking"] .ranking-card .report-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

body[data-page="ranking"] .ranking-card .report-actions > .share-card-button {
  margin-block: 0;
}

body[data-page="ranking"] .ranking-row {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: clamp(10px, 1.5vw, 20px);
  min-width: 0;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(85, 139, 198, 0.2);
  border-left: 3px solid transparent;
  border-radius: 15px;
  background: rgba(5, 18, 35, 0.7);
}

body[data-page="ranking"] .ranking-row.is-leader {
  border-color: rgba(242, 184, 75, 0.45);
  border-left-color: #f2c45f;
  background: linear-gradient(100deg, rgba(242, 184, 75, 0.14), rgba(5, 18, 35, 0.82) 56%);
  box-shadow: inset 0 1px 0 rgba(242, 184, 75, 0.12);
}

body[data-page="ranking"] .ranking-row.is-tied:not(.is-leader) {
  border-color: rgba(137, 164, 204, 0.35);
  background: linear-gradient(100deg, rgba(137, 164, 204, 0.08), rgba(5, 18, 35, 0.82) 65%);
}

body[data-page="ranking"] .ranking-row .position {
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, #176ac1, #233b73);
  font-family: "Formula1 Bold", "Formula1", sans-serif;
}

body[data-page="ranking"] .ranking-row-driver,
body[data-page="ranking"] .ranking-row-copy {
  min-width: 0;
}

body[data-page="ranking"] .ranking-row-driver .pilot-photo-frame,
body[data-page="ranking"] .ranking-row-driver .ranking-photo {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
}

body[data-page="ranking"] .ranking-row-name {
  gap: 7px;
}

body[data-page="ranking"] .ranking-row-name .text-link {
  color: #f0f5fc;
  font-size: clamp(0.9rem, 1vw, 1.04rem);
  text-decoration: none;
}

body[data-page="ranking"] .ranking-row-name .text-link:hover,
body[data-page="ranking"] .ranking-row-name .text-link:focus-visible {
  color: #72c5ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body[data-page="ranking"] .ranking-row-copy > div:not(.ranking-row-name) {
  margin-top: 3px;
  color: #9fb8d5;
  font-size: 0.76rem;
}

body[data-page="ranking"] .ranking-row .score {
  color: #edf4ff;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(0.95rem, 1.4vw, 1.3rem);
  white-space: nowrap;
}

body[data-page="ranking"] [data-ranking-panel][hidden],
body[data-page="historico"] .history-scope-panel[hidden] {
  display: none;
}

body[data-page="historico"] .history-scope-panel.section {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="historico"] .trophy-room {
  border-color: rgba(255, 209, 102, 0.35);
  background:
    radial-gradient(ellipse at 50% -18%, rgba(255, 209, 102, 0.14), transparent 55%),
    linear-gradient(145deg, rgba(13, 32, 58, 0.98), rgba(5, 17, 34, 0.98));
}

body[data-page="historico"] .history-global-records,
body[data-page="historico"] .history-global-block {
  min-width: 0;
  padding: clamp(17px, 2.2vw, 28px);
  border: 1px solid rgba(47, 143, 255, 0.24);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(9, 27, 50, 0.92), rgba(5, 17, 33, 0.96));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

body[data-page="historico"] .history-global-records {
  margin-bottom: 18px;
}

body[data-page="historico"] .history-global-heading {
  margin-bottom: 18px;
}

body[data-page="historico"] .history-global-heading > .eyebrow,
body[data-page="historico"] .trophy-room-heading .eyebrow {
  color: #35b9ff;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
}

body[data-page="historico"] .history-global-heading h2,
body[data-page="historico"] .trophy-room-heading h2 {
  color: #f4f7fc;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

body[data-page="historico"] .history-record-grid.history-global-record-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

body[data-page="historico"] .history-global-record-grid .history-record-card {
  min-width: 0;
  min-height: 190px;
  border-color: rgba(47, 143, 255, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(41, 125, 218, 0.14), transparent 65%),
    linear-gradient(145deg, rgba(14, 36, 66, 0.92), rgba(6, 19, 36, 0.96));
}

body[data-page="historico"] .history-global-record-grid .history-record-card strong {
  color: #4b9bff;
  font-size: clamp(2rem, 3.2vw, 3rem);
}

body[data-page="historico"] .history-global-record-grid .history-record-label {
  color: #b8cce3;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
}

body[data-page="historico"] .history-global-record-grid .history-record-card p {
  max-width: 36ch;
  color: #edf4ff;
  font-family: "Formula1", sans-serif;
  font-size: 0.88rem;
}

body[data-page="historico"] .history-global-block + .history-global-block {
  margin-top: 18px;
}

body[data-page="historico"] .history-champions-table {
  width: 100%;
  min-width: 560px;
}

body[data-page="historico"] .history-page .table-shell {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid rgba(70, 126, 187, 0.28);
  border-radius: 15px;
}

body[data-page="historico"] .history-page .history-note {
  max-width: none;
  margin: 14px 0 0;
  border-radius: 10px;
}

body[data-page="galeria"] .gallery-page-content {
  display: grid;
  gap: 16px;
}

body[data-page="galeria"] .gallery-content-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

body[data-page="galeria"] .gallery-content-heading .eyebrow {
  margin: 0 0 5px;
  color: #35b9ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

body[data-page="galeria"] .gallery-content-heading h2 {
  margin: 0;
  color: #f4f7fc;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(1.2rem, 2.1vw, 1.7rem);
}

body[data-page="galeria"] .gallery-content-count,
body[data-page="galeria"] .gallery-stage-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(47, 143, 255, 0.28);
  border-radius: 999px;
  background: rgba(13, 46, 79, 0.56);
  color: #b6cde7;
  font-size: 0.74rem;
  white-space: nowrap;
}

body[data-page="galeria"] .gallery-filter-bar {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(71, 126, 188, 0.25);
  border-radius: 15px;
  background: rgba(3, 15, 30, 0.62);
}

body[data-page="galeria"] .gallery-filter-bar .filter-field {
  width: min(100%, 440px);
}

body[data-page="galeria"] .gallery-archive {
  gap: 17px;
  min-width: 0;
}

body[data-page="galeria"] .gallery-stage {
  min-width: 0;
  gap: 15px;
  padding: clamp(14px, 1.8vw, 22px);
  border-color: rgba(47, 143, 255, 0.25);
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(10, 30, 55, 0.92), rgba(5, 17, 33, 0.96));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.17);
}

body[data-page="galeria"] .gallery-stage-head {
  gap: 4px;
}

body[data-page="galeria"] .gallery-stage-kicker {
  margin: 0;
  color: #35b9ff;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

body[data-page="galeria"] .gallery-stage-head h3 {
  color: #f4f7fc;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.3rem);
}

body[data-page="galeria"] .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  align-items: stretch;
  gap: 12px;
  min-width: 0;
}

body[data-page="galeria"] .gallery-thumb-button {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  min-width: 0;
  height: 100%;
  flex: initial;
  border-color: rgba(73, 129, 190, 0.26);
  border-radius: 14px;
  background: rgba(3, 15, 30, 0.85);
}

body[data-page="galeria"] .gallery-thumb-button img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

body[data-page="galeria"] .gallery-card-copy {
  min-width: 0;
  align-content: start;
  gap: 4px;
  padding: 10px 11px 11px;
}

body[data-page="galeria"] .gallery-card-copy strong {
  color: #edf4ff;
  font-size: 0.76rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

body[data-page="galeria"] .gallery-card-copy span {
  color: #9fb8d5;
  font-size: 0.69rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

body[data-page="galeria"] .gallery-modal-panel {
  border-color: rgba(47, 143, 255, 0.35);
  border-radius: 20px;
  background: rgba(3, 16, 33, 0.98);
}

body[data-page="galeria"] .gallery-modal-image {
  border-radius: 13px;
}

/* The upcoming season is intentionally a quiet, standalone destination. */
.upcoming-season-page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: calc(100% - clamp(20px, 3vw, 48px));
  min-height: calc(100vh - clamp(24px, 4vw, 52px));
  margin: clamp(12px, 2vw, 26px) auto;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(44, 145, 226, 0.55);
  border-radius: clamp(18px, 2vw, 28px);
  background:
    radial-gradient(circle at 8% 27%, rgba(22, 84, 148, 0.16), transparent 35rem),
    linear-gradient(145deg, rgba(6, 22, 41, 0.98), rgba(4, 13, 26, 0.99) 72%),
    #061426;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.018);
}

.upcoming-season-header {
  position: relative;
  z-index: 2;
  padding: 0 clamp(8px, 1.15vw, 16px);
}

.upcoming-season-topbar {
  min-height: 90px;
  margin-top: 0;
  gap: 16px;
  padding: 10px clamp(14px, 2vw, 28px);
  border: 1px solid rgba(47, 143, 255, 0.42);
  border-radius: 20px;
  background: rgba(3, 16, 33, 0.92);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.upcoming-season-topbar .brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  padding: 0;
  color: #f4f7fc;
  text-decoration: none;
}

.upcoming-season-topbar .brand-logo {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  object-fit: contain;
}

.upcoming-season-topbar .brand-copy {
  display: grid;
  gap: 3px;
}

.upcoming-season-topbar .brand-copy strong {
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(0.82rem, 1.3vw, 1.1rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.upcoming-season-topbar .brand-copy small {
  color: #9fb8d5;
  font-size: 0.62rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.upcoming-season-header-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 209, 102, 0.31);
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.07);
  color: #ffdc8a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.upcoming-season-header-status > span {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 0 5px rgba(255, 209, 102, 0.12), 0 0 20px rgba(255, 209, 102, 0.35);
}

.upcoming-season-main {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(12px, 1.6vw, 22px) clamp(8px, 1.1vw, 16px) clamp(8px, 1.1vw, 16px);
}

.upcoming-season-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: clamp(480px, 66vh, 730px);
  margin: 0;
  padding: clamp(30px, 6vw, 88px);
  overflow: hidden;
  border: 1px solid rgba(47, 143, 255, 0.36);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 5% 8%, rgba(13, 102, 191, 0.23), transparent 48%),
    radial-gradient(ellipse at 96% 94%, rgba(185, 42, 68, 0.16), transparent 40%),
    linear-gradient(112deg, rgba(3, 16, 33, 0.99), rgba(5, 24, 46, 0.95) 55%, rgba(6, 21, 39, 0.96));
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.21), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.upcoming-season-hero::before {
  position: absolute;
  inset: 0 0 0 43%;
  z-index: 0;
  background: linear-gradient(128deg, transparent 0 18%, rgba(19, 85, 151, 0.22) 18% 50%, rgba(140, 34, 65, 0.16) 50% 100%);
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
  content: "";
  pointer-events: none;
}

.upcoming-season-hero::after {
  position: absolute;
  top: 50%;
  right: 8%;
  z-index: 0;
  width: clamp(260px, 35vw, 500px);
  aspect-ratio: 1;
  border: 1px solid rgba(57, 147, 235, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(57, 147, 235, 0.04), 0 0 0 70px rgba(220, 49, 70, 0.035), inset 0 0 80px rgba(57, 147, 235, 0.07);
  content: "";
  pointer-events: none;
  transform: translateY(-50%);
}

.upcoming-season-copy {
  position: relative;
  z-index: 2;
  width: min(68%, 850px);
}

.upcoming-season-copy .eyebrow {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 17px;
  color: #35b9ff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.upcoming-season-kicker-line {
  display: inline-block;
  width: 34px;
  height: 4px;
  flex: 0 0 34px;
  border-radius: 4px;
  background: linear-gradient(90deg, #e2372f, #3588ff);
}

.upcoming-season-copy h1 {
  max-width: 12ch;
  margin: 0;
  color: #f5f7fb;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(3rem, 6.1vw, 6.1rem);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 0.99;
  text-wrap: balance;
}

.upcoming-season-copy .hero-text {
  max-width: 650px;
  margin: 22px 0 0;
  color: #c2d5ed;
  font-size: clamp(0.98rem, 1.35vw, 1.22rem);
  line-height: 1.6;
}

.upcoming-season-return {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-top: 28px;
  padding-inline: 22px;
  border: 1px solid rgba(80, 164, 255, 0.43);
  border-radius: 12px;
  background: linear-gradient(115deg, #087ff4, #1457d4);
  color: #f7fbff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 0 12px 28px rgba(0, 83, 193, 0.26);
}

.upcoming-season-return:hover,
.upcoming-season-return:focus-visible {
  border-color: rgba(145, 203, 255, 0.8);
  background: linear-gradient(115deg, #168eff, #246cea);
  transform: translateY(-1px);
}

.upcoming-season-year {
  position: absolute;
  z-index: 0;
  right: 8%;
  bottom: 8%;
  color: rgba(226, 235, 250, 0.065);
  font-family: "Formula1 Bold", "Formula1", sans-serif;
  font-size: clamp(8rem, 21vw, 20rem);
  letter-spacing: -0.09em;
  line-height: 0.8;
  pointer-events: none;
}

.upcoming-season-orbit {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: 23%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #35b9ff;
  box-shadow: 0 0 0 8px rgba(53, 185, 255, 0.12), 0 0 32px rgba(53, 185, 255, 0.52);
  transform: translateY(-50%);
}

.upcoming-season-orbit span,
.upcoming-season-orbit i,
.upcoming-season-orbit b {
  position: absolute;
  inset: 50%;
  display: block;
  width: 15vw;
  max-width: 190px;
  aspect-ratio: 1;
  border: 1px solid rgba(120, 168, 241, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.upcoming-season-orbit i {
  width: 25vw;
  max-width: 320px;
  border-color: rgba(120, 168, 241, 0.2);
}

.upcoming-season-orbit b {
  width: 37vw;
  max-width: 470px;
  border-color: rgba(226, 55, 47, 0.16);
}

.upcoming-season-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  height: 4px;
  opacity: 0.9;
}

.upcoming-season-track span {
  flex: 1;
  background: linear-gradient(90deg, #e2372f, #f15249);
}

.upcoming-season-track span:nth-child(2n) {
  background: linear-gradient(90deg, #1e5cca, #4a92ff);
}

@media (max-width: 1120px) {
  body[data-page="ranking"] #site-shell > .ranking-page-frame > .page-main > .page-hero,
  body[data-page="historico"] #site-shell > .history-page-frame > .page-main > .page-hero,
  body[data-page="galeria"] #site-shell > .gallery-page-frame > .page-main > .page-hero {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 0.72fr);
  }

  .upcoming-season-copy {
    width: min(74%, 800px);
  }
}

@media (max-width: 880px) {
  body[data-page="historico"] .history-record-grid.history-global-record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="historico"] .history-global-record-grid .history-record-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body[data-page="ranking"] #site-shell > .ranking-page-frame > .page-main > .page-hero,
  body[data-page="historico"] #site-shell > .history-page-frame > .page-main > .page-hero,
  body[data-page="galeria"] #site-shell > .gallery-page-frame > .page-main > .page-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    min-height: 0;
    padding: 22px 17px 17px;
    border-radius: 18px;
  }

  body[data-page="ranking"] .ranking-page-frame > .site-header .topbar,
  body[data-page="historico"] .history-page-frame > .site-header .topbar,
  body[data-page="galeria"] .gallery-page-frame > .site-header .topbar {
    min-height: 0;
  }

  body[data-page="ranking"] #site-shell > .ranking-page-frame > .page-main > .page-hero h1,
  body[data-page="historico"] #site-shell > .history-page-frame > .page-main > .page-hero h1,
  body[data-page="galeria"] #site-shell > .gallery-page-frame > .page-main > .page-hero h1 {
    max-width: 12ch;
    margin-top: 8px;
    font-size: clamp(2.2rem, 9.2vw, 3.35rem);
  }

  body[data-page="ranking"] .ranking-page-hero .hero-text,
  body[data-page="historico"] .history-page-hero .hero-text,
  body[data-page="galeria"] .gallery-page-hero .hero-text {
    margin-top: 11px;
    font-size: 0.8rem;
  }

  body[data-page="ranking"] .ranking-hero-summary,
  body[data-page="galeria"] .gallery-hero-summary {
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    padding: 14px;
    border-radius: 14px;
  }

  body[data-page="ranking"] .ranking-hero-summary > div,
  body[data-page="galeria"] .gallery-hero-summary > div {
    padding-inline: 10px;
  }

  body[data-page="ranking"] .ranking-hero-summary span,
  body[data-page="galeria"] .gallery-hero-summary span {
    font-size: 0.56rem;
  }

  body[data-page="ranking"] .ranking-hero-summary strong,
  body[data-page="galeria"] .gallery-hero-summary strong {
    font-size: 2.4rem;
  }

  body[data-page="historico"] .history-hero-summary {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    justify-self: center;
    width: fit-content;
    min-width: min(100%, 230px);
    justify-items: center;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 14px;
  }

  body[data-page="etapas"] #site-shell > .stages-page-frame > .page-main.stages-page > .stages-page-hero .stages-page-hero-actions {
    grid-template-columns: minmax(0, 1fr);
    justify-self: center;
    justify-items: center;
    width: fit-content;
    min-width: 0;
    gap: 8px;
    padding: 8px 9px;
  }

  body[data-page="etapas"] #site-shell > .stages-page-frame > .page-main.stages-page > .stages-page-hero .stages-page-hero-actions .report-link {
    width: auto;
    padding: 8px 9px;
    font-size: 0.57rem;
  }

  body[data-page="historico"] .history-hero-summary > strong {
    font-size: 2.5rem;
  }

  body[data-page="ranking"] .ranking-page-content.section,
  body[data-page="galeria"] .gallery-page-content.section,
  body[data-page="historico"] .history-global-records,
  body[data-page="historico"] .history-global-block {
    padding: 15px;
    border-radius: 17px;
  }

  body[data-page="ranking"] .ranking-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  body[data-page="ranking"] .ranking-card .report-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  body[data-page="ranking"] .ranking-card .report-actions > * {
    justify-content: center;
    min-width: 0;
  }

  body[data-page="ranking"] .ranking-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 11px 9px;
  }

  body[data-page="ranking"] .ranking-row .position {
    width: 34px;
    height: 34px;
    font-size: 0.82rem;
  }

  body[data-page="ranking"] .ranking-row-driver {
    gap: 8px;
  }

  body[data-page="ranking"] .ranking-row-driver .pilot-photo-frame,
  body[data-page="ranking"] .ranking-row-driver .ranking-photo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  body[data-page="ranking"] .ranking-row-name {
    gap: 5px;
  }

  body[data-page="ranking"] .ranking-row-name .text-link {
    font-size: 0.8rem;
  }

  body[data-page="ranking"] .ranking-row-copy > div:not(.ranking-row-name) {
    font-size: 0.64rem;
  }

  body[data-page="ranking"] .ranking-row .score {
    font-size: 0.78rem;
  }

  body[data-page="ranking"] .ranking-badge,
  body[data-page="ranking"] .ranking-row-name .ranking-series-badge {
    min-height: 18px;
    padding-inline: 6px;
    font-size: 0.5rem;
    letter-spacing: 0.02em;
  }

  body[data-page="ranking"] .ranking-series-switcher,
  body[data-page="historico"] .history-scope-switcher-shell .ranking-series-switcher {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    width: 100%;
    border-radius: 15px;
  }

  body[data-page="ranking"] .ranking-series-button,
  body[data-page="historico"] .history-scope-switcher-shell .ranking-series-button {
    min-width: 0;
    min-height: 40px;
    padding-inline: 8px;
    font-size: 0.66rem;
    letter-spacing: 0.025em;
  }

  body[data-page="historico"] .trophy-room {
    padding: 20px 16px;
    border-radius: 18px;
  }

  body[data-page="historico"] .trophy-award-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="historico"] .trophy-award,
  body[data-page="historico"] .trophy-award-champion {
    min-height: 180px;
  }

  body[data-page="historico"] .history-record-grid.history-global-record-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="historico"] .history-global-record-grid .history-record-card:last-child {
    grid-column: auto;
  }

  body[data-page="galeria"] .gallery-content-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  body[data-page="galeria"] .gallery-filter-bar .filter-field {
    width: 100%;
  }

  body[data-page="galeria"] .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 145px), 1fr));
    gap: 9px;
  }

  .upcoming-season-page {
    grid-template-rows: auto minmax(0, 1fr);
    width: calc(100% - 24px);
    min-height: calc(100vh - 24px);
    margin: 12px auto;
    padding: 6px;
    border-radius: 19px;
  }

  .upcoming-season-header {
    padding: 0 6px;
  }

  .upcoming-season-topbar {
    min-height: 64px;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 15px;
  }

  .upcoming-season-topbar .brand {
    min-width: 0;
    gap: 7px;
  }

  .upcoming-season-topbar .brand-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .upcoming-season-topbar .brand-copy strong {
    font-size: 0.67rem;
    letter-spacing: 0.025em;
  }

  .upcoming-season-topbar .brand-copy small {
    font-size: 0.48rem;
    letter-spacing: 0.11em;
  }

  .upcoming-season-header-status {
    gap: 6px;
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.48rem;
    letter-spacing: 0.01em;
  }

  .upcoming-season-header-status > span {
    width: 6px;
    height: 6px;
    flex-basis: 6px;
  }

  .upcoming-season-main {
    padding: 8px 6px 6px;
  }

  .upcoming-season-hero {
    align-items: flex-start;
    min-height: min(660px, calc(100svh - 110px));
    padding: clamp(25px, 7vw, 38px) clamp(18px, 5vw, 28px);
    border-radius: 17px;
  }

  .upcoming-season-copy {
    width: 100%;
  }

  .upcoming-season-copy .eyebrow {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    line-height: 1.45;
  }

  .upcoming-season-kicker-line {
    width: 24px;
    height: 3px;
    flex-basis: 24px;
    margin-top: 6px;
  }

  .upcoming-season-copy h1 {
    max-width: 11ch;
    font-size: clamp(2.35rem, 10.8vw, 3.8rem);
  }

  .upcoming-season-copy .hero-text {
    max-width: 38ch;
    margin-top: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
  }

  .upcoming-season-return {
    min-height: 48px;
    margin-top: 21px;
    padding-inline: 14px;
    font-size: 0.62rem;
  }

  .upcoming-season-hero::before {
    inset: 36% 0 0 0;
    clip-path: polygon(38% 0, 100% 0, 100% 100%, 0 100%);
  }

  .upcoming-season-hero::after {
    top: auto;
    right: -22%;
    bottom: 7%;
    width: 75vw;
    transform: none;
  }

  .upcoming-season-orbit {
    top: auto;
    right: 31%;
    bottom: 19%;
    transform: none;
  }

  .upcoming-season-orbit span {
    width: 34vw;
  }

  .upcoming-season-orbit i {
    width: 55vw;
  }

  .upcoming-season-orbit b {
    width: 78vw;
  }

  .upcoming-season-year {
    right: 6%;
    bottom: 8%;
    font-size: clamp(7rem, 36vw, 12rem);
  }
}

@media (max-width: 430px) {
  body[data-page="ranking"] .ranking-filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="ranking"] .ranking-filter-bar .favorite-filter-button {
    width: 100%;
  }

  body[data-page="ranking"] .ranking-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 5px;
    padding-inline: 6px;
  }

  body[data-page="ranking"] .ranking-row .position {
    width: 28px;
    height: 28px;
    font-size: 0.68rem;
  }

  body[data-page="ranking"] .ranking-row-driver {
    gap: 6px;
  }

  body[data-page="ranking"] .ranking-row-driver .pilot-photo-frame,
  body[data-page="ranking"] .ranking-row-driver .ranking-photo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  body[data-page="ranking"] .ranking-row-name .text-link {
    font-size: 0.72rem;
  }

  body[data-page="ranking"] .ranking-row-copy > div:not(.ranking-row-name) {
    font-size: 0.58rem;
  }

  body[data-page="ranking"] .ranking-row .score {
    font-size: 0.69rem;
  }

  body[data-page="ranking"] .ranking-card .report-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="galeria"] .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upcoming-season-topbar .brand-copy small {
    display: none;
  }

  .upcoming-season-header-status {
    max-width: 44%;
    white-space: normal;
    line-height: 1.2;
  }
}

body[data-page="ranking"] .ranking-controls-sticky {
  position: static;
  padding: 0 0 7px;
  background: transparent;
}

body[data-page="ranking"] .ranking-filter-bar .ranking-jump-favorite {
  min-height: 40px;
  white-space: nowrap;
}

body[data-page="ranking"] .ranking-back-to-top {
  position: static;
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  margin: 18px 0 0 auto;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(96, 168, 239, 0.56);
  border-radius: 999px;
  background: rgba(4, 20, 39, 0.95);
  color: #e4f2ff;
  cursor: pointer;
  font: inherit;
  font-size: 0.67rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body[data-page="ranking"] .ranking-back-to-top span {
  color: #70baff;
  font-size: 1.1rem;
}

body[data-page="ranking"] .ranking-back-to-top:hover {
  border-color: #8ccaff;
  background: #0b2c4d;
}

body[data-page="ranking"] .ranking-back-to-top:focus-visible {
  outline: 2px solid #91caff;
  outline-offset: 3px;
}

body[data-page="ranking"] .ranking-row:focus {
  outline: 2px solid rgba(126, 194, 255, 0.9);
  outline-offset: 3px;
  scroll-margin-top: 20px;
}

body[data-page="historico"] .history-season-state-active {
  justify-items: stretch;
  gap: 20px;
  padding: clamp(18px, 3vw, 30px);
  text-align: left;
}

body[data-page="historico"] .history-season-state-copy {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 5px 16px;
}

body[data-page="historico"] .history-season-state-copy .history-state-icon {
  grid-column: 1;
  grid-row: 1 / span 4;
}

body[data-page="historico"] .history-season-state-copy > :not(.history-state-icon) {
  grid-column: 2;
}

body[data-page="historico"] .history-season-state-copy .eyebrow,
body[data-page="historico"] .history-season-state-copy > p:not(.eyebrow) {
  margin: 0;
}

body[data-page="historico"] .history-season-state-copy h2 {
  max-width: none;
}

body[data-page="historico"] .history-season-state-copy .button {
  margin-top: 5px;
}

body[data-page="historico"] .history-active-global-records {
  width: 100%;
  padding-top: 17px;
  border-top: 1px solid rgba(104, 159, 217, 0.22);
}

body[data-page="historico"] .history-active-global-records .history-global-heading {
  margin-bottom: 10px;
}

body[data-page="historico"] .history-active-global-records .history-global-heading h3 {
  margin: 0;
  color: #f4f7fc;
  font-size: clamp(1.05rem, 2vw, 1.4rem);
}

body[data-page="historico"] .history-active-global-record-grid .history-record-card {
  min-height: 138px;
  padding: 15px;
}

body[data-page="historico"] .history-active-global-record-grid .history-record-card strong {
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
}

@media (max-width: 760px) {
  body[data-page="ranking"] .ranking-filter-bar .ranking-jump-favorite {
    width: 100%;
  }

  body[data-page="ranking"] .ranking-back-to-top {
    min-height: 42px;
    padding: 9px 12px;
  }

  body[data-page="historico"] .history-season-state-active {
    padding: 18px 15px;
  }

  body[data-page="historico"] .history-season-state-copy {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="historico"] .history-season-state-copy .history-state-icon,
  body[data-page="historico"] .history-season-state-copy > :not(.history-state-icon) {
    grid-column: 1;
    grid-row: auto;
  }

  body[data-page="historico"] .history-active-global-record-grid .history-record-card {
    min-height: 120px;
  }
}

body[data-page="ranking"] .ranking-filter-empty {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 24px 16px;
  color: var(--text, #eaf3ff);
}

body[data-page="ranking"] .ranking-filter-empty[hidden] { display: none; }
body[data-page="ranking"] .ranking-filter-empty p { margin: 0; line-height: 1.5; }
body[data-page="ranking"] .ranking-panel-rows > [data-ranking-row][hidden] { display: none !important; }
body[data-page="ranking"] .ranking-view-switch {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid rgba(120, 168, 241, 0.18);
  border-radius: 999px;
  background: rgba(3, 12, 25, 0.4);
}

body[data-page="ranking"].astro-ranking-enhanced .ranking-view-switch { display: inline-flex; }

body[data-page="ranking"] .ranking-view-button {
  min-height: 38px;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #a9bdd8;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

body[data-page="ranking"] .ranking-view-button.is-active {
  background: rgba(59, 140, 255, 0.2);
  color: #dceeff;
}

body[data-page="ranking"] .ranking-view-button:focus-visible {
  outline: 2px solid #82baff;
  outline-offset: 1px;
}

body[data-page="ranking"] [data-ranking-view-panel][hidden] { display: none !important; }

body[data-page="ranking"] .ranking-breakdown {
  margin-top: 22px;
  border-top: 1px solid rgba(117, 157, 205, 0.2);
  padding-top: 17px;
}

body[data-page="ranking"] .ranking-breakdown-note {
  max-width: 85ch;
  margin: 4px 0 12px;
  color: #a8bdd8;
  font-size: 0.78rem;
  line-height: 1.55;
}

body[data-page="ranking"] .ranking-breakdown-empty {
  margin: 12px 0 0;
  color: #a8bdd8;
  font-size: 0.82rem;
}

body[data-page="ranking"] .ranking-breakdown-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid rgba(91, 133, 184, 0.28);
  border-radius: 12px;
  background: rgba(2, 12, 25, 0.66);
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

body[data-page="ranking"] .ranking-breakdown-scroll:focus-visible {
  outline: 3px solid #82baff;
  outline-offset: 3px;
}

body[data-page="ranking"] .ranking-stage-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #e6eef9;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

body[data-page="ranking"] .ranking-stage-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

body[data-page="ranking"] .ranking-stage-table th,
body[data-page="ranking"] .ranking-stage-table td {
  min-width: 92px;
  padding: 10px 11px;
  border-right: 1px solid rgba(117, 157, 205, 0.12);
  border-bottom: 1px solid rgba(117, 157, 205, 0.14);
  text-align: center;
  vertical-align: middle;
}

body[data-page="ranking"] .ranking-stage-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #10243d;
  color: #bdcde1;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

body[data-page="ranking"] .ranking-stage-table thead th > span,
body[data-page="ranking"] .ranking-stage-table thead th > small {
  display: block;
}

body[data-page="ranking"] .ranking-stage-table thead th > small {
  max-width: 120px;
  margin: 4px auto 0;
  color: #91a9c5;
  font-size: 0.59rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
}

body[data-page="ranking"] .ranking-stage-table .ranking-stage-driver-column {
  position: sticky;
  z-index: 3;
  left: 0;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  background: #0b1c31;
  text-align: left;
}

body[data-page="ranking"] .ranking-stage-table thead .ranking-stage-driver-column {
  z-index: 4;
  background: #142b47;
}

body[data-page="ranking"] .ranking-stage-table tbody .ranking-stage-driver-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

body[data-page="ranking"] .ranking-stage-table tbody .ranking-stage-driver-identity > span {
  flex: 0 0 30px;
  color: #f2c45f;
  font-family: "Formula1 Bold", "Formula1", sans-serif;
}

body[data-page="ranking"] .ranking-stage-table tbody .ranking-stage-driver-identity > a {
  overflow: hidden;
  color: #eaf2fd;
  font-size: 0.74rem;
  font-weight: 700;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

body[data-page="ranking"] .ranking-stage-table tbody .ranking-stage-driver-identity > a:hover,
body[data-page="ranking"] .ranking-stage-table tbody .ranking-stage-driver-identity > a:focus-visible {
  color: #8fc8ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body[data-page="ranking"] .ranking-stage-table tbody th {
  vertical-align: middle;
  /* Keep the sticky cell stretched to the full row height. */
  display: table-cell;
}

body[data-page="ranking"] .ranking-stage-table tbody .ranking-stage-driver-column {
  background: #0b1c31;
}

body[data-page="ranking"] .ranking-stage-table td strong,
body[data-page="ranking"] .ranking-stage-table td small,
body[data-page="ranking"] .ranking-stage-status {
  display: block;
}

body[data-page="ranking"] .ranking-stage-table td strong {
  color: #f2f6fc;
  font-size: 0.78rem;
}

body[data-page="ranking"] .ranking-stage-series-results,
body[data-page="ranking"] .ranking-stage-status-paired {
  white-space: nowrap;
}

body[data-page="ranking"] .ranking-stage-table td small {
  color: #9fb6d1;
  font-size: 0.63rem;
}

body[data-page="ranking"] .ranking-stage-points-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
}

body[data-page="ranking"] .ranking-stage-penalty-marker {
  display: inline-flex;
  flex: 0 0 14px;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9c292b;
  box-shadow: 0 0 0 1px rgba(255, 111, 111, 0.24);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
}

body[data-page="ranking"] .ranking-stage-fastest-lap-marker {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 14px;
  padding: 0 4px;
  border: 1px solid rgba(108, 222, 169, 0.45);
  border-radius: 5px;
  background: rgba(38, 137, 97, 0.2);
  color: #8fe3b4;
  font-size: 0.48rem;
  font-weight: 900;
  line-height: 1;
}

body[data-page="ranking"] .ranking-stage-status {
  margin-top: 3px;
  color: #ffcc84;
  font-size: 0.57rem;
}

body[data-page="ranking"] .ranking-stage-table .ranking-stage-total {
  position: sticky;
  right: 0;
  z-index: 1;
  min-width: 115px;
  background: #10243d;
}

body[data-page="ranking"] .ranking-stage-table tbody tr:last-child > * {
  border-bottom: 0;
}

body[data-page="ranking"] .ranking-stage-table tr:hover td {
  background-color: rgba(35, 81, 137, 0.3);
}

body[data-page="ranking"] .ranking-stage-table tr:hover .ranking-stage-driver-column {
  background: #163252;
}

@media (max-width: 760px) {
  body[data-page="ranking"] .ranking-stage-table .ranking-stage-total {
    position: static;
    right: auto;
    z-index: auto;
  }
}

@media (max-width: 600px) {
  body[data-page="ranking"] .ranking-stage-table th,
  body[data-page="ranking"] .ranking-stage-table td {
    min-width: 82px;
    padding: 8px 6px;
  }

  body[data-page="ranking"] .ranking-stage-table .ranking-stage-driver-column {
    position: static;
    left: auto;
    z-index: auto;
    width: 112px;
    min-width: 112px;
    max-width: 112px;
  }

  body[data-page="ranking"] .ranking-stage-table thead .ranking-stage-driver-column {
    z-index: auto;
  }

  body[data-page="ranking"] .ranking-stage-table thead th > small {
    max-width: 84px;
  }
}

@media (max-width: 600px) and (orientation: portrait) {
  body[data-page="ranking"].astro-ranking-enhanced .ranking-view-switch {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .upcoming-season-page *,
  .upcoming-season-page *::before,
  .upcoming-season-page *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Championship movement stays in the driver's copy, preserving narrow screens. */
.ranking-movement-context { color: var(--muted, #a9bdd8); font-size: .82rem; line-height: 1.5; margin: .8rem 0; }
.ranking-movement { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .78rem; line-height: 1.5; margin-top: .3rem; }
.ranking-movement .movement-up { color: #76e3ac; }
.ranking-movement .movement-down { color: #ffacac; }
@media (max-width: 600px) {
  body[data-page="ranking"] .ranking-row-copy > .ranking-movement { display: grid; gap: .15rem; font-size: .7rem; overflow-wrap: anywhere; }
}
@media print { .ranking-movement span { color: #111 !important; } }
