:root {
  /* Marken-Tokens - nur noch Dark-Mode, kein Light-Mode-Umschalten mehr. */
  color-scheme: dark;

  --bg-background: #14161a;
  --black: #f2f2f2;
  --light-black: #a0a0a0;
  --box-color: #f80202;
  --box-color-light: rgba(248, 2, 2, 0.28);
  --box-font-color: #ff5459;
  --invalid-color: #ff6b74;
  --valid-color: #3ee24b;
  --light-blue: #1c2733;
  --white: #1c1f24;
  --on-dark: #fff;
  --br-sm: 6px;
  --box-shadow-1: 0 4px 8px 0 rgba(0, 0, 0, 0.5);
  --box-shadow-2: 0 6px 20px 0 rgba(0, 0, 0, 0.4);
  --box-shadow: var(--box-shadow-1), var(--box-shadow-2);

  /* Kategorie-Farben - themenuebergreifend identisch */
  --tr1: #f80202;
  --tr2: #fb9501;
  --trlite: #fde325;
  --trmax: #8dc442;
  --trk: #00ccfd;
  --trg: #ff04f2;

  /* Schrift */
  --font: "Lato", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Spyagency", var(--font);

  /* Layout */
  --nav-height: 64px;
  --sidebar-width: 240px;
  --content-max-width: 1100px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  touch-action: pan-x pan-y;
  height: 100%;
  overflow: hidden;
}

/* [hidden] muss immer gewinnen, auch gegen Klassen, die display selbst setzen (z.B. .btn) */
[hidden] {
  display: none !important;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--black);
  background: var(--bg-background);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 1.65rem;
}
h2 {
  font-size: 1.35rem;
}
h3 {
  font-size: 1.1rem;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Visuell versteckt, bleibt aber fuer Screenreader lesbar - genutzt von season-select/
   profile.php/standings.php/races.php/link-sent.php, war bisher nirgends definiert. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

:focus-visible {
  outline: 2px solid var(--box-color);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- App-Shell ---------- */
#app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
}

.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-background);
  border-bottom: 1px solid var(--light-blue);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-actions a {
  padding: 3px 6px 3px 6px;
  font-size: 1.05rem;
}

.app-header__logo {
  height: 32px;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

/* Mobile: untere Navigation - normaler Flex-Fluss statt fixed, siehe App-Shell-Kommentar oben. */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  background: var(--bg-background);
  border-top: 1px solid var(--light-blue);
  padding-bottom: var(--safe-bottom);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 10px;
  font-size: 0.85rem;
  color: var(--light-black);
  min-height: 44px;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav__item[aria-current="page"] {
  color: var(--box-color);
}

/* Desktop: seitliche Navigation */
.side-nav {
  display: none;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid > * {
  min-width: 0;
}
@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }

  #app-root {
    flex-direction: row;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid var(--light-blue);
    padding: 20px 12px;
    gap: 4px;
  }

  .side-nav__logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 24px 12px;
  }

  .side-nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--br-sm);
    color: var(--light-black);
    font-weight: 700;
  }
  .side-nav__item:hover {
    background: var(--light-blue);
  }

  .side-nav__item svg {
    width: 20px;
    height: 20px;
  }

  .side-nav__item[aria-current="page"] {
    color: var(--box-color);
    background: var(--box-color-light);
  }

  .app-main {
    padding: 24px 32px calc(24px + var(--safe-bottom));
    max-width: none;
  }

  .app-main > .page {
    max-width: var(--content-max-width);
  }

  .app-header {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
  }
}

