/* Fantasy Racing Manager – modern dark UI */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg-dark: #0c0c0e;
  --bg-panel: #16161a;
  --bg-card: #1e1e24;
  --accent: #e10600;
  --accent-dim: #b80500;
  --accent-gold: #ffd700;
  --stripes: #25252a;
  --text: #dfe4f1;
  --text-muted: #9898a0;
  --border: #2a2a30;
  --success: #00c853;
  --danger: #e10600;
  --link: #a4c9ec;
  --link-hover: #ffffff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(180deg, #0a0a0c 0%, var(--bg-dark) 30%, #121216 100%);
  -webkit-font-smoothing: antialiased;
}
.infobox {
  background: rgba(35, 143, 35, 0.534);
  border: 1px solid #00c853;
  color:white;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.infobox.red {
  background: rgba(143, 35, 35, 0.534);
  border: 1px solid #e10600;

}
/* Links in content – visible color and underline */
main a,
.panel a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 2px;
}
main a:hover,
.panel a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}
/* Buttons styled as links (e.g. .btn) keep their own styles; primary/danger keep white text */
main a.btn:not(.btn-primary):not(.btn-danger),
.panel a.btn:not(.btn-primary):not(.btn-danger) {
  color: inherit;
  text-decoration: none;
}
main a.btn-primary, .panel a.btn-primary,
main a.btn-danger, .panel a.btn-danger,
button.btn-primary, button.btn-danger,
input[type="submit"].btn-primary {
  color: #fff;
  text-decoration: none;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header – clean bar, sticky so menu + user bar stay fixed when scrolling */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(22, 22, 26, 0.92);
  backdrop-filter: blur(12px);
  padding: 0.75rem 0 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.75rem;
}
.user-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.user-bar .money { color: var(--accent-gold); font-weight: 600; }
.user-bar-name { font-weight: 600; color: var(--text); }
.user-bar-sep { color: var(--border); user-select: none; }
.user-bar-label { color: var(--text-muted); }
.user-bar-value { color: var(--text); }
.user-bar-competition { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.user-bar-competition:hover { color: var(--link-hover); }
.user-bar-link { color: var(--link); text-decoration: none; }
.user-bar-link:hover { color: var(--link-hover); text-decoration: underline; }
.user-bar-muted { font-style: italic; }
.user-bar-muted a { color: var(--link); }
.user-bar-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.user-bar-badge-open {
  background: rgba(0, 200, 83, 0.25);
  color: #81c784;
  border: 1px solid var(--success);
}
.user-bar-badge-closed {
  background: rgba(255, 165, 0, 0.25);
  color: #ffb74d;
  border: 1px solid #e69500;
}
.admin-bar {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 0.85rem;
  padding:0;
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.0rem;
  padding: 0.4rem 0.4rem 0.4rem 0.4rem;
}
.admin-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.admin-nav a:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255,255,255,0.04);
}
.user-bar-break {
  display: none;
}
.site-logo {
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  line-height: 1.2;
  gap: 0.05rem;
}
.site-logo-main {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.site-logo-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover {
  color: var(--link);
  background: rgba(255, 255, 255, 0.06);
}
.nav .admin-link { color: var(--accent-gold); }
.nav .admin-link:hover { color: var(--accent-gold); background: rgba(255,215,0,0.1); }
.nav .nav-user {
  color: var(--text);
  margin-left: 0.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

/* Burger menu: hidden on desktop */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: var(--shadow-sm);
}
.nav-burger:hover {
  background: rgba(255, 255, 255, 0.06);
}
.nav-burger-line {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.site-header.nav-open .nav-burger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-header.nav-open .nav-burger-line:nth-child(2) {
  opacity: 0;
}
.site-header.nav-open .nav-burger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
  .nav-burger {
    display: flex;
  }
  .site-header-inner {
    flex-wrap: nowrap;
  }
  .user-bar {
    font-size: 0.8rem;
    padding: 0.5rem 1rem 0.75rem;
    gap: 0.2rem 0.5rem;
    row-gap: 0.4rem;
  }
  .user-bar-badge {
    font-size: 0.65rem;
    padding: 0.15em 0.4em;
  }
  .user-bar-break {
    display: block;
    flex-basis: 100%;
    width: 0;
    height: 0;
    overflow: hidden;
  }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s;
  }
  .site-header.nav-open .nav {
    max-height: 80vh;
    opacity: 1;
    overflow-y: auto;
  }
  .nav a {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav a:last-child {
    border-bottom: none;
  }
  .nav .nav-user {
    margin-left: 0;
    padding-left: 1rem;
    border-left: none;
  }
}

/* Panels – floating cards with soft shadows */
.panel {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  min-width: 0;
  box-shadow: var(--shadow-md);
}
.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
.panel h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}
.panel h3:first-of-type { margin-top: 0.5rem; }