/* ---------- Karten & allgemeine Komponenten ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--light-blue);
  border-radius: var(--br-sm);
  padding: 16px;
}

.card + .card {
  margin-top: 16px;
}

/* ---------- Modal (wiederverwendbar) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  margin: 0 12px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--light-blue);
  border-radius: 16px;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 12px;
}
.modal__header .driver-avatar {
  width: 52px;
  height: 52px;
}
.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--light-blue);
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.modal__section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--light-black);
  font-size: 0.9rem;
}
.modal__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot-color, var(--light-black));
}

.race-event__topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.race-event__topbar-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--light-blue);
  color: inherit;
  cursor: pointer;
}
.race-event__topbar .race-event__topbar-action span {
  font-size: 1.05rem;
}
.media-modal__section {
  margin-bottom: 16px;
}
.media-modal__section:last-child {
  margin-bottom: 0;
}
.media-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: var(--br-sm);
  background: var(--light-blue);
  color: var(--black);
  font-weight: 700;
  text-decoration: none;
}
.media-link:last-child {
  margin-bottom: 0;
}

.hero-card {
  color: var(--on-dark);
  border-radius: var(--br-sm);
  margin-bottom: 16px;
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  .hero-card {
    min-height: 305px;
  }
}

.hero-card__content {
  position: relative;
  margin: 8px 0 16px 0;
  z-index: 1;
  padding: 8px;
}

.hero-card__image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mask-image: linear-gradient(90deg, transparent, #000 14%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%);
  opacity: 0.6;
  z-index: -1;
}

.hero-card__greeting {
  font-size: 2rem;
  margin-bottom: 16px;
  font-weight: 700;
}

.hero-card__headline {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-top: 2px;
}

.hero-card__days-label {
  font-size: 0.95rem;
  opacity: 0.8;
}

.hero-card__days {
  font-family: var(--font-display);
  font-size: 2.75rem;
  line-height: 1.05;
  color: var(--tr1);
  margin: 2px 0 8px;
}

.hero-card__days-unit {
  font-size: 1.3rem;
}

.hero-card__meta {
  font-size: 0.85rem;
  opacity: 0.8;
}

.hero-card__meta--link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-card__meta--link .icon-arrow-right-circle {
  font-size: 1rem;
}

.hero-stats {
  display: flex;
  gap: 0 30px;
  flex-wrap: wrap;
  margin-top: auto;
  background-color: rgba(0, 0, 0, 0.15);
  padding: 12px 6px 6px 8px;
}
.hero-stats-category {
  font-family: var(--font-display);
  width: 100%;
  font-size: 1.8rem;
}

.tr1 {
  color: var(--tr1) !important;
  padding-left: 4px;
}
.tr2 {
  color: var(--tr2) !important;
  padding-left: 4px;
}
.trlite {
  color: var(--trlite) !important;
  padding-left: 4px;
}
.trmax {
  color: var(--trmax) !important;
  padding-left: 4px;
}

.hero-card__stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.hero-card__stat-label {
  font-size: 0.75rem;
}

.page-header h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 0 8px 0;
}

.standings-photo-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}
@media (min-width: 900px) {
  .standings-photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.standings-photo {
  width: 100%;
  border-radius: var(--br-sm);
  border: 1px solid var(--light-blue);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--br-sm);
  border: none;
  background: var(--box-color);
  color: var(--on-dark);
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--secondary {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--light-blue);
}

.btn--ghost {
  background: transparent;
  color: var(--box-color);
}

.btn--block {
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  padding: 12px;
  border: 1px solid var(--light-blue);
  border-radius: var(--br-sm);
  background: var(--bg-background);
  color: var(--black);
  min-height: 44px;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.star-rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
}

.star-rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.star-rating label {
  font-size: 1.6rem;
  color: var(--light-blue);
  cursor: pointer;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: var(--box-color);
}

.field input:invalid[data-touched="true"] {
  border-color: var(--invalid-color);
}

.form-error {
  color: var(--invalid-color);
  font-size: 0.85rem;
  margin: -8px 0 14px;
}

.code-input {
  font-size: 2rem;
  letter-spacing: 0.5em;
  text-align: center;
  padding-right: calc(12px + 0.5em);
  text-indent: 0.5em;
}

/* ---------- Login/Link-gesendet/Auth-Verify ---------- */
.auth-screen {
  max-width: 380px;
  margin: 32px auto 0;
}

.auth-screen h1 {
  margin-bottom: 10px;
}

.auth-screen__claim {
  color: var(--light-black);
  line-height: 1.5;
  margin-bottom: 24px;
}

.empty-state {
  text-align: center;
  color: var(--light-black);
  padding: 32px 16px;
}

/* ---------- Season-Selector & Kategorie-Tabs ---------- */
.season-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 24px 0;
}

.season-select select {
  padding: 8px 10px;
  border-radius: var(--br-sm);
  border: 1px solid var(--light-blue);
  background: var(--bg-background);
  color: var(--black);
}

.season-select--stack {
  flex-direction: column;
  align-items: stretch;
}

.season-select--stack select {
  width: 100%;
}

@media (min-width: 900px) {
  .season-select--stack {
    flex-direction: row;
    align-items: center;
  }

  .season-select--stack select {
    width: auto;
  }
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.category-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--br-sm);
  border: 2px solid var(--tab-color, var(--light-blue));
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--black);
  white-space: nowrap;
}

.category-tab[aria-selected="true"] {
  background: var(--tab-color, var(--box-color));
  color: #000;
  border-color: var(--tab-color, var(--box-color));
}

.type-toggle {
  display: inline-flex;
  width: 100%;
  margin: 12px 0 24px 0;
}

.type-toggle button,
.type-toggle a {
  padding: 8px 16px;
  border: none;
  width: 50%;
  background: transparent;
  color: var(--light-black);
  cursor: pointer;
  border-bottom: 2px solid var(--light-blue);
  text-align: center;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-toggle button[aria-selected="true"],
.type-toggle a[aria-selected="true"] {
  color: var(--on-dark);
  border-bottom: 2px solid var(--box-color);
}

/* ---------- Einfache Datentabelle (z.B. Karriere-Uebersicht im Profil) ---------- */
.results-table {
  font-size: 0.9rem;
}

.results-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--light-black);
  padding: 8px 6px;
  border-bottom: 1px solid var(--light-blue);
}

.results-table td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--light-blue);
  vertical-align: middle;
}

.results-table td:first-child,
.results-table th:first-child {
  width: 1%;
  white-space: nowrap;
}

.results-table td.numeric,
.results-table th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Rangliste / Resultate ---------- */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard__row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: stretch;
  min-height: 43px;
}

.leaderboard__row[data-modal-open] {
  cursor: pointer;
}

.leaderboard__pos {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  background: var(--black);
  color: var(--bg-background);
}

.leaderboard__row.is-leader .leaderboard__pos {
  background: var(--box-color);
  color: #fff;
}

.leaderboard__row.is-leader .leaderboard__diff {
  border: none;
}

.leaderboard__row.has-fastest-lap .leaderboard__pos {
  background: #e6007e;
  color: #fff;
}

.leaderboard__row.is-own {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 3px;
}

.leaderboard__row.is-own .leaderboard__pos::after {
  content: "\ea10";
  font-family: "weblue";
  position: absolute;
  top: -8px;
  left: -8px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  background: #fff;
  color: var(--box-color);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-background);
}

.leaderboard__driver {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 6px;
  background: var(--sponsor-bg, var(--light-blue));
  color: var(--sponsor-font, var(--black));
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.85rem;
}

.leaderboard__driver .driver-cell__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.leaderboard__value,
.leaderboard__diff {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 63px;
  padding: 0 10px;
  border: 1px solid var(--light-blue);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}
.leaderboard__value {
  background: var(--white);
  font-size: 1.05rem;
}

.is-leader .leaderboard__value {
  background: var(--box-color);
  color: #fff;
  border-color: var(--box-color);
}
.leaderboard__value.time {
  min-width: 105px;
  font-size: 0.85rem;
}

.driver-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--light-blue);
  flex-shrink: 0;
  object-position: center 15%;
}

.sponsor-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.driver-avatar--lg {
  width: 84px;
  height: 84px;
}