/* Front page welcome (guest): hero image + text */
.frontpage-welcome {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.frontpage-hero-wrap {
  position: relative;
  display: block;
  line-height: 0;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.frontpage-hero {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: cover;
  object-position: center;
  vertical-align: top;
  background: var(--bg-card);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.frontpage-hero-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, var(--bg-panel) 100%);
}
.frontpage-welcome-body {
  padding: 1.5rem;
}
.frontpage-welcome-body h2 { margin-top: 0; }

/* Dashboard (homepage) */
.dashboard-panel { border-left: 4px solid var(--accent-gold); }
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.dashboard-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.dashboard-stat-value { font-size: 1.1rem; font-weight: 700; }
.dashboard-stat-value.money { color: var(--accent-gold); }
.dashboard-stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Admin dashboard cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.dashboard-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dashboard-card-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.dashboard-card-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1.1;
}
.dashboard-card-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.dashboard-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.25rem;
}
.dashboard-bar-fill {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-gold) 100%);
}

.next-race-box {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.next-top-pos {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  flex-shrink: 0;
  flex-grow: 0;
  margin-bottom:5px;
}
.next-race-layout {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.next-race-calendar {
  width: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.next-race-cal-month {
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0;
}
.next-race-cal-day {
  background: #ffffff;
  color: #111111;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  padding: 0.25rem 0 0;
}
.next-race-cal-weekday {
  background: #ffffff;
  color: #666666;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0 0.4rem;
}
.next-race-info {
  min-width: 0;
}
.next-race-box .next-race-date { font-size: 0.95rem; margin: 0.1rem 0 0.5rem; color: var(--text-muted); }
.next-race-box .next-race-name { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.25rem; color: var(--text); }
.next-race-box .next-race-muted { color: var(--text-muted); margin: 0; }
.next-race-guess {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}
.next-race-guess-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  font-size: 0.95rem;
  color: var(--text);
}
.next-race-guess-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.next-race-guess-pick {
  display: flex;
  align-items: center;
}

.guess-winner-nag {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}
.guess-winner-nag:hover {
  filter: brightness(1.08);
}
.guess-winner-nag-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}
.guess-winner-nag-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
  color: #fff;
}
.guess-winner-nag-text strong {
  font-size: 1.05rem;
}
.guess-winner-nag-text span {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
}
.guess-winner-nag-cta {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
@media (max-width: 600px) {
  .guess-winner-nag {
    flex-wrap: wrap;
  }
  .guess-winner-nag-cta {
    margin-left: auto;
  }
}

.guess-winner-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.35rem;
}
.guess-showcase {
  margin-top: 1.25rem;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
}
.guess-showcase-picked {
  background: rgba(0, 200, 83, 0.12);
  border: 1px solid var(--success);
  box-shadow: 0 0 24px rgba(0, 200, 83, 0.15);
}
.guess-showcase-empty {
  background: var(--bg-card);
  border: 2px dashed var(--border);
}
.guess-showcase-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.guess-showcase-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.guess-showcase-team {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.guess-showcase-empty-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 360px;
  margin: 0 auto;
}
.guess-winner-form {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.driver-pick-hint {
  margin: 1.25rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.driver-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.driver-pick-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease;
}
.driver-pick-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.driver-pick-card-selected {
  border-color: var(--success);
  background: rgba(0, 200, 83, 0.1);
}
.driver-pick-stripe {
  width: 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.driver-pick-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.driver-pick-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.driver-pick-team {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.driver-pick-stats {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.driver-pick-check {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  color: var(--success);
  font-weight: 800;
}

.squad-viewing-other-extra {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.squad-viewing-other-block h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.squad-transactions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.squad-transactions-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: baseline;
}
.squad-transactions-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}
.next-race-toplists {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1.5rem;
}
.next-toplist-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.next-toplist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.next-toplist li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.05rem;
  font-size: 0.9rem;
}
.next-top-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #111;
}
.next-top-pos-1 {
  background: #ffd700;
}
.next-top-pos-2 {
  background: #c0c0c0;
}
.next-top-pos-3 {
  background: #cd7f32;
}
.next-top-name {
  font-weight: 600;
}
.next-top-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}
@media (max-width: 600px) {
  .next-race-layout {
    align-items: flex-start;
  }
  .next-race-calendar {
    width: 64px;
  }
}