.rules-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  color: var(--light-black);
  font-size: 0.8rem;
  border-bottom: 1px dotted var(--light-black);
  padding-bottom: 1px;
}
.rules-link .icon-info {
  color: var(--box-color);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Rennen ---------- */
.race-event {
  background: var(--white);
}
.race-event__topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  background: var(--bg-background);
  color: var(--black);
}
.race-event__topbar [class^="icon-"],
.race-event__topbar [class*=" icon-"] {
  font-size: 1.2rem;
}
.race-event__message {
  margin-top: 16px;
}
.race-event__hero {
  min-height: 300px;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: var(--on-dark);
  background: #18221e;
}
.race-event__hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    0deg,
    rgba(8, 11, 12, 0.94),
    rgba(8, 11, 12, 0.05) 70%
  );
}
.race-event__hero img {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  object-fit: contain;
  object-position: center;
}
.race-event__hero .race-event__hero-image--logo {
  width: 45%;
  height: 45%;
  top: 40%;
}
.race-event__hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 24px 18px 20px;
}
.race-event__hero-content h1 {
  max-width: 75%;
  font-size: 1.55rem;
}
.race-event__hero-content p {
  margin-top: 2px;
}
.race-event__own-kart-nr {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: var(--br-sm);
  background: var(--box-color);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.race-event__weather-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: none;
  border-bottom: 1px solid var(--light-blue);
  background: var(--light-blue);
  text-align: left;
  cursor: pointer;
}
.race-event__weather-row-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--br-sm);
  background: var(--bg-background);
}
.race-event__weather-row-icon span {
  font-size: 1.5rem;
}
.race-event__weather-row-now small {
  display: block;
  color: var(--light-black);
  font-size: 0.7rem;
}
.race-event__weather-row-temps {
  margin-left: auto;
  flex-shrink: 0;
  text-align: right;
}
.race-event__weather-row-temps span {
  display: block;
}
.race-event__weather-row-temps,
.weather-modal__daily-row {
  font-size: 0.78rem;
  color: var(--light-black);
}
.race-event__weather-row-temps strong,
.weather-modal__daily-row strong,
.race-event__weather-row .icon-chevron-right {
  color: var(--black);
}
.race-event__countdown {
  position: absolute;
  right: 18px;
  bottom: 22px;
  padding: 3px 6px;
  border-radius: var(--br-sm);
  background: #3c7600;
  color: #d7ff5b;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.race-event__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
  padding: 17px 10px 14px;
  border-bottom: 1px solid var(--light-blue);
  text-align: center;
}
.race-event__stats div {
  min-width: 0;
}
.race-event__stats span {
  display: block;
  margin-bottom: 7px;
  font-size: 1.15rem;
}
.race-event__stats strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}
.race-event__stats small {
  color: var(--light-black);
  font-size: 0.58rem;
}
.race-event__track-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--light-blue);
}
.race-event__track-logo {
  position: static !important;
  width: auto !important;
  height: 34px !important;
  max-width: 45%;
  object-fit: contain !important;
}
.race-event__tabs {
  margin: 0;
  overflow-x: auto;
}
.race-event__tabs a {
  flex: 1 0 25%;
  width: 25%;
  padding: 13px 6px 10px;
  font-size: 0.7rem;
}
.race-event__overview {
  padding: 0 18px 24px;
}
.race-event__plan {
  margin-top: 14px;
}
.race-event__register {
  margin-top: 18px;
  width: 100%;
}
.race-event__category {
  margin: 16px 0 4px;
  font-size: 0.9rem;
}
.race-event__participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--light-blue);
  font-size: 0.9rem;
}
.race-event__kart-nr {
  margin: 0 6px 0 auto;
  font-size: 0.8rem;
  color: var(--light-black);
}
@media (min-width: 700px) {
  .race-event {
    margin: 0;
    border: 1px solid var(--light-blue);
    border-radius: var(--br-sm);
    overflow: hidden;
  }
  .race-event__hero {
    min-height: 390px;
  }
}

.race-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--light-blue);
  border-radius: var(--br-sm);
  margin-bottom: 10px;
}

.race-card__date {
  flex-shrink: 0;
  text-align: center;
  min-width: 52px;
}

.race-card__date-day {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1;
}

.race-card__date-month {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--light-black);
}

.race-card__body {
  flex: 1;
  min-width: 0;
}

.race-card__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  min-width: 0;
}

.race-card__title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.race-card__meta {
  font-size: 0.8rem;
  color: var(--light-black);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-card__status {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.race-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--light-blue);
}

.race-card__countdown {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--light-black);
}

.race-status--next {
  background: var(--box-color-light);
  color: var(--box-font-color);
}

.badge-lateapex {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 3px 4px;
  border-radius: 999px;
  background: var(--box-color);
  vertical-align: middle;
  line-height: 1;
}

/* ---------- Hauptsponsor ---------- */
.main-sponsor {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--light-blue);
  border-radius: var(--br-sm);
  text-align: center;
}

.main-sponsor__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--light-black);
  margin-bottom: 10px;
}

.main-sponsor a {
  display: block;
  margin: 0 auto;
  width: fit-content;
}

.main-sponsor__logo {
  max-width: 200px;
  max-height: 65px;
  border-radius: var(--br-sm);
  padding: 8px 12px;
}

/* ---------- Kategorie-Sponsor (Rangliste) ---------- */
.category-sponsor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: var(--light-black);
}

.category-sponsor__logo {
  max-height: 25px;
  max-width: 90px;
  object-fit: contain;
  background: #e5e5e5;
  border-radius: 4px;
  padding: 4px 6px;
}

/* ---------- Top 3 (Dashboard) ---------- */
.top3-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--light-blue);
}

.top3-row:last-child {
  border-bottom: none;
}

.top3-row__pos {
  width: 18px;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--light-black);
}

.top3-row__name {
  flex: 1;
  font-weight: 700;
  font-size: 0.92rem;
}

.top3-row__points {
  font-size: 0.9rem;
  color: var(--light-black);
}

/* ---------- News ---------- */
.news {
  margin-top: 16px;
}
.news-preview-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--light-blue);
}

.news-preview-item__title {
  font-weight: 700;
  font-size: 0.92rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.news-article__body {
  margin-top: 16px;
  line-height: 1.6;
}

/* ---------- Mitteilungen ---------- */
.notification-day {
  text-align: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--light-black);
  margin: 20px 0 10px;
}

.notification-day:first-child {
  margin-top: 0;
}

.notification-bubble {
  display: block;
  max-width: 85%;
  background: var(--light-blue);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
}

.notification-bubble--link {
  border: 1px solid var(--box-color);
}

.notification-bubble + .notification-bubble {
  margin-top: 10px;
}

.notification-bubble__title {
  font-weight: 700;
  font-size: 0.92rem;
}

.notification-bubble__body {
  font-size: 0.88rem;
  line-height: 1.4;
  margin-top: 2px;
}

.notification-bubble__time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 0.68rem;
  color: var(--light-black);
  margin-top: 6px;
}

.notification-bubble__time .icon-chevron-right {
  font-size: 0.6rem;
  color: var(--box-color);
}

.news-article__body p {
  margin-bottom: 12px;
}

/* ---------- Champion-Banner ---------- */
.champion-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--box-color), #ee2e34);
  color: #fff;
  border-radius: var(--br-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.champion-banner__trophy {
  font-size: 2rem;
}

/* ---------- Fan-Modus ---------- */
.fan-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--light-blue);
  border-radius: var(--br-sm);
  padding: 6px 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  max-width: var(--content-max-width);
}

.fan-banner__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.fan-banner__actions {
  margin-left: auto;
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.fan-banner__actions a {
  white-space: nowrap;
  font-weight: 600;
}

.fan-banner--sticky {
  position: sticky;
  top: -10px;
  margin-top: -16px;
  z-index: 5;
}

/* ---------- Profil ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-name-select {
  font: inherit;
  font-size: 1.3rem;
  color: inherit;
  border: 1px solid var(--light-blue);
  background: var(--white);
  border-radius: var(--br-sm);
  padding: 4px 10px;
  cursor: pointer;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.profile-stat {
  text-align: center;
  padding: 14px 8px;
  background: var(--white);
  border: 1px solid var(--light-blue);
  border-radius: var(--br-sm);
}

.profile-stat__value {
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.profile-stat__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--light-black);
  margin-top: 2px;
}

.profile-stat__delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 6px;
}

.skeleton-box {
  border-radius: var(--br-sm);
  background: linear-gradient(
    90deg,
    var(--light-blue) 25%,
    var(--bg-background) 50%,
    var(--light-blue) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------- Saisonverlauf (Chart.js, siehe js/season-chart.js) ---------- */
.season-chart {
  position: relative;
  width: 100%;
  height: 220px;
}

/* ---------- Liga-weiter Saisonverlauf (Chart.js, siehe js/league-chart.js) ---------- */
.league-chart__toggle {
  margin: 0 0 8px 0;
}

.league-chart__caption {
  font-size: 0.72rem;
  margin: 0 0 10px;
}

.league-chart {
  position: relative;
  width: 100%;
  height: 220px;
}

.league-legend {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 14px 2px 4px;
  margin: 0 -2px;
  scrollbar-width: thin;
}

.league-chip {
  all: unset;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 56px;
  min-height: 44px;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.league-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  background: var(--light-blue);
  border: 2px solid var(--chip-color, transparent);
  flex-shrink: 0;
  transform: translateZ(0);
}

.league-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--black);
}