.home-three-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.home-three-cols .panel { margin-bottom: 0; }
@media (max-width: 900px) {
  .home-three-cols { grid-template-columns: 1fr; }
  .home-three-cols .panel { margin-bottom: 1rem; }
  .home-three-cols .panel:last-child { margin-bottom: 0; }
}

.competition-list { list-style: none; padding: 0; margin: 0; }
.competition-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.competition-list-item:last-child { border-bottom: none; }
.competition-list-info { display: flex; flex-direction: column; gap: 0.2rem; }
.competition-name-link { color: inherit; text-decoration: none; }
.competition-name-link:hover { text-decoration: underline; }
.competition-meta { font-size: 0.9rem; color: var(--text-muted); }

/* Teams & drivers list page */
.teams-drivers-list { display: flex; flex-direction: column; gap: 1rem; }
.team-block {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.team-block-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.team-block-name { font-size: 1.1rem; }
a.team-block-name { color: var(--link); text-decoration: none; }
a.team-block-name:hover { text-decoration: underline; }
.team-block-exp { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.team-block-last-pts { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.team-block-value { margin-left: auto; font-weight: 700; }
.team-block-change { font-size: 0.9rem; }
.team-block-drivers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;

  gap: 0.5rem;
}
.team-block-drivers li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.driver-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.driver-name { flex: 1; min-width: 0; }
a.driver-name { color: var(--link); text-decoration: none; }
a.driver-name:hover { text-decoration: underline; }
.driver-exp { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; flex-shrink: 0; }
.driver-last-pts { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; flex-shrink: 0; }
.driver-avg-pts { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; flex-shrink: 0; }
.driver-value { font-weight: 600; font-size: 0.95rem; }

/* Race results page */
.race-result-block { padding: 1.25rem; }
.race-result-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.race-result-header h3 { margin: 0; font-size: 1.15rem; color: var(--accent); }
.race-result-meta { font-size: 0.9rem; color: var(--text-muted); }
.race-result-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-left: auto;
}
.race-result-badge.processed { background: rgba(0,200,83,0.2); color: var(--success); }
.race-result-badge.scheduled { background: rgba(110,181,255,0.2); color: var(--link); }
.race-result-header-row { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.race-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.race-result-row {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.35rem;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.race-result-pos {
  flex: 0 0 2.5rem;
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.race-result-driver {
  font-weight: 600;
  min-width: 0;
  flex: 0 0 auto;
}
.race-result-dnf { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-left: 0.35rem; }
.race-result-value { flex: 0 0 4.5rem; margin-left: auto; text-align: right; font-size: 0.9rem; }
.race-result-team { flex: 0 0 9rem; font-size: 0.9rem; color: var(--text-muted); text-align:left;}

@media (max-width: 650px) {
  .race-result-list .race-result-row {
    flex-wrap: wrap;
    align-items: baseline;
  }
  .race-result-list .race-result-pos {
    flex: 0 0 1rem;
    font-size: 0.8rem;
  }
  .race-result-list .race-result-driver {
    flex: 1 1 auto;
  }
  .race-result-list .race-result-value {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 0.85rem;
  }
  .race-result-list .race-result-team {
    flex: 0 0 100%;
    font-size: 0.8rem;
    margin-left: 2.2rem;
    margin-top: 0.1rem;
  }
}

/* Calendar page */
.calendar-championship { font-size: 1.1rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.calendar-list { padding: 1.25rem; }
.calendar-race-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.calendar-race-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.calendar-race-item:last-child { border-bottom: none; }
.calendar-race-date {
  flex: 0 0 12rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.calendar-race-name { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.calendar-race-item .race-result-badge { margin-left: 0; }
.calendar-race-past .calendar-race-date { opacity: 0.8; }
.calendar-race-past .calendar-race-name { color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); }

.admin-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 12rem;
}
.admin-menu-buttons .btn { margin: 0; text-align: center; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); }
.btn-danger { background: #8b0000; color: #fff; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-disabled { opacity: 0.7; cursor: not-allowed; pointer-events: none; }
.text-muted { color: var(--text-muted); }

/* Modal (sell driver etc.) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  cursor: pointer;
}
.modal-box {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-body {
  margin: 0 0 1.25rem;
  color: var(--text);
  line-height: 1.5;
}
.modal-body .money { color: var(--accent-gold); font-weight: 600; }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Forms – modern, readable inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  max-width: 480px;
  padding: 0.7rem 0.5em;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.25);
}
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}
label { display: block; margin-bottom: 0.35rem; color: var(--text); font-size: 0.95rem; font-weight: 500; }
.form-group { margin-bottom: 1.25rem; }

.position-pct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.position-pct-item label { display: block; font-size: 0.9rem; margin-bottom: 0.2rem; }
.position-pct-item input { width: 100%; max-width: 5rem; }
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.alert-error { background: rgba(225,6,0,.2); border: 1px solid var(--danger); color: #ffcccc; }
.alert-success { background: rgba(0,200,83,.15); border: 1px solid var(--success); color: #a5d6a7; }
.alert-warning { background: rgba(255,165,0,.2); border: 1px solid #e69500; color: #ffe0b2; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15em 0.5em;
  margin-left: 0.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  font-weight: 600;
  text-decoration: none;
}

/* Auth pages: centered card (login / register) */
.auth-layout {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem 1rem;
}
.auth-box {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 2.25rem 2rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-lg);
}
.auth-box-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  border: none;
  padding: 0;
  text-align: center;
}
.auth-box-subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}
.auth-box .form-group { margin-bottom: 1.1rem; }
.auth-box .form-group input {
  max-width: none;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}
.auth-box .form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}
.auth-submit {
  width: 100%;
  padding: 0.85rem 1.2rem;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}
.auth-box-footer {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.auth-box-footer a { font-weight: 600; }
.auth-box-footer a.btn-primary,
.auth-box-footer a.btn-danger { color: #fff; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm); }
.card .price { color: var(--accent-gold); font-weight: 700; }
.card label { cursor: pointer; display: block; }

/* Join: clickable cards (no checkboxes), highlight when selected */
.selectable-card {
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
  user-select: none;
}
.selectable-card:hover {
  filter: brightness(1.08);
}
.selectable-card.selected {
  box-shadow: 0 0 0 3px var(--accent), 0 0 12px rgba(225, 6, 0, 0.35);
  border-color: var(--accent) !important;
  background: linear-gradient(90deg, rgba(225, 6, 0, 0.15) 0%, var(--bg-card) 45%) !important;
}
.selectable-card.team-card,
.selectable-card.driver-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.join-counter { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.join-total .money { font-weight: 700; color: var(--accent-gold); }

/* Join page: fixed bottom bar with live total + Accept team */
.join-page-panel { padding-bottom: 5.5rem; }
.join-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(22, 22, 26, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}
.join-bottom-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  flex-wrap: wrap;
}
.join-bottom-total {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.join-bottom-label { color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.join-bottom-price { font-size: 1.35rem; font-weight: 800; color: var(--accent-gold); }
.join-bottom-budget { color: var(--text-muted); font-size: 0.95rem; }
.join-bottom-status {
  font-size: 0.9rem;
  flex: 0.5 0.5 auto;
  min-width: 0;
  text-align: center;
}
.join-bottom-status.join-bar-muted { color: var(--text-muted); }
.join-bottom-status.join-bar-error { color: var(--danger); font-weight: 600; }
.join-bottom-status.join-bar-warn { color: var(--accent); }
.join-bottom-status.join-bar-success { color: var(--success); font-weight: 600; }
.join-bottom-actions { display: flex; align-items: center; gap: 0.75rem; }
#join-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-card);
  color: var(--text-muted);
}
#join-submit:disabled:hover {
  background: var(--bg-card);
  transform: none;
}

/* Drivers by team (join competition): small team headline, two drivers per line */
.driver-team-block { margin-bottom: 0.5rem; }
.driver-team-headline { font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.driver-team-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
/* Join page: one driver per line on mobile, two per line on desktop */
.driver-team-line.driver-team-stack .driver-card {
  flex: 1 1 200px;
  min-width: 0;
  box-sizing: border-box;
}
.frontpage-panel {
  text-align: center;
  position: fixed;
  bottom: 0;
  margin:0;
  left: 0%;
  border-radius:0;
  width:100%;
  z-index: 100;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  box-shadow: 0px -2px 30px 0px rgba(0, 0, 0);
  padding: 1rem;
}
@media (max-width: 768px) {

  .frontpage-hero {
    max-height:250px;
  }
  .driver-team-line.driver-team-stack {
    flex-direction: column;
    gap: 0.5rem;
  }
  .driver-team-line.driver-team-stack .driver-card {
    flex: none;
    width: 100%;
  }
}
.driver-team-line .driver-card {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  flex: 1 1 200px;
  min-width: 0;
}
.driver-team-line .driver-card .price { font-size: 0.9rem; margin-left: auto; }
.join-expected-pos {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.driver-sep { color: var(--text-muted); font-weight: 300; user-select: none; }

/* Squad page: summary stats + scrollable tables on mobile */
.squad-summary-stats {
  display: block;
}
.squad-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.5rem 0;
  padding: 0 0.5rem;
}
.squad-table {
  min-width: 520px;
}

@media (max-width: 768px) {
  .squad-summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
    margin-bottom: 0.5rem;
  }
  .squad-summary-stats p {
    margin: 0;
  }
  .squad-summary-stats p:last-of-type {
    grid-column: 1 / -1;
  }
  .squad-table-wrap {
    margin: 0 -1rem 0;
    padding: 0 1rem;
    border-radius: 4px;
  }
  .squad-table {
    min-width: 580px;
    font-size: 0.9rem;
  }
  .squad-table th,
  .squad-table td {
    padding: 0.5rem 0.4rem;
  }
  .squad-table .btn-small {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .squad-summary-stats {
    grid-template-columns: 1fr;
  }
  .squad-summary-stats p:last-of-type {
    grid-column: 1;
  }
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
.stat-table th { width: 1%; white-space: nowrap; padding-right: 1.5rem; color: var(--text-muted); font-weight: 500; text-transform: none; font-size: 0.95rem; }
.stat-table td { vertical-align: middle; }

/* Compact stat grid for team/driver detail pages – no horizontal scroll */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem 1.5rem;
  min-width: 0;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.stat-value {
  font-size: 1.05rem;
  font-weight: 600;
}
.stat-value.money { color: var(--accent-gold); }
.stat-value a { font-weight: 600; }

/* Driver cards on team page – no horizontal scroll on mobile */
.driver-cards-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.driver-card-item {
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.driver-card-name {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--link);
  text-decoration: none;
}
.driver-card-name:hover { text-decoration: underline; }
.driver-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.driver-card-stats .money { color: var(--accent-gold); font-weight: 600; }
.driver-card-stats span { white-space: nowrap; }
th { background: var(--bg-card); color: var(--accent); text-transform: uppercase; font-size: 0.8rem; }
tr:hover { background: rgba(255, 255, 255, 0.04); }
.money { font-weight: 600; color: var(--accent-gold); }

/* Price change (previous value) + up/down triangle */
.price-change { font-size: 0.85rem; white-space: nowrap; }
.price-change-up { color: var(--success); }
.price-change-down { color: var(--danger); }
.price-change-cell { display: inline-flex; align-items: center; gap: 0.25rem; }
.price-change-cell .triangle { font-size: 0.6rem; line-height: 1; }
.price-change-cell .triangle.up { color: var(--success); }
.price-change-cell .triangle.down { color: var(--danger); }

/* Highscore */
.highscore-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.5rem 0;
  padding: 0 0.5rem;
}
.highscore-table .rank { width: 3rem; }
.highscore-table .total { font-weight: 700; color: var(--accent-gold); }
.highscore-table-value { min-width: 480px; }

@media (max-width: 768px) {
  .highscore-table-wrap {
    margin: 0 -1rem 0;
    padding: 0 1rem;
  }
  .highscore-table th,
  .highscore-table td {
    padding: 0.5rem 0.4rem;
  }
  .highscore-table .btn-small {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  .highscore-table-value { min-width: 520px; }
}

.about-position-pct { margin: 0.75rem 0; font-size: 0.95rem; }
.about-position-pct th { text-align: left; }
.about-position-pct td.about-pct { text-align: right; white-space: nowrap; }

/* Admin: enter results grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 1rem;
}
.results-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.results-pos {
  flex: 0 0 2rem;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}
.results-row select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
.results-dnf-label {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.results-dnf-label input { margin: 0; vertical-align: middle; }

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.site-footer a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-footer a:hover {
  color: var(--link-hover);
}