.league-chip__name {
  font-size: 0.65rem;
  color: var(--light-black);
  text-align: center;
  line-height: 1.2;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.league-chip--self .league-avatar {
  border-width: 3px;
}

.league-chip--self .league-chip__name {
  color: var(--on-dark);
  font-weight: 700;
}

.league-chip--off {
  opacity: 0.4;
}

.league-chip--off .league-chip__name {
  text-decoration: line-through;
}

.league-chip--active .league-avatar {
  box-shadow: 0 0 0 3px var(--chip-color, transparent);
}

.league-chip:focus-visible {
  outline: 2px solid var(--on-dark);
  outline-offset: 2px;
  border-radius: var(--br-sm);
}

.league-story {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.league-story__line {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--light-black);
}

.league-story__line b {
  color: var(--on-dark);
}

.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--light-blue);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row__pos {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--light-blue);
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.result-row__pos--win {
  background: var(--box-color);
  color: var(--on-dark);
}

.result-row__pos--p2 {
  background: #c0c0c0;
  color: #14161a;
}

.result-row__pos--p3 {
  background: #cd7f32;
  color: var(--on-dark);
}

.track-list {
  display: flex;
  flex-direction: column;
}

.track-list + .track-list {
  margin-top: 4px;
}

.track-list__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--light-black);
  margin: 14px 0 2px;
}

.track-list__title:first-child {
  margin-top: 0;
}

.result-row__race {
  font-weight: 700;
  font-size: 0.92rem;
}

.result-row__date {
  font-size: 0.78rem;
  color: var(--light-black);
}

.year-delta {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.year-delta--up {
  color: var(--valid-color);
}

.year-delta--down {
  color: var(--invalid-color);
}

.year-delta--same {
  color: var(--light-black);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--light-blue);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.toggle-switch__track {
  position: absolute;
  inset: 0;
  background: var(--light-blue);
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.toggle-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-switch__track {
  background: var(--box-color);
}

.toggle-switch input:checked + .toggle-switch__track::after {
  transform: translateX(18px);
}

.toggle-switch input:disabled + .toggle-switch__track {
  opacity: 0.5;
}

/* ---------- Install-Banner ---------- */
.install-banner {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--nav-height) + 8px + var(--safe-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--light-blue);
  box-shadow: var(--box-shadow);
  border-radius: var(--br-sm);
  padding: 10px 10px 10px 12px;
}

.install-banner__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
}

.install-banner__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.install-banner__hint {
  color: var(--light-black);
  font-size: 0.78rem;
}

.install-banner__hint a {
  color: var(--box-color);
  text-decoration: underline;
  font-weight: 700;
}

.install-banner__close {
  border: none;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--light-black);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

@media (min-width: 900px) {
  .install-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 320px;
  }
}

/* ---------- Twitch-Live-Bubble ---------- */
.twitch-bubble {
  position: fixed;
  right: 12px;
  bottom: calc(var(--nav-height) + 12px + var(--safe-bottom));
  z-index: 41;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--light-blue);
  box-shadow: var(--box-shadow);
  border-radius: 999px;
  padding: 10px 16px 10px 12px;
  color: var(--on-dark);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Faellt die Install-Banner in denselben Bereich, soll die Bubble darueber stehen. */
#app-root:has(#install-banner:not([hidden])) .twitch-bubble {
  bottom: calc(var(--nav-height) + 12px + var(--safe-bottom) + 64px);
}

.twitch-bubble__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--box-color);
  flex-shrink: 0;
  animation: twitch-bubble-pulse 1.6s ease-in-out infinite;
}

@keyframes twitch-bubble-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (min-width: 900px) {
  .twitch-bubble {
    right: 24px;
    bottom: 24px;
  }
  #app-root:has(#install-banner:not([hidden])) .twitch-bubble {
    bottom: 92px;
  }
}

/* ---------- Twitch-Live-Modal ---------- */
.twitch-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.twitch-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.twitch-modal__panel {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 12px;
}

.twitch-modal__player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--br-sm);
  overflow: hidden;
}

.twitch-modal__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.twitch-modal__close {
  position: absolute;
  top: -40px;
  right: 0;
  border: none;
  background: none;
  color: var(--on-dark);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.race-event__weather-row--static {
  cursor: default;
  margin-bottom: 8px;
  background: var(--bg-background);
  border: none;
  border-radius: var(--br-sm);
}
.race-event__weather-row--static .race-event__weather-row-icon span {
  font-size: 1.9rem;
}
.weather-modal__daily-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}
.weather-modal__range {
  position: relative;
  height: 6px;
  margin: 0 6px 20px;
}
.weather-modal__range-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #4d9fff, #ffce54, var(--box-color));
}
.weather-modal__range-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.weather-modal__hourly {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.weather-modal__hour {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--light-blue);
  border-radius: var(--br-sm);
  background: var(--bg-background);
  text-align: center;
}
.weather-modal__hour-time {
  font-size: 0.72rem;
  color: var(--light-black);
}
.weather-modal__hour span[class^="icon-weather-"] {
  font-size: 1.3rem;
  padding: 4px;
}
.weather-modal__hour-temp {
  border-bottom: 1px solid var(--light-blue);
  width: 100%;
  padding-bottom: 4px;
}
.weather-modal__hour-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--light-black);
  font-size: 0.62rem;
}

/* ---------- Navigations-Ladeanzeige ---------- */
.nav-progress {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--box-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-in;
}
.nav-progress::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--light-blue);
  border-top-color: var(--box-color);
}
.nav-progress--active {
  opacity: 1;
}
.nav-progress--active::after {
  animation: nav-progress-spin 0.7s linear infinite;
}
@keyframes nav-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Infos-Seite (infos.php) ---------- */
.info-content h1,
.info-content h2,
.info-content h3,
.info-content h4 {
  margin: 18px 0 8px;
}
.info-content > :first-child {
  margin-top: 0;
}
.info-content p {
  margin: 0 0 12px;
  line-height: 1.6;
}
.info-content ul,
.info-content ol {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.6;
}
.info-content li {
  margin-bottom: 4px;
}
.info-content li > ul,
.info-content li > ol {
  margin-top: 6px;
}
.info-content a {
  color: var(--box-color);
  text-decoration: underline;
}
.info-content > :last-child {
  margin-bottom: 0;
}
.info-points-grid {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}
.info-points-grid > .card {
  margin-top: 0;
}
@media (min-width: 700px) {
  .info-points-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.search-field {
  position: relative;
  margin: 20px 0 16px;
}
.search-field__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--light-black);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding-left: 38px;
}

/* Treffer-Hervorhebung von js/infos-search.js */
mark.info-search-highlight {
  background: var(--box-color);
  color: var(--on-dark);
  padding: 0 1px;
  border-radius: 2px;
}

/* ---------- Utility ---------- */
.text-muted {
  color: var(--light-black);
}
.text-center {
  text-align: center;
}

/* ---------- Release Notes ---------- */
.release__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--light-blue);
}
.release__version {
  font-weight: 700;
  font-size: 0.95rem;
}
.release__badge {
  background: var(--box-color);
  color: var(--on-dark);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
}
.release__date {
  margin-left: auto;
  font-size: 0.8rem;
}
.release__item {
  margin-top: 12px;
}
.release__item h3 {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.release__item p {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--light-black);
}
.release__item p + p {
  margin-top: 6px;
}
.version-link {
  color: inherit;
  text-decoration: underline;
}
